@labelbee/lb-components 1.9.0-alpha.3 → 1.9.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/index.css +1 -0
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +1 -0
- package/dist/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js.map +1 -1
- package/es/index.css +1 -0
- package/es/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
- package/es/views/MainView/toolFooter/AnnotatedAttributes/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],displayPointCloudList:[],polygonList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],setPolygonList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{}}),PointCloudProvider=({children:a})=>{const[o,b]=React.useState([]),[c,H]=React.useState([]),[n,f]=React.useState([]),[v,E]=React.useState(!0),[y,M]=React.useState(1),[r,_]=React.useState(),[w,O]=React.useState(),[I,T]=React.useState(),[i,j]=React.useState(),[V,k]=React.useState(""),[m,N]=React.useState(lbAnnotation.EToolName.Rect),q=React.useRef(new lbAnnotation.ActionsHistory).current,[s,P]=React.useState([]),[g,z]=React.useState(""),x=React.useMemo(()=>n.length===1?n[0]:"",[n]),L=React.useMemo(()=>{const d=o.find(t=>t.id===x),C=t=>{const e=o.concat(t);return b(e),e},p=t=>{E(t!==!1)},l=t=>{t===void 0&&f([]),typeof t=="string"&&f([t]),Array.isArray(t)&&f(Array.from(new Set(t)))},u=t=>{n.includes(t)?l(n.filter(e=>e!==t)):l([...n,t])},Z=()=>{l(o.map(t=>t.id))},G=t=>{l(o.filter(e=>e.attribute===t).map(e=>e.id))},h=o.filter(t=>!s.includes(t.attribute)),J=t=>{if(s.includes(t))P(s.filter(e=>e!==t));else{const e=s.concat(t);P(e)}},K=(t=h,e=c)=>{o.forEach(A=>{i==null||i.removeObjectByName(A.id)}),r==null||r.updatePolygonList(t,e),i==null||i.generateBoxes(t),B(t)},B=t=>{const e=i==null?void 0:i.highlightOriginPointCloud(t);return new Promise(A=>{e==null||e.then(S=>{[r].forEach(R=>{var D;S&&((D=R==null?void 0:R.pointCloudInstance)==null||D.updateColor(S),A({color:S}))})})})};return{selectedID:x,pointCloudBoxList:o,displayPointCloudList:h,selectedIDs:n,setPointCloudResult:b,setSelectedIDs:l,addPointCloudBox:C,valid:v,selectedPointCloudBox:d,setPointCloudValid:p,addSelectedID:u,selectedAllBoxes:Z,topViewInstance:r,setTopViewInstance:_,sideViewInstance:w,setSideViewInstance:O,backViewInstance:I,setBackViewInstance:T,mainViewInstance:i,setMainViewInstance:j,polygonList:c,setPolygonList:H,zoom:y,setZoom:M,history:q,toggleAttributesVisible:J,hideAttributes:s,setHideAttributes:P,reRender:K,attrPanelLayout:g,setAttrPanelLayout:z,syncAllViewPointCloudColor:B,defaultAttribute:V,setDefaultAttribute:k,pointCloudPattern:m,setPointCloudPattern:N,selectSpecAttr:G}},[v,n,o,c,r,w,I,i,y,s,g,V,m]),F=()=>{const d=o.filter(u=>s.includes(u.attribute)),{setSelectedIDs:C,reRender:p}=L,l=d.map(u=>u.id);l.length>0&&C(n.filter(u=>!l.includes(u))),p()};return React.useEffect(()=>{var d;F(),(d=r==null?void 0:r.pointCloud2dOperation)==null||d.setHiddenAttributes(s)},[s]),React__default.default.createElement(PointCloudContext.Provider,{value:L},a)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
package/dist/index.css
CHANGED
|
@@ -41,6 +41,7 @@ export interface IPointCloudContext extends IPointCloudContextInstances {
|
|
|
41
41
|
setDefaultAttribute: (defaultAttribute: string) => void;
|
|
42
42
|
pointCloudPattern: EToolName.Rect | EToolName.Polygon;
|
|
43
43
|
setPointCloudPattern: (toolName: EToolName.Rect | EToolName.Polygon) => void;
|
|
44
|
+
selectSpecAttr: (attr: string) => void;
|
|
44
45
|
}
|
|
45
46
|
export declare const PointCloudContext: React.Context<IPointCloudContext>;
|
|
46
47
|
export declare const PointCloudProvider: React.FC<{}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),React=require("react"),selectors=require("../../../../store/annotation/selectors.js"),ctx=require("../../../../store/ctx.js"),lbUtils=require("@labelbee/lb-utils"),icons=require("@ant-design/icons"),useHistory=require("../../../../components/pointCloudView/hooks/useHistory.js"),dom=require("../../../../utils/dom.js"),StepUtils=require("../../../../utils/StepUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),FooterPopover=require("../FooterPopover.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const AnnotatedAttributesItem=({attribute:t})=>{const s=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),React=require("react"),selectors=require("../../../../store/annotation/selectors.js"),ctx=require("../../../../store/ctx.js"),lbUtils=require("@labelbee/lb-utils"),icons=require("@ant-design/icons"),useHistory=require("../../../../components/pointCloudView/hooks/useHistory.js"),dom=require("../../../../utils/dom.js"),StepUtils=require("../../../../utils/StepUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),FooterPopover=require("../FooterPopover.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const AnnotatedAttributesItem=({attribute:t})=>{const s=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:l,hideAttributes:a,toggleAttributesVisible:r,polygonList:n,setPolygonList:u,setPointCloudResult:d,reRender:o,selectSpecAttr:x}=s,[c,g]=React.useState(!0),{pushHistoryWithList:v}=useHistory.useHistory(),p=[...l,...n].filter(e=>e.attribute===t.value),C=()=>{r(t.value)},b=a.includes(t.value),y=({trackID:e,order:i})=>e||i,A=({trackID:e,order:i})=>e?`trackID_${e}`:`order_${i}`,E=e=>{if(p.length===0)return;const i=n.filter(f=>e!==f.attribute),m=l.filter(f=>e!==f.attribute);o(m,i),u(i),d(m),v({pointCloudBoxList:m,polygonList:i})},P=e=>{antd.Modal.confirm({content:lbUtils.i18n.t("onDeleteGraphByAttr",{attribute:e.key}),onOk:()=>{E(e.value)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")})};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","item")},b?React__default.default.createElement(icons.EyeInvisibleFilled,{onClick:C}):React__default.default.createElement(icons.EyeFilled,{onClick:C}),React__default.default.createElement(icons.CaretDownFilled,{rotate:c?0:270,onClick:()=>{g(!c)}}),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","item","text"),onClick:()=>{x(t.value)}},t.key),React__default.default.createElement(icons.DeleteOutlined,{onClick:()=>P(t)})),c&&p.map(e=>React__default.default.createElement("div",{key:A(e),style:{paddingLeft:54}},`${y(e)}.${t.key}`)))},AnnotatedAttributesPanel=()=>{const t=ctx.useSelector(selectors.stepConfigSelector),{attrPanelLayout:s,setAttrPanelLayout:l,pointCloudBoxList:a,polygonList:r}=React.useContext(PointCloudContext.PointCloudContext),{t:n}=reactI18next.useTranslation(),u=React.useMemo(()=>[...a,...r].map(o=>o.attribute),[a,r]),d=React.useMemo(()=>t.attributeList.filter(o=>u.includes(o.value)),[u]);return React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute")},s?React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",null,n("AnnotatedResult")),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","pin"),onClick:()=>{l("")}},React__default.default.createElement(icons.PushpinFilled,null),n("CancelFixed"))):React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",{onClick:()=>{l("left")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),n("FixedOnLeft")),React__default.default.createElement("span",{onClick:()=>{l("right")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),n("FixedOnRight"))),React__default.default.createElement("div",null,d.length>0?d.map(o=>React__default.default.createElement(AnnotatedAttributesItem,{attribute:o,key:o.value})):React__default.default.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},n("NoData"))))},AnnotatedAttributesPanelFixedLeft=()=>{const{attrPanelLayout:t}=React.useContext(PointCloudContext.PointCloudContext);return t==="left"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesPanelFixedRight=()=>{const{attrPanelLayout:t}=React.useContext(PointCloudContext.PointCloudContext);return t==="right"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesIcon=()=>{const{attrPanelLayout:t}=React.useContext(PointCloudContext.PointCloudContext),{t:s}=reactI18next.useTranslation(),l=ctx.useSelector(a=>{var r,n;return StepUtils.getCurrentStepInfo((r=a==null?void 0:a.annotation)==null?void 0:r.step,(n=a.annotation)==null?void 0:n.stepList)});return(l==null?void 0:l.tool)!==lbAnnotation.EPointCloudName.PointCloud||t?null:React__default.default.createElement(FooterPopover,{hoverIcon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),icon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),title:s("AnnotatedList"),content:React__default.default.createElement(AnnotatedAttributesPanel,null)})};exports.AnnotatedAttributesIcon=AnnotatedAttributesIcon,exports.AnnotatedAttributesPanel=AnnotatedAttributesPanel,exports.AnnotatedAttributesPanelFixedLeft=AnnotatedAttributesPanelFixedLeft,exports.AnnotatedAttributesPanelFixedRight=AnnotatedAttributesPanelFixedRight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import H,{useState as o,useRef as
|
|
1
|
+
import H,{useState as o,useRef as tt,useMemo as E,useEffect as et}from"react";import{ActionsHistory as k,EToolName as M}from"@labelbee/lb-annotation";const O=H.createContext({pointCloudBoxList:[],displayPointCloudList:[],polygonList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],setPolygonList:()=>{},zoom:1,setZoom:()=>{},history:new k,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:M.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{}}),ot=({children:T})=>{const[n,m]=o([]),[u,z]=o([]),[i,f]=o([]),[w,F]=o(!0),[y,N]=o(1),[r,Z]=o(),[I,j]=o(),[V,q]=o(),[l,G]=o(),[v,J]=o(""),[g,K]=o(M.Rect),Q=tt(new k).current,[s,P]=o([]),[S,U]=o(""),L=E(()=>i.length===1?i[0]:"",[i]),h=E(()=>{const a=n.find(t=>t.id===L),C=t=>{const e=n.concat(t);return m(e),e},p=t=>{F(t!==!1)},d=t=>{t===void 0&&f([]),typeof t=="string"&&f([t]),Array.isArray(t)&&f(Array.from(new Set(t)))},c=t=>{i.includes(t)?d(i.filter(e=>e!==t)):d([...i,t])},X=()=>{d(n.map(t=>t.id))},Y=t=>{d(n.filter(e=>e.attribute===t).map(e=>e.id))},x=n.filter(t=>!s.includes(t.attribute)),_=t=>{if(s.includes(t))P(s.filter(e=>e!==t));else{const e=s.concat(t);P(e)}},$=(t=x,e=u)=>{n.forEach(A=>{l==null||l.removeObjectByName(A.id)}),r==null||r.updatePolygonList(t,e),l==null||l.generateBoxes(t),B(t)},B=t=>{const e=l==null?void 0:l.highlightOriginPointCloud(t);return new Promise(A=>{e==null||e.then(b=>{[r].forEach(R=>{var D;b&&((D=R==null?void 0:R.pointCloudInstance)==null||D.updateColor(b),A({color:b}))})})})};return{selectedID:L,pointCloudBoxList:n,displayPointCloudList:x,selectedIDs:i,setPointCloudResult:m,setSelectedIDs:d,addPointCloudBox:C,valid:w,selectedPointCloudBox:a,setPointCloudValid:p,addSelectedID:c,selectedAllBoxes:X,topViewInstance:r,setTopViewInstance:Z,sideViewInstance:I,setSideViewInstance:j,backViewInstance:V,setBackViewInstance:q,mainViewInstance:l,setMainViewInstance:G,polygonList:u,setPolygonList:z,zoom:y,setZoom:N,history:Q,toggleAttributesVisible:_,hideAttributes:s,setHideAttributes:P,reRender:$,attrPanelLayout:S,setAttrPanelLayout:U,syncAllViewPointCloudColor:B,defaultAttribute:v,setDefaultAttribute:J,pointCloudPattern:g,setPointCloudPattern:K,selectSpecAttr:Y}},[w,i,n,u,r,I,V,l,y,s,S,v,g]),W=()=>{const a=n.filter(c=>s.includes(c.attribute)),{setSelectedIDs:C,reRender:p}=h,d=a.map(c=>c.id);d.length>0&&C(i.filter(c=>!d.includes(c))),p()};return et(()=>{var a;W(),(a=r==null?void 0:r.pointCloud2dOperation)==null||a.setHiddenAttributes(s)},[s]),H.createElement(O.Provider,{value:h},T)};export{O as PointCloudContext,ot as PointCloudProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointCloudContext.js","sources":["../../../src/components/pointCloudView/PointCloudContext.tsx"],"sourcesContent":["import { IPointCloudBox, IPointCloudBoxList, IPolygonData } from '@labelbee/lb-utils';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n PointCloud,\n PointCloudAnnotation,\n ActionsHistory,\n EToolName,\n} from '@labelbee/lb-annotation';\n\ninterface IPointCloudContextInstances {\n topViewInstance?: PointCloudAnnotation;\n sideViewInstance?: PointCloudAnnotation;\n backViewInstance?: PointCloudAnnotation;\n mainViewInstance?: PointCloud;\n setTopViewInstance: (instance: PointCloudAnnotation) => void;\n setSideViewInstance: (instance: PointCloudAnnotation) => void;\n setBackViewInstance: (instance: PointCloudAnnotation) => void;\n setMainViewInstance: (instance: PointCloud) => void;\n}\n\ntype AttrPanelLayout = '' | 'left' | 'right';\n\nexport interface IPointCloudContext extends IPointCloudContextInstances {\n pointCloudBoxList: IPointCloudBoxList;\n displayPointCloudList: IPointCloudBoxList;\n selectedIDs: string[];\n setSelectedIDs: (ids?: string[] | string) => void;\n valid: boolean;\n setPointCloudResult: (resultList: IPointCloudBoxList) => void;\n selectedPointCloudBox?: IPointCloudBox;\n setPointCloudValid: (valid?: boolean) => void;\n addSelectedID: (selectedID: string) => void;\n selectedAllBoxes: () => void;\n selectedID: string;\n addPointCloudBox: (boxParams: IPointCloudBox) => IPointCloudBox[];\n\n polygonList: IPolygonData[];\n setPolygonList: (polygonList: IPolygonData[]) => void;\n\n zoom: number;\n setZoom: (zoom: number) => void;\n\n history: ActionsHistory; // Operation History\n hideAttributes: string[];\n setHideAttributes: (hideAttrs: string[]) => void;\n toggleAttributesVisible: (attribute: string) => void;\n reRender: (_displayPointCloudList: IPointCloudBoxList, _polygonList: IPolygonData[]) => void;\n attrPanelLayout: AttrPanelLayout;\n setAttrPanelLayout: (layout: AttrPanelLayout) => void;\n\n syncAllViewPointCloudColor: (newPointCloudList?: IPointCloudBox[]) => void;\n\n defaultAttribute: string;\n setDefaultAttribute: (defaultAttribute: string) => void;\n\n pointCloudPattern: EToolName.Rect | EToolName.Polygon;\n setPointCloudPattern: (toolName: EToolName.Rect | EToolName.Polygon) => void;\n}\n\nexport const PointCloudContext = React.createContext<IPointCloudContext>({\n pointCloudBoxList: [],\n displayPointCloudList: [],\n polygonList: [],\n selectedID: '',\n selectedIDs: [],\n valid: true,\n setSelectedIDs: () => {},\n setPointCloudResult: () => {},\n setPointCloudValid: () => {},\n setTopViewInstance: () => {},\n setSideViewInstance: () => {},\n setBackViewInstance: () => {},\n setMainViewInstance: () => {},\n addSelectedID: () => {},\n selectedAllBoxes: () => {},\n addPointCloudBox: () => {\n return [];\n },\n setPolygonList: () => {},\n\n zoom: 1,\n setZoom: () => {},\n history: new ActionsHistory(),\n hideAttributes: [],\n setHideAttributes: () => {},\n toggleAttributesVisible: () => {},\n reRender: () => {},\n setAttrPanelLayout: () => {},\n attrPanelLayout: '',\n syncAllViewPointCloudColor: () => {},\n\n defaultAttribute: '',\n setDefaultAttribute: () => {},\n\n pointCloudPattern: EToolName.Rect,\n setPointCloudPattern: () => {},\n});\n\nexport const PointCloudProvider: React.FC<{}> = ({ children }) => {\n const [pointCloudBoxList, setPointCloudResult] = useState<IPointCloudBoxList>([]);\n const [polygonList, setPolygonList] = useState<IPolygonData[]>([]);\n const [selectedIDs, setSelectedIDsState] = useState<string[]>([]);\n const [valid, setValid] = useState<boolean>(true);\n const [zoom, setZoom] = useState<number>(1);\n const [topViewInstance, setTopViewInstance] = useState<PointCloudAnnotation>();\n const [sideViewInstance, setSideViewInstance] = useState<PointCloudAnnotation>();\n const [backViewInstance, setBackViewInstance] = useState<PointCloudAnnotation>();\n const [mainViewInstance, setMainViewInstance] = useState<PointCloud>();\n const [defaultAttribute, setDefaultAttribute] = useState('');\n const [pointCloudPattern, setPointCloudPattern] = useState<EToolName.Rect | EToolName.Polygon>(\n EToolName.Rect,\n );\n const history = useRef(new ActionsHistory()).current;\n const [hideAttributes, setHideAttributes] = useState<string[]>([]);\n const [attrPanelLayout, setAttrPanelLayout] = useState<AttrPanelLayout>('');\n\n const selectedID = useMemo(() => {\n return selectedIDs.length === 1 ? selectedIDs[0] : '';\n }, [selectedIDs]);\n\n const ptCtx = useMemo(() => {\n const selectedPointCloudBox = pointCloudBoxList.find((v) => v.id === selectedID);\n\n const addPointCloudBox = (box: IPointCloudBox) => {\n const newPointCloudList = pointCloudBoxList.concat(box);\n setPointCloudResult(newPointCloudList);\n return newPointCloudList;\n };\n\n const setPointCloudValid = (valid?: boolean) => {\n setValid(valid === false ? false : true);\n };\n\n const setSelectedIDs = (selectedIDs?: string[] | string) => {\n if (selectedIDs === undefined) {\n setSelectedIDsState([]);\n }\n\n if (typeof selectedIDs === 'string') {\n setSelectedIDsState([selectedIDs]);\n }\n\n if (Array.isArray(selectedIDs)) {\n setSelectedIDsState(Array.from(new Set(selectedIDs)));\n }\n };\n\n /**\n * If selectedID existed, remove selectedID from selectedIDs\n * If selectedID not existed, add selectedID to selectedIDs\n * @param selectedID\n */\n const addSelectedID = (selectedID: string) => {\n if (selectedIDs.includes(selectedID)) {\n setSelectedIDs(selectedIDs.filter((i) => i !== selectedID));\n } else {\n setSelectedIDs([...selectedIDs, selectedID]);\n }\n };\n\n const selectedAllBoxes = () => {\n setSelectedIDs(pointCloudBoxList.map((i) => i.id));\n };\n\n const displayPointCloudList = pointCloudBoxList.filter(\n (i) => !hideAttributes.includes(i.attribute),\n );\n\n const toggleAttributesVisible = (tAttribute: string) => {\n if (hideAttributes.includes(tAttribute)) {\n setHideAttributes(hideAttributes.filter((attribute) => attribute !== tAttribute));\n } else {\n const updatedHideAttributes = hideAttributes.concat(tAttribute);\n setHideAttributes(updatedHideAttributes);\n }\n };\n\n const reRender = (\n _displayPointCloudList: IPointCloudBoxList = displayPointCloudList,\n _polygonList: IPolygonData[] = polygonList,\n ) => {\n pointCloudBoxList.forEach((v) => {\n mainViewInstance?.removeObjectByName(v.id);\n });\n\n topViewInstance?.updatePolygonList(_displayPointCloudList, _polygonList);\n mainViewInstance?.generateBoxes(_displayPointCloudList);\n syncAllViewPointCloudColor(_displayPointCloudList);\n };\n\n /**\n * Synchronize the highlighted pointCloud for all views.\n * @param pointCloudList\n */\n\n const syncAllViewPointCloudColor = (pointCloudList?: IPointCloudBox[]) => {\n const colorPromise = mainViewInstance?.highlightOriginPointCloud(pointCloudList);\n return new Promise((resolve) => {\n colorPromise?.then((color) => {\n [topViewInstance].forEach((instance) => {\n if (color) {\n instance?.pointCloudInstance?.updateColor(color);\n resolve({ color });\n }\n });\n // TODO: Sync sideView & backView Color.\n });\n });\n };\n\n return {\n selectedID,\n pointCloudBoxList,\n displayPointCloudList,\n selectedIDs,\n setPointCloudResult,\n setSelectedIDs,\n addPointCloudBox,\n valid,\n selectedPointCloudBox,\n setPointCloudValid,\n addSelectedID,\n selectedAllBoxes,\n topViewInstance,\n setTopViewInstance,\n sideViewInstance,\n setSideViewInstance,\n backViewInstance,\n setBackViewInstance,\n mainViewInstance,\n setMainViewInstance,\n polygonList,\n setPolygonList,\n zoom,\n setZoom,\n history,\n toggleAttributesVisible,\n hideAttributes,\n setHideAttributes,\n reRender,\n attrPanelLayout,\n setAttrPanelLayout,\n syncAllViewPointCloudColor,\n defaultAttribute,\n setDefaultAttribute,\n pointCloudPattern,\n setPointCloudPattern,\n };\n }, [\n valid,\n selectedIDs,\n pointCloudBoxList,\n polygonList,\n topViewInstance,\n sideViewInstance,\n backViewInstance,\n mainViewInstance,\n zoom,\n hideAttributes,\n attrPanelLayout,\n defaultAttribute,\n pointCloudPattern,\n ]);\n\n const updateSelectedIDsAndRenderAfterHide = () => {\n const pointCloudForFilteredList = pointCloudBoxList.filter((i) =>\n hideAttributes.includes(i.attribute),\n );\n\n const { setSelectedIDs, reRender } = ptCtx;\n\n const filteredIDs = pointCloudForFilteredList.map((i) => i.id);\n\n if (filteredIDs.length > 0) {\n setSelectedIDs(selectedIDs.filter((id) => !filteredIDs.includes(id)));\n }\n\n reRender();\n };\n\n useEffect(() => {\n updateSelectedIDsAndRenderAfterHide();\n topViewInstance?.pointCloud2dOperation?.setHiddenAttributes(hideAttributes);\n }, [hideAttributes]);\n\n return <PointCloudContext.Provider value={ptCtx}>{children}</PointCloudContext.Provider>;\n};\n"],"names":[],"mappings":";;;AA2Da,MAAA,iBAAA,GAAoB,MAAM,aAAkC,CAAA;AAAA,EACvE,iBAAmB,EAAA,EAAA;AAAA,EACnB,qBAAuB,EAAA,EAAA;AAAA,EACvB,WAAa,EAAA,EAAA;AAAA,EACb,UAAY,EAAA,EAAA;AAAA,EACZ,WAAa,EAAA,EAAA;AAAA,EACb,KAAO,EAAA,IAAA;AAAA,EACP,gBAAgB,MAAM;AAAA,GAAA;AAAA,EACtB,qBAAqB,MAAM;AAAA,GAAA;AAAA,EAC3B,oBAAoB,MAAM;AAAA,GAAA;AAAA,EAC1B,oBAAoB,MAAM;AAAA,GAAA;AAAA,EAC1B,qBAAqB,MAAM;AAAA,GAAA;AAAA,EAC3B,qBAAqB,MAAM;AAAA,GAAA;AAAA,EAC3B,qBAAqB,MAAM;AAAA,GAAA;AAAA,EAC3B,eAAe,MAAM;AAAA,GAAA;AAAA,EACrB,kBAAkB,MAAM;AAAA,GAAA;AAAA,EACxB,kBAAkB,MAAM;AACtB,IAAO,OAAA,EAAA,CAAA;AAAA,GAAA;AAAA,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sC,MAAM;AAChD,IAAA,MAAM,4BAA4B,iBAAkB,CAAA,MAAA,CAAO,CAAC,CAC1D,KAAA,cAAA,CAAe,SAAS,CAAE,CAAA,SAAA,CAAA,CAAA,CAAA;AAG5B,IAAM,MAAA,CAAE,gBAAgB,QAAa,CAAA,GAAA,KAAA,CAAA;AAErC,IAAA,MAAM,WAAc,GAAA,yBAAA,CAA0B,GAAI,CAAA,CAAC,MAAM,CAAE,CAAA,EAAA,CAAA,CAAA;AAE3D,IAAI,IAAA,WAAA,CAAY,SAAS,CAAG,EAAA;AAC1B,MAAA,cAAA,CAAe,YAAY,MAAO,CAAA,CAAC,EAAO,KAAA,CAAC,YAAY,QAAS,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA;AAAA,KAAA;AAGlE,IAAA,QAAA,EAAA,CAAA;AAAA,GAAA,CAAA;AAGF,EAAA,SAAA,CAAU,MAAM;AAxRlB,IAAA,IAAA,EAAA,CAAA;AAyRI,IAAA,mCAAA,EAAA,CAAA;AACA,IAAiB,CAAA,EAAA,GAAA,eAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,eAAA,CAAA,qBAAA,KAAjB,mBAAwC,mBAAoB,CAAA,cAAA,CAAA,CAAA;AAAA,GAAA,EAC3D,CAAC,cAAA,CAAA,CAAA,CAAA;AAEJ,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,kBAAkB,QAAnB,EAAA;AAAA,IAA4B,KAAO,EAAA,KAAA;AAAA,GAAQ,EAAA,QAAA,CAAA,CAAA;AAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"PointCloudContext.js","sources":["../../../src/components/pointCloudView/PointCloudContext.tsx"],"sourcesContent":["import { IPointCloudBox, IPointCloudBoxList, IPolygonData } from '@labelbee/lb-utils';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n PointCloud,\n PointCloudAnnotation,\n ActionsHistory,\n EToolName,\n} from '@labelbee/lb-annotation';\n\ninterface IPointCloudContextInstances {\n topViewInstance?: PointCloudAnnotation;\n sideViewInstance?: PointCloudAnnotation;\n backViewInstance?: PointCloudAnnotation;\n mainViewInstance?: PointCloud;\n setTopViewInstance: (instance: PointCloudAnnotation) => void;\n setSideViewInstance: (instance: PointCloudAnnotation) => void;\n setBackViewInstance: (instance: PointCloudAnnotation) => void;\n setMainViewInstance: (instance: PointCloud) => void;\n}\n\ntype AttrPanelLayout = '' | 'left' | 'right';\n\nexport interface IPointCloudContext extends IPointCloudContextInstances {\n pointCloudBoxList: IPointCloudBoxList;\n displayPointCloudList: IPointCloudBoxList;\n selectedIDs: string[];\n setSelectedIDs: (ids?: string[] | string) => void;\n valid: boolean;\n setPointCloudResult: (resultList: IPointCloudBoxList) => void;\n selectedPointCloudBox?: IPointCloudBox;\n setPointCloudValid: (valid?: boolean) => void;\n addSelectedID: (selectedID: string) => void;\n selectedAllBoxes: () => void;\n selectedID: string;\n addPointCloudBox: (boxParams: IPointCloudBox) => IPointCloudBox[];\n\n polygonList: IPolygonData[];\n setPolygonList: (polygonList: IPolygonData[]) => void;\n\n zoom: number;\n setZoom: (zoom: number) => void;\n\n history: ActionsHistory; // Operation History\n hideAttributes: string[];\n setHideAttributes: (hideAttrs: string[]) => void;\n toggleAttributesVisible: (attribute: string) => void;\n reRender: (_displayPointCloudList: IPointCloudBoxList, _polygonList: IPolygonData[]) => void;\n attrPanelLayout: AttrPanelLayout;\n setAttrPanelLayout: (layout: AttrPanelLayout) => void;\n\n syncAllViewPointCloudColor: (newPointCloudList?: IPointCloudBox[]) => void;\n\n defaultAttribute: string;\n setDefaultAttribute: (defaultAttribute: string) => void;\n\n pointCloudPattern: EToolName.Rect | EToolName.Polygon;\n setPointCloudPattern: (toolName: EToolName.Rect | EToolName.Polygon) => void;\n selectSpecAttr: (attr: string) => void;\n}\n\nexport const PointCloudContext = React.createContext<IPointCloudContext>({\n pointCloudBoxList: [],\n displayPointCloudList: [],\n polygonList: [],\n selectedID: '',\n selectedIDs: [],\n valid: true,\n setSelectedIDs: () => {},\n setPointCloudResult: () => {},\n setPointCloudValid: () => {},\n setTopViewInstance: () => {},\n setSideViewInstance: () => {},\n setBackViewInstance: () => {},\n setMainViewInstance: () => {},\n addSelectedID: () => {},\n selectedAllBoxes: () => {},\n addPointCloudBox: () => {\n return [];\n },\n setPolygonList: () => {},\n\n zoom: 1,\n setZoom: () => {},\n history: new ActionsHistory(),\n hideAttributes: [],\n setHideAttributes: () => {},\n toggleAttributesVisible: () => {},\n reRender: () => {},\n setAttrPanelLayout: () => {},\n attrPanelLayout: '',\n syncAllViewPointCloudColor: () => {},\n\n defaultAttribute: '',\n setDefaultAttribute: () => {},\n\n pointCloudPattern: EToolName.Rect,\n setPointCloudPattern: () => {},\n selectSpecAttr: () => {},\n});\n\nexport const PointCloudProvider: React.FC<{}> = ({ children }) => {\n const [pointCloudBoxList, setPointCloudResult] = useState<IPointCloudBoxList>([]);\n const [polygonList, setPolygonList] = useState<IPolygonData[]>([]);\n const [selectedIDs, setSelectedIDsState] = useState<string[]>([]);\n const [valid, setValid] = useState<boolean>(true);\n const [zoom, setZoom] = useState<number>(1);\n const [topViewInstance, setTopViewInstance] = useState<PointCloudAnnotation>();\n const [sideViewInstance, setSideViewInstance] = useState<PointCloudAnnotation>();\n const [backViewInstance, setBackViewInstance] = useState<PointCloudAnnotation>();\n const [mainViewInstance, setMainViewInstance] = useState<PointCloud>();\n const [defaultAttribute, setDefaultAttribute] = useState('');\n const [pointCloudPattern, setPointCloudPattern] = useState<EToolName.Rect | EToolName.Polygon>(\n EToolName.Rect,\n );\n const history = useRef(new ActionsHistory()).current;\n const [hideAttributes, setHideAttributes] = useState<string[]>([]);\n const [attrPanelLayout, setAttrPanelLayout] = useState<AttrPanelLayout>('');\n\n const selectedID = useMemo(() => {\n return selectedIDs.length === 1 ? selectedIDs[0] : '';\n }, [selectedIDs]);\n\n const ptCtx = useMemo(() => {\n const selectedPointCloudBox = pointCloudBoxList.find((v) => v.id === selectedID);\n\n const addPointCloudBox = (box: IPointCloudBox) => {\n const newPointCloudList = pointCloudBoxList.concat(box);\n setPointCloudResult(newPointCloudList);\n return newPointCloudList;\n };\n\n const setPointCloudValid = (valid?: boolean) => {\n setValid(valid === false ? false : true);\n };\n\n const setSelectedIDs = (selectedIDs?: string[] | string) => {\n if (selectedIDs === undefined) {\n setSelectedIDsState([]);\n }\n\n if (typeof selectedIDs === 'string') {\n setSelectedIDsState([selectedIDs]);\n }\n\n if (Array.isArray(selectedIDs)) {\n setSelectedIDsState(Array.from(new Set(selectedIDs)));\n }\n };\n\n /**\n * If selectedID existed, remove selectedID from selectedIDs\n * If selectedID not existed, add selectedID to selectedIDs\n * @param selectedID\n */\n const addSelectedID = (selectedID: string) => {\n if (selectedIDs.includes(selectedID)) {\n setSelectedIDs(selectedIDs.filter((i) => i !== selectedID));\n } else {\n setSelectedIDs([...selectedIDs, selectedID]);\n }\n };\n\n const selectedAllBoxes = () => {\n setSelectedIDs(pointCloudBoxList.map((i) => i.id));\n };\n\n const selectSpecAttr = (attr: string) => {\n setSelectedIDs(pointCloudBoxList.filter((i) => i.attribute === attr).map((i) => i.id));\n };\n\n const displayPointCloudList = pointCloudBoxList.filter(\n (i) => !hideAttributes.includes(i.attribute),\n );\n\n const toggleAttributesVisible = (tAttribute: string) => {\n if (hideAttributes.includes(tAttribute)) {\n setHideAttributes(hideAttributes.filter((attribute) => attribute !== tAttribute));\n } else {\n const updatedHideAttributes = hideAttributes.concat(tAttribute);\n setHideAttributes(updatedHideAttributes);\n }\n };\n\n const reRender = (\n _displayPointCloudList: IPointCloudBoxList = displayPointCloudList,\n _polygonList: IPolygonData[] = polygonList,\n ) => {\n pointCloudBoxList.forEach((v) => {\n mainViewInstance?.removeObjectByName(v.id);\n });\n\n topViewInstance?.updatePolygonList(_displayPointCloudList, _polygonList);\n mainViewInstance?.generateBoxes(_displayPointCloudList);\n syncAllViewPointCloudColor(_displayPointCloudList);\n };\n\n /**\n * Synchronize the highlighted pointCloud for all views.\n * @param pointCloudList\n */\n\n const syncAllViewPointCloudColor = (pointCloudList?: IPointCloudBox[]) => {\n const colorPromise = mainViewInstance?.highlightOriginPointCloud(pointCloudList);\n return new Promise((resolve) => {\n colorPromise?.then((color) => {\n [topViewInstance].forEach((instance) => {\n if (color) {\n instance?.pointCloudInstance?.updateColor(color);\n resolve({ color });\n }\n });\n // TODO: Sync sideView & backView Color.\n });\n });\n };\n\n return {\n selectedID,\n pointCloudBoxList,\n displayPointCloudList,\n selectedIDs,\n setPointCloudResult,\n setSelectedIDs,\n addPointCloudBox,\n valid,\n selectedPointCloudBox,\n setPointCloudValid,\n addSelectedID,\n selectedAllBoxes,\n topViewInstance,\n setTopViewInstance,\n sideViewInstance,\n setSideViewInstance,\n backViewInstance,\n setBackViewInstance,\n mainViewInstance,\n setMainViewInstance,\n polygonList,\n setPolygonList,\n zoom,\n setZoom,\n history,\n toggleAttributesVisible,\n hideAttributes,\n setHideAttributes,\n reRender,\n attrPanelLayout,\n setAttrPanelLayout,\n syncAllViewPointCloudColor,\n defaultAttribute,\n setDefaultAttribute,\n pointCloudPattern,\n setPointCloudPattern,\n selectSpecAttr,\n };\n }, [\n valid,\n selectedIDs,\n pointCloudBoxList,\n polygonList,\n topViewInstance,\n sideViewInstance,\n backViewInstance,\n mainViewInstance,\n zoom,\n hideAttributes,\n attrPanelLayout,\n defaultAttribute,\n pointCloudPattern,\n ]);\n\n const updateSelectedIDsAndRenderAfterHide = () => {\n const pointCloudForFilteredList = pointCloudBoxList.filter((i) =>\n hideAttributes.includes(i.attribute),\n );\n\n const { setSelectedIDs, reRender } = ptCtx;\n\n const filteredIDs = pointCloudForFilteredList.map((i) => i.id);\n\n if (filteredIDs.length > 0) {\n setSelectedIDs(selectedIDs.filter((id) => !filteredIDs.includes(id)));\n }\n\n reRender();\n };\n\n useEffect(() => {\n updateSelectedIDsAndRenderAfterHide();\n topViewInstance?.pointCloud2dOperation?.setHiddenAttributes(hideAttributes);\n }, [hideAttributes]);\n\n return <PointCloudContext.Provider value={ptCtx}>{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AA0B,GAAI,CAAA,CAAC,MAAM,CAAE,CAAA,EAAA,CAAA,CAAA;AAE3D,IAAI,IAAA,WAAA,CAAY,SAAS,CAAG,EAAA;AAC1B,MAAA,cAAA,CAAe,YAAY,MAAO,CAAA,CAAC,EAAO,KAAA,CAAC,YAAY,QAAS,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA;AAAA,KAAA;AAGlE,IAAA,QAAA,EAAA,CAAA;AAAA,GAAA,CAAA;AAGF,EAAA,SAAA,CAAU,MAAM;AA/RlB,IAAA,IAAA,EAAA,CAAA;AAgSI,IAAA,mCAAA,EAAA,CAAA;AACA,IAAiB,CAAA,EAAA,GAAA,eAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,eAAA,CAAA,qBAAA,KAAjB,mBAAwC,mBAAoB,CAAA,cAAA,CAAA,CAAA;AAAA,GAAA,EAC3D,CAAC,cAAA,CAAA,CAAA,CAAA;AAEJ,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,kBAAkB,QAAnB,EAAA;AAAA,IAA4B,KAAO,EAAA,KAAA;AAAA,GAAQ,EAAA,QAAA,CAAA,CAAA;AAAA;;;;"}
|
package/es/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloudContext as
|
|
1
|
+
import{PointCloudContext as m}from"../../../../components/pointCloudView/PointCloudContext.js";import{Modal as D}from"antd";import t,{useContext as d,useMemo as A,useState as H}from"react";import{stepConfigSelector as O}from"../../../../store/annotation/selectors.js";import{useSelector as h}from"../../../../store/ctx.js";import{i18n as x}from"@labelbee/lb-utils";import{UnorderedListOutlined as P,PushpinFilled as b,EyeInvisibleFilled as V,EyeFilled as _,CaretDownFilled as $,DeleteOutlined as G}from"@ant-design/icons";import{useHistory as T}from"../../../../components/pointCloudView/hooks/useHistory.js";import{getClassName as a}from"../../../../utils/dom.js";import U from"../../../../utils/StepUtils.js";import{EPointCloudName as M}from"@labelbee/lb-annotation";import{useTranslation as k}from"react-i18next";import K from"../FooterPopover.js";const W=({attribute:n})=>{const u=d(m),{pointCloudBoxList:l,hideAttributes:r,toggleAttributesVisible:s,polygonList:o,setPolygonList:p,setPointCloudResult:C,reRender:i,selectSpecAttr:F}=u,[E,N]=H(!0),{pushHistoryWithList:B}=T(),L=[...l,...o].filter(e=>e.attribute===n.value),v=()=>{s(n.value)},R=r.includes(n.value),S=({trackID:e,order:c})=>e||c,j=({trackID:e,order:c})=>e?`trackID_${e}`:`order_${c}`,I=e=>{if(L.length===0)return;const c=o.filter(y=>e!==y.attribute),g=l.filter(y=>e!==y.attribute);i(g,c),p(c),C(g),B({pointCloudBoxList:g,polygonList:c})},w=e=>{D.confirm({content:x.t("onDeleteGraphByAttr",{attribute:e.key}),onOk:()=>{I(e.value)},okText:x.t("Confirm"),cancelText:x.t("Cancel")})};return t.createElement(t.Fragment,null,t.createElement("div",{className:a("annotated-attribute","item")},R?t.createElement(V,{onClick:v}):t.createElement(_,{onClick:v}),t.createElement($,{rotate:E?0:270,onClick:()=>{N(!E)}}),t.createElement("span",{className:a("annotated-attribute","item","text"),onClick:()=>{F(n.value)}},n.key),t.createElement(G,{onClick:()=>w(n)})),E&&L.map(e=>t.createElement("div",{key:j(e),style:{paddingLeft:54}},`${S(e)}.${n.key}`)))},f=()=>{const n=h(O),{attrPanelLayout:u,setAttrPanelLayout:l,pointCloudBoxList:r,polygonList:s}=d(m),{t:o}=k(),p=A(()=>[...r,...s].map(i=>i.attribute),[r,s]),C=A(()=>n.attributeList.filter(i=>p.includes(i.value)),[p]);return t.createElement("div",{className:a("annotated-attribute")},u?t.createElement("div",{className:a("annotated-attribute","text")},t.createElement("span",null,o("AnnotatedResult")),t.createElement("span",{className:a("annotated-attribute","pin"),onClick:()=>{l("")}},t.createElement(b,null),o("CancelFixed"))):t.createElement("div",{className:a("annotated-attribute","text")},t.createElement("span",{onClick:()=>{l("left")},className:a("annotated-attribute","pin")},t.createElement(b,null),o("FixedOnLeft")),t.createElement("span",{onClick:()=>{l("right")},className:a("annotated-attribute","pin")},t.createElement(b,null),o("FixedOnRight"))),t.createElement("div",null,C.length>0?C.map(i=>t.createElement(W,{attribute:i,key:i.value})):t.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},o("NoData"))))},q=()=>{const{attrPanelLayout:n}=d(m);return n==="left"?t.createElement(f,null):null},z=()=>{const{attrPanelLayout:n}=d(m);return n==="right"?t.createElement(f,null):null},J=()=>{const{attrPanelLayout:n}=d(m),{t:u}=k(),l=h(r=>{var s,o;return U.getCurrentStepInfo((s=r==null?void 0:r.annotation)==null?void 0:s.step,(o=r.annotation)==null?void 0:o.stepList)});return(l==null?void 0:l.tool)!==M.PointCloud||n?null:t.createElement(K,{hoverIcon:t.createElement(P,{style:{marginRight:4}}),icon:t.createElement(P,{style:{marginRight:4}}),title:u("AnnotatedList"),content:t.createElement(f,null)})};export{J as AnnotatedAttributesIcon,f as AnnotatedAttributesPanel,q as AnnotatedAttributesPanelFixedLeft,z as AnnotatedAttributesPanelFixedRight};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/views/MainView/toolFooter/AnnotatedAttributes/index.tsx"],"sourcesContent":["import { PointCloudContext } from '@/components/pointCloudView/PointCloudContext';\nimport { Modal } from 'antd';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { stepConfigSelector } from '@/store/annotation/selectors';\nimport { useSelector } from '@/store/ctx';\nimport { i18n, IPointCloudConfig } from '@labelbee/lb-utils';\nimport {\n CaretDownFilled,\n DeleteOutlined,\n EyeFilled,\n EyeInvisibleFilled,\n PushpinFilled,\n UnorderedListOutlined,\n} from '@ant-design/icons';\nimport { IInputList } from '@/types/main';\nimport { useHistory } from '@/components/pointCloudView/hooks/useHistory';\nimport { getClassName } from '@/utils/dom';\nimport StepUtils from '@/utils/StepUtils';\nimport { EPointCloudName } from '@labelbee/lb-annotation';\nimport { useTranslation } from 'react-i18next';\nimport FooterPopover from '../FooterPopover';\n\nconst AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => {\n const pointCloudCtx = useContext(PointCloudContext);\n const {\n pointCloudBoxList,\n hideAttributes,\n toggleAttributesVisible,\n polygonList,\n setPolygonList,\n setPointCloudResult,\n reRender,\n } = pointCloudCtx;\n\n const [expanded, setExpanded] = useState(true);\n\n const { pushHistoryWithList } = useHistory();\n\n const pointCloudListForSpecAttribute = [...pointCloudBoxList, ...polygonList].filter(\n (i) => i.attribute === attribute.value,\n );\n\n const onVisibleChange = () => {\n toggleAttributesVisible(attribute.value);\n };\n\n const isHidden = hideAttributes.includes(attribute.value);\n\n const getBoxID = ({ trackID, order }: { trackID?: number; order?: number }) => {\n return trackID ? trackID : order;\n };\n\n const getBoxKey = ({ trackID, order }: { trackID?: number; order?: number }) => {\n return trackID ? `trackID_${trackID}` : `order_${order}`;\n };\n\n const deleteGraphByAttr = (attribute: string) => {\n if (pointCloudListForSpecAttribute.length === 0) {\n return;\n }\n\n const newPolygonList = polygonList.filter((i) => attribute !== i.attribute);\n const newPointCloudList = pointCloudBoxList.filter((i) => attribute !== i.attribute);\n\n reRender(newPointCloudList, newPolygonList);\n\n setPolygonList(newPolygonList);\n setPointCloudResult(newPointCloudList);\n\n pushHistoryWithList({ pointCloudBoxList: newPointCloudList, polygonList: newPolygonList });\n };\n\n const onDeleteGraphByAttr = (attribute: IInputList) => {\n Modal.confirm({\n content: i18n.t('onDeleteGraphByAttr', { attribute: attribute.key }),\n onOk: () => {\n deleteGraphByAttr(attribute.value);\n },\n okText: i18n.t('Confirm'),\n cancelText: i18n.t('Cancel'),\n });\n };\n\n return (\n <>\n <div className={getClassName('annotated-attribute', 'item')}>\n {isHidden ? (\n <EyeInvisibleFilled onClick={onVisibleChange} />\n ) : (\n <EyeFilled onClick={onVisibleChange} />\n )}\n <CaretDownFilled\n rotate={expanded ? 0 : 270}\n onClick={() => {\n setExpanded(!expanded);\n }}\n />\n <span className={getClassName('annotated-attribute', 'item', 'text')}>{attribute.key}</span>\n\n <DeleteOutlined onClick={() => onDeleteGraphByAttr(attribute)} />\n </div>\n\n {expanded &&\n pointCloudListForSpecAttribute.map((box) => {\n return (\n <div key={getBoxKey(box)} style={{ paddingLeft: 54 }}>\n {`${getBoxID(box)}.${attribute.key}`}\n </div>\n );\n })}\n </>\n );\n};\n\nexport const AnnotatedAttributesPanel = () => {\n const stepConfig: IPointCloudConfig = useSelector(stepConfigSelector);\n const { attrPanelLayout, setAttrPanelLayout, pointCloudBoxList, polygonList } =\n useContext(PointCloudContext);\n const { t } = useTranslation();\n\n const existAttributes = useMemo(() => {\n return [...pointCloudBoxList, ...polygonList].map((i) => i.attribute);\n }, [pointCloudBoxList, polygonList]);\n\n const displayAttrList = useMemo(() => {\n return (stepConfig.attributeList as IInputList[]).filter((i) =>\n existAttributes.includes(i.value),\n );\n }, [existAttributes]);\n\n useEffect(() => {\n console.log(pointCloudBoxList);\n }, [pointCloudBoxList]);\n\n console.log(pointCloudBoxList, polygonList, existAttributes, displayAttrList);\n\n return (\n <div className={getClassName('annotated-attribute')}>\n {attrPanelLayout ? (\n <div className={getClassName('annotated-attribute', 'text')}>\n <span>{t('AnnotatedResult')}</span>\n <span\n className={getClassName('annotated-attribute', 'pin')}\n onClick={() => {\n setAttrPanelLayout('');\n }}\n >\n <PushpinFilled />\n {t('CancelFixed')}\n </span>\n </div>\n ) : (\n <div className={getClassName('annotated-attribute', 'text')}>\n <span\n onClick={() => {\n setAttrPanelLayout('left');\n }}\n className={getClassName('annotated-attribute', 'pin')}\n >\n <PushpinFilled />\n {t('FixedOnLeft')}\n </span>\n <span\n onClick={() => {\n setAttrPanelLayout('right');\n }}\n className={getClassName('annotated-attribute', 'pin')}\n >\n <PushpinFilled />\n {t('FixedOnRight')}\n </span>\n </div>\n )}\n\n <div>\n {displayAttrList.length > 0 ? (\n displayAttrList.map((i) => <AnnotatedAttributesItem attribute={i} key={i.value} />)\n ) : (\n <div style={{ textAlign: 'center', height: 200, lineHeight: '200px' }}>{t('NoData')}</div>\n )}\n </div>\n </div>\n );\n};\n\nexport const AnnotatedAttributesPanelFixedLeft = () => {\n const { attrPanelLayout } = useContext(PointCloudContext);\n if (attrPanelLayout === 'left') {\n return <AnnotatedAttributesPanel />;\n }\n\n return null;\n};\n\nexport const AnnotatedAttributesPanelFixedRight = () => {\n const { attrPanelLayout } = useContext(PointCloudContext);\n\n if (attrPanelLayout === 'right') {\n return <AnnotatedAttributesPanel />;\n }\n\n return null;\n};\n\nexport const AnnotatedAttributesIcon = () => {\n const { attrPanelLayout } = useContext(PointCloudContext);\n const { t } = useTranslation();\n const stepInfo = useSelector((state) =>\n // @ts-ignore\n StepUtils.getCurrentStepInfo(state?.annotation?.step, state.annotation?.stepList),\n );\n\n if (stepInfo?.tool !== EPointCloudName.PointCloud) {\n return null;\n }\n\n if (attrPanelLayout) {\n return null;\n }\n\n return (\n <FooterPopover\n hoverIcon={<UnorderedListOutlined style={{ marginRight: 4 }} />}\n icon={<UnorderedListOutlined style={{ marginRight: 4 }} />}\n title={t('AnnotatedList')}\n content={<AnnotatedAttributesPanel />}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAsBA,MAAM,uBAAA,GAA0B,CAAC,CAAE,SAA2C,CAAA,KAAA;AAC5E,EAAA,MAAM,gBAAgB,UAAW,CAAA,iBAAA,CAAA,CAAA;AACjC,EAAM,MAAA;AAAA,IACJ,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,uBAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,mBAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,aAAA,CAAA;AAEJ,EAAM,MAAA,CAAC,QAAU,EAAA,WAAA,CAAA,GAAe,QAAS,CAAA,IAAA,CAAA,CAAA;AAEzC,EAAA,MAAM,CAAE,mBAAwB,CAAA,GAAA,UAAA,EAAA,CAAA;AAEhC,EAAM,MAAA,8BAAA,GAAiC,CAAC,GAAG,iBAAmB,EAAA,GAAG,WAAa,CAAA,CAAA,MAAA,CAC5E,CAA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A,GAAA,KAAA,CAAA,GAAA,QAAA,CAAU,IAAS,MAAA,eAAA,CAAgB,UAAY,EAAA;AACjD,IAAO,OAAA,IAAA,CAAA;AAAA,GAAA;AAGT,EAAA,IAAI,eAAiB,EAAA;AACnB,IAAO,OAAA,IAAA,CAAA;AAAA,GAAA;AAGT,EAAA,2CACG,aAAD,EAAA;AAAA,IACE,SAAA,sCAAY,qBAAD,EAAA;AAAA,MAAuB,KAAA,EAAO,CAAE,WAAa,EAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAAA,IACxD,IAAA,sCAAO,qBAAD,EAAA;AAAA,MAAuB,KAAA,EAAO,CAAE,WAAa,EAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAAA,IACnD,OAAO,CAAE,CAAA,eAAA,CAAA;AAAA,IACT,OAAA,sCAAU,wBAAD,EAAA,IAAA,CAAA;AAAA,GAAA,CAAA,CAAA;AAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/views/MainView/toolFooter/AnnotatedAttributes/index.tsx"],"sourcesContent":["import { PointCloudContext } from '@/components/pointCloudView/PointCloudContext';\nimport { Modal } from 'antd';\nimport React, { useContext, useMemo, useState } from 'react';\nimport { stepConfigSelector } from '@/store/annotation/selectors';\nimport { useSelector } from '@/store/ctx';\nimport { i18n, IPointCloudConfig } from '@labelbee/lb-utils';\nimport {\n CaretDownFilled,\n DeleteOutlined,\n EyeFilled,\n EyeInvisibleFilled,\n PushpinFilled,\n UnorderedListOutlined,\n} from '@ant-design/icons';\nimport { IInputList } from '@/types/main';\nimport { useHistory } from '@/components/pointCloudView/hooks/useHistory';\nimport { getClassName } from '@/utils/dom';\nimport StepUtils from '@/utils/StepUtils';\nimport { EPointCloudName } from '@labelbee/lb-annotation';\nimport { useTranslation } from 'react-i18next';\nimport FooterPopover from '../FooterPopover';\n\nconst AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => {\n const pointCloudCtx = useContext(PointCloudContext);\n const {\n pointCloudBoxList,\n hideAttributes,\n toggleAttributesVisible,\n polygonList,\n setPolygonList,\n setPointCloudResult,\n reRender,\n selectSpecAttr,\n } = pointCloudCtx;\n\n const [expanded, setExpanded] = useState(true);\n\n const { pushHistoryWithList } = useHistory();\n\n const pointCloudListForSpecAttribute = [...pointCloudBoxList, ...polygonList].filter(\n (i) => i.attribute === attribute.value,\n );\n\n const onVisibleChange = () => {\n toggleAttributesVisible(attribute.value);\n };\n\n const isHidden = hideAttributes.includes(attribute.value);\n\n const getBoxID = ({ trackID, order }: { trackID?: number; order?: number }) => {\n return trackID ? trackID : order;\n };\n\n const getBoxKey = ({ trackID, order }: { trackID?: number; order?: number }) => {\n return trackID ? `trackID_${trackID}` : `order_${order}`;\n };\n\n const deleteGraphByAttr = (attribute: string) => {\n if (pointCloudListForSpecAttribute.length === 0) {\n return;\n }\n\n const newPolygonList = polygonList.filter((i) => attribute !== i.attribute);\n const newPointCloudList = pointCloudBoxList.filter((i) => attribute !== i.attribute);\n\n reRender(newPointCloudList, newPolygonList);\n\n setPolygonList(newPolygonList);\n setPointCloudResult(newPointCloudList);\n\n pushHistoryWithList({ pointCloudBoxList: newPointCloudList, polygonList: newPolygonList });\n };\n\n const onDeleteGraphByAttr = (attribute: IInputList) => {\n Modal.confirm({\n content: i18n.t('onDeleteGraphByAttr', { attribute: attribute.key }),\n onOk: () => {\n deleteGraphByAttr(attribute.value);\n },\n okText: i18n.t('Confirm'),\n cancelText: i18n.t('Cancel'),\n });\n };\n\n return (\n <>\n <div className={getClassName('annotated-attribute', 'item')}>\n {isHidden ? (\n <EyeInvisibleFilled onClick={onVisibleChange} />\n ) : (\n <EyeFilled onClick={onVisibleChange} />\n )}\n <CaretDownFilled\n rotate={expanded ? 0 : 270}\n onClick={() => {\n setExpanded(!expanded);\n }}\n />\n <span\n className={getClassName('annotated-attribute', 'item', 'text')}\n onClick={() => {\n selectSpecAttr(attribute.value);\n }}\n >\n {attribute.key}\n </span>\n\n <DeleteOutlined onClick={() => onDeleteGraphByAttr(attribute)} />\n </div>\n\n {expanded &&\n pointCloudListForSpecAttribute.map((box) => {\n return (\n <div key={getBoxKey(box)} style={{ paddingLeft: 54 }}>\n {`${getBoxID(box)}.${attribute.key}`}\n </div>\n );\n })}\n </>\n );\n};\n\nexport const AnnotatedAttributesPanel = () => {\n const stepConfig: IPointCloudConfig = useSelector(stepConfigSelector);\n const { attrPanelLayout, setAttrPanelLayout, pointCloudBoxList, polygonList } =\n useContext(PointCloudContext);\n const { t } = useTranslation();\n\n const existAttributes = useMemo(() => {\n return [...pointCloudBoxList, ...polygonList].map((i) => i.attribute);\n }, [pointCloudBoxList, polygonList]);\n\n const displayAttrList = useMemo(() => {\n return (stepConfig.attributeList as IInputList[]).filter((i) =>\n existAttributes.includes(i.value),\n );\n }, [existAttributes]);\n\n return (\n <div className={getClassName('annotated-attribute')}>\n {attrPanelLayout ? (\n <div className={getClassName('annotated-attribute', 'text')}>\n <span>{t('AnnotatedResult')}</span>\n <span\n className={getClassName('annotated-attribute', 'pin')}\n onClick={() => {\n setAttrPanelLayout('');\n }}\n >\n <PushpinFilled />\n {t('CancelFixed')}\n </span>\n </div>\n ) : (\n <div className={getClassName('annotated-attribute', 'text')}>\n <span\n onClick={() => {\n setAttrPanelLayout('left');\n }}\n className={getClassName('annotated-attribute', 'pin')}\n >\n <PushpinFilled />\n {t('FixedOnLeft')}\n </span>\n <span\n onClick={() => {\n setAttrPanelLayout('right');\n }}\n className={getClassName('annotated-attribute', 'pin')}\n >\n <PushpinFilled />\n {t('FixedOnRight')}\n </span>\n </div>\n )}\n\n <div>\n {displayAttrList.length > 0 ? (\n displayAttrList.map((i) => <AnnotatedAttributesItem attribute={i} key={i.value} />)\n ) : (\n <div style={{ textAlign: 'center', height: 200, lineHeight: '200px' }}>{t('NoData')}</div>\n )}\n </div>\n </div>\n );\n};\n\nexport const AnnotatedAttributesPanelFixedLeft = () => {\n const { attrPanelLayout } = useContext(PointCloudContext);\n if (attrPanelLayout === 'left') {\n return <AnnotatedAttributesPanel />;\n }\n\n return null;\n};\n\nexport const AnnotatedAttributesPanelFixedRight = () => {\n const { attrPanelLayout } = useContext(PointCloudContext);\n\n if (attrPanelLayout === 'right') {\n return <AnnotatedAttributesPanel />;\n }\n\n return null;\n};\n\nexport const AnnotatedAttributesIcon = () => {\n const { attrPanelLayout } = useContext(PointCloudContext);\n const { t } = useTranslation();\n const stepInfo = useSelector((state) =>\n // @ts-ignore\n StepUtils.getCurrentStepInfo(state?.annotation?.step, state.annotation?.stepList),\n );\n\n if (stepInfo?.tool !== EPointCloudName.PointCloud) {\n return null;\n }\n\n if (attrPanelLayout) {\n return null;\n }\n\n return (\n <FooterPopover\n hoverIcon={<UnorderedListOutlined style={{ marginRight: 4 }} />}\n icon={<UnorderedListOutlined style={{ marginRight: 4 }} />}\n title={t('AnnotatedList')}\n content={<AnnotatedAttributesPanel />}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAsBA,MAAM,uBAAA,GAA0B,CAAC,CAAE,SAA2C,CAAA,KAAA;AAC5E,EAAA,MAAM,gBAAgB,UAAW,CAAA,iBAAA,CAAA,CAAA;AACjC,EAAM,MAAA;AAAA,IACJ,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,uBAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,mBAAA;AAAA,IACA,QAAA;AAAA,IACA,cAAA;AAAA,GACE,GAAA,aAAA,CAAA;AAEJ,EAAM,MAAA,CAAC,QAAU,EAAA,WAAA,CAAA,GAAe,QAAS,CAAA,IAAA,CAAA,CAAA;AAEzC,EAAA,MAAM,CAAE,mBAAwB,CAAA,GAAA,UAAA,EAAA,CAAA;AAEhC,EAAM,MAAA,8BAAA,GAAiC,CAAC,GAAG,iBAAmB,EAAA,GAAG,WAAa,CAAA,CAAA,MAAA,CAC5E,CAAC,CAAA,KAAM,CAAE,CAAA,SAAA,KAAc,SAAU,CAAA,KAAA,CAAA,CAAA;AAGnC,EAAA,MAAM,kBA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AA,sCAAY,qBAAD,EAAA;AAAA,MAAuB,KAAA,EAAO,CAAE,WAAa,EAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAAA,IACxD,IAAA,sCAAO,qBAAD,EAAA;AAAA,MAAuB,KAAA,EAAO,CAAE,WAAa,EAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAAA,IACnD,OAAO,CAAE,CAAA,eAAA,CAAA;AAAA,IACT,OAAA,sCAAU,wBAAD,EAAA,IAAA,CAAA;AAAA,GAAA,CAAA,CAAA;AAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.9.0-alpha.
|
|
3
|
+
"version": "1.9.0-alpha.4",
|
|
4
4
|
"description": "Provide a complete library of annotation components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"es": "./es/index.js",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@ant-design/icons": "^4.6.2",
|
|
44
|
-
"@labelbee/lb-annotation": "^1.13.0-alpha.
|
|
45
|
-
"@labelbee/lb-utils": "^1.6.0-alpha.
|
|
44
|
+
"@labelbee/lb-annotation": "^1.13.0-alpha.4",
|
|
45
|
+
"@labelbee/lb-utils": "^1.6.0-alpha.4",
|
|
46
46
|
"ahooks": "^3.4.0",
|
|
47
47
|
"classnames": "^2.3.0",
|
|
48
48
|
"lodash": "^4.17.21",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"path": "node_modules/cz-conventional-changelog"
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "9a348d54c0c974d871839d71271cc2f91249a4c3"
|
|
101
101
|
}
|