@labelbee/lb-components 1.12.0-alpha.1 → 1.12.0-alpha.10
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/AnnotationView/pointCloudAnnotationView.js +1 -1
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/PointCloudSegment.js +1 -1
- package/dist/components/pointCloudView/PointCloudSegmentListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudSegmentStatus.js +1 -1
- package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
- package/dist/components/pointCloudView/hooks/useSphere.js +1 -1
- package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/components/predictTracking/predictTrackingIcon/index.js +1 -1
- package/dist/components/predictTracking/previewResult/index.js +1 -1
- package/dist/hooks/annotation.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/App.d.ts +5 -8
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +1 -0
- package/dist/types/components/pointCloudView/hooks/useHistory.d.ts +1 -0
- package/dist/types/components/pointCloudView/hooks/useStatus.d.ts +2 -1
- package/dist/types/components/predictTracking/predictTrackingIcon/index.d.ts +1 -1
- package/dist/types/hooks/annotation.d.ts +0 -1
- package/dist/views/MainView/sidebar/GeneralOperation/index.js +1 -1
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/dist/views/MainView/toolFooter/PageNumber/index.js +1 -1
- package/dist/views/MainView/toolHeader/SwitchPattern/index.js +1 -1
- package/es/components/AnnotationView/pointCloudAnnotationView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudSegment.js +1 -1
- package/es/components/pointCloudView/PointCloudSegmentListener.js +1 -1
- package/es/components/pointCloudView/PointCloudSegmentStatus.js +1 -1
- package/es/components/pointCloudView/hooks/useHistory.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
- package/es/components/pointCloudView/hooks/useSphere.js +1 -1
- package/es/components/pointCloudView/hooks/useStatus.js +1 -1
- package/es/components/pointCloudView/index.js +1 -1
- package/es/components/predictTracking/predictTrackingIcon/index.js +1 -1
- package/es/components/predictTracking/previewResult/index.js +1 -1
- package/es/hooks/annotation.js +1 -1
- package/es/index.js +1 -1
- package/es/views/MainView/sidebar/GeneralOperation/index.js +1 -1
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/views/MainView/toolFooter/PageNumber/index.js +1 -1
- package/es/views/MainView/toolHeader/SwitchPattern/index.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React);const PointCloudAnnotationView=o=>{const{src:l,result:n,size:i,isOrthographicCamera:u=!1,backgroundColor:d="#ccc"}=o;let c=React.useRef();const r=React.useRef(),f=React.useCallback(e=>{c.current=e},[]);return React.useEffect(()=>{let e={container:c.current,backgroundColor:d,isOrthographicCamera:u};u&&Object.assign(e,{orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(i)});const a=new lbAnnotation.PointCloud(e);return r.current=a,()=>{var t;(t=r.current.renderer)==null||t.forceContextLoss()}},[]),React.useEffect(()=>{var e,a,t;r.current&&((e=r.current)==null||e.init(),(a=r.current)==null||a.initOrthographicCamera(lbUtils.PointCloudUtils.getDefaultOrthographicParams(i)),(t=r.current)==null||t.render())},[i]),React.useEffect(()=>{var e;r.current&&l&&((e=r.current)==null||e.loadPCDFile(l))},[l]),React.useEffect(()=>(n&&lbUtils.PointCloudUtils.getBoxParamsFromResultList(n).forEach(a=>{var t;(t=r.current)==null||t.generateBox(a,a.id)}),()=>{var e;lbUtils.PointCloudUtils.getBoxParamsFromResultList(n).forEach(t=>{var s;(s=r.current)==null||s.removeObjectByName(t.id,"box")}),(e=r.current)==null||e.render()}),[n]),React__default.default.createElement("div",{style:i,ref:f})};module.exports=PointCloudAnnotationView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,a,e)=>a in t?__defProp(t,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[a]=e,__spreadValues=(t,a)=>{for(var e in a||(a={}))__hasOwnProp.call(a,e)&&__defNormalProp(t,e,a[e]);if(__getOwnPropSymbols)for(var e of __getOwnPropSymbols(a))__propIsEnum.call(a,e)&&__defNormalProp(t,e,a[e]);return t},__spreadProps=(t,a)=>__defProps(t,__getOwnPropDescs(a));const pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:t})=>{const{isActive:a,setTarget3DView:e}=React.useContext(PointCloud3DContext),m=p=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",p)]:!0,active:a});return React__default.default.createElement("span",{onClick:()=>{e(lbUtils.EPerspectiveView[t])},className:m(t.toLocaleLowerCase())})},PointCloud3DSideBar=()=>{const{reset3DView:t,followTopView:a}=React.useContext(PointCloud3DContext),{t:e}=reactI18next.useTranslation();return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Top"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Front"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Left"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Back"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Right"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"LFT"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"RBT"}),React__default.default.createElement(antd.Tooltip,{title:e("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{a()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{t()},className:dom.getClassName("point-cloud-3d-view","reset")}))},PointCloud3D=({currentData:t,config:a})=>{const e=React.useContext(PointCloudContext.PointCloudContext),[m,p]=React.useState(!0),u=React.useRef(null),{initPointCloud3d:w}=usePointCloudViews.usePointCloudViews(),c=useSize(u),{t:C}=reactI18next.useTranslation();React.useEffect(()=>{!e.mainViewInstance||w==null||w(c)},[c]);const{selectedBox:s}=useSingleBox.useSingleBox(),{selectedSphere:d}=useSphere.useSphere(),v=o=>{var n,i;const r=s==null?void 0:s.info;if(r){const l=__spreadValues({},r.center);l.x=l.x-.01,l.z=10;const f=o===lbUtils.EPerspectiveView.Top;(n=e.mainViewInstance)==null||n.updateCameraByBox(r,o,f?l:void 0)}d&&((i=e.mainViewInstance)==null||i.updateCameraBySphere(d,o))},V=()=>{var o;(o=e.mainViewInstance)==null||o.resetCamera()},P=()=>{var o,n;const i=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance.camera;i&&((n=e.mainViewInstance)==null||n.applyCameraTarget(i))};React.useEffect(()=>{if(u.current&&(t==null?void 0:t.url)){let o=e.mainViewInstance;!o&&c.width&&(o=new lbAnnotation.PointCloud({container:u.current,isOrthographicCamera:!0,orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(c),config:a}),e.setMainViewInstance(o))}},[c]),React.useEffect(()=>{var o;if(u.current&&(t==null?void 0:t.url)&&t.result&&e.mainViewInstance){let n=e.mainViewInstance;const i=lbUtils.PointCloudUtils.getBoxParamsFromResultList(t.result);i.forEach(r=>{var l;const f=(l=lbUtils.toolStyleConverter.getColorFromConfig({attribute:r.attribute},__spreadProps(__spreadValues({},a),{attributeConfigurable:!0}),{}))==null?void 0:l.hex;n==null||n.generateBox(r,f)}),e.setPointCloudResult(i),e.setPointCloudValid((o=index.jsonParser(t.result))==null?void 0:o.valid)}},[t,e.mainViewInstance]),React.useEffect(()=>{var o,n,i,r;if(s){v(lbUtils.EPerspectiveView.Top);const l=(i=(n=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null?void 0:n.camera.zoom)!=null?i:1;(r=e.mainViewInstance)==null||r.updateCameraZoom(l)}},[s]),React.useEffect(()=>{var o,n,i,r;if(d){v(lbUtils.EPerspectiveView.Top);const l=(i=(n=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null?void 0:n.camera.zoom)!=null?i:1;(r=e.mainViewInstance)==null||r.updateCameraZoom(l)}},[d]);const _=React.useMemo(()=>({reset3DView:V,setTarget3DView:v,isActive:!!s,followTopView:P}),[s,e.mainViewInstance]),g=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{onChange:o=>{var n;(n=e.mainViewInstance)==null||n.updatePointSize({customSize:o})}}),React__default.default.createElement("span",{style:{marginRight:8}},C("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:m,onChange:o=>{var n;p(o),(n=e.mainViewInstance)==null||n.setShowDirection(o)}}));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-3d-container"),title:C("3DView"),toolbar:g},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},React__default.default.createElement(PointCloud3DContext.Provider,{value:_},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:u})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{}}),PointCloudProvider=({children:r})=>{const[
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{}}),PointCloudProvider=({children:r})=>{const[a,w]=React.useState([]),[C,V]=React.useState([]),[L,Z]=React.useState([]),[A,U]=React.useState([]),[l,g]=React.useState([]),[x,J]=React.useState(!0),[D,K]=React.useState(1),[o,R]=React.useState(),[B,E]=React.useState(),[H,_]=React.useState(),[n,q]=React.useState(),[G,Q]=React.useState(""),[I,W]=React.useState(lbAnnotation.EToolName.Rect),X=React.useRef(new lbAnnotation.ActionsHistory).current,[s,h]=React.useState([]),[M,Y]=React.useState(""),[m,$]=React.useState(lbUtils.EPointCloudPattern.Detection),[p,T]=React.useState(void 0),[y,tt]=React.useState([]),et=ctx.useDispatch(),j=React.useMemo(()=>l.length===1?l[0]:"",[l]),F=React.useMemo(()=>{const u=a.find(t=>t.id===j),S=t=>{const e=a.concat(t);return w(e),e},d=t=>{const e=C.concat(t);return V(e),e},c=t=>{J(t!==!1)},i=t=>{t===void 0&&g([]),typeof t=="string"&&g([t]),Array.isArray(t)&&g(Array.from(new Set(t)))},nt=t=>{l.includes(t)?i(l.filter(e=>e!==t)):i([...l,t])},st=()=>{if(I===lbAnnotation.EToolName.Rect){const t=a.map(e=>e.id);i(t),o==null||o.pointCloud2dOperation.setSelectedIDs(t)}},it=t=>{i(a.filter(e=>e.attribute===t).map(e=>e.id))},k=a.filter(t=>!s.includes(t.attribute)),N=C.filter(t=>!s.includes(t.attribute)),O=A.filter(t=>t.attribute&&!s.includes(t.attribute)),lt=t=>{if(s.includes(t))h(s.filter(e=>e!==t));else{const e=s.concat(t);h(e)}},at=(t=k,e=L,f=N,P=O,b=y)=>{var v;n==null||n.clearAllBox(),n==null||n.clearAllSphere(),o==null||o.updatePolygonList(t,e),o==null||o.updatePointList(f),o==null||o.updateLineList(P),n==null||n.generateBoxes(t),n==null||n.generateSpheres(f),(v=p==null?void 0:p.store)==null||v.updateCurrentSegment(b),z(t)},rt=()=>{R(void 0),E(void 0),_(void 0),q(void 0)},z=t=>{const e=n==null?void 0:n.highlightOriginPointCloud(t);return new Promise(f=>{e==null||e.then(P=>{[o].forEach(b=>{var v;P&&((v=b==null?void 0:b.pointCloudInstance)==null||v.updateColor(P),f({color:P}))})}).catch(P=>{console.error(P)})})};return{selectedID:j,pointCloudBoxList:a,pointCloudSphereList:C,displayPointCloudList:k,displaySphereList:N,displayLineList:O,selectedIDs:l,setPointCloudResult:w,setSelectedIDs:i,addPointCloudBox:S,addPointCloudSphere:d,setPointCloudSphereList:V,valid:x,selectedPointCloudBox:u,setPointCloudValid:c,addSelectedID:nt,selectedAllBoxes:st,topViewInstance:o,setTopViewInstance:R,sideViewInstance:B,setSideViewInstance:E,backViewInstance:H,setBackViewInstance:_,mainViewInstance:n,setMainViewInstance:q,polygonList:L,setPolygonList:Z,lineList:A,setLineList:U,zoom:D,setZoom:K,history:X,toggleAttributesVisible:lt,hideAttributes:s,setHideAttributes:h,reRender:at,attrPanelLayout:M,setAttrPanelLayout:Y,syncAllViewPointCloudColor:z,defaultAttribute:G,setDefaultAttribute:Q,pointCloudPattern:I,setPointCloudPattern:W,selectSpecAttr:it,globalPattern:m,setGlobalPattern:t=>{m!==t&&(et(actionCreators.ChangeSave),$(t),t===lbUtils.EPointCloudPattern.Detection&&T(void 0))},ptSegmentInstance:p,setPtSegmentInstance:T,segmentation:y,setSegmentation:tt,clearAllDetectionInstance:rt}},[x,l,a,C,L,A,o,B,H,n,D,s,M,G,I,m,p,y]),ot=()=>{const u=a.filter(i=>s.includes(i.attribute)),{setSelectedIDs:S,reRender:d}=F,c=u.map(i=>i.id);c.length>0&&S(l.filter(i=>!c.includes(i))),d()};return React.useEffect(()=>{var u,S,d,c;ot(),(S=(u=o==null?void 0:o.toolInstance)==null?void 0:u.setHiddenAttributes)==null||S.call(u,s),(c=(d=p==null?void 0:p.store)==null?void 0:d.setHiddenAttributes)==null||c.call(d,s)},[s]),React__default.default.createElement(PointCloudContext.Provider,{value:F},r)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var useSize=require("../../hooks/useSize.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),React=require("react"),reactRedux=require("react-redux"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const PointCloudSegment=({currentData:e,config:
|
|
1
|
+
"use strict";var useSize=require("../../hooks/useSize.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),React=require("react"),reactRedux=require("react-redux"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const PointCloudSegment=({currentData:e,config:n,checkMode:c})=>{var o,u;const a=React.useRef(null),{setPtSegmentInstance:d,setDefaultAttribute:m,ptSegmentInstance:r}=React.useContext(PointCloudContext.PointCloudContext),t=useSize(a),i=(u=(o=n==null?void 0:n.attributeList)==null?void 0:o[0])==null?void 0:u.value;return React.useEffect(()=>{var l;if(!(t==null?void 0:t.width)||!a.current||r)return;const s=new lbAnnotation.PointCloud({container:a.current,isOrthographicCamera:!0,isSegment:!0,orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(t),config:n,checkMode:c});(l=s.store)==null||l.setAttribute(i),m(i),d(s)},[t]),React.useEffect(()=>{r&&(r.initRenderer(),r.initOrthographicCamera(lbUtils.PointCloudUtils.getDefaultOrthographicParams(t)),r.render())},[t]),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),ref:a})};var PointCloudSegment$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegment);module.exports=PointCloudSegment$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),useAttribute=require("./hooks/useAttribute.js");const PointCloudSegmentListener=({checkMode:
|
|
1
|
+
"use strict";var React=require("react"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),useAttribute=require("./hooks/useAttribute.js");const PointCloudSegmentListener=({checkMode:c,currentData:r,imgIndex:m,highlightAttribute:u,config:v,toolInstanceRef:a})=>{const{updateSegmentAttribute:b}=useAttribute.useAttribute(),n=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:e,setSegmentation:s}=n;React.useEffect(()=>{var t;if(e&&r.url)return e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=r==null?void 0:r.url)!=null?t:"").then(()=>{var l,o;const i=lbUtils.PointCloudUtils.getSegmentFromResultList((l=r==null?void 0:r.result)!=null?l:"");(o=e==null?void 0:e.store)==null||o.updateCurrentSegment(i)}),e.on("syncSegmentData",s),()=>{e.unbind("syncSegmentData",s)}},[m,e]),React.useEffect(()=>{var t,l;let o=(t=v.attributeList.find(i=>(i==null?void 0:i.key)===u))==null?void 0:t.value;(l=e==null?void 0:e.store)==null||l.highlightPointsByAttribute(o!=null?o:"")},[u,e]);const S=(t,l)=>{var o,i;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Add);break;case"i":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(i=(o=e.store)==null?void 0:o.cacheSegData)==null?void 0:i.id);break}},d=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||c===!0)return;const l=t.key.toLocaleLowerCase();S(l)};return React.useEffect(()=>(window.addEventListener("keydown",d),a.current.setDefaultAttribute=t=>{b(t)},()=>{window.removeEventListener("keydown",d)}),[e]),React.useEffect(()=>{a.current.clearResult=()=>{!n.ptSegmentInstance||n.ptSegmentInstance.emit("clearAllSegmentData")}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var PointCloudSegmentListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegmentListener);module.exports=PointCloudSegmentListener$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),dom=require("../../utils/dom.js"),finish=require("../../assets/annotation/pointCloudTool/finish.svg.js"),cancel=require("../../assets/annotation/pointCloudTool/cancel.svg.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const SegmentInfo=({infoList:e})=>{const{t:l}=reactI18next.useTranslation();return e?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-status","info")},e.map(
|
|
1
|
+
"use strict";var React=require("react"),dom=require("../../utils/dom.js"),finish=require("../../assets/annotation/pointCloudTool/finish.svg.js"),cancel=require("../../assets/annotation/pointCloudTool/cancel.svg.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const SegmentInfo=({infoList:e})=>{const{t:l}=reactI18next.useTranslation();return e?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-status","info")},e.map(n=>React__default.default.createElement("div",{key:n.key},React__default.default.createElement("span",null,l(n.key),"\uFF1A "),React__default.default.createElement("span",null,n.value)))):null},PointCloudSegmentStatus=()=>{var e,l,n,d,r;const{t:s}=reactI18next.useTranslation(),{ptSegmentInstance:t,setDefaultAttribute:m}=React.useContext(PointCloudContext.PointCloudContext),[o,f]=React.useState({segmentStatus:lbUtils.EPointCloudSegmentStatus.Ready});React.useEffect(()=>{if(t){const a=c=>{f(c),c.cacheSegData&&m(c.cacheSegData.attribute)};return t==null||t.on("syncPointCloudStatus",a),()=>{t==null||t.unbind("syncPointCloudStatus",a)}}},[t]);const u=o.segmentStatus;if(u===lbUtils.EPointCloudSegmentStatus.Ready)return null;const g=u===lbUtils.EPointCloudSegmentStatus.Check,C=u===lbUtils.EPointCloudSegmentStatus.Edit;let i=null;const S=((n=(l=(e=o.cacheSegData)==null?void 0:e.points)==null?void 0:l.length)!=null?n:0)/3;let v=[{key:"SelectedPoints",value:S},{key:"Attribute",value:(r=(d=o.cacheSegData)==null?void 0:d.attribute)!=null?r:""}];return g&&(i=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-status","operation")},React__default.default.createElement("span",{className:dom.getClassName("point-cloud-status","button"),onClick:()=>{t==null||t.emit("updateCheck2Edit")}},s("EnterEditMode"),"(Enter)"))),C&&(i=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-status","operation")},React__default.default.createElement("span",{className:dom.getClassName("point-cloud-status","button"),onClick:()=>{var a;t==null||t.emit("addStash2Store"),((a=t==null?void 0:t.store)==null?void 0:a.segmentFocusMode)===lbUtils.EPointCloudSegmentFocusMode.Focus&&(t==null||t.emit("setSegmentFocusMode",lbUtils.EPointCloudSegmentFocusMode.Unfocus))}},React__default.default.createElement("img",{className:dom.getClassName("point-cloud-status","icon"),src:finish}),s("Finish")),React__default.default.createElement("span",{className:dom.getClassName("point-cloud-status","button"),onClick:()=>{var a;t==null||t.emit("clearStash"),((a=t==null?void 0:t.store)==null?void 0:a.segmentFocusMode)===lbUtils.EPointCloudSegmentFocusMode.Focus&&(t==null||t.emit("setSegmentFocusMode",lbUtils.EPointCloudSegmentFocusMode.Unfocus))}},React__default.default.createElement("img",{className:dom.getClassName("point-cloud-status","icon"),src:cancel}),s("Cancel")))),React__default.default.createElement(React__default.default.Fragment,null,i,React__default.default.createElement(SegmentInfo,{infoList:v}))};module.exports=PointCloudSegmentStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,s
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,s)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s,__spreadValues=(e,n)=>{for(var s in n||(n={}))__hasOwnProp.call(n,s)&&__defNormalProp(e,s,n[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(n))__propIsEnum.call(n,s)&&__defNormalProp(e,s,n[s]);return e};const useHistory=()=>{const{history:e,setPointCloudResult:n,setSelectedIDs:s,pointCloudBoxList:L,pointCloudSphereList:y,setPointCloudSphereList:g,mainViewInstance:u,topViewInstance:d,polygonList:c,setPolygonList:f,lineList:p,setLineList:C,syncAllViewPointCloudColor:P,segmentation:a}=React.useContext(PointCloudContext.PointCloudContext),x=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:l})=>{const r={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:y};t&&(r.pointCloudBoxList=L.concat(t)),o&&(r.polygonList=c.concat(o)),i&&(r.lineList=p.concat(i)),l&&(r.pointCloudSphereList=y.concat(l)),e.pushHistory(r)},v=t=>{const o={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:y,segmentation:a};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),t.segmentation&&(o.segmentation=t.segmentation),e.pushHistory(o)},S=t=>{if(p.find(i=>i.id===t.id)){const i=p.map(l=>l.id===t.id?t:__spreadValues({},l));e.pushHistory({lineList:i}),C(i)}},_=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(l=>l.id===t.id?t:__spreadValues({},l));e.pushHistory({pointCloudBoxList:L,polygonList:i}),f(i)}},H=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i})=>{e.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i,lineList:p},!0)},h=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:l=[],pointCloudSphereList:r=[]}=t;o&&(L.length!==o.length&&s(),u==null||u.clearAllBox(),u==null||u.generateBoxes(o),n(o),P(o)),r&&(y.length!==r.length&&s(),u==null||u.clearAllSphere(),u==null||u.generateSpheres(r),g(r)),i&&f(i),l&&C(l),d==null||d.updatePolygonList(o!=null?o:[],i!=null?i:[]),d==null||d.updateLineList(l!=null?l:[]),d==null||d.updatePointList(r)};return{addHistory:x,pushHistoryWithList:v,initHistory:H,pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdateLine:S,redo:()=>{h(e.redo())},undo:()=>{h(e.undo())}}};exports.useHistory=useHistory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,i)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[o]=i,__spreadValues=(t,o)=>{for(var i in o||(o={}))__hasOwnProp.call(o,i)&&__defNormalProp(t,i,o[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(o))__propIsEnum.call(o,i)&&__defNormalProp(t,i,o[i]);return t},__spreadProps=(t,o)=>__defProps(t,__getOwnPropDescs(o)),__async=(t,o,i)=>new Promise((l,e)=>{var a=d=>{try{r(i.next(d))}catch(g){e(g)}},p=d=>{try{r(i.throw(d))}catch(g){e(g)}},r=d=>d.done?l(d.value):Promise.resolve(d.value).then(a,p);r((i=i.apply(t,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(t,o,i,l,e)=>{const{x:a,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:r}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:a,y:p,z:r},id:t.id},g=l?__spreadValues(__spreadValues({},l),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return e&&Object.assign(g,e),g},topViewPolygon2PointCloud=(t,o,i,l,e,a)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),r=0,d=1,g={};if(i){const y=i.getSensesPointZAxisInPolygon(p,void 0,a);a&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),r=(y.maxZ+y.minZ)/2,d=y.maxZ-y.minZ,g={count:y.zCount}}const[f,L,I]=p,U=lbAnnotation.MathUtils.getLineCenterPoint([f,I]),_=lbAnnotation.MathUtils.getLineLength(f,L),D=lbAnnotation.MathUtils.getLineLength(L,I),O=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);l&&(r=l.center.z,d=l.depth);const V={center:{x:U.x,y:U.y,z:r},width:D,height:_,depth:d,rotation:O,id:t.id},w=__spreadValues(l?__spreadValues(__spreadValues({},l),V):__spreadProps(__spreadValues({},V),{attribute:"",valid:!0}),g);e&&Object.assign(w,e);const k=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:w,newPointList:k}},sideViewPoint2PointCloud=(t,o,i)=>{const l={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-l.x,y:i.center.y,z:i.center.z-l.y}})},sideViewPolygon2PointCloud=(t,o,i,l)=>{const[e,a,p]=t.pointList,[r,d,g]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),L=lbAnnotation.MathUtils.getLineCenterPoint([r,g]),U={x:{x:f.x-L.x,y:f.y-L.y}.x,y:0,z:f.y-L.y},_=lbAnnotation.MathUtils.getLineLength(e,a),D=lbAnnotation.MathUtils.getLineLength(r,d),O=_-D,V=lbAnnotation.MathUtils.getLineLength(a,p),w=lbAnnotation.MathUtils.getLineLength(d,g),k=V-w,{newBoxParams:y}=l.getNewBoxBySideUpdate(U,k,O,i);return y},backViewPoint2PointCloud=(t,o,i)=>{const l={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-l.x,z:i.center.z-l.y}})},backViewPolygon2PointCloud=(t,o,i,l)=>{const[e,a,p]=t.pointList,[r,d,g]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),L=lbAnnotation.MathUtils.getLineCenterPoint([r,g]),U={x:{x:f.x-L.x,y:f.y-L.y}.x,y:0,z:f.y-L.y},_=lbAnnotation.MathUtils.getLineLength(e,a),D=lbAnnotation.MathUtils.getLineLength(r,d),O=_-D,V=lbAnnotation.MathUtils.getLineLength(a,p),w=lbAnnotation.MathUtils.getLineLength(d,g),k=V-w;let{newBoxParams:y}=l.getNewBoxByBackUpdate(U,k,O,i);return y},syncSideViewByPoint=(t,o,i,l,e)=>{var a;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(a=e==null?void 0:e.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);r.setInitCameraPosition(d);const{point2d:g,zoom:f}=r.getSphereSidePoint2DCoordinate(t);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=a.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxSidePolygon2DCoordinate(t);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),e.initPosition(),e.zoomChangeOnCenter(d),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,i,l,e)=>{var a;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(a=e==null?void 0:e.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);r.setInitCameraPosition(d);const{point2d:g,zoom:f}=r.getSphereBackPoint2DCoordinate(t);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=a.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxBackPolygon2DCoordinate(t);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),e.initPosition(),e.zoomChangeOnCenter(d),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,i,l)=>{if(!i||!l)return;l.generateSphere(t),l.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),l.render();const{toolInstance:e,pointCloudInstance:a}=i,{point2d:p}=a.getSphereTopPoint2DCoordinate(t),r=[...e.pointList].map(d=>d.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);e.setResult(r),e.setSelectedID(o.id)},synchronizeTopView=(t,o,i,l)=>{var e;if(!i||!l)return;l.generateBox(t,o.id),l.render();const{pointCloud2dOperation:a,pointCloudInstance:p}=i,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(t),d=[...a.polygonList],g=d.find(f=>f.id===o.id);g?g.pointList=r:d.push({id:o.id,pointList:r,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),a.setResultAndSelectedID(d,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:l,mainViewInstance:e,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:f,hideAttributes:L}=t,{addHistory:I,initHistory:U,pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdateLine:D}=useHistory.useHistory(),{selectedPolygon:O}=usePolygon.usePolygon(),{updateSelectedBox:V,updateSelectedBoxes:w,getPointCloudByID:k}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:y,updatePointCloudSphere:F,selectedSphere:M}=useSphere.useSphere(),{currentData:j,config:B}=ctx.useSelector(n=>{const{stepList:s,step:P,imgList:c,imgIndex:u}=n.annotation;return{currentData:c[u],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,s).config)}}),N=ctx.useDispatch(),{selectedBox:A}=useSingleBox.useSingleBox(),{t:Q}=reactI18next.useTranslation(),Z=A==null?void 0:A.info;if(!o||!i||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:q}=o,X=n=>{e==null||e.generateBox(n),e==null||e.controls.update(),e==null||e.render()},Y=n=>{e==null||e.generateSphere(n),e==null||e.controls.update(),e==null||e.render()},J=({newPoint:n,size:s,zoom:P,trackConfigurable:c})=>{var u;const C={attribute:(u=o.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:f})});const h=topViewPoint2PointCloud(n,s,q,void 0,C);r(n.id);const v=p(h);R(PointCloudView.Top,n,h,P,v,B),I({newSphereParams:h})},K=({polygon:n,size:s,imgList:P,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var h,v;const m={attribute:(h=o.toolInstance.defaultAttribute)!=null?h:""};c===!0&&Object.assign(m,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:f})});const T=o==null?void 0:o.toolInstance,S=__spreadValues({},n),{boxParams:x,newPointList:z}=topViewPolygon2PointCloud(S,s,q,void 0,m,C);if((B==null?void 0:B.lowerLimitPointsNumInBox)&&typeof x.count=="number"&&x.count<B.lowerLimitPointsNumInBox){antd.message.info(Q("LowerLimitPointsNumInBox",{num:B.lowerLimitPointsNumInBox})),T.deletePolygon(x.id);return}C&&(z==null?void 0:z.length)&&(S.pointList=z);const b=L.includes(S.attribute),H=a(x),lt=(v=t==null?void 0:t.polygonList)!=null?v:[];o==null||o.updatePolygonList(H!=null?H:[],lt),b?r([]):(r(x.id),T.selection.setSelectedIDs(S.id),E(PointCloudView.Top,S,x,u,H),C&&synchronizeTopView(x,S,o,e)),I({newBoxParams:x})},$=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:P,newSphereList:c})=>{var u;const C=o==null?void 0:o.toolInstance;if(!(d.length===0||!C)){if(n||(A==null?void 0:A.info)){const h=n!=null?n:A==null?void 0:A.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(d[0]);const v=C.selectedPolygon;if(d.length===1&&h){E(PointCloudView.Top,v,h,void 0,s);return}}if((P||M)&&d.length===1){const h=P!=null?P:M;C.setSelectedID(d[0]);const v=C.selectedPoint;h&&R(PointCloudView.Top,v,h,void 0,c,B)}}},W=(n,s,P)=>{if(Z){let c,u;switch(P){case PointCloudView.Back:c=backViewPolygon2PointCloud;break;case PointCloudView.Side:c=sideViewPolygon2PointCloud;break;default:c=sideViewPolygon2PointCloud;break}if(u=c(n,s,Z,i.pointCloudInstance),e){const{count:h}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=__spreadProps(__spreadValues({},u),{count:h})}const C=V(u);return E(P,n,u,void 0,C),C}},G=(n,s,P)=>{if(M){let c,u;switch(P){case PointCloudView.Back:c=backViewPoint2PointCloud;break;case PointCloudView.Side:c=sideViewPoint2PointCloud;break;default:c=sideViewPoint2PointCloud;break}u=c(n,s,M);const C=F(u);return R(P,n,u,void 0,C,B),C}},tt=(n,s)=>{G(n,s,PointCloudView.Side)},et=(n,s)=>{G(n,s,PointCloudView.Back)},ot=(n,s)=>{W(n,s,PointCloudView.Side)},it=(n,s)=>{W(n,s,PointCloudView.Back)},nt=(n,s)=>{D(n)},st=(n,s)=>{const P=y(n.id),c=topViewPoint2PointCloud(n,s,q,P),u=F(c);R(PointCloudView.Top,n,c,void 0,u,B)},rt=(n,s)=>{if(O){const c=n[0].newPolygon;c.pointList=c.pointList.map(u=>lbUtils.PointCloudUtils.transferCanvas2World(u,s)),_(n[0].newPolygon);return}const P=n.map(({newPolygon:c})=>{const u=k(c.id),{boxParams:C}=topViewPolygon2PointCloud(c,s,o.pointCloudInstance,u);return C});if(P.length===1){const{newPolygon:c}=n[0],u=w(P);E(PointCloudView.Top,c,P[0],void 0,u)}else{const c=w(P);c&&t.syncAllViewPointCloudColor(c)}},R=(n,s,P,c,u,C)=>__async(void 0,null,function*(){const h=j==null?void 0:j.url,v={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,s,i,h,C)},[PointCloudView.Back]:()=>{l&&syncBackViewByPoint(P,s,l,h,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,s,o,e)}};Object.keys(v).forEach(m=>{m!==n&&v[m]()}),c&&(e==null||e.updateCameraZoom(c)),Y(P)}),E=(n,s,P,c,u)=>__async(void 0,null,function*(){const C=j==null?void 0:j.url;u&&(yield t.syncAllViewPointCloudColor(u));const h={[PointCloudView.Side]:()=>{synchronizeSideView(P,s,i,C)},[PointCloudView.Back]:()=>{l&&synchronizeBackView(P,s,l,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,s,o,e)}};Object.keys(h).forEach(v=>{v!==n&&h[v]()}),c&&(e==null||e.updateCameraZoom(c)),X(P)});return{topViewAddSphere:J,topViewAddBox:K,topViewSelectedChanged:$,topViewUpdatePoint:st,sideViewUpdatePoint:tt,backViewUpdatePoint:et,topViewUpdateBox:rt,topViewUpdateLine:nt,sideViewUpdateBox:ot,backViewUpdateBox:it,pointCloudBoxListUpdated:n=>{o.updatePolygonList(n),e==null||e.generateBoxes(n)},initPointCloud3d:n=>{if(!e)return;const s={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};e.initOrthographicCamera(s),e.initRenderer(),e.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=j){var P,c,u,C,h,v;if(!(s==null?void 0:s.url)||!e)return;actionCreators.SetPointCloudLoading(N,!0),yield e.loadPCDFile(s.url,(P=B==null?void 0:B.radius)!=null?P:DEFAULT_RADIUS),g.forEach(b=>{e==null||e.removeObjectByName(b.id)}),f.forEach(b=>{e==null||e.removeObjectByName(b.id)});let m=[],T=[],S=[],x=[];s.result?(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),S=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),T=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),x=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),m.forEach(b=>{e==null||e.generateBox(b)}),x.forEach(b=>{e==null||e.generateSphere(b)}),t.syncAllViewPointCloudColor(m),t.setPointCloudResult(m),t.setPolygonList(S),t.setLineList(T),t.setPointCloudSphereList(x)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),U({pointCloudBoxList:m,polygonList:S,pointCloudSphereList:x}),e.updateTopCamera();const z=(u=(c=index.jsonParser(s.result))==null?void 0:c.valid)!=null?u:!0;t.setPointCloudValid(z),(C=t.sideViewInstance)==null||C.clearAllData(),(h=t.backViewInstance)==null||h.clearAllData(),o.updateData(s.url,s.result,{radius:(v=B==null?void 0:B.radius)!=null?v:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(N,!1)})}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,o,i)=>o in e?__defProp(e,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[o]=i,__spreadValues=(e,o)=>{for(var i in o||(o={}))__hasOwnProp.call(o,i)&&__defNormalProp(e,i,o[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(o))__propIsEnum.call(o,i)&&__defNormalProp(e,i,o[i]);return e},__spreadProps=(e,o)=>__defProps(e,__getOwnPropDescs(o)),__async=(e,o,i)=>new Promise((l,t)=>{var a=d=>{try{r(i.next(d))}catch(g){t(g)}},p=d=>{try{r(i.throw(d))}catch(g){t(g)}},r=d=>d.done?l(d.value):Promise.resolve(d.value).then(a,p);r((i=i.apply(e,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,o,i,l,t)=>{const{x:a,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(e,o),{defaultZ:r}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:a,y:p,z:r},id:e.id},g=l?__spreadValues(__spreadValues({},l),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},topViewPolygon2PointCloud=(e,o,i,l,t,a)=>{let p=e.pointList.map(v=>lbUtils.PointCloudUtils.transferCanvas2World(v,o)),r=0,d=1,g={};if(i){const v=i.getSensesPointZAxisInPolygon(p,void 0,a);a&&v.fittedCoordinates.length>0&&(p=v.fittedCoordinates),r=(v.maxZ+v.minZ)/2,d=v.maxZ-v.minZ,g={count:v.zCount}}const[f,x,V]=p,U=lbAnnotation.MathUtils.getLineCenterPoint([f,V]),I=lbAnnotation.MathUtils.getLineLength(f,x),_=lbAnnotation.MathUtils.getLineLength(x,V),D=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);l&&(r=l.center.z,d=l.depth);const b={center:{x:U.x,y:U.y,z:r},width:_,height:I,depth:d,rotation:D,id:e.id},S=__spreadValues(l?__spreadValues(__spreadValues({},l),b):__spreadProps(__spreadValues({},b),{attribute:"",valid:!0}),g);t&&Object.assign(S,t);const O=p.map(v=>lbUtils.PointCloudUtils.transferWorld2Canvas(v,o));return{boxParams:S,newPointList:O}},sideViewPoint2PointCloud=(e,o,i)=>{const l={x:e.x-o.x,y:e.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-l.x,y:i.center.y,z:i.center.z-l.y}})},sideViewPolygon2PointCloud=(e,o,i,l)=>{const[t,a,p]=e.pointList,[r,d,g]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([t,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([r,g]),U={x:{x:f.x-x.x,y:f.y-x.y}.x,y:0,z:f.y-x.y},I=lbAnnotation.MathUtils.getLineLength(t,a),_=lbAnnotation.MathUtils.getLineLength(r,d),D=I-_,b=lbAnnotation.MathUtils.getLineLength(a,p),S=lbAnnotation.MathUtils.getLineLength(d,g),O=b-S,{newBoxParams:v}=l.getNewBoxBySideUpdate(U,O,D,i);return v},backViewPoint2PointCloud=(e,o,i)=>{const l={x:e.x-o.x,y:e.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-l.x,z:i.center.z-l.y}})},backViewPolygon2PointCloud=(e,o,i,l)=>{const[t,a,p]=e.pointList,[r,d,g]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([t,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([r,g]),U={x:{x:f.x-x.x,y:f.y-x.y}.x,y:0,z:f.y-x.y},I=lbAnnotation.MathUtils.getLineLength(t,a),_=lbAnnotation.MathUtils.getLineLength(r,d),D=I-_,b=lbAnnotation.MathUtils.getLineLength(a,p),S=lbAnnotation.MathUtils.getLineLength(d,g),O=b-S;let{newBoxParams:v}=l.getNewBoxByBackUpdate(U,O,D,i);return v},syncSideViewByPoint=(e,o,i,l,t)=>{var a;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);r.setInitCameraPosition(d);const{point2d:g,zoom:f}=r.getSphereSidePoint2DCoordinate(e);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),g),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(e,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=a.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(d),t.setResultAndSelectedID([{id:o.id,valid:e.valid,pointList:r,textAttribute:"",isRect:!0,attribute:e.attribute}],o.id)},syncBackViewByPoint=(e,o,i,l,t)=>{var a;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);r.setInitCameraPosition(d);const{point2d:g,zoom:f}=r.getSphereBackPoint2DCoordinate(e);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),g),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(e,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=a.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(d),t.setResultAndSelectedID([{id:o.id,valid:e.valid,pointList:r,textAttribute:"",isRect:!0,attribute:e.attribute}],o.id)},syncTopViewByPoint=(e,o,i,l)=>{if(!i||!l)return;l.generateSphere(e),l.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),l.render();const{toolInstance:t,pointCloudInstance:a}=i,{point2d:p}=a.getSphereTopPoint2DCoordinate(e),r=[...t.pointList].map(d=>d.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:e.valid,textAttribute:"",attribute:e.attribute}):d);t.setResult(r),t.setSelectedID(o.id)},synchronizeTopView=(e,o,i,l)=>{var t;if(!i||!l)return;l.generateBox(e,o.id),l.render();const{pointCloud2dOperation:a,pointCloudInstance:p}=i,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(e),d=[...a.polygonList],g=d.find(f=>f.id===o.id);g?g.pointList=r:d.push({id:o.id,pointList:r,textAttribute:"",isRect:!0,valid:(t=e.valid)!=null?t:!0}),a.setResultAndSelectedID(d,o.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:l,mainViewInstance:t,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:f,hideAttributes:x}=e,{addHistory:V,initHistory:U,pushHistoryUnderUpdatePolygon:I,pushHistoryUnderUpdateLine:_}=useHistory.useHistory(),{selectedPolygon:D}=usePolygon.usePolygon(),{updateSelectedBox:b,updateSelectedBoxes:S,getPointCloudByID:O}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:v,updatePointCloudSphere:H,selectedSphere:T}=useSphere.useSphere(),{currentData:A,config:L}=ctx.useSelector(n=>{const{stepList:s,step:P,imgList:c,imgIndex:u}=n.annotation;return{currentData:c[u],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,s).config)}}),F=ctx.useDispatch(),{selectedBox:k}=useSingleBox.useSingleBox(),{t:G}=reactI18next.useTranslation(),N=k==null?void 0:k.info;if(!o||!i||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,Q=n=>{t==null||t.generateBox(n),t==null||t.controls.update(),t==null||t.render()},X=n=>{t==null||t.generateSphere(n),t==null||t.controls.update(),t==null||t.render()},Y=({newPoint:n,size:s,zoom:P,trackConfigurable:c})=>{var u;const C={attribute:(u=o.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:f})});const h=topViewPoint2PointCloud(n,s,E,void 0,C);r(n.id);const y=p(h);M(PointCloudView.Top,n,h,P,y,L),V({newSphereParams:h})},J=({polygon:n,size:s,imgList:P,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var h,y;const m={attribute:(h=o.toolInstance.defaultAttribute)!=null?h:""};c===!0&&Object.assign(m,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:f})});const z=o==null?void 0:o.toolInstance,w=__spreadValues({},n),{boxParams:B,newPointList:j}=topViewPolygon2PointCloud(w,s,E,void 0,m,C);if((L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(G("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),z.deletePolygon(B.id);return}C&&(j==null?void 0:j.length)&&(w.pointList=j);const rt=x.includes(w.attribute),q=a(B),lt=(y=e==null?void 0:e.polygonList)!=null?y:[];o==null||o.updatePolygonList(q!=null?q:[],lt),rt?r([]):(r(B.id),z.selection.setSelectedIDs(w.id),R(PointCloudView.Top,w,B,u,q),C&&synchronizeTopView(B,w,o,t)),V({newBoxParams:B})},K=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:P,newSphereList:c})=>{var u;const C=o==null?void 0:o.toolInstance;if(!(d.length===0||!C)){if(n||(k==null?void 0:k.info)){const h=n!=null?n:k==null?void 0:k.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(d[0]);const y=C.selectedPolygon;if(d.length===1&&h){R(PointCloudView.Top,y,h,void 0,s);return}}if((P||T)&&d.length===1){const h=P!=null?P:T;C.setSelectedID(d[0]);const y=C.selectedPoint;h&&M(PointCloudView.Top,y,h,void 0,c,L)}}},Z=(n,s,P)=>{if(N){let c,u;switch(P){case PointCloudView.Back:c=backViewPolygon2PointCloud;break;case PointCloudView.Side:c=sideViewPolygon2PointCloud;break;default:c=sideViewPolygon2PointCloud;break}if(u=c(n,s,N,i.pointCloudInstance),t){const{count:h}=t.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=__spreadProps(__spreadValues({},u),{count:h})}const C=b(u);return R(P,n,u,void 0,C),C}},W=(n,s,P)=>{if(T){let c,u;switch(P){case PointCloudView.Back:c=backViewPoint2PointCloud;break;case PointCloudView.Side:c=sideViewPoint2PointCloud;break;default:c=sideViewPoint2PointCloud;break}u=c(n,s,T);const C=H(u);return M(P,n,u,void 0,C,L),C}},$=(n,s)=>{W(n,s,PointCloudView.Side)},tt=(n,s)=>{W(n,s,PointCloudView.Back)},et=(n,s)=>{Z(n,s,PointCloudView.Side)},ot=(n,s)=>{Z(n,s,PointCloudView.Back)},it=(n,s)=>{_(n)},nt=(n,s)=>{const P=v(n.id),c=topViewPoint2PointCloud(n,s,E,P),u=H(c);M(PointCloudView.Top,n,c,void 0,u,L)},st=(n,s)=>{if(D){const c=n[0].newPolygon;c.pointList=c.pointList.map(u=>lbUtils.PointCloudUtils.transferCanvas2World(u,s)),I(n[0].newPolygon);return}const P=n.map(({newPolygon:c})=>{const u=O(c.id),{boxParams:C}=topViewPolygon2PointCloud(c,s,o.pointCloudInstance,u);return C});if(P.length===1){const{newPolygon:c}=n[0],u=S(P);R(PointCloudView.Top,c,P[0],void 0,u)}else{const c=S(P);c&&e.syncAllViewPointCloudColor(c)}},M=(n,s,P,c,u,C)=>__async(void 0,null,function*(){const h=A==null?void 0:A.url,y={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,s,i,h,C)},[PointCloudView.Back]:()=>{l&&syncBackViewByPoint(P,s,l,h,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,s,o,t)}};Object.keys(y).forEach(m=>{m!==n&&y[m]()}),c&&(t==null||t.updateCameraZoom(c)),X(P)}),R=(n,s,P,c,u)=>__async(void 0,null,function*(){const C=A==null?void 0:A.url;u&&(yield e.syncAllViewPointCloudColor(u));const h={[PointCloudView.Side]:()=>{synchronizeSideView(P,s,i,C)},[PointCloudView.Back]:()=>{l&&synchronizeBackView(P,s,l,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,s,o,t)}};Object.keys(h).forEach(y=>{y!==n&&h[y]()}),c&&(t==null||t.updateCameraZoom(c)),Q(P)});return{topViewAddSphere:Y,topViewAddBox:J,topViewSelectedChanged:K,topViewUpdatePoint:nt,sideViewUpdatePoint:$,backViewUpdatePoint:tt,topViewUpdateBox:st,topViewUpdateLine:it,sideViewUpdateBox:et,backViewUpdateBox:ot,pointCloudBoxListUpdated:n=>{o.updatePolygonList(n),t==null||t.generateBoxes(n)},initPointCloud3d:n=>{if(!t)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(n);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=A){var P,c,u,C,h,y;if(!(s==null?void 0:s.url)||!t)return;actionCreators.SetPointCloudLoading(F,!0),yield t.loadPCDFile(s.url,(P=L==null?void 0:L.radius)!=null?P:DEFAULT_RADIUS),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let m=[],z=[],w=[],B=[];s.result&&(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),w=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),z=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),B=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(m),t==null||t.generateSpheres(B),e.syncAllViewPointCloudColor(m)),U({pointCloudBoxList:m,polygonList:w,lineList:z,pointCloudSphereList:B}),t.updateTopCamera();const j=(u=(c=index.jsonParser(s.result))==null?void 0:c.valid)!=null?u:!0;e.setPointCloudValid(j),(C=e.sideViewInstance)==null||C.clearAllData(),(h=e.backViewInstance)==null||h.clearAllData(),o.updateData(s.url,s.result,{radius:(y=L==null?void 0:L.radius)!=null?y:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(F,!1)})}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,l,n)=>l in e?__defProp(e,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[l]=n,__spreadValues=(e,l)=>{for(var n in l||(l={}))__hasOwnProp.call(l,n)&&__defNormalProp(e,n,l[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(l))__propIsEnum.call(l,n)&&__defNormalProp(e,n,l[n]);return e},__spreadProps=(e,l)=>__defProps(e,__getOwnPropDescs(l));const{ESortDirection}=lbAnnotation.cAnnotation,useSingleBox=()=>{const{pointCloudBoxList:e,setPointCloudResult:l,topViewInstance:n,backViewInstance:P,sideViewInstance:y,selectedIDs:c,selectedID:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,l,n)=>l in e?__defProp(e,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[l]=n,__spreadValues=(e,l)=>{for(var n in l||(l={}))__hasOwnProp.call(l,n)&&__defNormalProp(e,n,l[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(l))__propIsEnum.call(l,n)&&__defNormalProp(e,n,l[n]);return e},__spreadProps=(e,l)=>__defProps(e,__getOwnPropDescs(l));const{ESortDirection}=lbAnnotation.cAnnotation,useSingleBox=()=>{const{pointCloudBoxList:e,setPointCloudResult:l,topViewInstance:n,backViewInstance:P,sideViewInstance:y,selectedIDs:c,selectedID:x,mainViewInstance:s,setSelectedIDs:I,syncAllViewPointCloudColor:C,polygonList:O,pointCloudPattern:v}=React.useContext(PointCloudContext.PointCloudContext),{selectedPolygon:a,updateSelectedPolygon:m,updatePolygonValidByID:h,deletePolygon:D}=usePolygon.usePolygon(),{pushHistoryWithList:g}=useHistory.useHistory(),d=React.useMemo(()=>{const o=e.findIndex(t=>t.id===x);if(o>-1)return{info:e[o],index:o}},[x,e]),B=React.useCallback(o=>{if(d==null?void 0:d.info){e.splice(d.index,1,___default.default.merge(d.info,o));const t=___default.default.cloneDeep(e);return l(t),g({pointCloudBoxList:t}),t}return e},[x,e]),V=React.useCallback((o,t)=>{const i=e.findIndex(r=>r.id===t);if(i>-1){e.splice(i,1,___default.default.merge(e[i],o));const r=___default.default.cloneDeep(e);return l(r),r}return e},[e]),f=React.useCallback(o=>{n==null||n.pointCloud2dOperation.setPolygonValidAndRender(o,!0),y==null||y.pointCloud2dOperation.setPolygonValidAndRender(o,!0),P==null||P.pointCloud2dOperation.setPolygonValidAndRender(o,!0)},[n,y,P]),L=React.useCallback(()=>{if(d==null?void 0:d.info){const{id:o,valid:t=!0}=d.info,i=B({valid:!t});C(i),f(o)}a&&(m(__spreadProps(__spreadValues({},a),{valid:!a.valid})),n==null||n.pointCloud2dOperation.setPolygonValidAndRender(a.id,!0))},[f,d,a]),S=React.useCallback(o=>{const t=e.find(i=>i.id===o);if(t){const{id:i,valid:r=!0}=t,u=V({valid:!r},i);return f(i),u}h(o)},[f,e,O]),b=React.useCallback((o=ESortDirection.ascend,t=!1)=>{if(!n||c.length>1)return;if(v!==lbAnnotation.EToolName.Rect&&v!==lbAnnotation.EToolName.Polygon){t&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:o!==ESortDirection.ascend}));return}const{pointCloud2dOperation:i}=n,r=i.switchToNextPolygon(o);r&&I(r)},[n,v,n==null?void 0:n.toolInstance]),j=(o=!1)=>{b(ESortDirection.descend,o)},k=(o=!1)=>{b(ESortDirection.ascend,o)},w=o=>{const t=e.filter(i=>i.id!==o);l(t),s==null||s.removeObjectByName(o,"box"),s==null||s.render(),C(t)},A=()=>{d&&(w(d.info.id),n==null||n.pointCloud2dOperation.deletePolygon(d.info.id)),a&&(D(a.id),n==null||n.pointCloud2dOperation.deletePolygon(a.id))},E=React.useMemo(()=>e.filter(o=>c.includes(o.id)),[c,e]),N=React.useCallback(o=>{const t=___default.default.cloneDeep(e);let i=!1;if(o.forEach(r=>{const u=t.findIndex(p=>p.id===r.id);if(u>-1){const p=___default.default.merge(t[u],r);t.splice(u,1,p),s==null||s.generateBox(p),i=!0}}),i)return l(t),g({pointCloudBoxList:t}),s==null||s.render(),t},[c,e]),R=React.useCallback(o=>e.find(t=>t.id===o),[e]);return{selectedBox:d,updateSelectedBox:B,changeSelectedBoxValid:L,changeValidByID:S,selectNextBox:k,selectPrevBox:j,deletePointCloudBox:w,selectedBoxes:E,updateSelectedBoxes:N,getPointCloudByID:R,deleteSelectedPointCloudBoxAndPolygon:A}};exports.useSingleBox=useSingleBox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),_=require("lodash"),useHistory=require("./useHistory.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_);const{ESortDirection}=lbAnnotation.cAnnotation,useSphere=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:l,selectedID:u,setSelectedIDs:a,mainViewInstance:s,topViewInstance:r}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:p}=useHistory.useHistory(),C=React.useMemo(()=>e.find(t=>t.id===u),[u,e]),f=React.useCallback(t=>e.find(n=>n.id===t),[e]),h=React.useCallback(t=>{const n=e.findIndex(o=>o.id===t.id);if(n>-1){e.splice(n,1,___default.default.merge(e[n],t));const o=___default.default.cloneDeep(e);return l(o),p({pointCloudSphereList:o}),o}return e},[e]),S=React.useCallback(t=>{const n=e.filter(o=>o.id!==t);l(n),s==null||s.removeObjectByName(t),s==null||s.render()},[e]),I=React.useCallback((t=ESortDirection.ascend)=>{if(!r)return;const n=r.toolInstance.pointList,o=r.toolInstance.selectedID,d=n.findIndex(i=>(i==null?void 0:i.id)===o);if(d>-1){let i=1;t===ESortDirection.descend&&(i=-1);const c=n.length,b=n[(d+i+c)%c];a(b.id)}},[r]);return{selectedSphere:C,getPointCloudSphereByID:f,updatePointCloudSphere:h,deletePointCloudSphere:S,switchToNextSphere:I}};exports.useSphere=useSphere;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),_=require("lodash"),useHistory=require("./useHistory.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_);const{ESortDirection}=lbAnnotation.cAnnotation,useSphere=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:l,selectedID:u,setSelectedIDs:a,mainViewInstance:s,topViewInstance:r}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:p}=useHistory.useHistory(),C=React.useMemo(()=>e.find(t=>t.id===u),[u,e]),f=React.useCallback(t=>e.find(n=>n.id===t),[e]),h=React.useCallback(t=>{const n=e.findIndex(o=>o.id===t.id);if(n>-1){e.splice(n,1,___default.default.merge(e[n],t));const o=___default.default.cloneDeep(e);return l(o),p({pointCloudSphereList:o}),o}return e},[e]),S=React.useCallback(t=>{const n=e.filter(o=>o.id!==t);l(n),s==null||s.removeObjectByName(t,"sphere"),s==null||s.render()},[e]),I=React.useCallback((t=ESortDirection.ascend)=>{if(!r)return;const n=r.toolInstance.pointList,o=r.toolInstance.selectedID,d=n.findIndex(i=>(i==null?void 0:i.id)===o);if(d>-1){let i=1;t===ESortDirection.descend&&(i=-1);const c=n.length,b=n[(d+i+c)%c];a(b.id)}},[r]);return{selectedSphere:C,getPointCloudSphereByID:f,updatePointCloudSphere:h,deletePointCloudSphere:S,switchToNextSphere:I}};exports.useSphere=useSphere;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),lbUtils=require("@labelbee/lb-utils");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),lbUtils=require("@labelbee/lb-utils");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:r,backViewInstance:u,mainViewInstance:o,setPointCloudResult:d,setPointCloudSphereList:P,setPolygonList:C,pointCloudPattern:a,setPointCloudPattern:e,syncAllViewPointCloudColor:v,globalPattern:n,setLineList:b}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:h}=useHistory.useHistory(),p=()=>{o==null||o.clearAllBox(),o==null||o.clearAllSphere(),o==null||o.render(),d([]),C([]),P([]),b([]),i==null||i.toolScheduler.clearStatusAndResult(),v([]),h({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},y=c=>{if(c===a)return;const s=[i,r,u];switch(c){case EToolName.Rect:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Rect)}),e(EToolName.Rect);break;case EToolName.Polygon:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Normal)}),e(EToolName.Polygon);break;case EToolName.Point:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.Point)}),e(EToolName.Point);break;case EToolName.Line:l(),s.forEach(t=>{t==null||t.switchToCanvas(EToolName.Line)}),e(EToolName.Line);break}},w=React.useMemo(()=>n===lbUtils.EPointCloudPattern.Detection,[n]),L=React.useMemo(()=>n===lbUtils.EPointCloudPattern.Segmentation,[n]);return{clearAllResult:p,updatePointCloudPattern:y,pointCloudPattern:a,isPointCloudDetectionPattern:w,isPointCloudSegmentationPattern:L}};exports.useStatus=useStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const PointCloudView=({currentData:t,imgList:d,drawLayerSlot:
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const PointCloudView=({currentData:t,imgList:d,drawLayerSlot:u,checkMode:l,intelligentFit:c,imgIndex:m})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:s,setGlobalPattern:C}=e,P=index.jsonParser(t.result),{toolInstanceRef:o,clearToolInstance:f}=annotation.useCustomToolInstance({basicInfo:P});return React.useEffect(()=>{o.current.setPointCloudGlobalPattern=n=>{n!==s&&(C(n),e.clearAllDetectionInstance(),f())}},[s]),React.useEffect(()=>{var n;if(t){const{boxParamsList:a,polygonList:i,lineList:r,sphereParamsList:v,segmentation:g}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((n=t==null?void 0:t.result)!=null?n:"");e.setPointCloudResult(a),e.setPolygonList(i),e.setLineList(r),e.setPointCloudSphereList(v),e.setSegmentation(g)}},[m]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var n,a,i,r;return{resultPolygon:(n=e.polygonList)!=null?n:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(i=e.pointCloudSphereList)!=null?i:[],segmentation:(r=e.segmentation)!=null?r:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),d.length===0?null:s===lbUtils.EPointCloudPattern.Segmentation?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:l,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement(PointCloudSegment,{checkMode:l}),React__default.default.createElement(PointCloudSegmentStatus,null),u==null?void 0:u({direct:!0})):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:l,toolInstanceRef:o}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud2DView,null),React__default.default.createElement(PointCloud3DView,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","right")},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:u,checkMode:l,intelligentFit:c}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","right-bottom")},React__default.default.createElement(PointCloudSideView,{checkMode:l}),React__default.default.createElement(PointCloudBackView,{checkMode:l})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var antd=require("antd"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),icon=require("../../../assets/predictTracking/icon.svg.js"),useSingleBox=require("../../pointCloudView/hooks/useSingleBox.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),util=require("../previewResult/util.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var antd=require("antd"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),icon=require("../../../assets/predictTracking/icon.svg.js"),useSingleBox=require("../../pointCloudView/hooks/useSingleBox.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),util=require("../previewResult/util.js"),useStatus=require("../../pointCloudView/hooks/useStatus.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,i,t)=>new Promise((c,s)=>{var o=r=>{try{a(t.next(r))}catch(n){s(n)}},l=r=>{try{a(t.throw(r))}catch(n){s(n)}},a=r=>r.done?c(r.value):Promise.resolve(r.value).then(o,l);a((t=t.apply(e,i)).next())});const PredictTrackingIcon=e=>{const i=ctx.useDispatch(),{t}=reactI18next.useTranslation(),{isPointCloudSegmentationPattern:c}=useStatus.useStatus(),{loading:s}=e,{selectedBox:o}=useSingleBox.useSingleBox(),l=()=>__async(void 0,null,function*(){if(s)return;const a=o==null?void 0:o.info.trackID;if(!a){antd.message.error(t("BeforePredictStarting"));return}yield i(actionCreators.ChangeSave);const r=o==null?void 0:o.info.id,n=yield i(actionCreators.GetBoxesByID(a,r));if(n.length<2){antd.message.error(t("MarkOnlyOne"));return}const f=n.findIndex(v=>v.id===r),u=n[f-1],d=n[f],g=d.index-u.index;if(g<2){antd.message.error(t("HaveNoNeed"));return}if(g>8){antd.message.error(t("ThePredictedPointCloud"));return}antd.message.success(t("PredictingDataFrom",{startPage:u.index+1,endPage:d.index+1,selectedBoxTrackID:a})),actionCreators.SetPointCloudLoading(i,!0);const x=util.predict(u,d);actionCreators.SetPredictResult(i,x),actionCreators.SetPredictResultVisible(i,!0)});return c?null:React__default.default.createElement(antd.Button,{type:"link",onClick:l,style:{display:"flex",flexDirection:"column",height:"auto",alignItems:"center"}},React__default.default.createElement("img",{src:icon,style:{alignSelf:"center"}}),React__default.default.createElement("span",{style:{color:"#797979"}},t("ComplementaryTracking")))},mapStateToProps=e=>({loading:e.annotation.loading});var PredictTrackingIcon$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PredictTrackingIcon);module.exports=PredictTrackingIcon$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var classNames=require("classnames"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),PointCloudContext=require("../../pointCloudView/PointCloudContext.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),dom=require("../../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),util=require("./util.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,a)=>new Promise((c,n)=>{var o=
|
|
1
|
+
"use strict";var classNames=require("classnames"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),PointCloudContext=require("../../pointCloudView/PointCloudContext.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),dom=require("../../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),util=require("./util.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,a)=>new Promise((c,n)=>{var o=i=>{try{l(a.next(i))}catch(s){n(s)}},r=i=>{try{l(a.throw(i))}catch(s){n(s)}},l=i=>i.done?c(i.value):Promise.resolve(i.value).then(o,r);l((a=a.apply(e,t)).next())});const PreviewResult=e=>{const{predictionResult:t,predictionResultVisible:a,imgList:c}=e,[n,o]=React.useState([]),r=ctx.useDispatch(),{t:l}=reactI18next.useTranslation(),i=()=>{actionCreators.SetPredictResultVisible(r,!1),actionCreators.SetPredictResult(r,[]),o([])},s=()=>__async(void 0,null,function*(){actionCreators.SetPointCloudLoading(r,!0),yield r(actionCreators.BatchUpdateImgListResultByPredictResult()),actionCreators.SetPointCloudLoading(r,!1),i()});return a?React__default.default.createElement(React__default.default.Fragment,null,n.length>0&&React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","bar")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","title")},React__default.default.createElement("div",null,l("ComplementaryTrackingPrediction"),n.length>0?`\uFF08${n.length}\uFF09`:""),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","option")},React__default.default.createElement("div",{className:classNames__default.default([dom.getClassName("point-cloud-predict-tracking-container","cancelOption"),dom.getClassName("point-cloud-predict-tracking-container","button")]),onClick:i},l("Cancel")),React__default.default.createElement("div",{className:classNames__default.default([dom.getClassName("point-cloud-predict-tracking-container","okOption"),dom.getClassName("point-cloud-predict-tracking-container","button")]),onClick:s},l("Apply")))),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","content")},React__default.default.createElement(Result,{list:n})))),t.length>0&&React__default.default.createElement(GenerateViewsDataUrl,{result:t,imgList:c,setList:o})):null},Result=e=>{const{list:t}=e,{t:a}=reactI18next.useTranslation(),c=[a("TopView"),a("SideView"),a("BackView")];return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","left")},c.map(n=>React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","title"),key:n},n))),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","right")},t.map(n=>React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","item"),key:n.id},util.views.map(o=>{const r=n[o];return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","view"),key:`${n.id}-${o}`},React__default.default.createElement("img",{src:r}))})))))},GenerateViewsDataUrl=e=>{const t=React__default.default.useContext(PointCloudContext.PointCloudContext),a=ctx.useDispatch(),{result:c,imgList:n,setList:o}=e,r=React.useRef(null),l={width:600,height:600};return React.useEffect(()=>{(()=>__async(void 0,null,function*(){var s,f,g,v,C,P;const p=(s=t.mainViewInstance)==null?void 0:s.config;if(p&&r.current){const y=lbUtils.PointCloudUtils.getDefaultOrthographicParams(l),u=new lbAnnotation.PointCloud({container:r.current,isOrthographicCamera:!0,orthographicParams:y,config:p});u.setShowDirection(!1);for(const d of c){const{index:m}=d,N=n[m].url?n[m].url:(C=(v=(g=(f=n[m])==null?void 0:f.webPointCloudFile)==null?void 0:g.lidar)==null?void 0:v.url)!=null?C:"";yield u.loadPCDFileByBox(N,d,{width:2,height:2,depth:2}),yield u.updateCameraZoom(t.zoom);const _=(P=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},p),{attributeConfigurable:!0}),{}))==null?void 0:P.fill;u.generateBox(d,_),yield util.sleep(500),yield util.getViewsDataUrl(u,d,t.zoom),yield u.removeObjectByName(d.id,"box"),yield u.clearPointCloudAndRender()}o(c),actionCreators.SetPointCloudLoading(a,!1)}}))()},[]),React__default.default.createElement("div",{style:l,ref:r,className:"generate-view"})},mapStateToProps=e=>({predictionResult:e.annotation.predictionResult,predictionResultVisible:e.annotation.predictionResultVisible,imgList:e.annotation.imgList});var PreviewResult$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PreviewResult);module.exports=PreviewResult$1;
|
package/dist/hooks/annotation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),ctx=require("../store/ctx.js"),Actions=require("../store/Actions.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),ctx=require("../store/ctx.js"),Actions=require("../store/Actions.js");const useCustomToolInstance=({basicInfo:o}={})=>{var s;const r=ctx.useDispatch(),n={valid:(s=o==null?void 0:o.valid)!=null?s:!0,exportData:()=>[[],{}],exportCustomData:()=>({}),clearResult:()=>{},singleOn:()=>{},on:()=>{},unbind:()=>{},setResult:()=>{},history:{initRecord:()=>{},pushHistory:()=>{}},setDefaultAttribute:t=>{},setForbidOperation:()=>{},setShowDefaultCursor:()=>{},setSubAttribute:(t,l)=>{},setValid:()=>{},updateRotate:()=>{},redo:()=>{},undo:()=>{},setPointCloudGlobalPattern:t=>{}},e=React.useRef(n),u=t=>{r({type:Actions.ANNOTATION_ACTIONS.SET_TOOL,payload:{instance:t}})},a=()=>{r({type:Actions.ANNOTATION_ACTIONS.SET_TOOL,payload:{instance:void 0}})},i=()=>{Object.assign(e.current,n)};return React.useEffect(()=>(u(e.current),()=>{a()}),[]),{toolInstanceRef:e,clearToolInstance:i}};exports.useCustomToolInstance=useCustomToolInstance;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoPlayer/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$2=require("./components/predictTracking/predictTrackingIcon/index.js"),index$3=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoPlayer/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$2=require("./components/predictTracking/predictTrackingIcon/index.js"),index$3=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,a]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:o=>{const n=~~o-1;store.dispatch(actionCreators.PageJump(n))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:o=>{var n;a(o),(n=e.onLoad)==null||n.call(e,{toolInstance:o})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$2,Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$3.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$3.ESubmitType}}),exports.componentCls=index$3.componentCls,exports.prefix=index$3.prefix,exports.default=index,exports.store=store;
|
package/dist/types/App.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ToolInstance } from './store/annotation/types';
|
|
3
3
|
import { GetFileData, IFileItem, LoadFileList, OnPageChange, OnSave, OnStepChange, OnSubmit } from './types/data';
|
|
4
|
-
import { Header, RenderFooter, Sider } from './types/main';
|
|
4
|
+
import { Header, RenderFooter, Sider, TDrawLayerSlot } from './types/main';
|
|
5
5
|
import { IStepInfo } from './types/step';
|
|
6
6
|
interface IAnnotationStyle {
|
|
7
7
|
strokeColor: string;
|
|
@@ -52,13 +52,7 @@ export interface AppProps {
|
|
|
52
52
|
leftSider?: () => React.ReactNode | React.ReactNode;
|
|
53
53
|
skipBeforePageTurning?: (pageTurning: Function) => void;
|
|
54
54
|
beforeRotate?: () => boolean;
|
|
55
|
-
drawLayerSlot?:
|
|
56
|
-
zoom: number;
|
|
57
|
-
currentPos: {
|
|
58
|
-
x: number;
|
|
59
|
-
y: number;
|
|
60
|
-
};
|
|
61
|
-
}) => React.ReactNode;
|
|
55
|
+
drawLayerSlot?: TDrawLayerSlot;
|
|
62
56
|
dataInjectionAtCreation: (annotationData: any) => {};
|
|
63
57
|
renderEnhance: {
|
|
64
58
|
staticRender?: (canvas: HTMLCanvasElement, data: any, style: IAnnotationStyle) => void;
|
|
@@ -70,6 +64,9 @@ export interface AppProps {
|
|
|
70
64
|
intelligentFit?: boolean;
|
|
71
65
|
enableColorPicker?: boolean;
|
|
72
66
|
highlightAttribute?: string;
|
|
67
|
+
onLoad?: ({ toolInstance }: {
|
|
68
|
+
toolInstance: ToolInstance;
|
|
69
|
+
}) => void;
|
|
73
70
|
}
|
|
74
71
|
declare const _default: import("react-redux").ConnectedComponent<React.FC<AppProps>, import("react-redux").Omit<AppProps & {
|
|
75
72
|
children?: React.ReactNode;
|
|
@@ -59,6 +59,7 @@ export interface IPointCloudContext extends IPointCloudContextInstances, IPointC
|
|
|
59
59
|
selectSpecAttr: (attr: string) => void;
|
|
60
60
|
segmentation: IPointCloudSegmentation[];
|
|
61
61
|
setSegmentation: (segmentation: IPointCloudSegmentation[]) => void;
|
|
62
|
+
clearAllDetectionInstance: () => void;
|
|
62
63
|
}
|
|
63
64
|
export declare const PointCloudContext: React.Context<IPointCloudContext>;
|
|
64
65
|
export declare const PointCloudProvider: React.FC<{}>;
|
|
@@ -16,6 +16,7 @@ export declare const useHistory: () => {
|
|
|
16
16
|
initHistory: ({ pointCloudBoxList, polygonList, pointCloudSphereList, }: {
|
|
17
17
|
pointCloudBoxList: IPointCloudBoxList;
|
|
18
18
|
polygonList: IPolygonData[];
|
|
19
|
+
lineList: ILine[];
|
|
19
20
|
pointCloudSphereList: IPointCloudSphereList;
|
|
20
21
|
}) => void;
|
|
21
22
|
pushHistoryUnderUpdatePolygon: (polygon: IPolygonData) => void;
|
|
@@ -8,5 +8,6 @@ export declare const useStatus: () => {
|
|
|
8
8
|
clearAllResult: () => void;
|
|
9
9
|
updatePointCloudPattern: (toolName: any) => void;
|
|
10
10
|
pointCloudPattern: cTool.EToolName.Rect | cTool.EToolName.Point | cTool.EToolName.Polygon | cTool.EToolName.Line;
|
|
11
|
-
|
|
11
|
+
isPointCloudDetectionPattern: boolean;
|
|
12
|
+
isPointCloudSegmentationPattern: boolean;
|
|
12
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const _default: import("react-redux").ConnectedComponent<(props: {
|
|
3
3
|
loading: boolean;
|
|
4
|
-
}) => React.JSX.Element, import("react-redux").Omit<{
|
|
4
|
+
}) => React.JSX.Element | null, import("react-redux").Omit<{
|
|
5
5
|
loading: boolean;
|
|
6
6
|
}, "loading">>;
|
|
7
7
|
export default _default;
|
|
@@ -22,7 +22,6 @@ export interface ICustomToolInstance {
|
|
|
22
22
|
undo: () => void;
|
|
23
23
|
redo: () => void;
|
|
24
24
|
setPointCloudGlobalPattern: (globalPattern: EPointCloudPattern) => void;
|
|
25
|
-
getPointCloudGlobalPattern: () => EPointCloudPattern;
|
|
26
25
|
[str: string]: any;
|
|
27
26
|
}
|
|
28
27
|
export interface ICustomToolInstanceProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),reactRedux=require("react-redux"),StepUtils=require("../../../../utils/StepUtils.js"),index=require("../../../../utils/index.js"),ActionsConfirm=require("./ActionsConfirm.js"),useOperationList=require("./useOperationList.js"),ctx=require("../../../../store/ctx.js"),unitAttribute=require("../../../../assets/annotation/pointCloudTool/unitAttribute.svg.js"),unitAttributeForbid=require("../../../../assets/annotation/pointCloudTool/unitAttributeForbid.svg.js"),unitAttributeHover=require("../../../../assets/annotation/pointCloudTool/unitAttributeHover.svg.js"),reactI18next=require("react-i18next"),index$1=require("../../../../components/pointCloudView/components/UnifyParamsModal/index.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reducer=require("../../../../store/annotation/reducer.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),reactRedux=require("react-redux"),StepUtils=require("../../../../utils/StepUtils.js"),index=require("../../../../utils/index.js"),ActionsConfirm=require("./ActionsConfirm.js"),useOperationList=require("./useOperationList.js"),ctx=require("../../../../store/ctx.js"),unitAttribute=require("../../../../assets/annotation/pointCloudTool/unitAttribute.svg.js"),unitAttributeForbid=require("../../../../assets/annotation/pointCloudTool/unitAttributeForbid.svg.js"),unitAttributeHover=require("../../../../assets/annotation/pointCloudTool/unitAttributeHover.svg.js"),reactI18next=require("react-i18next"),index$1=require("../../../../components/pointCloudView/components/UnifyParamsModal/index.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reducer=require("../../../../store/annotation/reducer.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const mapStateToProps=t=>{var e,o;const n=StepUtils.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(o=t.annotation)==null?void 0:o.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:n,imgList:t.annotation.imgList,imgIndex:t.annotation.imgIndex,stepList:t.annotation.stepList}},GeneralOperation=({toolInstance:t,stepInfo:e})=>{const o=useOperationList(t),n=index.jsonParser(e==null?void 0:e.config),i=[o.empty];return(e==null?void 0:e.dataSourceStep)===0&&i.push(o.setValidity),(n==null?void 0:n.copyBackwardResult)&&i.push(o.copyPrevious),React__default.default.createElement(ActionsConfirm,{allOperation:i})},PointCloudOperation=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(({toolInstance:t,stepInfo:e,imgList:o,stepList:n,imgIndex:i})=>{const{t:p}=reactI18next.useTranslation(),{selectedBox:a}=useSingleBox.useSingleBox(),u=useOperationList(t),[v,l]=React.useState(!1),[f,m]=React.useState([]),{isPointCloudDetectionPattern:g,isPointCloudSegmentationPattern:x}=useStatus.useStatus(),c=index.jsonParser(e.config);let r=[u.copyPrevious,u.empty,u.setValidity];if(g&&c.trackConfigurable===!0){const s=!a,y={name:p("UnifyParams"),key:"UnifyParams",imgSvg:s?unitAttributeForbid:unitAttribute,hoverSvg:unitAttributeHover,onClick:()=>{m(reducer.composeResultByToolInstance({toolInstance:t,imgList:o,imgIndex:i,stepList:n})),l(!0)},forbidConfirm:!0,forbidOperation:s};r.unshift(y)}const C=React.useCallback(()=>{l(!1)},[]),d=a==null?void 0:a.info;return x&&(r=r.filter(s=>!["setValidity","copyPrevious"].includes(s.key))),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ActionsConfirm,{allOperation:r}),React__default.default.createElement(index$1,{id:d==null?void 0:d.trackID,visible:v,onCancel:C,config:c,imgList:f}))});var GeneralOperation$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(GeneralOperation);exports.PointCloudOperation=PointCloudOperation,exports.default=GeneralOperation$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icons=require("@ant-design/icons"),ToolIcons=require("../ToolIcons.js"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),StepUtils=require("../../../../utils/StepUtils.js"),reactRedux=require("react-redux"),index=require("../../../../utils/index.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index$1=require("./components/batchUpdateModal/index.js"),lbUtils=require("@labelbee/lb-utils"),index$2=require("../../../../components/attributeList/index.js"),useAttribute=require("../../../../components/pointCloudView/hooks/useAttribute.js"),lassoSelector=require("../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js"),lassoSelector_a=require("../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js"),circleSelector=require("../../../../assets/annotation/pointCloudTool/circleSelector.svg.js"),circleSelector_a=require("../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js"),index$3=require("../index.js"),actionCreators=require("../../../../store/annotation/actionCreators.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,l)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l,__spreadValues=(t,e)=>{for(var l in e||(e={}))__hasOwnProp.call(e,l)&&__defNormalProp(t,l,e[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(e))__propIsEnum.call(e,l)&&__defNormalProp(t,l,e[l]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const AnnotatedBox=({imgList:t,imgIndex:e})=>{const l=React.useContext(PointCloudContext.PointCloudContext),[d,i]=React.useState([]),{t:r}=reactI18next.useTranslation();React.useEffect(()=>{const m=t;let a=new Map;i(lbUtils.PointCloudUtils.getAllPointCloudResult({imgList:m,extraBoxList:u,ignoreIndexList:[e]}).filter(n=>!n.trackID||a.get(n.trackID)?!1:(a.set(n.trackID,!0),!0)).sort((n,v)=>{var s,g;const c=(s=n==null?void 0:n.trackID)!=null?s:0,p=(g=v==null?void 0:v.trackID)!=null?g:0;return c-p}).map(n=>{var v;return(v=n==null?void 0:n.trackID)!=null?v:0}))},[l.pointCloudBoxList,t]);const{pointCloudBoxList:u}=l;return React__default.default.createElement("div",{style:{padding:24,borderBottom:"1px solid #eee"}},React__default.default.createElement("div",{style:{marginBottom:16}},r("AllTrackIDs")),React__default.default.createElement("div",null,d.map(m=>React__default.default.createElement(antd.Tag,{color:"#F3F4FF",key:m,style:{color:"#666",marginBottom:8}},m))))},BoxTrackIDInput=()=>{const[t,e]=React.useState(!1),l=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:d}=l,{selectedBox:i,updateSelectedBox:r}=useSingleBox.useSingleBox(),[u,m]=React.useState(""),{t:a}=reactI18next.useTranslation(),n=i==null?void 0:i.info.trackID,v=c=>!!d.find(S=>S.trackID===c&&S.id!==(i==null?void 0:i.info.id)),s=(c=!1)=>{const p=parseInt(u,10);if(c&&e(!1),isNaN(p)){antd.message.error(a("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){antd.message.error(a("NotAllowDecimalPointsInTrackID"));return}if(v(p)){antd.message.error(a("DuplicateTrackIDsExist"));return}if(!(p>0)){antd.message.error(a("PositiveIntegerCheck"));return}g(p)};React.useEffect(()=>{e(!1)},[n]);const g=c=>{var p;const S=r({trackID:c});(p=l==null?void 0:l.topViewInstance)==null||p.updatePolygonList(S!=null?S:[])};return React__default.default.createElement("div",{style:{padding:24}},React__default.default.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,a("CurrentBoxTrackIDs")),n&&React__default.default.createElement(index$1,{id:n,updateCurrentPolygonList:c=>g(c)})),React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},t&&n?React__default.default.createElement(antd.Input,{defaultValue:n,onChange:c=>{m(c.target.value)},disabled:!n,size:"small",onBlur:()=>{s()},onPressEnter:()=>{s(!0)}}):React__default.default.createElement("span",null,n),React__default.default.createElement(icons.EditFilled,{style:{color:"#999",marginLeft:16,cursor:typeof n!="undefined"?"pointer":"not-allowed"},onClick:()=>{n&&e(!t)}})))},AttributeUpdater=({attributeList:t,subAttributeList:e,toolInstance:l,config:d,stepList:i,stepInfo:r,enableColorPicker:u})=>{const{selectedBox:m}=useSingleBox.useSingleBox(),a=React.useContext(PointCloudContext.PointCloudContext),{t:n}=reactI18next.useTranslation(),{defaultAttribute:v}=useAttribute.useAttribute(),s=ctx.useDispatch(),g={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},c={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},p=(o,x)=>{var b,_,I,E,f;const y=(b=d==null?void 0:d.attributeList)==null?void 0:b.map(C=>C.value===o?__spreadProps(__spreadValues({},C),{color:x}):C),k=__spreadProps(__spreadValues({},d),{attributeList:y}),L=JSON.stringify(k),D=i==null?void 0:i.map(C=>(C==null?void 0:C.step)===(r==null?void 0:r.step)?__spreadProps(__spreadValues({},C),{config:L}):C);(_=a==null?void 0:a.topViewInstance)==null||_.updateAttributeList(y),(I=a==null?void 0:a.sideViewInstance)==null||I.updateAttributeList(y),(E=a==null?void 0:a.backViewInstance)==null||E.updateAttributeList(y),(f=a==null?void 0:a.mainViewInstance)==null||f.setConfig(k),s(actionCreators.SetTaskStepList({stepList:D}))},S=o=>{l.setDefaultAttribute(o)},P=(o,x)=>{l.setSubAttribute(o,x)},T=t.map(o=>({label:o.key,value:o.value,color:o==null?void 0:o.color}));return React__default.default.createElement("div",null,React__default.default.createElement("div",{style:g},n("Attribute")),React__default.default.createElement(index$2.default,{list:T,forbidDefault:!0,selectedAttribute:v!=null?v:"",attributeChanged:o=>S(o),updateColorConfig:p,enableColorPicker:u}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),m&&React__default.default.createElement(React__default.default.Fragment,null,e.map(o=>{var x,b,_,I,E;return(o==null?void 0:o.subSelected)&&React__default.default.createElement("div",{style:{marginTop:12},key:o.value},React__default.default.createElement("div",{style:c},n("SubAttribute"),"-",o.key),((x=o.subSelected)==null?void 0:x.length)<5?React__default.default.createElement(index$2.default,{list:o.subSelected.map(f=>({label:f.key,value:f.value})),selectedAttribute:(_=(b=a.selectedPointCloudBox)==null?void 0:b.subAttribute)==null?void 0:_[o.value],num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:f=>P(o.value,f),style:{marginBottom:12}}):React__default.default.createElement(antd.Select,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:(E=(I=a.selectedPointCloudBox)==null?void 0:I.subAttribute)==null?void 0:E[o.value],placeholder:n("PleaseSelect"),onChange:f=>P(o.value,f),allowClear:!0},o.subSelected.map(f=>React__default.default.createElement(antd.Select.Option,{key:f.value,value:f.value},f.key))),React__default.default.createElement(antd.Divider,{style:{margin:0}}))})))},renderSegmentTools=[{toolName:"LassoSelector",commonSvg:lassoSelector,selectedSvg:lassoSelector_a},{toolName:"CircleSelector",commonSvg:circleSelector,selectedSvg:circleSelector_a}],PointCloudSegToolIcon=({toolInstance:t})=>{const{ptSegmentInstance:e}=React.useContext(PointCloudContext.PointCloudContext),[l,d]=React.useState("CircleSelector"),{t:i}=reactI18next.useTranslation();return React.useEffect(()=>{if(!e)return;const r=()=>{d("LassoSelector")},u=()=>{d("CircleSelector")};return e.on("LassoSelector",r),e.on("CircleSelector",u),()=>{e.unbind("LassoSelector",r),e.unbind("CircleSelector",u)}},[e]),React__default.default.createElement("div",{className:`${index$3.sidebarCls}__level`},renderSegmentTools.map(r=>{const u=l===r.toolName;return React__default.default.createElement("span",{className:`${index$3.sidebarCls}__toolOption`,key:r.toolName,onClick:()=>e==null?void 0:e.emit(r.toolName)},React__default.default.createElement("img",{className:`${index$3.sidebarCls}__singleTool`,src:u?r==null?void 0:r.selectedSvg:r==null?void 0:r.commonSvg}),React__default.default.createElement("span",{className:index.classnames({[`${index$3.sidebarCls}__toolOption__selected`]:u})},i(r.toolName)))}))},PointCloudToolSidebar=({stepInfo:t,toolInstance:e,imgList:l,imgIndex:d,stepList:i,enableColorPicker:r})=>{var u,m;const{updatePointCloudPattern:a,pointCloudPattern:n,isSegmentPattern:v}=useStatus.useStatus(),s=index.jsonParser(t.config),g=(u=s==null?void 0:s.attributeList)!=null?u:[],c=(s==null?void 0:s.secondaryAttributeConfigurable)===!0?(m=s==null?void 0:s.inputList)!=null?m:[]:[];return v?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegToolIcon,{toolInstance:e}),React__default.default.createElement(AttributeUpdater,{toolInstance:e,attributeList:g,subAttributeList:c,config:s,stepList:i,stepInfo:t,enableColorPicker:r})):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ToolIcons.ToolIcons,{toolName:lbAnnotation.cTool.EPointCloudName.PointCloud,selectedToolName:n,onChange:p=>a==null?void 0:a(p)}),React__default.default.createElement(AttributeUpdater,{toolInstance:e,attributeList:g,subAttributeList:c,config:s,stepList:i,stepInfo:t,enableColorPicker:r}),(s==null?void 0:s.trackConfigurable)===!0&&React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(BoxTrackIDInput,null),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(AnnotatedBox,{imgList:l,imgIndex:d})))},mapStateToProps=t=>{var e,l,d,i;const r=StepUtils.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(l=t.annotation)==null?void 0:l.stepList),u=(d=t.annotation)==null?void 0:d.toolInstance,m=(i=t.annotation)==null?void 0:i.stepList;return{stepInfo:r,toolInstance:u,imgList:t.annotation.imgList,imgIndex:t.annotation.imgIndex,stepList:m}};var PointCloudToolSidebar$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudToolSidebar);exports.PointCloudSegToolIcon=PointCloudSegToolIcon,exports.default=PointCloudToolSidebar$1;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icons=require("@ant-design/icons"),ToolIcons=require("../ToolIcons.js"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),StepUtils=require("../../../../utils/StepUtils.js"),reactRedux=require("react-redux"),index=require("../../../../utils/index.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index$1=require("./components/batchUpdateModal/index.js"),lbUtils=require("@labelbee/lb-utils"),index$2=require("../../../../components/attributeList/index.js"),useAttribute=require("../../../../components/pointCloudView/hooks/useAttribute.js"),lassoSelector=require("../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js"),lassoSelector_a=require("../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js"),circleSelector=require("../../../../assets/annotation/pointCloudTool/circleSelector.svg.js"),circleSelector_a=require("../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js"),index$3=require("../index.js"),actionCreators=require("../../../../store/annotation/actionCreators.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,n)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,__spreadValues=(t,e)=>{for(var n in e||(e={}))__hasOwnProp.call(e,n)&&__defNormalProp(t,n,e[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(e))__propIsEnum.call(e,n)&&__defNormalProp(t,n,e[n]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const AnnotatedBox=({imgList:t,imgIndex:e})=>{const n=React.useContext(PointCloudContext.PointCloudContext),[d,i]=React.useState([]),{t:r}=reactI18next.useTranslation();React.useEffect(()=>{const m=t;let a=new Map;i(lbUtils.PointCloudUtils.getAllPointCloudResult({imgList:m,extraBoxList:u,ignoreIndexList:[e]}).filter(l=>!l.trackID||a.get(l.trackID)?!1:(a.set(l.trackID,!0),!0)).sort((l,v)=>{var s,g;const c=(s=l==null?void 0:l.trackID)!=null?s:0,p=(g=v==null?void 0:v.trackID)!=null?g:0;return c-p}).map(l=>{var v;return(v=l==null?void 0:l.trackID)!=null?v:0}))},[n.pointCloudBoxList,t]);const{pointCloudBoxList:u}=n;return React__default.default.createElement("div",{style:{padding:24,borderBottom:"1px solid #eee"}},React__default.default.createElement("div",{style:{marginBottom:16}},r("AllTrackIDs")),React__default.default.createElement("div",null,d.map(m=>React__default.default.createElement(antd.Tag,{color:"#F3F4FF",key:m,style:{color:"#666",marginBottom:8}},m))))},BoxTrackIDInput=()=>{const[t,e]=React.useState(!1),n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:d}=n,{selectedBox:i,updateSelectedBox:r}=useSingleBox.useSingleBox(),[u,m]=React.useState(""),{t:a}=reactI18next.useTranslation(),l=i==null?void 0:i.info.trackID,v=c=>!!d.find(S=>S.trackID===c&&S.id!==(i==null?void 0:i.info.id)),s=(c=!1)=>{const p=parseInt(u,10);if(c&&e(!1),isNaN(p)){antd.message.error(a("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){antd.message.error(a("NotAllowDecimalPointsInTrackID"));return}if(v(p)){antd.message.error(a("DuplicateTrackIDsExist"));return}if(!(p>0)){antd.message.error(a("PositiveIntegerCheck"));return}g(p)};React.useEffect(()=>{e(!1)},[l]);const g=c=>{var p;const S=r({trackID:c});(p=n==null?void 0:n.topViewInstance)==null||p.updatePolygonList(S!=null?S:[])};return React__default.default.createElement("div",{style:{padding:24}},React__default.default.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,a("CurrentBoxTrackIDs")),l&&React__default.default.createElement(index$1,{id:l,updateCurrentPolygonList:c=>g(c)})),React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},t&&l?React__default.default.createElement(antd.Input,{defaultValue:l,onChange:c=>{m(c.target.value)},disabled:!l,size:"small",onBlur:()=>{s()},onPressEnter:()=>{s(!0)}}):React__default.default.createElement("span",null,l),React__default.default.createElement(icons.EditFilled,{style:{color:"#999",marginLeft:16,cursor:typeof l!="undefined"?"pointer":"not-allowed"},onClick:()=>{l&&e(!t)}})))},AttributeUpdater=({attributeList:t,subAttributeList:e,toolInstance:n,config:d,stepList:i,stepInfo:r,enableColorPicker:u})=>{const{selectedBox:m}=useSingleBox.useSingleBox(),a=React.useContext(PointCloudContext.PointCloudContext),{t:l}=reactI18next.useTranslation(),{defaultAttribute:v}=useAttribute.useAttribute(),s=ctx.useDispatch(),g={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},c={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},p=(o,x)=>{var b,_,I,E,f;const y=(b=d==null?void 0:d.attributeList)==null?void 0:b.map(C=>C.value===o?__spreadProps(__spreadValues({},C),{color:x}):C),k=__spreadProps(__spreadValues({},d),{attributeList:y}),T=JSON.stringify(k),D=i==null?void 0:i.map(C=>(C==null?void 0:C.step)===(r==null?void 0:r.step)?__spreadProps(__spreadValues({},C),{config:T}):C);(_=a==null?void 0:a.topViewInstance)==null||_.updateAttributeList(y),(I=a==null?void 0:a.sideViewInstance)==null||I.updateAttributeList(y),(E=a==null?void 0:a.backViewInstance)==null||E.updateAttributeList(y),(f=a==null?void 0:a.mainViewInstance)==null||f.setConfig(k),s(actionCreators.SetTaskStepList({stepList:D}))},S=o=>{n.setDefaultAttribute(o)},P=(o,x)=>{n.setSubAttribute(o,x)},L=t.map(o=>({label:o.key,value:o.value,color:o==null?void 0:o.color}));return React__default.default.createElement("div",null,React__default.default.createElement("div",{style:g},l("Attribute")),React__default.default.createElement(index$2.default,{list:L,forbidDefault:!0,selectedAttribute:v!=null?v:"",attributeChanged:o=>S(o),updateColorConfig:p,enableColorPicker:u}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),m&&React__default.default.createElement(React__default.default.Fragment,null,e.map(o=>{var x,b,_,I,E;return(o==null?void 0:o.subSelected)&&React__default.default.createElement("div",{style:{marginTop:12},key:o.value},React__default.default.createElement("div",{style:c},l("SubAttribute"),"-",o.key),((x=o.subSelected)==null?void 0:x.length)<5?React__default.default.createElement(index$2.default,{list:o.subSelected.map(f=>({label:f.key,value:f.value})),selectedAttribute:(_=(b=a.selectedPointCloudBox)==null?void 0:b.subAttribute)==null?void 0:_[o.value],num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:f=>P(o.value,f),style:{marginBottom:12}}):React__default.default.createElement(antd.Select,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:(E=(I=a.selectedPointCloudBox)==null?void 0:I.subAttribute)==null?void 0:E[o.value],placeholder:l("PleaseSelect"),onChange:f=>P(o.value,f),allowClear:!0},o.subSelected.map(f=>React__default.default.createElement(antd.Select.Option,{key:f.value,value:f.value},f.key))),React__default.default.createElement(antd.Divider,{style:{margin:0}}))})))},renderSegmentTools=[{toolName:"LassoSelector",commonSvg:lassoSelector,selectedSvg:lassoSelector_a},{toolName:"CircleSelector",commonSvg:circleSelector,selectedSvg:circleSelector_a}],PointCloudSegToolIcon=({toolInstance:t})=>{const{ptSegmentInstance:e}=React.useContext(PointCloudContext.PointCloudContext),[n,d]=React.useState("LassoSelector"),{t:i}=reactI18next.useTranslation();return React.useEffect(()=>{if(!e)return;const r=()=>{d("LassoSelector")},u=()=>{d("CircleSelector")};return e.on("LassoSelector",r),e.on("CircleSelector",u),()=>{e.unbind("LassoSelector",r),e.unbind("CircleSelector",u)}},[e]),React__default.default.createElement("div",{className:`${index$3.sidebarCls}__level`},renderSegmentTools.map(r=>{const u=n===r.toolName;return React__default.default.createElement("span",{className:`${index$3.sidebarCls}__toolOption`,key:r.toolName,onClick:()=>e==null?void 0:e.emit(r.toolName)},React__default.default.createElement("img",{className:`${index$3.sidebarCls}__singleTool`,src:u?r==null?void 0:r.selectedSvg:r==null?void 0:r.commonSvg}),React__default.default.createElement("span",{className:index.classnames({[`${index$3.sidebarCls}__toolOption__selected`]:u})},i(r.toolName)))}))},PointCloudToolSidebar=({stepInfo:t,toolInstance:e,imgList:n,imgIndex:d,stepList:i,enableColorPicker:r})=>{var u,m;const{updatePointCloudPattern:a,pointCloudPattern:l,isPointCloudSegmentationPattern:v}=useStatus.useStatus(),s=index.jsonParser(t.config),g=(u=s==null?void 0:s.attributeList)!=null?u:[],c=(s==null?void 0:s.secondaryAttributeConfigurable)===!0?(m=s==null?void 0:s.inputList)!=null?m:[]:[];return v?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegToolIcon,{toolInstance:e}),React__default.default.createElement(AttributeUpdater,{toolInstance:e,attributeList:g,subAttributeList:c,config:s,stepList:i,stepInfo:t,enableColorPicker:r})):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ToolIcons.ToolIcons,{toolName:lbAnnotation.cTool.EPointCloudName.PointCloud,selectedToolName:l,onChange:p=>a==null?void 0:a(p)}),React__default.default.createElement(AttributeUpdater,{toolInstance:e,attributeList:g,subAttributeList:c,config:s,stepList:i,stepInfo:t,enableColorPicker:r}),(s==null?void 0:s.trackConfigurable)===!0&&React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(BoxTrackIDInput,null),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(AnnotatedBox,{imgList:n,imgIndex:d})))},mapStateToProps=t=>{var e,n,d,i;const r=StepUtils.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(n=t.annotation)==null?void 0:n.stepList),u=(d=t.annotation)==null?void 0:d.toolInstance,m=(i=t.annotation)==null?void 0:i.stepList;return{stepInfo:r,toolInstance:u,imgList:t.annotation.imgList,imgIndex:t.annotation.imgIndex,stepList:m}};var PointCloudToolSidebar$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudToolSidebar);exports.PointCloudSegToolIcon=PointCloudSegToolIcon,exports.default=PointCloudToolSidebar$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),reactRedux=require("react-redux"),es=require("antd/es"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const PageNumber=e=>{var n,r;const{toolInstance:t}=e,[
|
|
1
|
+
"use strict";var React=require("react"),reactRedux=require("react-redux"),es=require("antd/es"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const PageNumber=e=>{var n,r;const{toolInstance:t}=e,[d,o]=React.useState(0),{pointCloudBoxList:l,segmentation:u,globalPattern:i}=React.useContext(PointCloudContext.PointCloudContext),{t:c}=reactI18next.useTranslation();if(React.useEffect(()=>{t&&t.singleOn("updatePageNumber",()=>{o(s=>s+1)})},[t]),!t)return null;const a=((r=(n=t==null?void 0:t.currentPageResult)==null?void 0:n.length)!=null?r:i===lbUtils.EPointCloudPattern.Detection)?l.length:u.length;return a>=0?React__default.default.createElement("span",null,`${c("ItemsOfThisPage")}: ${a}`,React__default.default.createElement(es.Divider,{type:"vertical",style:{background:"rgba(153, 153, 153, 1)",height:"16px"}})):null},mapStateToProps=e=>{var n;return{toolInstance:(n=e.annotation)==null?void 0:n.toolInstance}};var PageNumber$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PageNumber);module.exports=PageNumber$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),antd=require("antd"),reactRedux=require("react-redux"),ctx=require("../../../../store/ctx.js"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const SwitchPattern=({toolName:t})=>{const{t:e}=reactI18next.useTranslation(),{globalPattern:n,setGlobalPattern:o,setTopViewInstance:r,setSideViewInstance:i,setBackViewInstance:l,setMainViewInstance:u}=React.useContext(PointCloudContext.PointCloudContext);if(t!==lbAnnotation.EPointCloudName.PointCloud)return null;const
|
|
1
|
+
"use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),antd=require("antd"),reactRedux=require("react-redux"),ctx=require("../../../../store/ctx.js"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const SwitchPattern=({toolName:t})=>{const{t:e}=reactI18next.useTranslation(),{globalPattern:n,setGlobalPattern:o,setTopViewInstance:r,setSideViewInstance:i,setBackViewInstance:l,setMainViewInstance:c,ptSegmentInstance:a,setSelectedIDs:u}=React.useContext(PointCloudContext.PointCloudContext);if(t!==lbAnnotation.EPointCloudName.PointCloud)return null;const s=()=>{u([]),r(void 0),i(void 0),l(void 0),c(void 0)},d=()=>{a==null||a.emit("clearStash")},p=()=>{d(),o(lbUtils.EPointCloudPattern.Detection)},v=()=>{s(),o(lbUtils.EPointCloudPattern.Segmentation)};return React__default.default.createElement("span",{style:{margin:"0 10px"}},React__default.default.createElement(antd.Button,{type:n===lbUtils.EPointCloudPattern.Detection?"primary":void 0,onClick:p},e("DetectionMode")),React__default.default.createElement(antd.Button,{type:n===lbUtils.EPointCloudPattern.Segmentation?"primary":void 0,onClick:v},e("SegmentationMode")))},mapStateToProps=t=>{var e,n;return{toolName:(n=(e=t.annotation.stepList[t.annotation.step-1])==null?void 0:e.tool)!=null?n:""}};var SwitchPattern$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(SwitchPattern);module.exports=SwitchPattern$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloud as
|
|
1
|
+
import{PointCloud as P}from"@labelbee/lb-annotation";import{PointCloudUtils as i}from"@labelbee/lb-utils";import p,{useRef as m,useCallback as g,useEffect as l}from"react";const h=f=>{const{src:c,result:o,size:n,isOrthographicCamera:s=!1,backgroundColor:b="#ccc"}=f;let u=m();const e=m(),v=g(r=>{u.current=r},[]);return l(()=>{let r={container:u.current,backgroundColor:b,isOrthographicCamera:s};s&&Object.assign(r,{orthographicParams:i.getDefaultOrthographicParams(n)});const a=new P(r);return e.current=a,()=>{var t;(t=e.current.renderer)==null||t.forceContextLoss()}},[]),l(()=>{var r,a,t;e.current&&((r=e.current)==null||r.init(),(a=e.current)==null||a.initOrthographicCamera(i.getDefaultOrthographicParams(n)),(t=e.current)==null||t.render())},[n]),l(()=>{var r;e.current&&c&&((r=e.current)==null||r.loadPCDFile(c))},[c]),l(()=>(o&&i.getBoxParamsFromResultList(o).forEach(a=>{var t;(t=e.current)==null||t.generateBox(a,a.id)}),()=>{var r;i.getBoxParamsFromResultList(o).forEach(t=>{var d;(d=e.current)==null||d.removeObjectByName(t.id,"box")}),(r=e.current)==null||r.render()}),[o]),p.createElement("div",{style:n,ref:v})};export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as
|
|
1
|
+
import{getClassName as c}from"../../utils/dom.js";import{PointCloud as z}from"@labelbee/lb-annotation";import{PointCloudUtils as I,toolStyleConverter as N,EPerspectiveView as C}from"@labelbee/lb-utils";import L from"classnames";import n,{useContext as h,useState as k,useRef as R,useEffect as w,useMemo as F}from"react";import{PointCloudContainer as A}from"./PointCloudLayout.js";import{PointCloudContext as M}from"./PointCloudContext.js";import{a2MapStateToProps as U}from"../../store/annotation/map.js";import{connect as Z}from"react-redux";import{jsonParser as q}from"../../utils/index.js";import{useSingleBox as G}from"./hooks/useSingleBox.js";import{useSphere as H}from"./hooks/useSphere.js";import{Switch as J,Tooltip as K}from"antd";import Q from"../../hooks/useSize.js";import{usePointCloudViews as W}from"./hooks/usePointCloudViews.js";import{useTranslation as S}from"react-i18next";import{LabelBeeContext as X}from"../../store/ctx.js";import Y from"./components/PointCloudSizeSlider/index.js";var $=Object.defineProperty,ee=Object.defineProperties,te=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,T=(o,i,e)=>i in o?$(o,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[i]=e,j=(o,i)=>{for(var e in i||(i={}))oe.call(i,e)&&T(o,e,i[e]);if(b)for(var e of b(i))ne.call(i,e)&&T(o,e,i[e]);return o},ie=(o,i)=>ee(o,te(i));const re="LABELBEE-POINTCLOUD",E=n.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),m=({perspectiveView:o})=>{const{isActive:i,setTarget3DView:e}=h(E),f=V=>L({[c("point-cloud-3d-view",V)]:!0,active:i});return n.createElement("span",{onClick:()=>{e(C[o])},className:f(o.toLocaleLowerCase())})},ae=()=>{const{reset3DView:o,followTopView:i}=h(E),{t:e}=S();return n.createElement("div",{className:c("point-cloud-3d-sidebar")},n.createElement(m,{perspectiveView:"Top"}),n.createElement(m,{perspectiveView:"Front"}),n.createElement(m,{perspectiveView:"Left"}),n.createElement(m,{perspectiveView:"Back"}),n.createElement(m,{perspectiveView:"Right"}),n.createElement(m,{perspectiveView:"LFT"}),n.createElement(m,{perspectiveView:"RBT"}),n.createElement(K,{title:e("CameraFollowTopView")},n.createElement("span",{onClick:()=>{i()},className:c("point-cloud-3d-view","followTop")})),n.createElement("span",{onClick:()=>{o()},className:c("point-cloud-3d-view","reset")}))},le=({currentData:o,config:i})=>{const e=h(M),[f,V]=k(!0),p=R(null),{initPointCloud3d:g}=W(),d=Q(p),{t:x}=S();w(()=>{!e.mainViewInstance||g==null||g(d)},[d]);const{selectedBox:u}=G(),{selectedSphere:v}=H(),P=t=>{var r,a;const l=u==null?void 0:u.info;if(l){const s=j({},l.center);s.x=s.x-.01,s.z=10;const _=t===C.Top;(r=e.mainViewInstance)==null||r.updateCameraByBox(l,t,_?s:void 0)}v&&((a=e.mainViewInstance)==null||a.updateCameraBySphere(v,t))},O=()=>{var t;(t=e.mainViewInstance)==null||t.resetCamera()},B=()=>{var t,r;const a=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance.camera;a&&((r=e.mainViewInstance)==null||r.applyCameraTarget(a))};w(()=>{if(p.current&&(o==null?void 0:o.url)){let t=e.mainViewInstance;!t&&d.width&&(t=new z({container:p.current,isOrthographicCamera:!0,orthographicParams:I.getDefaultOrthographicParams(d),config:i}),e.setMainViewInstance(t))}},[d]),w(()=>{var t;if(p.current&&(o==null?void 0:o.url)&&o.result&&e.mainViewInstance){let r=e.mainViewInstance;const a=I.getBoxParamsFromResultList(o.result);a.forEach(l=>{var s;const _=(s=N.getColorFromConfig({attribute:l.attribute},ie(j({},i),{attributeConfigurable:!0}),{}))==null?void 0:s.hex;r==null||r.generateBox(l,_)}),e.setPointCloudResult(a),e.setPointCloudValid((t=q(o.result))==null?void 0:t.valid)}},[o,e.mainViewInstance]),w(()=>{var t,r,a,l;if(u){P(C.Top);const s=(a=(r=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:r.camera.zoom)!=null?a:1;(l=e.mainViewInstance)==null||l.updateCameraZoom(s)}},[u]),w(()=>{var t,r,a,l;if(v){P(C.Top);const s=(a=(r=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:r.camera.zoom)!=null?a:1;(l=e.mainViewInstance)==null||l.updateCameraZoom(s)}},[v]);const D=F(()=>({reset3DView:O,setTarget3DView:P,isActive:!!u,followTopView:B}),[u,e.mainViewInstance]),y=n.createElement(n.Fragment,null,n.createElement(Y,{onChange:t=>{var r;(r=e.mainViewInstance)==null||r.updatePointSize({customSize:t})}}),n.createElement("span",{style:{marginRight:8}},x("ShowArrows")),n.createElement(J,{size:"small",checked:f,onChange:t=>{var r;V(t),(r=e.mainViewInstance)==null||r.setShowDirection(t)}}));return n.createElement(A,{className:c("point-cloud-3d-container"),title:x("3DView"),toolbar:y},n.createElement("div",{className:c("point-cloud-3d-content")},n.createElement(E.Provider,{value:D},n.createElement(ae,null)),n.createElement("div",{className:c("point-cloud-3d-view"),id:re,ref:p})))};var se=Z(U,null,null,{context:X})(le);export{se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EPointCloudPattern as
|
|
1
|
+
import{EPointCloudPattern as w}from"@labelbee/lb-utils";import K,{useState as n,useRef as vt,useMemo as Q,useEffect as bt}from"react";import{ActionsHistory as U,EToolName as V}from"@labelbee/lb-annotation";import{useDispatch as mt}from"../../store/ctx.js";import{ChangeSave as Lt}from"../../store/annotation/actionCreators.js";const W=K.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new U,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:V.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:w.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{}}),St=({children:X})=>{const[a,D]=n([]),[v,x]=n([]),[L,Y]=n([]),[S,$]=n([]),[r,A]=n([]),[B,tt]=n(!0),[R,et]=n(1),[o,H]=n(),[E,G]=n(),[F,k]=n(),[i,M]=n(),[T,nt]=n(""),[g,ot]=n(V.Rect),it=vt(new U).current,[s,I]=n([]),[_,st]=n(""),[h,lt]=n(w.Detection),[P,j]=n(void 0),[y,rt]=n([]),at=mt(),z=Q(()=>r.length===1?r[0]:"",[r]),O=Q(()=>{const d=a.find(t=>t.id===z),f=t=>{const e=a.concat(t);return D(e),e},c=t=>{const e=v.concat(t);return x(e),e},u=t=>{tt(t!==!1)},l=t=>{t===void 0&&A([]),typeof t=="string"&&A([t]),Array.isArray(t)&&A(Array.from(new Set(t)))},ct=t=>{r.includes(t)?l(r.filter(e=>e!==t)):l([...r,t])},ut=()=>{if(g===V.Rect){const t=a.map(e=>e.id);l(t),o==null||o.pointCloud2dOperation.setSelectedIDs(t)}},pt=t=>{l(a.filter(e=>e.attribute===t).map(e=>e.id))},Z=a.filter(t=>!s.includes(t.attribute)),N=v.filter(t=>!s.includes(t.attribute)),q=S.filter(t=>t.attribute&&!s.includes(t.attribute)),Pt=t=>{if(s.includes(t))I(s.filter(e=>e!==t));else{const e=s.concat(t);I(e)}},ft=(t=Z,e=L,b=N,p=q,m=y)=>{var C;i==null||i.clearAllBox(),i==null||i.clearAllSphere(),o==null||o.updatePolygonList(t,e),o==null||o.updatePointList(b),o==null||o.updateLineList(p),i==null||i.generateBoxes(t),i==null||i.generateSpheres(b),(C=P==null?void 0:P.store)==null||C.updateCurrentSegment(m),J(t)},Ct=()=>{H(void 0),G(void 0),k(void 0),M(void 0)},J=t=>{const e=i==null?void 0:i.highlightOriginPointCloud(t);return new Promise(b=>{e==null||e.then(p=>{[o].forEach(m=>{var C;p&&((C=m==null?void 0:m.pointCloudInstance)==null||C.updateColor(p),b({color:p}))})}).catch(p=>{console.error(p)})})};return{selectedID:z,pointCloudBoxList:a,pointCloudSphereList:v,displayPointCloudList:Z,displaySphereList:N,displayLineList:q,selectedIDs:r,setPointCloudResult:D,setSelectedIDs:l,addPointCloudBox:f,addPointCloudSphere:c,setPointCloudSphereList:x,valid:B,selectedPointCloudBox:d,setPointCloudValid:u,addSelectedID:ct,selectedAllBoxes:ut,topViewInstance:o,setTopViewInstance:H,sideViewInstance:E,setSideViewInstance:G,backViewInstance:F,setBackViewInstance:k,mainViewInstance:i,setMainViewInstance:M,polygonList:L,setPolygonList:Y,lineList:S,setLineList:$,zoom:R,setZoom:et,history:it,toggleAttributesVisible:Pt,hideAttributes:s,setHideAttributes:I,reRender:ft,attrPanelLayout:_,setAttrPanelLayout:st,syncAllViewPointCloudColor:J,defaultAttribute:T,setDefaultAttribute:nt,pointCloudPattern:g,setPointCloudPattern:ot,selectSpecAttr:pt,globalPattern:h,setGlobalPattern:t=>{h!==t&&(at(Lt),lt(t),t===w.Detection&&j(void 0))},ptSegmentInstance:P,setPtSegmentInstance:j,segmentation:y,setSegmentation:rt,clearAllDetectionInstance:Ct}},[B,r,a,v,L,S,o,E,F,i,R,s,_,T,g,h,P,y]),dt=()=>{const d=a.filter(l=>s.includes(l.attribute)),{setSelectedIDs:f,reRender:c}=O,u=d.map(l=>l.id);u.length>0&&f(r.filter(l=>!u.includes(l))),c()};return bt(()=>{var d,f,c,u;dt(),(f=(d=o==null?void 0:o.toolInstance)==null?void 0:d.setHiddenAttributes)==null||f.call(d,s),(u=(c=P==null?void 0:P.store)==null?void 0:c.setHiddenAttributes)==null||u.call(c,s)},[s]),K.createElement(W.Provider,{value:O},X)};export{W as PointCloudContext,St as PointCloudProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import f from"../../hooks/useSize.js";import{a2MapStateToProps as
|
|
1
|
+
import f from"../../hooks/useSize.js";import{a2MapStateToProps as C}from"../../store/annotation/map.js";import{LabelBeeContext as b}from"../../store/ctx.js";import{getClassName as g}from"../../utils/dom.js";import{PointCloud as h}from"@labelbee/lb-annotation";import P,{useRef as v,useContext as S,useEffect as u}from"react";import{connect as x}from"react-redux";import{PointCloudContext as j}from"./PointCloudContext.js";import{PointCloudUtils as m}from"@labelbee/lb-utils";const D=({currentData:R,config:r,checkMode:c})=>{var n,a;const o=v(null),{setPtSegmentInstance:d,setDefaultAttribute:p,ptSegmentInstance:e}=S(j),t=f(o),i=(a=(n=r==null?void 0:r.attributeList)==null?void 0:n[0])==null?void 0:a.value;return u(()=>{var l;if(!(t==null?void 0:t.width)||!o.current||e)return;const s=new h({container:o.current,isOrthographicCamera:!0,isSegment:!0,orthographicParams:m.getDefaultOrthographicParams(t),config:r,checkMode:c});(l=s.store)==null||l.setAttribute(i),p(i),d(s)},[t]),u(()=>{e&&(e.initRenderer(),e.initOrthographicCamera(m.getDefaultOrthographicParams(t)),e.render())},[t]),P.createElement("div",{className:g("point-cloud-layout"),ref:o})};var O=x(C,null,null,{context:b})(D);export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as C,useEffect as a}from"react";import{a2MapStateToProps as f}from"../../store/annotation/map.js";import{connect as L}from"react-redux";import{LabelBeeContext as k}from"../../store/ctx.js";import{PointCloudContext as
|
|
1
|
+
import{useContext as C,useEffect as a}from"react";import{a2MapStateToProps as f}from"../../store/annotation/map.js";import{connect as L}from"react-redux";import{LabelBeeContext as k}from"../../store/ctx.js";import{PointCloudContext as y}from"./PointCloudContext.js";import{CommonToolUtils as w}from"@labelbee/lb-annotation";import{PointCloudUtils as x,EPointCloudSegmentMode as c}from"@labelbee/lb-utils";import{useAttribute as h}from"./hooks/useAttribute.js";const P=({checkMode:v,currentData:r,imgIndex:S,highlightAttribute:s,config:p,toolInstanceRef:u})=>{const{updateSegmentAttribute:b}=h(),n=C(y),{ptSegmentInstance:e,setSegmentation:m}=n;a(()=>{var t;if(e&&r.url)return e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=r==null?void 0:r.url)!=null?t:"").then(()=>{var o,l;const i=x.getSegmentFromResultList((o=r==null?void 0:r.result)!=null?o:"");(l=e==null?void 0:e.store)==null||l.updateCurrentSegment(i)}),e.on("syncSegmentData",m),()=>{e.unbind("syncSegmentData",m)}},[S,e]),a(()=>{var t,o;let l=(t=p.attributeList.find(i=>(i==null?void 0:i.key)===s))==null?void 0:t.value;(o=e==null?void 0:e.store)==null||o.highlightPointsByAttribute(l!=null?l:"")},[s,e]);const g=(t,o)=>{var l,i;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",c.Add);break;case"i":e==null||e.emit("setSegmentMode",c.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(i=(l=e.store)==null?void 0:l.cacheSegData)==null?void 0:i.id);break}},d=t=>{if(!w.hotkeyFilter(t)||v===!0)return;const o=t.key.toLocaleLowerCase();g(o)};return a(()=>(window.addEventListener("keydown",d),u.current.setDefaultAttribute=t=>{b(t)},()=>{window.removeEventListener("keydown",d)}),[e]),a(()=>{u.current.clearResult=()=>{!n.ptSegmentInstance||n.ptSegmentInstance.emit("clearAllSegmentData")}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var A=L(f,null,null,{context:k})(P);export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as
|
|
1
|
+
import e,{useContext as F,useState as y,useEffect as N}from"react";import{getClassName as o}from"../../utils/dom.js";import P from"../../assets/annotation/pointCloudTool/finish.svg.js";import _ from"../../assets/annotation/pointCloudTool/cancel.svg.js";import{PointCloudContext as M}from"./PointCloudContext.js";import{EPointCloudSegmentStatus as u,EPointCloudSegmentFocusMode as i}from"@labelbee/lb-utils";import{useTranslation as v}from"react-i18next";const x=({infoList:a})=>{const{t:l}=v();return a?e.createElement("div",{className:o("point-cloud-status","info")},a.map(s=>e.createElement("div",{key:s.key},e.createElement("span",null,l(s.key),"\uFF1A "),e.createElement("span",null,s.value)))):null},j=()=>{var a,l,s,g,f;const{t:c}=v(),{ptSegmentInstance:t,setDefaultAttribute:S}=F(M),[m,E]=y({segmentStatus:u.Ready});N(()=>{if(t){const n=p=>{E(p),p.cacheSegData&&S(p.cacheSegData.attribute)};return t==null||t.on("syncPointCloudStatus",n),()=>{t==null||t.unbind("syncPointCloudStatus",n)}}},[t]);const r=m.segmentStatus;if(r===u.Ready)return null;const C=r===u.Check,b=r===u.Edit;let d=null;const h=((s=(l=(a=m.cacheSegData)==null?void 0:a.points)==null?void 0:l.length)!=null?s:0)/3;let k=[{key:"SelectedPoints",value:h},{key:"Attribute",value:(f=(g=m.cacheSegData)==null?void 0:g.attribute)!=null?f:""}];return C&&(d=e.createElement("div",{className:o("point-cloud-status","operation")},e.createElement("span",{className:o("point-cloud-status","button"),onClick:()=>{t==null||t.emit("updateCheck2Edit")}},c("EnterEditMode"),"(Enter)"))),b&&(d=e.createElement("div",{className:o("point-cloud-status","operation")},e.createElement("span",{className:o("point-cloud-status","button"),onClick:()=>{var n;t==null||t.emit("addStash2Store"),((n=t==null?void 0:t.store)==null?void 0:n.segmentFocusMode)===i.Focus&&(t==null||t.emit("setSegmentFocusMode",i.Unfocus))}},e.createElement("img",{className:o("point-cloud-status","icon"),src:P}),c("Finish")),e.createElement("span",{className:o("point-cloud-status","button"),onClick:()=>{var n;t==null||t.emit("clearStash"),((n=t==null?void 0:t.store)==null?void 0:n.segmentFocusMode)===i.Focus&&(t==null||t.emit("setSegmentFocusMode",i.Unfocus))}},e.createElement("img",{className:o("point-cloud-status","icon"),src:_}),c("Cancel")))),e.createElement(e.Fragment,null,d,e.createElement(x,{infoList:k}))};export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as
|
|
1
|
+
import{useContext as m}from"react";import{PointCloudContext as I}from"../PointCloudContext.js";var R=Object.defineProperty,g=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,P=(e,n,s)=>n in e?R(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s,a=(e,n)=>{for(var s in n||(n={}))U.call(n,s)&&P(e,s,n[s]);if(g)for(var s of g(n))V.call(n,s)&&P(e,s,n[s]);return e};const j=()=>{const{history:e,setPointCloudResult:n,setSelectedIDs:s,pointCloudBoxList:L,pointCloudSphereList:f,setPointCloudSphereList:x,mainViewInstance:d,topViewInstance:u,polygonList:c,setPolygonList:y,lineList:p,setLineList:h,syncAllViewPointCloudColor:S,segmentation:v}=m(I),_=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:l})=>{const r={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:f};t&&(r.pointCloudBoxList=L.concat(t)),o&&(r.polygonList=c.concat(o)),i&&(r.lineList=p.concat(i)),l&&(r.pointCloudSphereList=f.concat(l)),e.pushHistory(r)},w=t=>{const o={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:f,segmentation:v};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),t.segmentation&&(o.segmentation=t.segmentation),e.pushHistory(o)},B=t=>{if(p.find(i=>i.id===t.id)){const i=p.map(l=>l.id===t.id?t:a({},l));e.pushHistory({lineList:i}),h(i)}},H=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(l=>l.id===t.id?t:a({},l));e.pushHistory({pointCloudBoxList:L,polygonList:i}),y(i)}},O=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i})=>{e.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i,lineList:p},!0)},C=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:l=[],pointCloudSphereList:r=[]}=t;o&&(L.length!==o.length&&s(),d==null||d.clearAllBox(),d==null||d.generateBoxes(o),n(o),S(o)),r&&(f.length!==r.length&&s(),d==null||d.clearAllSphere(),d==null||d.generateSpheres(r),x(r)),i&&y(i),l&&h(l),u==null||u.updatePolygonList(o!=null?o:[],i!=null?i:[]),u==null||u.updateLineList(l!=null?l:[]),u==null||u.updatePointList(r)};return{addHistory:_,pushHistoryWithList:w,initHistory:O,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:B,redo:()=>{C(e.redo())},undo:()=>{C(e.undo())}}};export{j as useHistory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MathUtils as x,getCuboidFromPointCloudBox as Ut}from"@labelbee/lb-annotation";import{EPerspectiveView as Z,PointCloudUtils as D,DEFAULT_SPHERE_PARAMS as kt}from"@labelbee/lb-utils";import{useContext as At}from"react";import{PointCloudContext as jt}from"../PointCloudContext.js";import{useSingleBox as rt}from"./useSingleBox.js";import{useSphere as Tt}from"./useSphere.js";import{useSelector as zt,useDispatch as Rt}from"../../../store/ctx.js";import Et from"../../../utils/StepUtils.js";import{jsonParser as lt}from"../../../utils/index.js";import{SetPointCloudLoading as dt}from"../../../store/annotation/actionCreators.js";import{message as Ht}from"antd";import{useTranslation as Ft}from"react-i18next";import{useHistory as Nt}from"./useHistory.js";import{usePolygon as Zt}from"./usePolygon.js";var Wt=Object.defineProperty,Mt=Object.defineProperties,Gt=Object.getOwnPropertyDescriptors,at=Object.getOwnPropertySymbols,Qt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,ct=(t,e,n)=>e in t?Wt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||(e={}))Qt.call(e,n)&&ct(t,n,e[n]);if(at)for(var n of at(e))Xt.call(e,n)&&ct(t,n,e[n]);return t},k=(t,e)=>Mt(t,Gt(e)),J=(t,e,n)=>new Promise((l,o)=>{var a=d=>{try{r(n.next(d))}catch(g){o(g)}},p=d=>{try{r(n.throw(d))}catch(g){o(g)}},r=d=>d.done?l(d.value):Promise.resolve(d.value).then(a,p);r((n=n.apply(t,e)).next())});const Q=5,X=90,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},K=(t,e,n,l,o)=>{const{x:a,y:p}=D.transferCanvas2World(t,e),{defaultZ:r}=kt,d={center:{x:a,y:p,z:r},id:t.id},g=l?y(y({},l),d):k(y({},d),{attribute:"",valid:!0});return o&&Object.assign(g,o),g},$=(t,e,n,l,o,a)=>{let p=t.pointList.map(m=>D.transferCanvas2World(m,e)),r=0,d=1,g={};if(n){const m=n.getSensesPointZAxisInPolygon(p,void 0,a);a&&m.fittedCoordinates.length>0&&(p=m.fittedCoordinates),r=(m.maxZ+m.minZ)/2,d=m.maxZ-m.minZ,g={count:m.zCount}}const[h,S,A]=p,V=x.getLineCenterPoint([h,A]),j=x.getLineLength(h,S),T=x.getLineLength(S,A),z=x.getRadiusFromQuadrangle(t.pointList);l&&(r=l.center.z,d=l.depth);const U={center:{x:V.x,y:V.y,z:r},width:T,height:j,depth:d,rotation:z,id:t.id},_=y(l?y(y({},l),U):k(y({},U),{attribute:"",valid:!0}),g);o&&Object.assign(_,o);const R=p.map(m=>D.transferWorld2Canvas(m,e));return{boxParams:_,newPointList:R}},ut=(t,e,n)=>{const l={x:t.x-e.x,y:t.y-e.y};return k(y({},n),{center:{x:n.center.x-l.x,y:n.center.y,z:n.center.z-l.y}})},pt=(t,e,n,l)=>{const[o,a,p]=t.pointList,[r,d,g]=e.pointList,h=x.getLineCenterPoint([o,p]),S=x.getLineCenterPoint([r,g]),V={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},j=x.getLineLength(o,a),T=x.getLineLength(r,d),z=j-T,U=x.getLineLength(a,p),_=x.getLineLength(d,g),R=U-_,{newBoxParams:m}=l.getNewBoxBySideUpdate(V,R,z,n);return m},Yt=(t,e,n)=>{const l={x:t.x-e.x,y:t.y-e.y};return k(y({},n),{center:{x:n.center.x,y:n.center.y-l.x,z:n.center.z-l.y}})},qt=(t,e,n,l)=>{const[o,a,p]=t.pointList,[r,d,g]=e.pointList,h=x.getLineCenterPoint([o,p]),S=x.getLineCenterPoint([r,g]),V={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},j=x.getLineLength(o,a),T=x.getLineLength(r,d),z=j-T,U=x.getLineLength(a,p),_=x.getLineLength(d,g),R=U-_;let{newBoxParams:m}=l.getNewBoxByBackUpdate(V,R,z,n);return m},ft=(t,e,n,l,o)=>{var a;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(l,(a=o==null?void 0:o.radius)!=null?a:X);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,Z.Left);r.setInitCameraPosition(d);const{point2d:g,zoom:h}=r.getSphereSidePoint2DCoordinate(t);r.camera.zoom=h,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(h),p.setResult([k(y(y({},e),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},Ct=(t,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=n;a.loadPCDFileByBox(l,t,{width:Q,depth:Q});const{cameraPositionVector:p}=a.updateOrthoCamera(t,Z.Left);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxSidePolygon2DCoordinate(t);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},gt=(t,e,n,l,o)=>{var a;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(l,(a=o==null?void 0:o.radius)!=null?a:X);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,Z.Back);r.setInitCameraPosition(d);const{point2d:g,zoom:h}=r.getSphereBackPoint2DCoordinate(t);r.camera.zoom=h,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(h),p.setResult([k(y(y({},e),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},Pt=(t,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=n;a.loadPCDFileByBox(l,t,{height:Q,depth:Q});const{cameraPositionVector:p}=a.updateOrthoCamera(t,Z.Back);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxBackPolygon2DCoordinate(t);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},ht=(t,e,n,l)=>{if(!n||!l)return;l.generateSphere(t),l.updateCameraBySphere(t,Z.Top),l.render();const{toolInstance:o,pointCloudInstance:a}=n,{point2d:p}=a.getSphereTopPoint2DCoordinate(t),r=[...o.pointList].map(d=>d.id===e.id?k(y(y({},e),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);o.setResult(r),o.setSelectedID(e.id)},tt=(t,e,n,l)=>{var o;if(!n||!l)return;l.generateBox(t,e.id),l.render();const{pointCloud2dOperation:a,pointCloudInstance:p}=n,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(t),d=[...a.polygonList],g=d.find(h=>h.id===e.id);g?g.pointList=r:d.push({id:e.id,pointList:r,textAttribute:"",isRect:!0,valid:(o=t.valid)!=null?o:!0}),a.setResultAndSelectedID(d,e.id)},Jt=()=>{const t=At(jt),{topViewInstance:e,sideViewInstance:n,backViewInstance:l,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:h,hideAttributes:S}=t,{addHistory:A,initHistory:V,pushHistoryUnderUpdatePolygon:j,pushHistoryUnderUpdateLine:T}=Nt(),{selectedPolygon:z}=Zt(),{updateSelectedBox:U,updateSelectedBoxes:_,getPointCloudByID:R}=rt(),{getPointCloudSphereByID:m,updatePointCloudSphere:ot,selectedSphere:W}=Tt(),{currentData:H,config:b}=zt(i=>{const{stepList:s,step:f,imgList:c,imgIndex:u}=i.annotation;return{currentData:c[u],config:lt(Et.getCurrentStepInfo(f,s).config)}}),et=Rt(),{selectedBox:E}=rt(),{t:Lt}=Ft(),nt=E==null?void 0:E.info;if(!e||!n||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:Y}=e,yt=i=>{o==null||o.generateBox(i),o==null||o.controls.update(),o==null||o.render()},mt=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},vt=({newPoint:i,size:s,zoom:f,trackConfigurable:c})=>{var u;const C={attribute:(u=e.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:D.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const P=K(i,s,Y,void 0,C);r(i.id);const v=p(P);M(L.Top,i,P,f,v,b),A({newSphereParams:P})},xt=({polygon:i,size:s,imgList:f,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var P,v;const w={attribute:(P=e.toolInstance.defaultAttribute)!=null?P:""};c===!0&&Object.assign(w,{trackID:D.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:h})});const F=e==null?void 0:e.toolInstance,I=y({},i),{boxParams:B,newPointList:N}=$(I,s,Y,void 0,w,C);if((b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<b.lowerLimitPointsNumInBox){Ht.info(Lt("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),F.deletePolygon(B.id);return}C&&(N==null?void 0:N.length)&&(I.pointList=N);const O=S.includes(I.attribute),q=a(B),Vt=(v=t==null?void 0:t.polygonList)!=null?v:[];e==null||e.updatePolygonList(q!=null?q:[],Vt),O?r([]):(r(B.id),F.selection.setSelectedIDs(I.id),G(L.Top,I,B,u,q),C&&tt(B,I,e,o)),A({newBoxParams:B})},Bt=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:f,newSphereList:c})=>{var u;const C=e==null?void 0:e.toolInstance;if(!(d.length===0||!C)){if(i||(E==null?void 0:E.info)){const P=i!=null?i:E==null?void 0:E.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(d[0]);const v=C.selectedPolygon;if(d.length===1&&P){G(L.Top,v,P,void 0,s);return}}if((f||W)&&d.length===1){const P=f!=null?f:W;C.setSelectedID(d[0]);const v=C.selectedPoint;P&&M(L.Top,v,P,void 0,c,b)}}},it=(i,s,f)=>{if(nt){let c,u;switch(f){case L.Back:c=qt;break;case L.Side:c=pt;break;default:c=pt;break}if(u=c(i,s,nt,n.pointCloudInstance),o){const{count:P}=o.getSensesPointZAxisInPolygon(Ut(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=k(y({},u),{count:P})}const C=U(u);return G(f,i,u,void 0,C),C}},st=(i,s,f)=>{if(W){let c,u;switch(f){case L.Back:c=Yt;break;case L.Side:c=ut;break;default:c=ut;break}u=c(i,s,W);const C=ot(u);return M(f,i,u,void 0,C,b),C}},St=(i,s)=>{st(i,s,L.Side)},bt=(i,s)=>{st(i,s,L.Back)},wt=(i,s)=>{it(i,s,L.Side)},It=(i,s)=>{it(i,s,L.Back)},Dt=(i,s)=>{T(i)},_t=(i,s)=>{const f=m(i.id),c=K(i,s,Y,f),u=ot(c);M(L.Top,i,c,void 0,u,b)},Ot=(i,s)=>{if(z){const c=i[0].newPolygon;c.pointList=c.pointList.map(u=>D.transferCanvas2World(u,s)),j(i[0].newPolygon);return}const f=i.map(({newPolygon:c})=>{const u=R(c.id),{boxParams:C}=$(c,s,e.pointCloudInstance,u);return C});if(f.length===1){const{newPolygon:c}=i[0],u=_(f);G(L.Top,c,f[0],void 0,u)}else{const c=_(f);c&&t.syncAllViewPointCloudColor(c)}},M=(i,s,f,c,u,C)=>J(void 0,null,function*(){const P=H==null?void 0:H.url,v={[L.Side]:()=>{ft(f,s,n,P,C)},[L.Back]:()=>{l&>(f,s,l,P,C)},[L.Top]:()=>{ht(f,s,e,o)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),c&&(o==null||o.updateCameraZoom(c)),mt(f)}),G=(i,s,f,c,u)=>J(void 0,null,function*(){const C=H==null?void 0:H.url;u&&(yield t.syncAllViewPointCloudColor(u));const P={[L.Side]:()=>{Ct(f,s,n,C)},[L.Back]:()=>{l&&Pt(f,s,l,C)},[L.Top]:()=>{tt(f,s,e,o)}};Object.keys(P).forEach(v=>{v!==i&&P[v]()}),c&&(o==null||o.updateCameraZoom(c)),yt(f)});return{topViewAddSphere:vt,topViewAddBox:xt,topViewSelectedChanged:Bt,topViewUpdatePoint:_t,sideViewUpdatePoint:St,backViewUpdatePoint:bt,topViewUpdateBox:Ot,topViewUpdateLine:Dt,sideViewUpdateBox:wt,backViewUpdateBox:It,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const s={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>J(void 0,[...i],function*(s=H){var f,c,u,C,P,v;if(!(s==null?void 0:s.url)||!o)return;dt(et,!0),yield o.loadPCDFile(s.url,(f=b==null?void 0:b.radius)!=null?f:X),g.forEach(O=>{o==null||o.removeObjectByName(O.id)}),h.forEach(O=>{o==null||o.removeObjectByName(O.id)});let w=[],F=[],I=[],B=[];s.result?(w=D.getBoxParamsFromResultList(s.result),I=D.getPolygonListFromResultList(s.result),F=D.getLineListFromResultList(s.result),B=D.getSphereParamsFromResultList(s.result),w.forEach(O=>{o==null||o.generateBox(O)}),B.forEach(O=>{o==null||o.generateSphere(O)}),t.syncAllViewPointCloudColor(w),t.setPointCloudResult(w),t.setPolygonList(I),t.setLineList(F),t.setPointCloudSphereList(B)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),V({pointCloudBoxList:w,polygonList:I,pointCloudSphereList:B}),o.updateTopCamera();const N=(u=(c=lt(s.result))==null?void 0:c.valid)!=null?u:!0;t.setPointCloudValid(N),(C=t.sideViewInstance)==null||C.clearAllData(),(P=t.backViewInstance)==null||P.clearAllData(),e.updateData(s.url,s.result,{radius:(v=b==null?void 0:b.radius)!=null?v:X}),dt(et,!1)})}};export{gt as syncBackViewByPoint,ft as syncSideViewByPoint,ht as syncTopViewByPoint,Pt as synchronizeBackView,Ct as synchronizeSideView,tt as synchronizeTopView,K as topViewPoint2PointCloud,$ as topViewPolygon2PointCloud,Jt as usePointCloudViews};
|
|
1
|
+
import{MathUtils as x,getCuboidFromPointCloudBox as At}from"@labelbee/lb-annotation";import{EPerspectiveView as N,PointCloudUtils as w,DEFAULT_SPHERE_PARAMS as Ut}from"@labelbee/lb-utils";import{useContext as kt}from"react";import{PointCloudContext as zt}from"../PointCloudContext.js";import{useSingleBox as st}from"./useSingleBox.js";import{useSphere as jt}from"./useSphere.js";import{useSelector as Tt,useDispatch as Rt}from"../../../store/ctx.js";import Ht from"../../../utils/StepUtils.js";import{jsonParser as rt}from"../../../utils/index.js";import{SetPointCloudLoading as lt}from"../../../store/annotation/actionCreators.js";import{message as Et}from"antd";import{useTranslation as Ft}from"react-i18next";import{useHistory as Nt}from"./useHistory.js";import{usePolygon as Zt}from"./usePolygon.js";var Wt=Object.defineProperty,Mt=Object.defineProperties,Gt=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertySymbols,Qt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,at=(o,e,n)=>e in o?Wt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,L=(o,e)=>{for(var n in e||(e={}))Qt.call(e,n)&&at(o,n,e[n]);if(dt)for(var n of dt(e))Xt.call(e,n)&&at(o,n,e[n]);return o},A=(o,e)=>Mt(o,Gt(e)),q=(o,e,n)=>new Promise((l,t)=>{var a=d=>{try{r(n.next(d))}catch(g){t(g)}},p=d=>{try{r(n.throw(d))}catch(g){t(g)}},r=d=>d.done?l(d.value):Promise.resolve(d.value).then(a,p);r((n=n.apply(o,e)).next())});const G=5,Q=90,m={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(o,e,n,l,t)=>{const{x:a,y:p}=w.transferCanvas2World(o,e),{defaultZ:r}=Ut,d={center:{x:a,y:p,z:r},id:o.id},g=l?L(L({},l),d):A(L({},d),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},K=(o,e,n,l,t,a)=>{let p=o.pointList.map(h=>w.transferCanvas2World(h,e)),r=0,d=1,g={};if(n){const h=n.getSensesPointZAxisInPolygon(p,void 0,a);a&&h.fittedCoordinates.length>0&&(p=h.fittedCoordinates),r=(h.maxZ+h.minZ)/2,d=h.maxZ-h.minZ,g={count:h.zCount}}const[y,B,U]=p,O=x.getLineCenterPoint([y,U]),k=x.getLineLength(y,B),z=x.getLineLength(B,U),j=x.getRadiusFromQuadrangle(o.pointList);l&&(r=l.center.z,d=l.depth);const V={center:{x:O.x,y:O.y,z:r},width:z,height:k,depth:d,rotation:j,id:o.id},D=L(l?L(L({},l),V):A(L({},V),{attribute:"",valid:!0}),g);t&&Object.assign(D,t);const T=p.map(h=>w.transferWorld2Canvas(h,e));return{boxParams:D,newPointList:T}},ct=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return A(L({},n),{center:{x:n.center.x-l.x,y:n.center.y,z:n.center.z-l.y}})},ut=(o,e,n,l)=>{const[t,a,p]=o.pointList,[r,d,g]=e.pointList,y=x.getLineCenterPoint([t,p]),B=x.getLineCenterPoint([r,g]),O={x:{x:y.x-B.x,y:y.y-B.y}.x,y:0,z:y.y-B.y},k=x.getLineLength(t,a),z=x.getLineLength(r,d),j=k-z,V=x.getLineLength(a,p),D=x.getLineLength(d,g),T=V-D,{newBoxParams:h}=l.getNewBoxBySideUpdate(O,T,j,n);return h},Yt=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return A(L({},n),{center:{x:n.center.x,y:n.center.y-l.x,z:n.center.z-l.y}})},qt=(o,e,n,l)=>{const[t,a,p]=o.pointList,[r,d,g]=e.pointList,y=x.getLineCenterPoint([t,p]),B=x.getLineCenterPoint([r,g]),O={x:{x:y.x-B.x,y:y.y-B.y}.x,y:0,z:y.y-B.y},k=x.getLineLength(t,a),z=x.getLineLength(r,d),j=k-z,V=x.getLineLength(a,p),D=x.getLineLength(d,g),T=V-D;let{newBoxParams:h}=l.getNewBoxByBackUpdate(O,T,j,n);return h},pt=(o,e,n,l,t)=>{var a;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:Q);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(o,N.Left);r.setInitCameraPosition(d);const{point2d:g,zoom:y}=r.getSphereSidePoint2DCoordinate(o);r.camera.zoom=y,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(y),p.setResult([A(L(L({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),p.setSelectedID(e.id)},ft=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=n;a.loadPCDFileByBox(l,o,{width:G,depth:G});const{cameraPositionVector:p}=a.updateOrthoCamera(o,N.Left);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxSidePolygon2DCoordinate(o);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(d),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:r,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},Ct=(o,e,n,l,t)=>{var a;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:Q);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(o,N.Back);r.setInitCameraPosition(d);const{point2d:g,zoom:y}=r.getSphereBackPoint2DCoordinate(o);r.camera.zoom=y,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(y),p.setResult([A(L(L({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),p.setSelectedID(e.id)},gt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=n;a.loadPCDFileByBox(l,o,{height:G,depth:G});const{cameraPositionVector:p}=a.updateOrthoCamera(o,N.Back);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxBackPolygon2DCoordinate(o);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(d),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:r,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},Pt=(o,e,n,l)=>{if(!n||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,N.Top),l.render();const{toolInstance:t,pointCloudInstance:a}=n,{point2d:p}=a.getSphereTopPoint2DCoordinate(o),r=[...t.pointList].map(d=>d.id===e.id?A(L(L({},e),p),{valid:o.valid,textAttribute:"",attribute:o.attribute}):d);t.setResult(r),t.setSelectedID(e.id)},$=(o,e,n,l)=>{var t;if(!n||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:a,pointCloudInstance:p}=n,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(o),d=[...a.polygonList],g=d.find(y=>y.id===e.id);g?g.pointList=r:d.push({id:e.id,pointList:r,textAttribute:"",isRect:!0,valid:(t=o.valid)!=null?t:!0}),a.setResultAndSelectedID(d,e.id)},Jt=()=>{const o=kt(zt),{topViewInstance:e,sideViewInstance:n,backViewInstance:l,mainViewInstance:t,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:y,hideAttributes:B}=o,{addHistory:U,initHistory:O,pushHistoryUnderUpdatePolygon:k,pushHistoryUnderUpdateLine:z}=Nt(),{selectedPolygon:j}=Zt(),{updateSelectedBox:V,updateSelectedBoxes:D,getPointCloudByID:T}=st(),{getPointCloudSphereByID:h,updatePointCloudSphere:tt,selectedSphere:Z}=jt(),{currentData:H,config:S}=Tt(i=>{const{stepList:s,step:f,imgList:c,imgIndex:u}=i.annotation;return{currentData:c[u],config:rt(Ht.getCurrentStepInfo(f,s).config)}}),ot=Rt(),{selectedBox:R}=st(),{t:yt}=Ft(),et=R==null?void 0:R.info;if(!e||!n||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:X}=e,mt=i=>{t==null||t.generateBox(i),t==null||t.controls.update(),t==null||t.render()},Lt=i=>{t==null||t.generateSphere(i),t==null||t.controls.update(),t==null||t.render()},ht=({newPoint:i,size:s,zoom:f,trackConfigurable:c})=>{var u;const C={attribute:(u=e.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:w.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:y})});const P=J(i,s,X,void 0,C);r(i.id);const v=p(P);W(m.Top,i,P,f,v,S),U({newSphereParams:P})},vt=({polygon:i,size:s,imgList:f,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var P,v;const I={attribute:(P=e.toolInstance.defaultAttribute)!=null?P:""};c===!0&&Object.assign(I,{trackID:w.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:y})});const E=e==null?void 0:e.toolInstance,_=L({},i),{boxParams:b,newPointList:F}=K(_,s,X,void 0,I,C);if((S==null?void 0:S.lowerLimitPointsNumInBox)&&typeof b.count=="number"&&b.count<S.lowerLimitPointsNumInBox){Et.info(yt("LowerLimitPointsNumInBox",{num:S.lowerLimitPointsNumInBox})),E.deletePolygon(b.id);return}C&&(F==null?void 0:F.length)&&(_.pointList=F);const Ot=B.includes(_.attribute),Y=a(b),Vt=(v=o==null?void 0:o.polygonList)!=null?v:[];e==null||e.updatePolygonList(Y!=null?Y:[],Vt),Ot?r([]):(r(b.id),E.selection.setSelectedIDs(_.id),M(m.Top,_,b,u,Y),C&&$(b,_,e,t)),U({newBoxParams:b})},xt=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:f,newSphereList:c})=>{var u;const C=e==null?void 0:e.toolInstance;if(!(d.length===0||!C)){if(i||(R==null?void 0:R.info)){const P=i!=null?i:R==null?void 0:R.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(d[0]);const v=C.selectedPolygon;if(d.length===1&&P){M(m.Top,v,P,void 0,s);return}}if((f||Z)&&d.length===1){const P=f!=null?f:Z;C.setSelectedID(d[0]);const v=C.selectedPoint;P&&W(m.Top,v,P,void 0,c,S)}}},nt=(i,s,f)=>{if(et){let c,u;switch(f){case m.Back:c=qt;break;case m.Side:c=ut;break;default:c=ut;break}if(u=c(i,s,et,n.pointCloudInstance),t){const{count:P}=t.getSensesPointZAxisInPolygon(At(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=A(L({},u),{count:P})}const C=V(u);return M(f,i,u,void 0,C),C}},it=(i,s,f)=>{if(Z){let c,u;switch(f){case m.Back:c=Yt;break;case m.Side:c=ct;break;default:c=ct;break}u=c(i,s,Z);const C=tt(u);return W(f,i,u,void 0,C,S),C}},Bt=(i,s)=>{it(i,s,m.Side)},St=(i,s)=>{it(i,s,m.Back)},bt=(i,s)=>{nt(i,s,m.Side)},wt=(i,s)=>{nt(i,s,m.Back)},It=(i,s)=>{z(i)},Dt=(i,s)=>{const f=h(i.id),c=J(i,s,X,f),u=tt(c);W(m.Top,i,c,void 0,u,S)},_t=(i,s)=>{if(j){const c=i[0].newPolygon;c.pointList=c.pointList.map(u=>w.transferCanvas2World(u,s)),k(i[0].newPolygon);return}const f=i.map(({newPolygon:c})=>{const u=T(c.id),{boxParams:C}=K(c,s,e.pointCloudInstance,u);return C});if(f.length===1){const{newPolygon:c}=i[0],u=D(f);M(m.Top,c,f[0],void 0,u)}else{const c=D(f);c&&o.syncAllViewPointCloudColor(c)}},W=(i,s,f,c,u,C)=>q(void 0,null,function*(){const P=H==null?void 0:H.url,v={[m.Side]:()=>{pt(f,s,n,P,C)},[m.Back]:()=>{l&&Ct(f,s,l,P,C)},[m.Top]:()=>{Pt(f,s,e,t)}};Object.keys(v).forEach(I=>{I!==i&&v[I]()}),c&&(t==null||t.updateCameraZoom(c)),Lt(f)}),M=(i,s,f,c,u)=>q(void 0,null,function*(){const C=H==null?void 0:H.url;u&&(yield o.syncAllViewPointCloudColor(u));const P={[m.Side]:()=>{ft(f,s,n,C)},[m.Back]:()=>{l&>(f,s,l,C)},[m.Top]:()=>{$(f,s,e,t)}};Object.keys(P).forEach(v=>{v!==i&&P[v]()}),c&&(t==null||t.updateCameraZoom(c)),mt(f)});return{topViewAddSphere:ht,topViewAddBox:vt,topViewSelectedChanged:xt,topViewUpdatePoint:Dt,sideViewUpdatePoint:Bt,backViewUpdatePoint:St,topViewUpdateBox:_t,topViewUpdateLine:It,sideViewUpdateBox:bt,backViewUpdateBox:wt,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),t==null||t.generateBoxes(i)},initPointCloud3d:i=>{if(!t)return;const s=w.getDefaultOrthographicParams(i);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...i)=>q(void 0,[...i],function*(s=H){var f,c,u,C,P,v;if(!(s==null?void 0:s.url)||!t)return;lt(ot,!0),yield t.loadPCDFile(s.url,(f=S==null?void 0:S.radius)!=null?f:Q),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let I=[],E=[],_=[],b=[];s.result&&(I=w.getBoxParamsFromResultList(s.result),_=w.getPolygonListFromResultList(s.result),E=w.getLineListFromResultList(s.result),b=w.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(I),t==null||t.generateSpheres(b),o.syncAllViewPointCloudColor(I)),O({pointCloudBoxList:I,polygonList:_,lineList:E,pointCloudSphereList:b}),t.updateTopCamera();const F=(u=(c=rt(s.result))==null?void 0:c.valid)!=null?u:!0;o.setPointCloudValid(F),(C=o.sideViewInstance)==null||C.clearAllData(),(P=o.backViewInstance)==null||P.clearAllData(),e.updateData(s.url,s.result,{radius:(v=S==null?void 0:S.radius)!=null?v:Q}),lt(ot,!1)})}};export{Ct as syncBackViewByPoint,pt as syncSideViewByPoint,Pt as syncTopViewByPoint,gt as synchronizeBackView,ft as synchronizeSideView,$ as synchronizeTopView,J as topViewPoint2PointCloud,K as topViewPolygon2PointCloud,Jt as usePointCloudViews};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as z,useMemo as
|
|
1
|
+
import{useContext as z,useMemo as b,useCallback as a}from"react";import u from"lodash";import{PointCloudContext as F}from"../PointCloudContext.js";import{EToolName as h,cAnnotation as G}from"@labelbee/lb-annotation";import{useHistory as J}from"./useHistory.js";import{usePolygon as Q}from"./usePolygon.js";var U=Object.defineProperty,X=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,D=(e,i,t)=>i in e?U(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t,ee=(e,i)=>{for(var t in i||(i={}))Z.call(i,t)&&D(e,t,i[t]);if(V)for(var t of V(i))$.call(i,t)&&D(e,t,i[t]);return e},oe=(e,i)=>X(e,Y(i));const{ESortDirection:y}=G,ne=()=>{const{pointCloudBoxList:e,setPointCloudResult:i,topViewInstance:t,backViewInstance:v,sideViewInstance:g,selectedIDs:f,selectedID:C,mainViewInstance:s,setSelectedIDs:L,syncAllViewPointCloudColor:B,polygonList:S,pointCloudPattern:m}=z(F),{selectedPolygon:c,updateSelectedPolygon:j,updatePolygonValidByID:A,deletePolygon:E}=Q(),{pushHistoryWithList:w}=J(),l=b(()=>{const o=e.findIndex(n=>n.id===C);if(o>-1)return{info:e[o],index:o}},[C,e]),I=a(o=>{if(l==null?void 0:l.info){e.splice(l.index,1,u.merge(l.info,o));const n=u.cloneDeep(e);return i(n),w({pointCloudBoxList:n}),n}return e},[C,e]),N=a((o,n)=>{const d=e.findIndex(r=>r.id===n);if(d>-1){e.splice(d,1,u.merge(e[d],o));const r=u.cloneDeep(e);return i(r),r}return e},[e]),P=a(o=>{t==null||t.pointCloud2dOperation.setPolygonValidAndRender(o,!0),g==null||g.pointCloud2dOperation.setPolygonValidAndRender(o,!0),v==null||v.pointCloud2dOperation.setPolygonValidAndRender(o,!0)},[t,g,v]),R=a(()=>{if(l==null?void 0:l.info){const{id:o,valid:n=!0}=l.info,d=I({valid:!n});B(d),P(o)}c&&(j(oe(ee({},c),{valid:!c.valid})),t==null||t.pointCloud2dOperation.setPolygonValidAndRender(c.id,!0))},[P,l,c]),H=a(o=>{const n=e.find(d=>d.id===o);if(n){const{id:d,valid:r=!0}=n,p=N({valid:!r},d);return P(d),p}A(o)},[P,e,S]),O=a((o=y.ascend,n=!1)=>{if(!t||f.length>1)return;if(m!==h.Rect&&m!==h.Polygon){n&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:o!==y.ascend}));return}const{pointCloud2dOperation:d}=t,r=d.switchToNextPolygon(o);r&&L(r)},[t,m,t==null?void 0:t.toolInstance]),T=(o=!1)=>{O(y.descend,o)},k=(o=!1)=>{O(y.ascend,o)},_=o=>{const n=e.filter(d=>d.id!==o);i(n),s==null||s.removeObjectByName(o,"box"),s==null||s.render(),B(n)},K=()=>{l&&(_(l.info.id),t==null||t.pointCloud2dOperation.deletePolygon(l.info.id)),c&&(E(c.id),t==null||t.pointCloud2dOperation.deletePolygon(c.id))},M=b(()=>e.filter(o=>f.includes(o.id)),[f,e]),W=a(o=>{const n=u.cloneDeep(e);let d=!1;if(o.forEach(r=>{const p=n.findIndex(x=>x.id===r.id);if(p>-1){const x=u.merge(n[p],r);n.splice(p,1,x),s==null||s.generateBox(x),d=!0}}),d)return i(n),w({pointCloudBoxList:n}),s==null||s.render(),n},[f,e]),q=a(o=>e.find(n=>n.id===o),[e]);return{selectedBox:l,updateSelectedBox:I,changeSelectedBoxValid:R,changeValidByID:H,selectNextBox:k,selectPrevBox:T,deletePointCloudBox:_,selectedBoxes:M,updateSelectedBoxes:W,getPointCloudByID:q,deleteSelectedPointCloudBoxAndPolygon:K}};export{ne as useSingleBox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as w,useMemo as D,useCallback as d}from"react";import{PointCloudContext as b}from"../PointCloudContext.js";import h from"lodash";import{useHistory as y}from"./useHistory.js";import{cAnnotation as g}from"@labelbee/lb-annotation";const{ESortDirection:S}=g,j=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:c,selectedID:l,setSelectedIDs:a,mainViewInstance:s,topViewInstance:r}=w(b),{pushHistoryWithList:f}=y(),m=D(()=>e.find(t=>t.id===l),[l,e]),C=d(t=>e.find(n=>n.id===t),[e]),I=d(t=>{const n=e.findIndex(o=>o.id===t.id);if(n>-1){e.splice(n,1,h.merge(e[n],t));const o=h.cloneDeep(e);return c(o),f({pointCloudSphereList:o}),o}return e},[e]),x=d(t=>{const n=e.filter(o=>o.id!==t);c(n),s==null||s.removeObjectByName(t),s==null||s.render()},[e]),L=d((t=S.ascend)=>{if(!r)return;const n=r.toolInstance.pointList,o=r.toolInstance.selectedID,u=n.findIndex(i=>(i==null?void 0:i.id)===o);if(u>-1){let i=1;t===S.descend&&(i=-1);const p=n.length,P=n[(u+i+p)%p];a(P.id)}},[r]);return{selectedSphere:m,getPointCloudSphereByID:C,updatePointCloudSphere:I,deletePointCloudSphere:x,switchToNextSphere:L}};export{j as useSphere};
|
|
1
|
+
import{useContext as w,useMemo as D,useCallback as d}from"react";import{PointCloudContext as b}from"../PointCloudContext.js";import h from"lodash";import{useHistory as y}from"./useHistory.js";import{cAnnotation as g}from"@labelbee/lb-annotation";const{ESortDirection:S}=g,j=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:c,selectedID:l,setSelectedIDs:a,mainViewInstance:s,topViewInstance:r}=w(b),{pushHistoryWithList:f}=y(),m=D(()=>e.find(t=>t.id===l),[l,e]),C=d(t=>e.find(n=>n.id===t),[e]),I=d(t=>{const n=e.findIndex(o=>o.id===t.id);if(n>-1){e.splice(n,1,h.merge(e[n],t));const o=h.cloneDeep(e);return c(o),f({pointCloudSphereList:o}),o}return e},[e]),x=d(t=>{const n=e.filter(o=>o.id!==t);c(n),s==null||s.removeObjectByName(t,"sphere"),s==null||s.render()},[e]),L=d((t=S.ascend)=>{if(!r)return;const n=r.toolInstance.pointList,o=r.toolInstance.selectedID,u=n.findIndex(i=>(i==null?void 0:i.id)===o);if(u>-1){let i=1;t===S.descend&&(i=-1);const p=n.length,P=n[(u+i+p)%p];a(P.id)}},[r]);return{selectedSphere:m,getPointCloudSphereByID:C,updatePointCloudSphere:I,deletePointCloudSphere:x,switchToNextSphere:L}};export{j as useSphere};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as
|
|
1
|
+
import{useContext as S,useMemo as P}from"react";import{PointCloudContext as I}from"../PointCloudContext.js";import{cTool as E}from"@labelbee/lb-annotation";import{useHistory as x}from"./useHistory.js";import{EPointCloudPattern as C}from"@labelbee/lb-utils";const{EToolName:t,EPolygonPattern:p}=E,A=()=>{const{topViewInstance:r,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,setPointCloudResult:v,setPointCloudSphereList:h,setPolygonList:m,pointCloudPattern:c,setPointCloudPattern:n,syncAllViewPointCloudColor:b,globalPattern:l,setLineList:w}=S(I),{pushHistoryWithList:y}=x(),L=()=>{e==null||e.clearAllBox(),e==null||e.clearAllSphere(),e==null||e.render(),v([]),m([]),h([]),w([]),r==null||r.toolScheduler.clearStatusAndResult(),b([]),y({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},f=d=>{if(d===c)return;const s=[r,a,u];switch(d){case t.Rect:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(p.Rect)}),n(t.Rect);break;case t.Polygon:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(p.Normal)}),n(t.Polygon);break;case t.Point:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),n(t.Point);break;case t.Line:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),n(t.Line);break}},g=P(()=>l===C.Detection,[l]),R=P(()=>l===C.Segmentation,[l]);return{clearAllResult:L,updatePointCloudPattern:f,pointCloudPattern:c,isPointCloudDetectionPattern:g,isPointCloudSegmentationPattern:R}};export{A as useStatus};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as l}from"../../utils/dom.js";import t,{useContext as j,useEffect as
|
|
1
|
+
import{getClassName as l}from"../../utils/dom.js";import t,{useContext as j,useEffect as c}from"react";import S from"./PointCloud3DView.js";import b from"./PointCloudBackView.js";import v from"./PointCloudTopView.js";import w from"./PointCloudSideView.js";import V from"./PointCloud2DView.js";import A from"./PointCloudListener.js";import N from"./PointCloudSegmentListener.js";import T from"./PointCloudSegment.js";import I from"./PointCloudSegmentStatus.js";import B from"./PointCloudSegmentToolbar.js";import{connect as D}from"react-redux";import{LabelBeeContext as F}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as R,AnnotatedAttributesPanelFixedRight as _}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as h}from"./PointCloudContext.js";import{PointCloudUtils as y,EPointCloudPattern as G}from"@labelbee/lb-utils";import{useCustomToolInstance as U}from"../../hooks/annotation.js";import{jsonParser as $}from"../../utils/index.js";import{a2MapStateToProps as q}from"../../store/annotation/map.js";const z=({currentData:r,imgList:p,drawLayerSlot:u,checkMode:n,intelligentFit:C,imgIndex:P})=>{const e=j(h),{globalPattern:d,setGlobalPattern:f}=e,g=$(r.result),{toolInstanceRef:i,clearToolInstance:E}=U({basicInfo:g});return c(()=>{i.current.setPointCloudGlobalPattern=o=>{o!==d&&(f(o),e.clearAllDetectionInstance(),E())}},[d]),c(()=>{var o;if(r){const{boxParamsList:s,polygonList:a,lineList:m,sphereParamsList:L,segmentation:x}=y.parsePointCloudCurrentResult((o=r==null?void 0:r.result)!=null?o:"");e.setPointCloudResult(s),e.setPolygonList(a),e.setLineList(m),e.setPointCloudSphereList(L),e.setSegmentation(x)}},[P]),c(()=>{i.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],i.current.exportCustomData=()=>{var o,s,a,m;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(s=e.lineList)!=null?s:[],resultPoint:(a=e.pointCloudSphereList)!=null?a:[],segmentation:(m=e.segmentation)!=null?m:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),p.length===0?null:d===G.Segmentation?t.createElement(t.Fragment,null,t.createElement(N,{checkMode:n,toolInstanceRef:i}),t.createElement(B,null),t.createElement(T,{checkMode:n}),t.createElement(I,null),u==null?void 0:u({direct:!0})):t.createElement(t.Fragment,null,t.createElement(A,{checkMode:n,toolInstanceRef:i}),t.createElement("div",{className:l("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:l("point-cloud-wrapper")},t.createElement(R,null),t.createElement("div",{className:l("point-cloud-content")},t.createElement("div",{className:l("point-cloud-container","left")},t.createElement(V,null),t.createElement(S,null)),t.createElement("div",{className:l("point-cloud-container","right")},t.createElement(v,{drawLayerSlot:u,checkMode:n,intelligentFit:C}),t.createElement("div",{className:l("point-cloud-container","right-bottom")},t.createElement(w,{checkMode:n}),t.createElement(b,{checkMode:n})))),t.createElement(_,null))))};var H=D(q,null,null,{context:F})(z);export{H as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Button as
|
|
1
|
+
import{Button as h,message as c}from"antd";import f from"react";import{useTranslation as v}from"react-i18next";import{connect as y}from"react-redux";import S from"../../../assets/predictTracking/icon.svg.js";import{useSingleBox as k}from"../../pointCloudView/hooks/useSingleBox.js";import{ChangeSave as B,GetBoxesByID as C,SetPointCloudLoading as I,SetPredictResult as D,SetPredictResultVisible as T}from"../../../store/annotation/actionCreators.js";import{LabelBeeContext as j,useDispatch as w}from"../../../store/ctx.js";import{predict as R}from"../previewResult/util.js";import{useStatus as b}from"../../pointCloudView/hooks/useStatus.js";var E=(s,o,e)=>new Promise((l,a)=>{var i=t=>{try{r(e.next(t))}catch(n){a(n)}},d=t=>{try{r(e.throw(t))}catch(n){a(n)}},r=t=>t.done?l(t.value):Promise.resolve(t.value).then(i,d);r((e=e.apply(s,o)).next())});const V=s=>{const o=w(),{t:e}=v(),{isPointCloudSegmentationPattern:l}=b(),{loading:a}=s,{selectedBox:i}=k(),d=()=>E(void 0,null,function*(){if(a)return;const r=i==null?void 0:i.info.trackID;if(!r){c.error(e("BeforePredictStarting"));return}yield o(B);const t=i==null?void 0:i.info.id,n=yield o(C(r,t));if(n.length<2){c.error(e("MarkOnlyOne"));return}const p=n.findIndex(P=>P.id===t),u=n[p-1],m=n[p],x=m.index-u.index;if(x<2){c.error(e("HaveNoNeed"));return}if(x>8){c.error(e("ThePredictedPointCloud"));return}c.success(e("PredictingDataFrom",{startPage:u.index+1,endPage:m.index+1,selectedBoxTrackID:r})),I(o,!0);const g=R(u,m);D(o,g),T(o,!0)});return l?null:f.createElement(h,{type:"link",onClick:d,style:{display:"flex",flexDirection:"column",height:"auto",alignItems:"center"}},f.createElement("img",{src:S,style:{alignSelf:"center"}}),f.createElement("span",{style:{color:"#797979"}},e("ComplementaryTracking")))},L=s=>({loading:s.annotation.loading});var N=y(L,null,null,{context:j})(V);export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import w from"classnames";import n,{useState as j,useRef as S,useEffect as F}from"react";import{useTranslation as _}from"react-i18next";import{connect as L}from"react-redux";import{PointCloudContext as B}from"../../pointCloudView/PointCloudContext.js";import{SetPredictResultVisible as D,SetPredictResult as T,SetPointCloudLoading as v,BatchUpdateImgListResultByPredictResult as I}from"../../../store/annotation/actionCreators.js";import{LabelBeeContext as U,useDispatch as E}from"../../../store/ctx.js";import{getClassName as o}from"../../../utils/dom.js";import{PointCloud as $}from"@labelbee/lb-annotation";import{PointCloudUtils as z,toolStyleConverter as A}from"@labelbee/lb-utils";import{views as G,sleep as Z,getViewsDataUrl as q}from"./util.js";var H=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,N=(i,e,t)=>e in i?H(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,W=(i,e)=>{for(var t in e||(e={}))M.call(e,t)&&N(i,t,e[t]);if(k)for(var t of k(e))Q.call(e,t)&&N(i,t,e[t]);return i},X=(i,e)=>J(i,K(e)),O=(i,e,t)=>new Promise((d,r)=>{var s=a=>{try{c(t.next(a))}catch(u){r(u)}},l=a=>{try{c(t.throw(a))}catch(u){r(u)}},c=a=>a.done?d(a.value):Promise.resolve(a.value).then(s,l);c((t=t.apply(i,e)).next())});const Y=i=>{const{predictionResult:e,predictionResultVisible:t,imgList:d}=i,[r,s]=j([]),l=E(),{t:c}=_(),a=()=>{D(l,!1),T(l,[]),s([])},u=()=>O(void 0,null,function*(){v(l,!0),yield l(I()),v(l,!1),a()});return t?n.createElement(n.Fragment,null,r.length>0&&n.createElement("div",{className:o("point-cloud-predict-tracking-container")},n.createElement("div",{className:o("point-cloud-predict-tracking-container","bar")},n.createElement("div",{className:o("point-cloud-predict-tracking-container","title")},n.createElement("div",null,c("ComplementaryTrackingPrediction"),r.length>0?`\uFF08${r.length}\uFF09`:""),n.createElement("div",{className:o("point-cloud-predict-tracking-container","option")},n.createElement("div",{className:w([o("point-cloud-predict-tracking-container","cancelOption"),o("point-cloud-predict-tracking-container","button")]),onClick:a},c("Cancel")),n.createElement("div",{className:w([o("point-cloud-predict-tracking-container","okOption"),o("point-cloud-predict-tracking-container","button")]),onClick:u},c("Apply")))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","content")},n.createElement(ee,{list:r})))),e.length>0&&n.createElement(te,{result:e,imgList:d,setList:s})):null},ee=i=>{const{list:e}=i,{t}=_(),d=[t("TopView"),t("SideView"),t("BackView")];return n.createElement(n.Fragment,null,n.createElement("div",{className:o("point-cloud-predict-tracking-container","left")},d.map(r=>n.createElement("div",{className:o("point-cloud-predict-tracking-container","title"),key:r},r))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","right")},e.map(r=>n.createElement("div",{className:o("point-cloud-predict-tracking-container","item"),key:r.id},G.map(s=>{const l=r[s];return n.createElement("div",{className:o("point-cloud-predict-tracking-container","view"),key:`${r.id}-${s}`},n.createElement("img",{src:l}))})))))},te=i=>{const e=n.useContext(B),t=E(),{result:d,imgList:r,setList:s}=i,l=S(null),c={width:600,height:600};return F(()=>{(()=>O(void 0,null,function*(){var u,P,h,y,C,b;const f=(u=e.mainViewInstance)==null?void 0:u.config;if(f&&l.current){const R=z.getDefaultOrthographicParams(c),p=new $({container:l.current,isOrthographicCamera:!0,orthographicParams:R,config:f});p.setShowDirection(!1);for(const m of d){const{index:g}=m,x=r[g].url?r[g].url:(C=(y=(h=(P=r[g])==null?void 0:P.webPointCloudFile)==null?void 0:h.lidar)==null?void 0:y.url)!=null?C:"";yield p.loadPCDFileByBox(x,m,{width:2,height:2,depth:2}),yield p.updateCameraZoom(e.zoom);const V=(b=A.getColorFromConfig({attribute:m.attribute},X(W({},f),{attributeConfigurable:!0}),{}))==null?void 0:b.fill;p.generateBox(m,V),yield Z(500),yield q(p,m,e.zoom),yield p.removeObjectByName(m.id,"box"),yield p.clearPointCloudAndRender()}s(d),v(t,!1)}}))()},[]),n.createElement("div",{style:c,ref:l,className:"generate-view"})},ne=i=>({predictionResult:i.annotation.predictionResult,predictionResultVisible:i.annotation.predictionResultVisible,imgList:i.annotation.imgList});var ie=L(ne,null,null,{context:U})(Y);export{ie as default};
|
package/es/hooks/annotation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useRef as c,useEffect as d}from"react";import{useDispatch as p}from"../store/ctx.js";import{ANNOTATION_ACTIONS as a}from"../store/Actions.js";
|
|
1
|
+
import{useRef as c,useEffect as d}from"react";import{useDispatch as p}from"../store/ctx.js";import{ANNOTATION_ACTIONS as a}from"../store/Actions.js";const m=({basicInfo:o}={})=>{var n;const r=p(),s={valid:(n=o==null?void 0:o.valid)!=null?n:!0,exportData:()=>[[],{}],exportCustomData:()=>({}),clearResult:()=>{},singleOn:()=>{},on:()=>{},unbind:()=>{},setResult:()=>{},history:{initRecord:()=>{},pushHistory:()=>{}},setDefaultAttribute:t=>{},setForbidOperation:()=>{},setShowDefaultCursor:()=>{},setSubAttribute:(t,O)=>{},setValid:()=>{},updateRotate:()=>{},redo:()=>{},undo:()=>{},setPointCloudGlobalPattern:t=>{}},e=c(s),u=t=>{r({type:a.SET_TOOL,payload:{instance:t}})},i=()=>{r({type:a.SET_TOOL,payload:{instance:void 0}})},l=()=>{Object.assign(e.current,s)};return d(()=>(u(e.current),()=>{i()}),[]),{toolInstanceRef:e,clearToolInstance:l}};export{m as useCustomToolInstance};
|
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";import{i18n as l}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import n,{useState as m,useImperativeHandle as d}from"react";import{I18nextProvider as f}from"react-i18next";import{Provider as u}from"react-redux";import P from"./App.js";import g from"./configureStore.js";import{PageBackward as x,PageForward as
|
|
1
|
+
export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";import{i18n as l}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import n,{useState as m,useImperativeHandle as d}from"react";import{I18nextProvider as f}from"react-i18next";import{Provider as u}from"react-redux";import P from"./App.js";import g from"./configureStore.js";import{PageBackward as x,PageForward as v,PageJump as _}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoPlayer/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as w}from"./components/pointCloudView/PointCloudContext.js";import{LabelBeeContext as j}from"./store/ctx.js";export{default as PredictTracking}from"./components/predictTracking/predictTrackingIcon/index.js";export{EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var b=Object.defineProperty,O=Object.defineProperties,A=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,s=(t,e,o)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,y=(t,e)=>{for(var o in e||(e={}))I.call(e,o)&&s(t,o,e[o]);if(p)for(var o of p(e))T.call(e,o)&&s(t,o,e[o]);return t},E=(t,e)=>O(t,A(e));const r=g(),C=(t,e)=>{const[o,c]=m();return d(e,()=>({toolInstance:o,annotationEngine:r.getState().annotation.annotationEngine,pageBackwardActions:()=>r.dispatch(x()),pageForwardActions:()=>r.dispatch(v()),pageJump:a=>{const i=~~a-1;r.dispatch(_(i))},hello:()=>alert("hello labelBee!!!")}),[o]),n.createElement(u,{store:r,context:j},n.createElement(f,{i18n:l},n.createElement(w,null,n.createElement(P,E(y({},t),{setToolInstance:a=>{var i;c(a),(i=t.onLoad)==null||i.call(t,{toolInstance:a})}})))))};var S=n.forwardRef(C);export{S as default,r as store};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import s,{useState as f,useCallback as
|
|
1
|
+
import s,{useState as f,useCallback as B}from"react";import{connect as d}from"react-redux";import I from"../../../../utils/StepUtils.js";import{jsonParser as g}from"../../../../utils/index.js";import v from"./ActionsConfirm.js";import C from"./useOperationList.js";import{LabelBeeContext as y}from"../../../../store/ctx.js";import U from"../../../../assets/annotation/pointCloudTool/unitAttribute.svg.js";import w from"../../../../assets/annotation/pointCloudTool/unitAttributeForbid.svg.js";import T from"../../../../assets/annotation/pointCloudTool/unitAttributeHover.svg.js";import{useTranslation as V}from"react-i18next";import A from"../../../../components/pointCloudView/components/UnifyParamsModal/index.js";import{useSingleBox as E}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{composeResultByToolInstance as M}from"../../../../store/annotation/reducer.js";import{useStatus as R}from"../../../../components/pointCloudView/hooks/useStatus.js";const S=o=>{var t,n;const i=I.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList);return{toolInstance:o.annotation.toolInstance,stepInfo:i,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:o.annotation.stepList}},$=({toolInstance:o,stepInfo:t})=>{const n=C(o),i=g(t==null?void 0:t.config),e=[n.empty];return(t==null?void 0:t.dataSourceStep)===0&&e.push(n.setValidity),(i==null?void 0:i.copyBackwardResult)&&e.push(n.copyPrevious),s.createElement(v,{allOperation:e})},D=d(S,null,null,{context:y})(({toolInstance:o,stepInfo:t,imgList:n,stepList:i,imgIndex:e})=>{const{t:x}=V(),{selectedBox:l}=E(),m=C(o),[P,c]=f(!1),[j,L]=f([]),{isPointCloudDetectionPattern:b,isPointCloudSegmentationPattern:k}=R(),u=g(t.config);let r=[m.copyPrevious,m.empty,m.setValidity];if(b&&u.trackConfigurable===!0){const a=!l,O={name:x("UnifyParams"),key:"UnifyParams",imgSvg:a?w:U,hoverSvg:T,onClick:()=>{L(M({toolInstance:o,imgList:n,imgIndex:e,stepList:i})),c(!0)},forbidConfirm:!0,forbidOperation:a};r.unshift(O)}const h=B(()=>{c(!1)},[]),p=l==null?void 0:l.info;return k&&(r=r.filter(a=>!["setValidity","copyPrevious"].includes(a.key))),s.createElement(s.Fragment,null,s.createElement(v,{allOperation:r}),s.createElement(A,{id:p==null?void 0:p.trackID,visible:P,onCancel:h,config:u,imgList:j}))});var F=d(S,null,null,{context:y})($);export{D as PointCloudOperation,F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as k,useState as L,useEffect as h}from"react";import{EditFilled as H}from"@ant-design/icons";import{ToolIcons as K}from"../ToolIcons.js";import{cTool as Q}from"@labelbee/lb-annotation";import{PointCloudContext as T}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as j,Tag as X,Input as Y,Select as F,message as w}from"antd";import Z from"../../../../utils/StepUtils.js";import{connect as ee}from"react-redux";import{jsonParser as te,classnames as oe}from"../../../../utils/index.js";import{useStatus as ne}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as $}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as D}from"react-i18next";import{LabelBeeContext as le,useDispatch as re}from"../../../../store/ctx.js";import ae from"./components/batchUpdateModal/index.js";import{PointCloudUtils as ie}from"@labelbee/lb-utils";import U from"../../../../components/attributeList/index.js";import{useAttribute as se}from"../../../../components/pointCloudView/hooks/useAttribute.js";import ce from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import ue from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import de from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import me from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import{sidebarCls as B}from"../index.js";import{SetTaskStepList as pe}from"../../../../store/annotation/actionCreators.js";var ve=Object.defineProperty,fe=Object.defineProperties,ge=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,z=(o,t,n)=>t in o?ve(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,N=(o,t)=>{for(var n in t||(t={}))Ce.call(t,n)&&z(o,n,t[n]);if(M)for(var n of M(t))Se.call(t,n)&&z(o,n,t[n]);return o},O=(o,t)=>fe(o,ge(t));const xe=({imgList:o,imgIndex:t})=>{const n=k(T),[m,c]=L([]),{t:a}=D();h(()=>{const v=o;let i=new Map;c(ie.getAllPointCloudResult({imgList:v,extraBoxList:u,ignoreIndexList:[t]}).filter(l=>!l.trackID||i.get(l.trackID)?!1:(i.set(l.trackID,!0),!0)).sort((l,g)=>{var s,C;const d=(s=l==null?void 0:l.trackID)!=null?s:0,p=(C=g==null?void 0:g.trackID)!=null?C:0;return d-p}).map(l=>{var g;return(g=l==null?void 0:l.trackID)!=null?g:0}))},[n.pointCloudBoxList,o]);const{pointCloudBoxList:u}=n;return e.createElement("div",{style:{padding:24,borderBottom:"1px solid #eee"}},e.createElement("div",{style:{marginBottom:16}},a("AllTrackIDs")),e.createElement("div",null,m.map(v=>e.createElement(X,{color:"#F3F4FF",key:v,style:{color:"#666",marginBottom:8}},v))))},be=()=>{const[o,t]=L(!1),n=k(T),{pointCloudBoxList:m}=n,{selectedBox:c,updateSelectedBox:a}=$(),[u,v]=L(""),{t:i}=D(),l=c==null?void 0:c.info.trackID,g=d=>!!m.find(x=>x.trackID===d&&x.id!==(c==null?void 0:c.info.id)),s=(d=!1)=>{const p=parseInt(u,10);if(d&&t(!1),isNaN(p)){w.error(i("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){w.error(i("NotAllowDecimalPointsInTrackID"));return}if(g(p)){w.error(i("DuplicateTrackIDsExist"));return}if(!(p>0)){w.error(i("PositiveIntegerCheck"));return}C(p)};h(()=>{t(!1)},[l]);const C=d=>{var p;const x=a({trackID:d});(p=n==null?void 0:n.topViewInstance)==null||p.updatePolygonList(x!=null?x:[])};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,i("CurrentBoxTrackIDs")),l&&e.createElement(ae,{id:l,updateCurrentPolygonList:d=>C(d)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},o&&l?e.createElement(Y,{defaultValue:l,onChange:d=>{v(d.target.value)},disabled:!l,size:"small",onBlur:()=>{s()},onPressEnter:()=>{s(!0)}}):e.createElement("span",null,l),e.createElement(H,{style:{color:"#999",marginLeft:16,cursor:typeof l!="undefined"?"pointer":"not-allowed"},onClick:()=>{l&&t(!o)}})))},W=({attributeList:o,subAttributeList:t,toolInstance:n,config:m,stepList:c,stepInfo:a,enableColorPicker:u})=>{const{selectedBox:v}=$(),i=k(T),{t:l}=D(),{defaultAttribute:g}=se(),s=re(),C={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},d={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},p=(r,b)=>{var _,E,I,y,f;const P=(_=m==null?void 0:m.attributeList)==null?void 0:_.map(S=>S.value===r?O(N({},S),{color:b}):S),V=O(N({},m),{attributeList:P}),q=JSON.stringify(V),G=c==null?void 0:c.map(S=>(S==null?void 0:S.step)===(a==null?void 0:a.step)?O(N({},S),{config:q}):S);(E=i==null?void 0:i.topViewInstance)==null||E.updateAttributeList(P),(I=i==null?void 0:i.sideViewInstance)==null||I.updateAttributeList(P),(y=i==null?void 0:i.backViewInstance)==null||y.updateAttributeList(P),(f=i==null?void 0:i.mainViewInstance)==null||f.setConfig(V),s(pe({stepList:G}))},x=r=>{n.setDefaultAttribute(r)},A=(r,b)=>{n.setSubAttribute(r,b)},J=o.map(r=>({label:r.key,value:r.value,color:r==null?void 0:r.color}));return e.createElement("div",null,e.createElement("div",{style:C},l("Attribute")),e.createElement(U,{list:J,forbidDefault:!0,selectedAttribute:g!=null?g:"",attributeChanged:r=>x(r),updateColorConfig:p,enableColorPicker:u}),e.createElement(j,{style:{margin:0}}),v&&e.createElement(e.Fragment,null,t.map(r=>{var b,_,E,I,y;return(r==null?void 0:r.subSelected)&&e.createElement("div",{style:{marginTop:12},key:r.value},e.createElement("div",{style:d},l("SubAttribute"),"-",r.key),((b=r.subSelected)==null?void 0:b.length)<5?e.createElement(U,{list:r.subSelected.map(f=>({label:f.key,value:f.value})),selectedAttribute:(E=(_=i.selectedPointCloudBox)==null?void 0:_.subAttribute)==null?void 0:E[r.value],num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:f=>A(r.value,f),style:{marginBottom:12}}):e.createElement(F,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:(y=(I=i.selectedPointCloudBox)==null?void 0:I.subAttribute)==null?void 0:y[r.value],placeholder:l("PleaseSelect"),onChange:f=>A(r.value,f),allowClear:!0},r.subSelected.map(f=>e.createElement(F.Option,{key:f.value,value:f.value},f.key))),e.createElement(j,{style:{margin:0}}))})))},_e=[{toolName:"LassoSelector",commonSvg:ce,selectedSvg:ue},{toolName:"CircleSelector",commonSvg:de,selectedSvg:me}],R=({toolInstance:o})=>{const{ptSegmentInstance:t}=k(T),[n,m]=L("
|
|
1
|
+
import e,{useContext as k,useState as L,useEffect as h}from"react";import{EditFilled as H}from"@ant-design/icons";import{ToolIcons as K}from"../ToolIcons.js";import{cTool as Q}from"@labelbee/lb-annotation";import{PointCloudContext as T}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as j,Tag as X,Input as Y,Select as F,message as w}from"antd";import Z from"../../../../utils/StepUtils.js";import{connect as ee}from"react-redux";import{jsonParser as te,classnames as oe}from"../../../../utils/index.js";import{useStatus as ne}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as $}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as D}from"react-i18next";import{LabelBeeContext as le,useDispatch as re}from"../../../../store/ctx.js";import ae from"./components/batchUpdateModal/index.js";import{PointCloudUtils as ie}from"@labelbee/lb-utils";import U from"../../../../components/attributeList/index.js";import{useAttribute as se}from"../../../../components/pointCloudView/hooks/useAttribute.js";import ce from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import ue from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import de from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import me from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import{sidebarCls as B}from"../index.js";import{SetTaskStepList as pe}from"../../../../store/annotation/actionCreators.js";var ve=Object.defineProperty,fe=Object.defineProperties,ge=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,z=(o,t,n)=>t in o?ve(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,N=(o,t)=>{for(var n in t||(t={}))Ce.call(t,n)&&z(o,n,t[n]);if(M)for(var n of M(t))Se.call(t,n)&&z(o,n,t[n]);return o},O=(o,t)=>fe(o,ge(t));const xe=({imgList:o,imgIndex:t})=>{const n=k(T),[m,c]=L([]),{t:a}=D();h(()=>{const v=o;let i=new Map;c(ie.getAllPointCloudResult({imgList:v,extraBoxList:u,ignoreIndexList:[t]}).filter(l=>!l.trackID||i.get(l.trackID)?!1:(i.set(l.trackID,!0),!0)).sort((l,g)=>{var s,C;const d=(s=l==null?void 0:l.trackID)!=null?s:0,p=(C=g==null?void 0:g.trackID)!=null?C:0;return d-p}).map(l=>{var g;return(g=l==null?void 0:l.trackID)!=null?g:0}))},[n.pointCloudBoxList,o]);const{pointCloudBoxList:u}=n;return e.createElement("div",{style:{padding:24,borderBottom:"1px solid #eee"}},e.createElement("div",{style:{marginBottom:16}},a("AllTrackIDs")),e.createElement("div",null,m.map(v=>e.createElement(X,{color:"#F3F4FF",key:v,style:{color:"#666",marginBottom:8}},v))))},be=()=>{const[o,t]=L(!1),n=k(T),{pointCloudBoxList:m}=n,{selectedBox:c,updateSelectedBox:a}=$(),[u,v]=L(""),{t:i}=D(),l=c==null?void 0:c.info.trackID,g=d=>!!m.find(x=>x.trackID===d&&x.id!==(c==null?void 0:c.info.id)),s=(d=!1)=>{const p=parseInt(u,10);if(d&&t(!1),isNaN(p)){w.error(i("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){w.error(i("NotAllowDecimalPointsInTrackID"));return}if(g(p)){w.error(i("DuplicateTrackIDsExist"));return}if(!(p>0)){w.error(i("PositiveIntegerCheck"));return}C(p)};h(()=>{t(!1)},[l]);const C=d=>{var p;const x=a({trackID:d});(p=n==null?void 0:n.topViewInstance)==null||p.updatePolygonList(x!=null?x:[])};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,i("CurrentBoxTrackIDs")),l&&e.createElement(ae,{id:l,updateCurrentPolygonList:d=>C(d)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},o&&l?e.createElement(Y,{defaultValue:l,onChange:d=>{v(d.target.value)},disabled:!l,size:"small",onBlur:()=>{s()},onPressEnter:()=>{s(!0)}}):e.createElement("span",null,l),e.createElement(H,{style:{color:"#999",marginLeft:16,cursor:typeof l!="undefined"?"pointer":"not-allowed"},onClick:()=>{l&&t(!o)}})))},W=({attributeList:o,subAttributeList:t,toolInstance:n,config:m,stepList:c,stepInfo:a,enableColorPicker:u})=>{const{selectedBox:v}=$(),i=k(T),{t:l}=D(),{defaultAttribute:g}=se(),s=re(),C={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},d={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},p=(r,b)=>{var _,E,I,y,f;const P=(_=m==null?void 0:m.attributeList)==null?void 0:_.map(S=>S.value===r?O(N({},S),{color:b}):S),V=O(N({},m),{attributeList:P}),q=JSON.stringify(V),G=c==null?void 0:c.map(S=>(S==null?void 0:S.step)===(a==null?void 0:a.step)?O(N({},S),{config:q}):S);(E=i==null?void 0:i.topViewInstance)==null||E.updateAttributeList(P),(I=i==null?void 0:i.sideViewInstance)==null||I.updateAttributeList(P),(y=i==null?void 0:i.backViewInstance)==null||y.updateAttributeList(P),(f=i==null?void 0:i.mainViewInstance)==null||f.setConfig(V),s(pe({stepList:G}))},x=r=>{n.setDefaultAttribute(r)},A=(r,b)=>{n.setSubAttribute(r,b)},J=o.map(r=>({label:r.key,value:r.value,color:r==null?void 0:r.color}));return e.createElement("div",null,e.createElement("div",{style:C},l("Attribute")),e.createElement(U,{list:J,forbidDefault:!0,selectedAttribute:g!=null?g:"",attributeChanged:r=>x(r),updateColorConfig:p,enableColorPicker:u}),e.createElement(j,{style:{margin:0}}),v&&e.createElement(e.Fragment,null,t.map(r=>{var b,_,E,I,y;return(r==null?void 0:r.subSelected)&&e.createElement("div",{style:{marginTop:12},key:r.value},e.createElement("div",{style:d},l("SubAttribute"),"-",r.key),((b=r.subSelected)==null?void 0:b.length)<5?e.createElement(U,{list:r.subSelected.map(f=>({label:f.key,value:f.value})),selectedAttribute:(E=(_=i.selectedPointCloudBox)==null?void 0:_.subAttribute)==null?void 0:E[r.value],num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:f=>A(r.value,f),style:{marginBottom:12}}):e.createElement(F,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:(y=(I=i.selectedPointCloudBox)==null?void 0:I.subAttribute)==null?void 0:y[r.value],placeholder:l("PleaseSelect"),onChange:f=>A(r.value,f),allowClear:!0},r.subSelected.map(f=>e.createElement(F.Option,{key:f.value,value:f.value},f.key))),e.createElement(j,{style:{margin:0}}))})))},_e=[{toolName:"LassoSelector",commonSvg:ce,selectedSvg:ue},{toolName:"CircleSelector",commonSvg:de,selectedSvg:me}],R=({toolInstance:o})=>{const{ptSegmentInstance:t}=k(T),[n,m]=L("LassoSelector"),{t:c}=D();return h(()=>{if(!t)return;const a=()=>{m("LassoSelector")},u=()=>{m("CircleSelector")};return t.on("LassoSelector",a),t.on("CircleSelector",u),()=>{t.unbind("LassoSelector",a),t.unbind("CircleSelector",u)}},[t]),e.createElement("div",{className:`${B}__level`},_e.map(a=>{const u=n===a.toolName;return e.createElement("span",{className:`${B}__toolOption`,key:a.toolName,onClick:()=>t==null?void 0:t.emit(a.toolName)},e.createElement("img",{className:`${B}__singleTool`,src:u?a==null?void 0:a.selectedSvg:a==null?void 0:a.commonSvg}),e.createElement("span",{className:oe({[`${B}__toolOption__selected`]:u})},c(a.toolName)))}))},Ee=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:m,stepList:c,enableColorPicker:a})=>{var u,v;const{updatePointCloudPattern:i,pointCloudPattern:l,isPointCloudSegmentationPattern:g}=ne(),s=te(o.config),C=(u=s==null?void 0:s.attributeList)!=null?u:[],d=(s==null?void 0:s.secondaryAttributeConfigurable)===!0?(v=s==null?void 0:s.inputList)!=null?v:[]:[];return g?e.createElement(e.Fragment,null,e.createElement(R,{toolInstance:t}),e.createElement(W,{toolInstance:t,attributeList:C,subAttributeList:d,config:s,stepList:c,stepInfo:o,enableColorPicker:a})):e.createElement(e.Fragment,null,e.createElement(K,{toolName:Q.EPointCloudName.PointCloud,selectedToolName:l,onChange:p=>i==null?void 0:i(p)}),e.createElement(W,{toolInstance:t,attributeList:C,subAttributeList:d,config:s,stepList:c,stepInfo:o,enableColorPicker:a}),(s==null?void 0:s.trackConfigurable)===!0&&e.createElement(e.Fragment,null,e.createElement(be,null),e.createElement(j,{style:{margin:0}}),e.createElement(xe,{imgList:n,imgIndex:m})))},Ie=o=>{var t,n,m,c;const a=Z.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList),u=(m=o.annotation)==null?void 0:m.toolInstance,v=(c=o.annotation)==null?void 0:c.stepList;return{stepInfo:a,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:v}};var ye=ee(Ie,null,null,{context:le})(Ee);export{R as PointCloudSegToolIcon,ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import l,{useState as
|
|
1
|
+
import l,{useState as p,useContext as d,useEffect as f}from"react";import{connect as g}from"react-redux";import{Divider as b}from"antd/es";import{useTranslation as x}from"react-i18next";import{LabelBeeContext as P}from"../../../../store/ctx.js";import{PointCloudContext as C}from"../../../../components/pointCloudView/PointCloudContext.js";import{EPointCloudPattern as v}from"@labelbee/lb-utils";const h=n=>{var e,o;const{toolInstance:t}=n,[_,a]=p(0),{pointCloudBoxList:u,segmentation:i,globalPattern:s}=d(C),{t:c}=x();if(f(()=>{t&&t.singleOn("updatePageNumber",()=>{a(m=>m+1)})},[t]),!t)return null;const r=((o=(e=t==null?void 0:t.currentPageResult)==null?void 0:e.length)!=null?o:s===v.Detection)?u.length:i.length;return r>=0?l.createElement("span",null,`${c("ItemsOfThisPage")}: ${r}`,l.createElement(b,{type:"vertical",style:{background:"rgba(153, 153, 153, 1)",height:"16px"}})):null},E=n=>{var e;return{toolInstance:(e=n.annotation)==null?void 0:e.toolInstance}};var I=g(E,null,null,{context:P})(h);export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a,{useContext as b}from"react";import{EPointCloudName as f}from"@labelbee/lb-annotation";import{EPointCloudPattern as o}from"@labelbee/lb-utils";import{Button as l}from"antd";import{connect as v}from"react-redux";import{LabelBeeContext as x}from"../../../../store/ctx.js";import{PointCloudContext as g}from"../../../../components/pointCloudView/PointCloudContext.js";import{useTranslation as w}from"react-i18next";const D=({toolName:n})=>{const{t}=w(),{globalPattern:e,setGlobalPattern:i,setTopViewInstance:c,setSideViewInstance:s,setBackViewInstance:m,setMainViewInstance:p,ptSegmentInstance:r,setSelectedIDs:d}=b(g);if(n!==f.PointCloud)return null;const u=()=>{d([]),c(void 0),s(void 0),m(void 0),p(void 0)},C=()=>{r==null||r.emit("clearStash")},S=()=>{C(),i(o.Detection)},P=()=>{u(),i(o.Segmentation)};return a.createElement("span",{style:{margin:"0 10px"}},a.createElement(l,{type:e===o.Detection?"primary":void 0,onClick:S},t("DetectionMode")),a.createElement(l,{type:e===o.Segmentation?"primary":void 0,onClick:P},t("SegmentationMode")))},I=n=>{var t,e;return{toolName:(e=(t=n.annotation.stepList[n.annotation.step-1])==null?void 0:t.tool)!=null?e:""}};var y=v(I,null,null,{context:x})(D);export{y as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.12.0-alpha.
|
|
3
|
+
"version": "1.12.0-alpha.10",
|
|
4
4
|
"description": "Provide a complete library of annotation components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"es": "./es/index.js",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ant-design/icons": "^4.6.2",
|
|
46
|
-
"@labelbee/lb-annotation": "1.16.0-alpha.
|
|
47
|
-
"@labelbee/lb-utils": "1.8.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.16.0-alpha.8",
|
|
47
|
+
"@labelbee/lb-utils": "1.8.0-alpha.6",
|
|
48
48
|
"ahooks": "^3.4.0",
|
|
49
49
|
"classnames": "^2.3.0",
|
|
50
50
|
"lodash": "^4.17.21",
|