@labelbee/lb-components 1.12.0-alpha.2 → 1.12.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/components/AnnotationView/pointCloudAnnotationView.js +1 -1
  2. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  3. package/dist/components/pointCloudView/PointCloudSegment.js +1 -1
  4. package/dist/components/pointCloudView/PointCloudSegmentListener.js +1 -1
  5. package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
  6. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  7. package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
  8. package/dist/components/pointCloudView/hooks/useSphere.js +1 -1
  9. package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
  10. package/dist/components/pointCloudView/index.js +1 -1
  11. package/dist/components/predictTracking/previewResult/index.js +1 -1
  12. package/dist/hooks/annotation.js +1 -1
  13. package/dist/types/App.d.ts +2 -8
  14. package/dist/types/components/pointCloudView/hooks/useHistory.d.ts +1 -0
  15. package/dist/types/hooks/annotation.d.ts +0 -1
  16. package/es/components/AnnotationView/pointCloudAnnotationView.js +1 -1
  17. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  18. package/es/components/pointCloudView/PointCloudSegment.js +1 -1
  19. package/es/components/pointCloudView/PointCloudSegmentListener.js +1 -1
  20. package/es/components/pointCloudView/hooks/useHistory.js +1 -1
  21. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  22. package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
  23. package/es/components/pointCloudView/hooks/useSphere.js +1 -1
  24. package/es/components/pointCloudView/hooks/useStatus.js +1 -1
  25. package/es/components/pointCloudView/index.js +1 -1
  26. package/es/components/predictTracking/previewResult/index.js +1 -1
  27. package/es/hooks/annotation.js +1 -1
  28. 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(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React);function getDefaultOrthographicParams(r){return{left:-r.width/2,right:r.width/2,top:r.height/2,bottom:-r.height/2,near:100,far:-100}}const PointCloudAnnotationView=r=>{const{src:l,result:o,size:i,isOrthographicCamera:u=!1,backgroundColor:f="#ccc"}=r;let c=React.useRef();const e=React.useRef(),d=React.useCallback(t=>{c.current=t},[]);return React.useEffect(()=>{let t={container:c.current,backgroundColor:f,isOrthographicCamera:u};u&&Object.assign(t,{orthographicParams:getDefaultOrthographicParams(i)});const n=new lbAnnotation.PointCloud(t);return e.current=n,()=>{var a;(a=e.current.renderer)==null||a.forceContextLoss()}},[]),React.useEffect(()=>{var t,n,a;e.current&&((t=e.current)==null||t.init(),(n=e.current)==null||n.initOrthographicCamera(getDefaultOrthographicParams(i)),(a=e.current)==null||a.render())},[i]),React.useEffect(()=>{var t;e.current&&l&&((t=e.current)==null||t.loadPCDFile(l))},[l]),React.useEffect(()=>(o&&lbUtils.PointCloudUtils.getBoxParamsFromResultList(o).forEach(n=>{var a;(a=e.current)==null||a.generateBox(n,n.id)}),()=>{var t;lbUtils.PointCloudUtils.getBoxParamsFromResultList(o).forEach(a=>{var s;(s=e.current)==null||s.removeObjectByName(a.id)}),(t=e.current)==null||t.render()}),[o]),React__default.default.createElement("div",{style:i,ref:d})};module.exports=PointCloudAnnotationView;
1
+ "use strict";var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React);function getDefaultOrthographicParams(r){return{left:-r.width/2,right:r.width/2,top:r.height/2,bottom:-r.height/2,near:100,far:-100}}const PointCloudAnnotationView=r=>{const{src:l,result:o,size:i,isOrthographicCamera:u=!1,backgroundColor:f="#ccc"}=r;let c=React.useRef();const e=React.useRef(),d=React.useCallback(t=>{c.current=t},[]);return React.useEffect(()=>{let t={container:c.current,backgroundColor:f,isOrthographicCamera:u};u&&Object.assign(t,{orthographicParams:getDefaultOrthographicParams(i)});const n=new lbAnnotation.PointCloud(t);return e.current=n,()=>{var a;(a=e.current.renderer)==null||a.forceContextLoss()}},[]),React.useEffect(()=>{var t,n,a;e.current&&((t=e.current)==null||t.init(),(n=e.current)==null||n.initOrthographicCamera(getDefaultOrthographicParams(i)),(a=e.current)==null||a.render())},[i]),React.useEffect(()=>{var t;e.current&&l&&((t=e.current)==null||t.loadPCDFile(l))},[l]),React.useEffect(()=>(o&&lbUtils.PointCloudUtils.getBoxParamsFromResultList(o).forEach(n=>{var a;(a=e.current)==null||a.generateBox(n,n.id)}),()=>{var t;lbUtils.PointCloudUtils.getBoxParamsFromResultList(o).forEach(a=>{var s;(s=e.current)==null||s.removeObjectByName(a.id,"box")}),(t=e.current)==null||t.render()}),[o]),React__default.default.createElement("div",{style:i,ref:d})};module.exports=PointCloudAnnotationView;
@@ -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[l,V]=React.useState([]),[p,x]=React.useState([]),[v,F]=React.useState([]),[L,k]=React.useState([]),[a,g]=React.useState([]),[D,z]=React.useState(!0),[B,Z]=React.useState(1),[o,U]=React.useState(),[R,J]=React.useState(),[E,K]=React.useState(),[n,Q]=React.useState(),[H,W]=React.useState(""),[m,X]=React.useState(lbAnnotation.EToolName.Rect),Y=React.useRef(new lbAnnotation.ActionsHistory).current,[s,y]=React.useState([]),[j,$]=React.useState(""),[A,tt]=React.useState(lbUtils.EPointCloudPattern.Detection),[d,_]=React.useState(void 0),[h,et]=React.useState([]),ot=ctx.useDispatch(),q=React.useMemo(()=>a.length===1?a[0]:"",[a]),G=React.useMemo(()=>{const c=l.find(t=>t.id===q),P=t=>{const e=l.concat(t);return V(e),e},I=t=>{const e=p.concat(t);return x(e),e},f=t=>{z(t!==!1)},i=t=>{t===void 0&&g([]),typeof t=="string"&&g([t]),Array.isArray(t)&&g(Array.from(new Set(t)))},st=t=>{a.includes(t)?i(a.filter(e=>e!==t)):i([...a,t])},it=()=>{if(m===lbAnnotation.EToolName.Rect){const t=l.map(e=>e.id);i(t),o==null||o.pointCloud2dOperation.setSelectedIDs(t)}},lt=t=>{i(l.filter(e=>e.attribute===t).map(e=>e.id))},M=l.filter(t=>!s.includes(t.attribute)),N=p.filter(t=>!s.includes(t.attribute)),O=L.filter(t=>t.attribute&&!s.includes(t.attribute)),at=t=>{if(s.includes(t))y(s.filter(e=>e!==t));else{const e=s.concat(t);y(e)}},rt=(t=M,e=v,C=N,u=O,b=h)=>{var S;l.forEach(w=>{n==null||n.removeObjectByName(w.id)}),p.forEach(w=>{n==null||n.removeObjectByName(w.id)}),o==null||o.updatePolygonList(t,e),o==null||o.updatePointList(C),o==null||o.updateLineList(u),n==null||n.generateBoxes(t),n==null||n.generateSpheres(C),(S=d==null?void 0:d.store)==null||S.updateCurrentSegment(b),T(t)},T=t=>{const e=n==null?void 0:n.highlightOriginPointCloud(t);return new Promise(C=>{e==null||e.then(u=>{[o].forEach(b=>{var S;u&&((S=b==null?void 0:b.pointCloudInstance)==null||S.updateColor(u),C({color:u}))})}).catch(u=>{console.error(u)})})};return{selectedID:q,pointCloudBoxList:l,pointCloudSphereList:p,displayPointCloudList:M,displaySphereList:N,displayLineList:O,selectedIDs:a,setPointCloudResult:V,setSelectedIDs:i,addPointCloudBox:P,addPointCloudSphere:I,setPointCloudSphereList:x,valid:D,selectedPointCloudBox:c,setPointCloudValid:f,addSelectedID:st,selectedAllBoxes:it,topViewInstance:o,setTopViewInstance:U,sideViewInstance:R,setSideViewInstance:J,backViewInstance:E,setBackViewInstance:K,mainViewInstance:n,setMainViewInstance:Q,polygonList:v,setPolygonList:F,lineList:L,setLineList:k,zoom:B,setZoom:Z,history:Y,toggleAttributesVisible:at,hideAttributes:s,setHideAttributes:y,reRender:rt,attrPanelLayout:j,setAttrPanelLayout:$,syncAllViewPointCloudColor:T,defaultAttribute:H,setDefaultAttribute:W,pointCloudPattern:m,setPointCloudPattern:X,selectSpecAttr:lt,globalPattern:A,setGlobalPattern:t=>{A!==t&&(ot(actionCreators.ChangeSave),tt(t),t===lbUtils.EPointCloudPattern.Detection&&_(void 0))},ptSegmentInstance:d,setPtSegmentInstance:_,segmentation:h,setSegmentation:et}},[D,a,l,p,v,L,o,R,E,n,B,s,j,H,m,A,d,h]),nt=()=>{const c=l.filter(i=>s.includes(i.attribute)),{setSelectedIDs:P,reRender:I}=G,f=c.map(i=>i.id);f.length>0&&P(a.filter(i=>!f.includes(i))),I()};return React.useEffect(()=>{var c,P;nt(),(c=o==null?void 0:o.toolInstance)==null||c.setHiddenAttributes(s),(P=d==null?void 0:d.store)==null||P.setHiddenAttributes(s)},[s]),React__default.default.createElement(PointCloudContext.Provider,{value:G},r)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
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[a,w]=React.useState([]),[f,V]=React.useState([]),[L,k]=React.useState([]),[g,N]=React.useState([]),[l,A]=React.useState([]),[x,O]=React.useState(!0),[D,z]=React.useState(1),[o,Z]=React.useState(),[R,U]=React.useState(),[B,J]=React.useState(),[n,K]=React.useState(),[E,Q]=React.useState(""),[h,W]=React.useState(lbAnnotation.EToolName.Rect),X=React.useRef(new lbAnnotation.ActionsHistory).current,[s,m]=React.useState([]),[H,Y]=React.useState(""),[y,$]=React.useState(lbUtils.EPointCloudPattern.Detection),[p,_]=React.useState(void 0),[I,tt]=React.useState([]),et=ctx.useDispatch(),q=React.useMemo(()=>l.length===1?l[0]:"",[l]),G=React.useMemo(()=>{const u=a.find(t=>t.id===q),S=t=>{const e=a.concat(t);return w(e),e},d=t=>{const e=f.concat(t);return V(e),e},c=t=>{O(t!==!1)},i=t=>{t===void 0&&A([]),typeof t=="string"&&A([t]),Array.isArray(t)&&A(Array.from(new Set(t)))},nt=t=>{l.includes(t)?i(l.filter(e=>e!==t)):i([...l,t])},st=()=>{if(h===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))},M=a.filter(t=>!s.includes(t.attribute)),T=f.filter(t=>!s.includes(t.attribute)),j=g.filter(t=>t.attribute&&!s.includes(t.attribute)),lt=t=>{if(s.includes(t))m(s.filter(e=>e!==t));else{const e=s.concat(t);m(e)}},at=(t=M,e=L,v=T,P=j,b=I)=>{var C;n==null||n.clearAllBox(),n==null||n.clearAllSphere(),o==null||o.updatePolygonList(t,e),o==null||o.updatePointList(v),o==null||o.updateLineList(P),n==null||n.generateBoxes(t),n==null||n.generateSpheres(v),(C=p==null?void 0:p.store)==null||C.updateCurrentSegment(b),F(t)},F=t=>{const e=n==null?void 0:n.highlightOriginPointCloud(t);return new Promise(v=>{e==null||e.then(P=>{[o].forEach(b=>{var C;P&&((C=b==null?void 0:b.pointCloudInstance)==null||C.updateColor(P),v({color:P}))})}).catch(P=>{console.error(P)})})};return{selectedID:q,pointCloudBoxList:a,pointCloudSphereList:f,displayPointCloudList:M,displaySphereList:T,displayLineList:j,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:Z,sideViewInstance:R,setSideViewInstance:U,backViewInstance:B,setBackViewInstance:J,mainViewInstance:n,setMainViewInstance:K,polygonList:L,setPolygonList:k,lineList:g,setLineList:N,zoom:D,setZoom:z,history:X,toggleAttributesVisible:lt,hideAttributes:s,setHideAttributes:m,reRender:at,attrPanelLayout:H,setAttrPanelLayout:Y,syncAllViewPointCloudColor:F,defaultAttribute:E,setDefaultAttribute:Q,pointCloudPattern:h,setPointCloudPattern:W,selectSpecAttr:it,globalPattern:y,setGlobalPattern:t=>{y!==t&&(et(actionCreators.ChangeSave),$(t),t===lbUtils.EPointCloudPattern.Detection&&_(void 0))},ptSegmentInstance:p,setPtSegmentInstance:_,segmentation:I,setSegmentation:tt}},[x,l,a,f,L,g,o,R,B,n,D,s,H,E,h,y,p,I]),ot=()=>{const u=a.filter(i=>s.includes(i.attribute)),{setSelectedIDs:S,reRender:d}=G,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:G},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:a,checkMode:f})=>{var o,u;const n=React.useRef(null),{setPtSegmentInstance:c,setDefaultAttribute:d,ptSegmentInstance:r}=React.useContext(PointCloudContext.PointCloudContext),t=useSize(n),i=(u=(o=a==null?void 0:a.attributeList)==null?void 0:o[0])==null?void 0:u.value;return React.useEffect(()=>{var l;if(!(t==null?void 0:t.width)||!n.current||r)return;const v={left:-t.width/2,right:t.width/2,top:t.height/2,bottom:-t.height/2,near:100,far:-100},s=new lbAnnotation.PointCloud({container:n.current,isOrthographicCamera:!0,isSegment:!0,orthographicParams:v,config:a});(l=s.store)==null||l.setAttribute(i),d(i),c(s)},[t]),React.useEffect(()=>{r&&(r.initRenderer(),r.initOrthographicCamera(lbUtils.PointCloudUtils.getDefaultOrthographic(t)),r.render())},[t]),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),ref:n})};var PointCloudSegment$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegment);module.exports=PointCloudSegment$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(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const PointCloudSegment=({currentData:t,config:a,checkMode:f})=>{var o,u;const n=React.useRef(null),{setPtSegmentInstance:c,setDefaultAttribute:d,ptSegmentInstance:r}=React.useContext(PointCloudContext.PointCloudContext),e=useSize(n),i=(u=(o=a==null?void 0:a.attributeList)==null?void 0:o[0])==null?void 0:u.value;return React.useEffect(()=>{var l;if(!(e==null?void 0:e.width)||!n.current||r)return;const v={left:-e.width/2,right:e.width/2,top:e.height/2,bottom:-e.height/2,near:1e3,far:-1e3},s=new lbAnnotation.PointCloud({container:n.current,isOrthographicCamera:!0,isSegment:!0,orthographicParams:v,config:a});(l=s.store)==null||l.setAttribute(i),d(i),c(s)},[e]),React.useEffect(()=>{r&&(r.initRenderer(),r.initOrthographicCamera(lbUtils.PointCloudUtils.getDefaultOrthographic(e)),r.render())},[e]),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),ref:n})};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: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.loadPCDFile((t=r==null?void 0:r.url)!=null?t:"").then(()=>{var o,l;e.emit("clearAllSegmentData");const i=lbUtils.PointCloudUtils.getSegmentFromResultList((o=r==null?void 0:r.result)!=null?o:"");(l=e==null?void 0:e.store)==null||l.updateCurrentSegment(i)}),e.on("syncSegmentData",s),()=>{e.unbind("syncSegmentData",s)}},[m,e]),React.useEffect(()=>{var t,o;let l=(t=v.attributeList.find(i=>(i==null?void 0:i.key)===u))==null?void 0:t.value;(o=e==null?void 0:e.store)==null||o.highlightPointsByAttribute(l!=null?l:"")},[u,e]);const S=(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",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=(l=e.store)==null?void 0:l.cacheSegData)==null?void 0:i.id);break}},d=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||c===!0)return;const o=t.key.toLocaleLowerCase();S(o)};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
+ "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("clearAllSegmentData"),e.loadPCDFile((t=r==null?void 0:r.url)!=null?t:"").then(()=>{var o,l;const i=lbUtils.PointCloudUtils.getSegmentFromResultList((o=r==null?void 0:r.result)!=null?o:"");(l=e==null?void 0:e.store)==null||l.updateCurrentSegment(i)}),e.on("syncSegmentData",s),()=>{e.unbind("syncSegmentData",s)}},[m,e]),React.useEffect(()=>{var t,o;let l=(t=v.attributeList.find(i=>(i==null?void 0:i.key)===u))==null?void 0:t.value;(o=e==null?void 0:e.store)==null||o.highlightPointsByAttribute(l!=null?l:"")},[u,e]);const S=(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",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=(l=e.store)==null?void 0:l.cacheSegData)==null?void 0:i.id);break}},d=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||c===!0)return;const o=t.key.toLocaleLowerCase();S(o)};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";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,l)=>s in e?__defProp(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l,__spreadValues=(e,s)=>{for(var l in s||(s={}))__hasOwnProp.call(s,l)&&__defNormalProp(e,l,s[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(s))__propIsEnum.call(s,l)&&__defNormalProp(e,l,s[l]);return e};const useHistory=()=>{const{history:e,setPointCloudResult:s,setSelectedIDs:l,pointCloudBoxList:p,pointCloudSphereList:L,setPointCloudSphereList:x,mainViewInstance:u,topViewInstance:f,polygonList:y,setPolygonList:g,lineList:C,setLineList:P,syncAllViewPointCloudColor:_,segmentation:S}=React.useContext(PointCloudContext.PointCloudContext),B=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:r})=>{const d={pointCloudBoxList:p,polygonList:y,lineList:C,pointCloudSphereList:L};t&&(d.pointCloudBoxList=p.concat(t)),o&&(d.polygonList=y.concat(o)),i&&(d.lineList=C.concat(i)),r&&(d.pointCloudSphereList=L.concat(r)),e.pushHistory(d)},H=t=>{const o={pointCloudBoxList:p,polygonList:y,lineList:C,pointCloudSphereList:L,segmentation:S};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)},O=t=>{if(C.find(i=>i.id===t.id)){const i=C.map(r=>r.id===t.id?t:__spreadValues({},r));e.pushHistory({lineList:i}),P(i)}},w=t=>{if(y.find(i=>i.id===t.id)){const i=y.map(r=>r.id===t.id?t:__spreadValues({},r));e.pushHistory({pointCloudBoxList:p,polygonList:i}),g(i)}},j=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i})=>{e.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i},!0)},v=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:r=[],pointCloudSphereList:d=[]}=t;if(o){p.length!==o.length&&l();const h=p.filter(n=>o.every(c=>c.id!==n.id)),a=o.filter(n=>p.every(c=>c.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),a.forEach(n=>{u==null||u.generateBox(n)}),s(o),_(o)}if(d){L.length!==d.length&&l();let h=L.filter(n=>d.every(c=>c.id!==n.id)),a=d.filter(n=>L.every(c=>c.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),a.forEach(n=>{u==null||u.generateSphere(n)}),x(d)}i&&g(i),r&&P(r),f==null||f.updatePolygonList(o!=null?o:[],i!=null?i:[]),f==null||f.updateLineList(r!=null?r:[]),f==null||f.updatePointList(d)};return{addHistory:B,pushHistoryWithList:H,initHistory:j,pushHistoryUnderUpdatePolygon:w,pushHistoryUnderUpdateLine:O,redo:()=>{v(e.redo())},undo:()=>{v(e.undo())}}};exports.useHistory=useHistory;
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,b=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 U={center:{x:b.x,y:b.y,z:r},width:_,height:I,depth:d,rotation:D,id:e.id},S=__spreadValues(l?__spreadValues(__spreadValues({},l),U):__spreadProps(__spreadValues({},U),{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]),b={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-_,U=lbAnnotation.MathUtils.getLineLength(a,p),S=lbAnnotation.MathUtils.getLineLength(d,g),O=U-S,{newBoxParams:v}=l.getNewBoxBySideUpdate(b,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]),b={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-_,U=lbAnnotation.MathUtils.getLineLength(a,p),S=lbAnnotation.MathUtils.getLineLength(d,g),O=U-S;let{newBoxParams:v}=l.getNewBoxByBackUpdate(b,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:b,pushHistoryUnderUpdatePolygon:I,pushHistoryUnderUpdateLine:_}=useHistory.useHistory(),{selectedPolygon:D}=usePolygon.usePolygon(),{updateSelectedBox:U,updateSelectedBoxes:S,getPointCloudByID:O}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:v,updatePointCloudSphere:H,selectedSphere:z}=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 j=o==null?void 0:o.toolInstance,w=__spreadValues({},n),{boxParams:B,newPointList:T}=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})),j.deletePolygon(B.id);return}C&&(T==null?void 0:T.length)&&(w.pointList=T);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),j.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||z)&&d.length===1){const h=P!=null?P:z;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=U(u);return R(P,n,u,void 0,C),C}},W=(n,s,P)=>{if(z){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,z);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={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};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=[],j=[],w=[],B=[];s.result&&(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),w=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),j=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),B=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(m),t==null||t.generateSpheres(B),e.syncAllViewPointCloudColor(m)),b({pointCloudBoxList:m,polygonList:w,lineList:j,pointCloudSphereList:B}),t.updateTopCamera();const T=(u=(c=index.jsonParser(s.result))==null?void 0:c.valid)!=null?u:!0;e.setPointCloudValid(T),(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:v,mainViewInstance:s,setSelectedIDs:I,syncAllViewPointCloudColor:C,polygonList:O,pointCloudPattern:x}=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===v);if(o>-1)return{info:e[o],index:o}},[v,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},[v,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(x!==lbAnnotation.EToolName.Rect&&x!==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,x,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),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
+ "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:s,sideViewInstance:r,backViewInstance:a,mainViewInstance:o,pointCloudBoxList:c,pointCloudSphereList:d,setPointCloudResult:P,setPointCloudSphereList:C,setPolygonList:v,pointCloudPattern:u,setPointCloudPattern:n,syncAllViewPointCloudColor:b,globalPattern:h,setLineList:p}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:y}=useHistory.useHistory(),L=()=>{c.forEach(e=>{o==null||o.removeObjectByName(e.id)}),d.forEach(e=>{o==null||o.removeObjectByName(e.id)}),o==null||o.render(),P([]),v([]),C([]),p([]),s==null||s.toolScheduler.clearStatusAndResult(),b([]),y({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),a==null||a.toolInstance.clearResult()};return{clearAllResult:L,updatePointCloudPattern:e=>{if(e===u)return;const i=[s,r,a];switch(e){case EToolName.Rect:l(),i.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Rect)}),n(EToolName.Rect);break;case EToolName.Polygon:l(),i.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Normal)}),n(EToolName.Polygon);break;case EToolName.Point:l(),i.forEach(t=>{t==null||t.switchToCanvas(EToolName.Point)}),n(EToolName.Point);break;case EToolName.Line:l(),i.forEach(t=>{t==null||t.switchToCanvas(EToolName.Line)}),n(EToolName.Line);break}},pointCloudPattern:u,isSegmentPattern:h===lbUtils.EPointCloudPattern.Segmentation}};exports.useStatus=useStatus;
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:s,sideViewInstance:i,backViewInstance:r,mainViewInstance:o,setPointCloudResult:c,setPointCloudSphereList:d,setPolygonList:P,pointCloudPattern:a,setPointCloudPattern:e,syncAllViewPointCloudColor:C,globalPattern:v,setLineList:b}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:h}=useHistory.useHistory(),p=()=>{o==null||o.clearAllBox(),o==null||o.clearAllSphere(),o==null||o.render(),c([]),P([]),d([]),b([]),s==null||s.toolScheduler.clearStatusAndResult(),C([]),h({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},l=()=>{i==null||i.toolInstance.clearResult(),r==null||r.toolInstance.clearResult()};return{clearAllResult:p,updatePointCloudPattern:u=>{if(u===a)return;const n=[s,i,r];switch(u){case EToolName.Rect:l(),n.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Rect)}),e(EToolName.Rect);break;case EToolName.Polygon:l(),n.forEach(t=>{t==null||t.switchToCanvas(EToolName.PointCloudPolygon),t==null||t.toolInstance.setPattern(EPolygonPattern.Normal)}),e(EToolName.Polygon);break;case EToolName.Point:l(),n.forEach(t=>{t==null||t.switchToCanvas(EToolName.Point)}),e(EToolName.Point);break;case EToolName.Line:l(),n.forEach(t=>{t==null||t.switchToCanvas(EToolName.Line)}),e(EToolName.Line);break}},pointCloudPattern:a,isSegmentPattern:v===lbUtils.EPointCloudPattern.Segmentation}};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:s,drawLayerSlot:d,checkMode:a,intelligentFit:c})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:o,setGlobalPattern:m}=e,C=index.jsonParser(t.result),{toolInstanceRef:l,clearToolInstance:f}=annotation.useCustomToolInstance({basicInfo:C});return React.useEffect(()=>{l.current.setPointCloudGlobalPattern=n=>{n!==o&&(m(n),f())},l.current.getPointCloudGlobalPattern=()=>o},[o]),React.useEffect(()=>{l.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],l.current.exportCustomData=()=>{var n,r,u,i;return{resultPolygon:(n=e.polygonList)!=null?n:[],resultLine:(r=e.lineList)!=null?r:[],resultPoint:(u=e.pointCloudSphereList)!=null?u:[],segmentation:(i=e.segmentation)!=null?i:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),s.length===0?null:o===lbUtils.EPointCloudPattern.Segmentation?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:a,toolInstanceRef:l}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement(PointCloudSegment,null),React__default.default.createElement(PointCloudSegmentStatus,null)):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:a,toolInstanceRef:l}),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:d,checkMode:a,intelligentFit:c}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","right-bottom")},React__default.default.createElement(PointCloudSideView,{checkMode:a}),React__default.default.createElement(PointCloudBackView,{checkMode:a})))),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
+ "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),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,null),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 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=l=>{try{i(a.next(l))}catch(s){n(s)}},r=l=>{try{i(a.throw(l))}catch(s){n(s)}},i=l=>l.done?c(l.value):Promise.resolve(l.value).then(o,r);i((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:i}=reactI18next.useTranslation(),l=()=>{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),l()});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,i("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:l},i("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},i("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),i={width:600,height:600};return React.useEffect(()=>{(()=>__async(void 0,null,function*(){var s,f,g,v,C,h;const p=(s=t.mainViewInstance)==null?void 0:s.config;if(p&&r.current){const P={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:200,far:-200},u=new lbAnnotation.PointCloud({container:r.current,isOrthographicCamera:!0,orthographicParams:P,config:p});u.setShowDirection(!1);for(const d of c){const{index:m}=d,y=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(y,d,{width:2,height:2,depth:2}),yield u.updateCameraZoom(t.zoom);const N=(h=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},p),{attributeConfigurable:!0}),{}))==null?void 0:h.fill;u.generateBox(d,N),yield util.sleep(500),yield util.getViewsDataUrl(u,d,t.zoom),yield u.removeObjectByName(d.id),yield u.clearPointCloudAndRender()}o(c),actionCreators.SetPointCloudLoading(a,!1)}}))()},[]),React__default.default.createElement("div",{style:i,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;
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=l=>{try{i(a.next(l))}catch(s){n(s)}},r=l=>{try{i(a.throw(l))}catch(s){n(s)}},i=l=>l.done?c(l.value):Promise.resolve(l.value).then(o,r);i((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:i}=reactI18next.useTranslation(),l=()=>{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),l()});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,i("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:l},i("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},i("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),i={width:600,height:600};return React.useEffect(()=>{(()=>__async(void 0,null,function*(){var s,f,g,v,C,h;const p=(s=t.mainViewInstance)==null?void 0:s.config;if(p&&r.current){const P={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:200,far:-200},u=new lbAnnotation.PointCloud({container:r.current,isOrthographicCamera:!0,orthographicParams:P,config:p});u.setShowDirection(!1);for(const d of c){const{index:m}=d,y=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(y,d,{width:2,height:2,depth:2}),yield u.updateCameraZoom(t.zoom);const N=(h=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},p),{attributeConfigurable:!0}),{}))==null?void 0:h.fill;u.generateBox(d,N),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:i,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;
@@ -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"),lbUtils=require("@labelbee/lb-utils");const useCustomToolInstance=({basicInfo:o}={})=>{var r;const n=ctx.useDispatch(),s={valid:(r=o==null?void 0:o.valid)!=null?r:!0,exportData:()=>[[],{}],exportCustomData:()=>({}),clearResult:()=>{},singleOn:()=>{},on:()=>{},unbind:()=>{},setResult:()=>{},history:{initRecord:()=>{},pushHistory:()=>{}},setDefaultAttribute:t=>{},setForbidOperation:()=>{},setShowDefaultCursor:()=>{},setSubAttribute:(t,i)=>{},setValid:()=>{},updateRotate:()=>{},redo:()=>{},undo:()=>{},setPointCloudGlobalPattern:t=>{},getPointCloudGlobalPattern:()=>lbUtils.EPointCloudPattern.Detection},e=React.useRef(s),a=t=>{n({type:Actions.ANNOTATION_ACTIONS.SET_TOOL,payload:{instance:t}})},u=()=>{n({type:Actions.ANNOTATION_ACTIONS.SET_TOOL,payload:{instance:void 0}})},l=()=>{Object.assign(e.current,s)};return React.useEffect(()=>(a(e.current),()=>{u()}),[]),{toolInstanceRef:e,clearToolInstance:l}};exports.useCustomToolInstance=useCustomToolInstance;
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;
@@ -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?: (props: {
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;
@@ -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;
@@ -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
- import{PointCloud as g}from"@labelbee/lb-annotation";import{PointCloudUtils as m}from"@labelbee/lb-utils";import p,{useRef as f,useCallback as P,useEffect as l}from"react";function b(a){return{left:-a.width/2,right:a.width/2,top:a.height/2,bottom:-a.height/2,near:100,far:-100}}const C=a=>{const{src:c,result:n,size:i,isOrthographicCamera:u=!1,backgroundColor:h="#ccc"}=a;let s=f();const t=f(),v=P(r=>{s.current=r},[]);return l(()=>{let r={container:s.current,backgroundColor:h,isOrthographicCamera:u};u&&Object.assign(r,{orthographicParams:b(i)});const o=new g(r);return t.current=o,()=>{var e;(e=t.current.renderer)==null||e.forceContextLoss()}},[]),l(()=>{var r,o,e;t.current&&((r=t.current)==null||r.init(),(o=t.current)==null||o.initOrthographicCamera(b(i)),(e=t.current)==null||e.render())},[i]),l(()=>{var r;t.current&&c&&((r=t.current)==null||r.loadPCDFile(c))},[c]),l(()=>(n&&m.getBoxParamsFromResultList(n).forEach(o=>{var e;(e=t.current)==null||e.generateBox(o,o.id)}),()=>{var r;m.getBoxParamsFromResultList(n).forEach(e=>{var d;(d=t.current)==null||d.removeObjectByName(e.id)}),(r=t.current)==null||r.render()}),[n]),p.createElement("div",{style:i,ref:v})};export{C as default};
1
+ import{PointCloud as g}from"@labelbee/lb-annotation";import{PointCloudUtils as m}from"@labelbee/lb-utils";import p,{useRef as f,useCallback as P,useEffect as l}from"react";function b(a){return{left:-a.width/2,right:a.width/2,top:a.height/2,bottom:-a.height/2,near:100,far:-100}}const C=a=>{const{src:c,result:n,size:i,isOrthographicCamera:u=!1,backgroundColor:h="#ccc"}=a;let s=f();const t=f(),v=P(r=>{s.current=r},[]);return l(()=>{let r={container:s.current,backgroundColor:h,isOrthographicCamera:u};u&&Object.assign(r,{orthographicParams:b(i)});const o=new g(r);return t.current=o,()=>{var e;(e=t.current.renderer)==null||e.forceContextLoss()}},[]),l(()=>{var r,o,e;t.current&&((r=t.current)==null||r.init(),(o=t.current)==null||o.initOrthographicCamera(b(i)),(e=t.current)==null||e.render())},[i]),l(()=>{var r;t.current&&c&&((r=t.current)==null||r.loadPCDFile(c))},[c]),l(()=>(n&&m.getBoxParamsFromResultList(n).forEach(o=>{var e;(e=t.current)==null||e.generateBox(o,o.id)}),()=>{var r;m.getBoxParamsFromResultList(n).forEach(e=>{var d;(d=t.current)==null||d.removeObjectByName(e.id,"box")}),(r=t.current)==null||r.render()}),[n]),p.createElement("div",{style:i,ref:v})};export{C as default};
@@ -1 +1 @@
1
- import{EPointCloudPattern as V}from"@labelbee/lb-utils";import _,{useState as o,useRef as bt,useMemo as q,useEffect as mt}from"react";import{ActionsHistory as J,EToolName as x}from"@labelbee/lb-annotation";import{useDispatch as vt}from"../../store/ctx.js";import{ChangeSave as Lt}from"../../store/annotation/actionCreators.js";const 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 J,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:x.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:V.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{}}),St=({children:Q})=>{const[r,D]=o([]),[P,B]=o([]),[v,U]=o([]),[L,W]=o([]),[a,S]=o([]),[R,X]=o(!0),[E,Y]=o(1),[n,$]=o(),[H,tt]=o(),[G,et]=o(),[i,ot]=o(),[j,nt]=o(""),[g,it]=o(x.Rect),st=bt(new J).current,[s,h]=o([]),[F,lt]=o(""),[A,rt]=o(V.Detection),[c,O]=o(void 0),[I,at]=o([]),dt=vt(),k=q(()=>a.length===1?a[0]:"",[a]),M=q(()=>{const u=r.find(t=>t.id===k),p=t=>{const e=r.concat(t);return D(e),e},y=t=>{const e=P.concat(t);return B(e),e},C=t=>{X(t!==!1)},l=t=>{t===void 0&&S([]),typeof t=="string"&&S([t]),Array.isArray(t)&&S(Array.from(new Set(t)))},ut=t=>{a.includes(t)?l(a.filter(e=>e!==t)):l([...a,t])},pt=()=>{if(g===x.Rect){const t=r.map(e=>e.id);l(t),n==null||n.pointCloud2dOperation.setSelectedIDs(t)}},Pt=t=>{l(r.filter(e=>e.attribute===t).map(e=>e.id))},N=r.filter(t=>!s.includes(t.attribute)),T=P.filter(t=>!s.includes(t.attribute)),z=L.filter(t=>t.attribute&&!s.includes(t.attribute)),ft=t=>{if(s.includes(t))h(s.filter(e=>e!==t));else{const e=s.concat(t);h(e)}},Ct=(t=N,e=v,b=T,d=z,m=I)=>{var f;r.forEach(w=>{i==null||i.removeObjectByName(w.id)}),P.forEach(w=>{i==null||i.removeObjectByName(w.id)}),n==null||n.updatePolygonList(t,e),n==null||n.updatePointList(b),n==null||n.updateLineList(d),i==null||i.generateBoxes(t),i==null||i.generateSpheres(b),(f=c==null?void 0:c.store)==null||f.updateCurrentSegment(m),Z(t)},Z=t=>{const e=i==null?void 0:i.highlightOriginPointCloud(t);return new Promise(b=>{e==null||e.then(d=>{[n].forEach(m=>{var f;d&&((f=m==null?void 0:m.pointCloudInstance)==null||f.updateColor(d),b({color:d}))})}).catch(d=>{console.error(d)})})};return{selectedID:k,pointCloudBoxList:r,pointCloudSphereList:P,displayPointCloudList:N,displaySphereList:T,displayLineList:z,selectedIDs:a,setPointCloudResult:D,setSelectedIDs:l,addPointCloudBox:p,addPointCloudSphere:y,setPointCloudSphereList:B,valid:R,selectedPointCloudBox:u,setPointCloudValid:C,addSelectedID:ut,selectedAllBoxes:pt,topViewInstance:n,setTopViewInstance:$,sideViewInstance:H,setSideViewInstance:tt,backViewInstance:G,setBackViewInstance:et,mainViewInstance:i,setMainViewInstance:ot,polygonList:v,setPolygonList:U,lineList:L,setLineList:W,zoom:E,setZoom:Y,history:st,toggleAttributesVisible:ft,hideAttributes:s,setHideAttributes:h,reRender:Ct,attrPanelLayout:F,setAttrPanelLayout:lt,syncAllViewPointCloudColor:Z,defaultAttribute:j,setDefaultAttribute:nt,pointCloudPattern:g,setPointCloudPattern:it,selectSpecAttr:Pt,globalPattern:A,setGlobalPattern:t=>{A!==t&&(dt(Lt),rt(t),t===V.Detection&&O(void 0))},ptSegmentInstance:c,setPtSegmentInstance:O,segmentation:I,setSegmentation:at}},[R,a,r,P,v,L,n,H,G,i,E,s,F,j,g,A,c,I]),ct=()=>{const u=r.filter(l=>s.includes(l.attribute)),{setSelectedIDs:p,reRender:y}=M,C=u.map(l=>l.id);C.length>0&&p(a.filter(l=>!C.includes(l))),y()};return mt(()=>{var u,p;ct(),(u=n==null?void 0:n.toolInstance)==null||u.setHiddenAttributes(s),(p=c==null?void 0:c.store)==null||p.setHiddenAttributes(s)},[s]),_.createElement(K.Provider,{value:M},Q)};export{K as PointCloudContext,St as PointCloudProvider};
1
+ import{EPointCloudPattern as w}from"@labelbee/lb-utils";import Z,{useState as n,useRef as Ct,useMemo as N,useEffect as bt}from"react";import{ActionsHistory as q,EToolName as V}from"@labelbee/lb-annotation";import{useDispatch as mt}from"../../store/ctx.js";import{ChangeSave as vt}from"../../store/annotation/actionCreators.js";const J=Z.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 q,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:V.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:w.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{}}),Lt=({children:K})=>{const[a,x]=n([]),[b,D]=n([]),[L,Q]=n([]),[S,U]=n([]),[r,g]=n([]),[B,W]=n(!0),[R,X]=n(1),[o,Y]=n(),[H,$]=n(),[E,tt]=n(),[i,et]=n(),[G,nt]=n(""),[A,ot]=n(V.Rect),it=Ct(new q).current,[s,h]=n([]),[F,st]=n(""),[I,lt]=n(w.Detection),[P,k]=n(void 0),[y,rt]=n([]),at=mt(),M=N(()=>r.length===1?r[0]:"",[r]),T=N(()=>{const d=a.find(t=>t.id===M),f=t=>{const e=a.concat(t);return x(e),e},c=t=>{const e=b.concat(t);return D(e),e},u=t=>{W(t!==!1)},l=t=>{t===void 0&&g([]),typeof t=="string"&&g([t]),Array.isArray(t)&&g(Array.from(new Set(t)))},ct=t=>{r.includes(t)?l(r.filter(e=>e!==t)):l([...r,t])},ut=()=>{if(A===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))},_=a.filter(t=>!s.includes(t.attribute)),j=b.filter(t=>!s.includes(t.attribute)),z=S.filter(t=>t.attribute&&!s.includes(t.attribute)),Pt=t=>{if(s.includes(t))h(s.filter(e=>e!==t));else{const e=s.concat(t);h(e)}},ft=(t=_,e=L,m=j,p=z,v=y)=>{var C;i==null||i.clearAllBox(),i==null||i.clearAllSphere(),o==null||o.updatePolygonList(t,e),o==null||o.updatePointList(m),o==null||o.updateLineList(p),i==null||i.generateBoxes(t),i==null||i.generateSpheres(m),(C=P==null?void 0:P.store)==null||C.updateCurrentSegment(v),O(t)},O=t=>{const e=i==null?void 0:i.highlightOriginPointCloud(t);return new Promise(m=>{e==null||e.then(p=>{[o].forEach(v=>{var C;p&&((C=v==null?void 0:v.pointCloudInstance)==null||C.updateColor(p),m({color:p}))})}).catch(p=>{console.error(p)})})};return{selectedID:M,pointCloudBoxList:a,pointCloudSphereList:b,displayPointCloudList:_,displaySphereList:j,displayLineList:z,selectedIDs:r,setPointCloudResult:x,setSelectedIDs:l,addPointCloudBox:f,addPointCloudSphere:c,setPointCloudSphereList:D,valid:B,selectedPointCloudBox:d,setPointCloudValid:u,addSelectedID:ct,selectedAllBoxes:ut,topViewInstance:o,setTopViewInstance:Y,sideViewInstance:H,setSideViewInstance:$,backViewInstance:E,setBackViewInstance:tt,mainViewInstance:i,setMainViewInstance:et,polygonList:L,setPolygonList:Q,lineList:S,setLineList:U,zoom:R,setZoom:X,history:it,toggleAttributesVisible:Pt,hideAttributes:s,setHideAttributes:h,reRender:ft,attrPanelLayout:F,setAttrPanelLayout:st,syncAllViewPointCloudColor:O,defaultAttribute:G,setDefaultAttribute:nt,pointCloudPattern:A,setPointCloudPattern:ot,selectSpecAttr:pt,globalPattern:I,setGlobalPattern:t=>{I!==t&&(at(vt),lt(t),t===w.Detection&&k(void 0))},ptSegmentInstance:P,setPtSegmentInstance:k,segmentation:y,setSegmentation:rt}},[B,r,a,b,L,S,o,H,E,i,R,s,F,G,A,I,P,y]),dt=()=>{const d=a.filter(l=>s.includes(l.attribute)),{setSelectedIDs:f,reRender:c}=T,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]),Z.createElement(J.Provider,{value:T},K)};export{J as PointCloudContext,Lt as PointCloudProvider};
@@ -1 +1 @@
1
- import f from"../../hooks/useSize.js";import{a2MapStateToProps as p}from"../../store/annotation/map.js";import{LabelBeeContext as h}from"../../store/ctx.js";import{getClassName as b}from"../../utils/dom.js";import{PointCloud as g}from"@labelbee/lb-annotation";import C,{useRef as v,useContext as P,useEffect as u}from"react";import{connect as S}from"react-redux";import{PointCloudContext as x}from"./PointCloudContext.js";import{PointCloudUtils as j}from"@labelbee/lb-utils";const w=({currentData:z,config:r,checkMode:A})=>{var n,i;const o=v(null),{setPtSegmentInstance:m,setDefaultAttribute:c,ptSegmentInstance:e}=P(x),t=f(o),a=(i=(n=r==null?void 0:r.attributeList)==null?void 0:n[0])==null?void 0:i.value;return u(()=>{var l;if(!(t==null?void 0:t.width)||!o.current||e)return;const d={left:-t.width/2,right:t.width/2,top:t.height/2,bottom:-t.height/2,near:100,far:-100},s=new g({container:o.current,isOrthographicCamera:!0,isSegment:!0,orthographicParams:d,config:r});(l=s.store)==null||l.setAttribute(a),c(a),m(s)},[t]),u(()=>{e&&(e.initRenderer(),e.initOrthographicCamera(j.getDefaultOrthographic(t)),e.render())},[t]),C.createElement("div",{className:b("point-cloud-layout"),ref:o})};var R=S(p,null,null,{context:h})(w);export{R as default};
1
+ import f from"../../hooks/useSize.js";import{a2MapStateToProps as p}from"../../store/annotation/map.js";import{LabelBeeContext as h}from"../../store/ctx.js";import{getClassName as b}from"../../utils/dom.js";import{PointCloud as g}from"@labelbee/lb-annotation";import C,{useRef as v,useContext as P,useEffect as u}from"react";import{connect as S}from"react-redux";import{PointCloudContext as x}from"./PointCloudContext.js";import{PointCloudUtils as j}from"@labelbee/lb-utils";const w=({currentData:z,config:r,checkMode:A})=>{var n,i;const o=v(null),{setPtSegmentInstance:m,setDefaultAttribute:c,ptSegmentInstance:e}=P(x),t=f(o),a=(i=(n=r==null?void 0:r.attributeList)==null?void 0:n[0])==null?void 0:i.value;return u(()=>{var l;if(!(t==null?void 0:t.width)||!o.current||e)return;const d={left:-t.width/2,right:t.width/2,top:t.height/2,bottom:-t.height/2,near:1e3,far:-1e3},s=new g({container:o.current,isOrthographicCamera:!0,isSegment:!0,orthographicParams:d,config:r});(l=s.store)==null||l.setAttribute(a),c(a),m(s)},[t]),u(()=>{e&&(e.initRenderer(),e.initOrthographicCamera(j.getDefaultOrthographic(t)),e.render())},[t]),C.createElement("div",{className:b("point-cloud-layout"),ref:o})};var R=S(p,null,null,{context:h})(w);export{R 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 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 P}from"./hooks/useAttribute.js";const h=({checkMode:v,currentData:r,imgIndex:p,highlightAttribute:s,config:S,toolInstanceRef:u})=>{const{updateSegmentAttribute:b}=P(),n=C(y),{ptSegmentInstance:e,setSegmentation:d}=n;a(()=>{var t;if(e&&r.url)return e.loadPCDFile((t=r==null?void 0:r.url)!=null?t:"").then(()=>{var o,l;e.emit("clearAllSegmentData");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",d),()=>{e.unbind("syncSegmentData",d)}},[p,e]),a(()=>{var t,o;let l=(t=S.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}},m=t=>{if(!w.hotkeyFilter(t)||v===!0)return;const o=t.key.toLocaleLowerCase();g(o)};return a(()=>(window.addEventListener("keydown",m),u.current.setDefaultAttribute=t=>{b(t)},()=>{window.removeEventListener("keydown",m)}),[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})(h);export{A as default};
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 P}from"./hooks/useAttribute.js";const h=({checkMode:v,currentData:r,imgIndex:p,highlightAttribute:s,config:S,toolInstanceRef:u})=>{const{updateSegmentAttribute:b}=P(),n=C(y),{ptSegmentInstance:e,setSegmentation:d}=n;a(()=>{var t;if(e&&r.url)return 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",d),()=>{e.unbind("syncSegmentData",d)}},[p,e]),a(()=>{var t,o;let l=(t=S.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}},m=t=>{if(!w.hotkeyFilter(t)||v===!0)return;const o=t.key.toLocaleLowerCase();g(o)};return a(()=>(window.addEventListener("keydown",m),u.current.setDefaultAttribute=t=>{b(t)},()=>{window.removeEventListener("keydown",m)}),[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})(h);export{A as default};
@@ -1 +1 @@
1
- import{useContext as b}from"react";import{PointCloudContext as R}from"../PointCloudContext.js";var U=Object.defineProperty,x=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,S=(e,s,l)=>s in e?U(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l,_=(e,s)=>{for(var l in s||(s={}))V.call(s,l)&&S(e,l,s[l]);if(x)for(var l of x(s))N.call(s,l)&&S(e,l,s[l]);return e};const A=()=>{const{history:e,setPointCloudResult:s,setSelectedIDs:l,pointCloudBoxList:p,pointCloudSphereList:c,setPointCloudSphereList:B,mainViewInstance:u,topViewInstance:f,polygonList:y,setPolygonList:P,lineList:C,setLineList:a,syncAllViewPointCloudColor:w,segmentation:H}=b(R),O=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:d})=>{const r={pointCloudBoxList:p,polygonList:y,lineList:C,pointCloudSphereList:c};t&&(r.pointCloudBoxList=p.concat(t)),o&&(r.polygonList=y.concat(o)),i&&(r.lineList=C.concat(i)),d&&(r.pointCloudSphereList=c.concat(d)),e.pushHistory(r)},m=t=>{const o={pointCloudBoxList:p,polygonList:y,lineList:C,pointCloudSphereList:c,segmentation:H};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)},E=t=>{if(C.find(i=>i.id===t.id)){const i=C.map(d=>d.id===t.id?t:_({},d));e.pushHistory({lineList:i}),a(i)}},j=t=>{if(y.find(i=>i.id===t.id)){const i=y.map(d=>d.id===t.id?t:_({},d));e.pushHistory({pointCloudBoxList:p,polygonList:i}),P(i)}},I=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i})=>{e.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i},!0)},v=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:d=[],pointCloudSphereList:r=[]}=t;if(o){p.length!==o.length&&l();const h=p.filter(n=>o.every(L=>L.id!==n.id)),g=o.filter(n=>p.every(L=>L.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),g.forEach(n=>{u==null||u.generateBox(n)}),s(o),w(o)}if(r){c.length!==r.length&&l();let h=c.filter(n=>r.every(L=>L.id!==n.id)),g=r.filter(n=>c.every(L=>L.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),g.forEach(n=>{u==null||u.generateSphere(n)}),B(r)}i&&P(i),d&&a(d),f==null||f.updatePolygonList(o!=null?o:[],i!=null?i:[]),f==null||f.updateLineList(d!=null?d:[]),f==null||f.updatePointList(r)};return{addHistory:O,pushHistoryWithList:m,initHistory:I,pushHistoryUnderUpdatePolygon:j,pushHistoryUnderUpdateLine:E,redo:()=>{v(e.redo())},undo:()=>{v(e.undo())}}};export{A as useHistory};
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&&gt(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 I,DEFAULT_SPHERE_PARAMS as Ut}from"@labelbee/lb-utils";import{useContext as kt}from"react";import{PointCloudContext as jt}from"../PointCloudContext.js";import{useSingleBox as st}from"./useSingleBox.js";import{useSphere as Tt}from"./useSphere.js";import{useSelector as zt,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,m=(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,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(o,e,n,l,t)=>{const{x:a,y:p}=I.transferCanvas2World(o,e),{defaultZ:r}=Ut,d={center:{x:a,y:p,z:r},id:o.id},g=l?m(m({},l),d):A(m({},d),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},K=(o,e,n,l,t,a)=>{let p=o.pointList.map(L=>I.transferCanvas2World(L,e)),r=0,d=1,g={};if(n){const L=n.getSensesPointZAxisInPolygon(p,void 0,a);a&&L.fittedCoordinates.length>0&&(p=L.fittedCoordinates),r=(L.maxZ+L.minZ)/2,d=L.maxZ-L.minZ,g={count:L.zCount}}const[h,B,U]=p,V=x.getLineCenterPoint([h,U]),k=x.getLineLength(h,B),j=x.getLineLength(B,U),T=x.getRadiusFromQuadrangle(o.pointList);l&&(r=l.center.z,d=l.depth);const O={center:{x:V.x,y:V.y,z:r},width:j,height:k,depth:d,rotation:T,id:o.id},D=m(l?m(m({},l),O):A(m({},O),{attribute:"",valid:!0}),g);t&&Object.assign(D,t);const z=p.map(L=>I.transferWorld2Canvas(L,e));return{boxParams:D,newPointList:z}},ct=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return A(m({},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,h=x.getLineCenterPoint([t,p]),B=x.getLineCenterPoint([r,g]),V={x:{x:h.x-B.x,y:h.y-B.y}.x,y:0,z:h.y-B.y},k=x.getLineLength(t,a),j=x.getLineLength(r,d),T=k-j,O=x.getLineLength(a,p),D=x.getLineLength(d,g),z=O-D,{newBoxParams:L}=l.getNewBoxBySideUpdate(V,z,T,n);return L},Yt=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return A(m({},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,h=x.getLineCenterPoint([t,p]),B=x.getLineCenterPoint([r,g]),V={x:{x:h.x-B.x,y:h.y-B.y}.x,y:0,z:h.y-B.y},k=x.getLineLength(t,a),j=x.getLineLength(r,d),T=k-j,O=x.getLineLength(a,p),D=x.getLineLength(d,g),z=O-D;let{newBoxParams:L}=l.getNewBoxByBackUpdate(V,z,T,n);return L},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:h}=r.getSphereSidePoint2DCoordinate(o);r.camera.zoom=h,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(h),p.setResult([A(m(m({},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:h}=r.getSphereBackPoint2DCoordinate(o);r.camera.zoom=h,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(h),p.setResult([A(m(m({},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(m(m({},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(h=>h.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(jt),{topViewInstance:e,sideViewInstance:n,backViewInstance:l,mainViewInstance:t,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:h,hideAttributes:B}=o,{addHistory:U,initHistory:V,pushHistoryUnderUpdatePolygon:k,pushHistoryUnderUpdateLine:j}=Nt(),{selectedPolygon:T}=Zt(),{updateSelectedBox:O,updateSelectedBoxes:D,getPointCloudByID:z}=st(),{getPointCloudSphereByID:L,updatePointCloudSphere:tt,selectedSphere:Z}=Tt(),{currentData:H,config:S}=zt(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:ht}=Ft(),et=R==null?void 0:R.info;if(!e||!n||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:X}=e,yt=i=>{t==null||t.generateBox(i),t==null||t.controls.update(),t==null||t.render()},mt=i=>{t==null||t.generateSphere(i),t==null||t.controls.update(),t==null||t.render()},Lt=({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:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const P=J(i,s,X,void 0,C);r(i.id);const v=p(P);W(y.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 w={attribute:(P=e.toolInstance.defaultAttribute)!=null?P:""};c===!0&&Object.assign(w,{trackID:I.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:h})});const E=e==null?void 0:e.toolInstance,_=m({},i),{boxParams:b,newPointList:F}=K(_,s,X,void 0,w,C);if((S==null?void 0:S.lowerLimitPointsNumInBox)&&typeof b.count=="number"&&b.count<S.lowerLimitPointsNumInBox){Et.info(ht("LowerLimitPointsNumInBox",{num:S.lowerLimitPointsNumInBox})),E.deletePolygon(b.id);return}C&&(F==null?void 0:F.length)&&(_.pointList=F);const Vt=B.includes(_.attribute),Y=a(b),Ot=(v=o==null?void 0:o.polygonList)!=null?v:[];e==null||e.updatePolygonList(Y!=null?Y:[],Ot),Vt?r([]):(r(b.id),E.selection.setSelectedIDs(_.id),M(y.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(y.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(y.Top,v,P,void 0,c,S)}}},nt=(i,s,f)=>{if(et){let c,u;switch(f){case y.Back:c=qt;break;case y.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(m({},u),{count:P})}const C=O(u);return M(f,i,u,void 0,C),C}},it=(i,s,f)=>{if(Z){let c,u;switch(f){case y.Back:c=Yt;break;case y.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,y.Side)},St=(i,s)=>{it(i,s,y.Back)},bt=(i,s)=>{nt(i,s,y.Side)},wt=(i,s)=>{nt(i,s,y.Back)},It=(i,s)=>{j(i)},Dt=(i,s)=>{const f=L(i.id),c=J(i,s,X,f),u=tt(c);W(y.Top,i,c,void 0,u,S)},_t=(i,s)=>{if(T){const c=i[0].newPolygon;c.pointList=c.pointList.map(u=>I.transferCanvas2World(u,s)),k(i[0].newPolygon);return}const f=i.map(({newPolygon:c})=>{const u=z(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(y.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={[y.Side]:()=>{pt(f,s,n,P,C)},[y.Back]:()=>{l&&Ct(f,s,l,P,C)},[y.Top]:()=>{Pt(f,s,e,t)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),c&&(t==null||t.updateCameraZoom(c)),mt(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={[y.Side]:()=>{ft(f,s,n,C)},[y.Back]:()=>{l&&gt(f,s,l,C)},[y.Top]:()=>{$(f,s,e,t)}};Object.keys(P).forEach(v=>{v!==i&&P[v]()}),c&&(t==null||t.updateCameraZoom(c)),yt(f)});return{topViewAddSphere:Lt,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={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};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 w=[],E=[],_=[],b=[];s.result&&(w=I.getBoxParamsFromResultList(s.result),_=I.getPolygonListFromResultList(s.result),E=I.getLineListFromResultList(s.result),b=I.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(w),t==null||t.generateSpheres(b),o.syncAllViewPointCloudColor(w)),V({pointCloudBoxList:w,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 h,useCallback as a}from"react";import u from"lodash";import{PointCloudContext as F}from"../PointCloudContext.js";import{EToolName as V,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,b=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(b)for(var t of b(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=h(()=>{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!==V.Rect&&m!==V.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),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=h(()=>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
+ 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 w}from"react";import{PointCloudContext as g}from"../PointCloudContext.js";import{cTool as E}from"@labelbee/lb-annotation";import{useHistory as R}from"./useHistory.js";import{EPointCloudPattern as S}from"@labelbee/lb-utils";const{EToolName:t,EPolygonPattern:d}=E,I=()=>{const{topViewInstance:r,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,pointCloudBoxList:P,pointCloudSphereList:C,setPointCloudResult:p,setPointCloudSphereList:m,setPolygonList:v,pointCloudPattern:c,setPointCloudPattern:l,syncAllViewPointCloudColor:h,globalPattern:b,setLineList:y}=w(g),{pushHistoryWithList:L}=R(),f=()=>{P.forEach(n=>{e==null||e.removeObjectByName(n.id)}),C.forEach(n=>{e==null||e.removeObjectByName(n.id)}),e==null||e.render(),p([]),v([]),m([]),y([]),r==null||r.toolScheduler.clearStatusAndResult(),h([]),L({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()};return{clearAllResult:f,updatePointCloudPattern:n=>{if(n===c)return;const s=[r,a,u];switch(n){case t.Rect:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Rect)}),l(t.Rect);break;case t.Polygon:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Normal)}),l(t.Polygon);break;case t.Point:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),l(t.Point);break;case t.Line:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),l(t.Line);break}},pointCloudPattern:c,isSegmentPattern:b===S.Segmentation}};export{I as useStatus};
1
+ import{useContext as y}from"react";import{PointCloudContext as L}from"../PointCloudContext.js";import{cTool as f}from"@labelbee/lb-annotation";import{useHistory as g}from"./useHistory.js";import{EPointCloudPattern as R}from"@labelbee/lb-utils";const{EToolName:t,EPolygonPattern:d}=f,S=()=>{const{topViewInstance:s,sideViewInstance:r,backViewInstance:a,mainViewInstance:e,setPointCloudResult:P,setPointCloudSphereList:C,setPolygonList:p,pointCloudPattern:u,setPointCloudPattern:l,syncAllViewPointCloudColor:v,globalPattern:h,setLineList:m}=y(L),{pushHistoryWithList:b}=g(),w=()=>{e==null||e.clearAllBox(),e==null||e.clearAllSphere(),e==null||e.render(),P([]),p([]),C([]),m([]),s==null||s.toolScheduler.clearStatusAndResult(),v([]),b({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},n=()=>{r==null||r.toolInstance.clearResult(),a==null||a.toolInstance.clearResult()};return{clearAllResult:w,updatePointCloudPattern:c=>{if(c===u)return;const i=[s,r,a];switch(c){case t.Rect:n(),i.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Rect)}),l(t.Rect);break;case t.Polygon:n(),i.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Normal)}),l(t.Polygon);break;case t.Point:n(),i.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),l(t.Point);break;case t.Line:n(),i.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),l(t.Line);break}},pointCloudPattern:u,isSegmentPattern:h===R.Segmentation}};export{S as useStatus};
@@ -1 +1 @@
1
- import{getClassName as l}from"../../utils/dom.js";import t,{useContext as E,useEffect as s}from"react";import j from"./PointCloud3DView.js";import x from"./PointCloudBackView.js";import S from"./PointCloudTopView.js";import b from"./PointCloudSideView.js";import w from"./PointCloud2DView.js";import L from"./PointCloudListener.js";import v from"./PointCloudSegmentListener.js";import V from"./PointCloudSegment.js";import D from"./PointCloudSegmentStatus.js";import N from"./PointCloudSegmentToolbar.js";import{connect as T}from"react-redux";import{LabelBeeContext as A}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as B,AnnotatedAttributesPanelFixedRight as F}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as I}from"./PointCloudContext.js";import{EPointCloudPattern as y}from"@labelbee/lb-utils";import{useCustomToolInstance as _}from"../../hooks/annotation.js";import{jsonParser as h}from"../../utils/index.js";import{a2MapStateToProps as G}from"../../store/annotation/map.js";const R=({currentData:d,imgList:c,drawLayerSlot:p,checkMode:i,intelligentFit:C})=>{const e=E(I),{globalPattern:r,setGlobalPattern:P}=e,f=h(d.result),{toolInstanceRef:n,clearToolInstance:g}=_({basicInfo:f});return s(()=>{n.current.setPointCloudGlobalPattern=o=>{o!==r&&(P(o),g())},n.current.getPointCloudGlobalPattern=()=>r},[r]),s(()=>{n.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],n.current.exportCustomData=()=>{var o,a,m,u;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),c.length===0?null:r===y.Segmentation?t.createElement(t.Fragment,null,t.createElement(v,{checkMode:i,toolInstanceRef:n}),t.createElement(N,null),t.createElement(V,null),t.createElement(D,null)):t.createElement(t.Fragment,null,t.createElement(L,{checkMode:i,toolInstanceRef:n}),t.createElement("div",{className:l("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:l("point-cloud-wrapper")},t.createElement(B,null),t.createElement("div",{className:l("point-cloud-content")},t.createElement("div",{className:l("point-cloud-container","left")},t.createElement(w,null),t.createElement(j,null)),t.createElement("div",{className:l("point-cloud-container","right")},t.createElement(S,{drawLayerSlot:p,checkMode:i,intelligentFit:C}),t.createElement("div",{className:l("point-cloud-container","right-bottom")},t.createElement(b,{checkMode:i}),t.createElement(x,{checkMode:i})))),t.createElement(F,null))))};var $=T(G,null,null,{context:A})(R);export{$ as default};
1
+ import{getClassName as n}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 N from"./PointCloudListener.js";import T from"./PointCloudSegmentListener.js";import A from"./PointCloudSegment.js";import h from"./PointCloudSegmentStatus.js";import B from"./PointCloudSegmentToolbar.js";import{connect as F}from"react-redux";import{LabelBeeContext as I}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as R,AnnotatedAttributesPanelFixedRight as _}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as y}from"./PointCloudContext.js";import{PointCloudUtils as D,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:l,intelligentFit:C,imgIndex:P})=>{const e=j(y),{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())}},[d]),c(()=>{var o;if(r){const{boxParamsList:s,polygonList:a,lineList:m,sphereParamsList:L,segmentation:x}=D.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(T,{checkMode:l,toolInstanceRef:i}),t.createElement(B,null),t.createElement(A,null),t.createElement(h,null),u==null?void 0:u({direct:!0})):t.createElement(t.Fragment,null,t.createElement(N,{checkMode:l,toolInstanceRef:i}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(R,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(V,null),t.createElement(S,null)),t.createElement("div",{className:n("point-cloud-container","right")},t.createElement(v,{drawLayerSlot:u,checkMode:l,intelligentFit:C}),t.createElement("div",{className:n("point-cloud-container","right-bottom")},t.createElement(w,{checkMode:l}),t.createElement(b,{checkMode:l})))),t.createElement(_,null))))};var H=F(q,null,null,{context:I})(z);export{H as default};
@@ -1 +1 @@
1
- import C 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 $,useDispatch as E}from"../../../store/ctx.js";import{getClassName as o}from"../../../utils/dom.js";import{PointCloud as z}from"@labelbee/lb-annotation";import{toolStyleConverter as U}from"@labelbee/lb-utils";import{views as A,sleep as G,getViewsDataUrl as Z}from"./util.js";var q=Object.defineProperty,H=Object.defineProperties,J=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,N=(i,e,t)=>e in i?q(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Q=(i,e)=>{for(var t in e||(e={}))K.call(e,t)&&N(i,t,e[t]);if(k)for(var t of k(e))M.call(e,t)&&N(i,t,e[t]);return i},W=(i,e)=>H(i,J(e)),O=(i,e,t)=>new Promise((d,r)=>{var s=c=>{try{a(t.next(c))}catch(u){r(u)}},l=c=>{try{a(t.throw(c))}catch(u){r(u)}},a=c=>c.done?d(c.value):Promise.resolve(c.value).then(s,l);a((t=t.apply(i,e)).next())});const X=i=>{const{predictionResult:e,predictionResultVisible:t,imgList:d}=i,[r,s]=j([]),l=E(),{t:a}=_(),c=()=>{D(l,!1),T(l,[]),s([])},u=()=>O(void 0,null,function*(){v(l,!0),yield l(I()),v(l,!1),c()});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,a("ComplementaryTrackingPrediction"),r.length>0?`\uFF08${r.length}\uFF09`:""),n.createElement("div",{className:o("point-cloud-predict-tracking-container","option")},n.createElement("div",{className:C([o("point-cloud-predict-tracking-container","cancelOption"),o("point-cloud-predict-tracking-container","button")]),onClick:c},a("Cancel")),n.createElement("div",{className:C([o("point-cloud-predict-tracking-container","okOption"),o("point-cloud-predict-tracking-container","button")]),onClick:u},a("Apply")))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","content")},n.createElement(Y,{list:r})))),e.length>0&&n.createElement(ee,{result:e,imgList:d,setList:s})):null},Y=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},A.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}))})))))},ee=i=>{const e=n.useContext(B),t=E(),{result:d,imgList:r,setList:s}=i,l=S(null),a={width:600,height:600};return F(()=>{(()=>O(void 0,null,function*(){var u,h,y,P,w,b;const f=(u=e.mainViewInstance)==null?void 0:u.config;if(f&&l.current){const R={left:-a.width/2,right:a.width/2,top:a.height/2,bottom:-a.height/2,near:200,far:-200},p=new z({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:(w=(P=(y=(h=r[g])==null?void 0:h.webPointCloudFile)==null?void 0:y.lidar)==null?void 0:P.url)!=null?w:"";yield p.loadPCDFileByBox(x,m,{width:2,height:2,depth:2}),yield p.updateCameraZoom(e.zoom);const V=(b=U.getColorFromConfig({attribute:m.attribute},W(Q({},f),{attributeConfigurable:!0}),{}))==null?void 0:b.fill;p.generateBox(m,V),yield G(500),yield Z(p,m,e.zoom),yield p.removeObjectByName(m.id),yield p.clearPointCloudAndRender()}s(d),v(t,!1)}}))()},[]),n.createElement("div",{style:a,ref:l,className:"generate-view"})},te=i=>({predictionResult:i.annotation.predictionResult,predictionResultVisible:i.annotation.predictionResultVisible,imgList:i.annotation.imgList});var ne=L(te,null,null,{context:$})(X);export{ne as default};
1
+ import C 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 $,useDispatch as E}from"../../../store/ctx.js";import{getClassName as o}from"../../../utils/dom.js";import{PointCloud as z}from"@labelbee/lb-annotation";import{toolStyleConverter as U}from"@labelbee/lb-utils";import{views as A,sleep as G,getViewsDataUrl as Z}from"./util.js";var q=Object.defineProperty,H=Object.defineProperties,J=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,N=(i,e,t)=>e in i?q(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Q=(i,e)=>{for(var t in e||(e={}))K.call(e,t)&&N(i,t,e[t]);if(k)for(var t of k(e))M.call(e,t)&&N(i,t,e[t]);return i},W=(i,e)=>H(i,J(e)),O=(i,e,t)=>new Promise((d,r)=>{var s=c=>{try{a(t.next(c))}catch(u){r(u)}},l=c=>{try{a(t.throw(c))}catch(u){r(u)}},a=c=>c.done?d(c.value):Promise.resolve(c.value).then(s,l);a((t=t.apply(i,e)).next())});const X=i=>{const{predictionResult:e,predictionResultVisible:t,imgList:d}=i,[r,s]=j([]),l=E(),{t:a}=_(),c=()=>{D(l,!1),T(l,[]),s([])},u=()=>O(void 0,null,function*(){v(l,!0),yield l(I()),v(l,!1),c()});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,a("ComplementaryTrackingPrediction"),r.length>0?`\uFF08${r.length}\uFF09`:""),n.createElement("div",{className:o("point-cloud-predict-tracking-container","option")},n.createElement("div",{className:C([o("point-cloud-predict-tracking-container","cancelOption"),o("point-cloud-predict-tracking-container","button")]),onClick:c},a("Cancel")),n.createElement("div",{className:C([o("point-cloud-predict-tracking-container","okOption"),o("point-cloud-predict-tracking-container","button")]),onClick:u},a("Apply")))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","content")},n.createElement(Y,{list:r})))),e.length>0&&n.createElement(ee,{result:e,imgList:d,setList:s})):null},Y=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},A.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}))})))))},ee=i=>{const e=n.useContext(B),t=E(),{result:d,imgList:r,setList:s}=i,l=S(null),a={width:600,height:600};return F(()=>{(()=>O(void 0,null,function*(){var u,h,y,P,w,b;const f=(u=e.mainViewInstance)==null?void 0:u.config;if(f&&l.current){const R={left:-a.width/2,right:a.width/2,top:a.height/2,bottom:-a.height/2,near:200,far:-200},p=new z({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:(w=(P=(y=(h=r[g])==null?void 0:h.webPointCloudFile)==null?void 0:y.lidar)==null?void 0:P.url)!=null?w:"";yield p.loadPCDFileByBox(x,m,{width:2,height:2,depth:2}),yield p.updateCameraZoom(e.zoom);const V=(b=U.getColorFromConfig({attribute:m.attribute},W(Q({},f),{attributeConfigurable:!0}),{}))==null?void 0:b.fill;p.generateBox(m,V),yield G(500),yield Z(p,m,e.zoom),yield p.removeObjectByName(m.id,"box"),yield p.clearPointCloudAndRender()}s(d),v(t,!1)}}))()},[]),n.createElement("div",{style:a,ref:l,className:"generate-view"})},te=i=>({predictionResult:i.annotation.predictionResult,predictionResultVisible:i.annotation.predictionResultVisible,imgList:i.annotation.imgList});var ne=L(te,null,null,{context:$})(X);export{ne as default};
@@ -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";import{EPointCloudPattern as b}from"@labelbee/lb-utils";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=>{},getPointCloudGlobalPattern:()=>b.Detection},e=c(s),u=t=>{r({type:a.SET_TOOL,payload:{instance:t}})},l=()=>{r({type:a.SET_TOOL,payload:{instance:void 0}})},i=()=>{Object.assign(e.current,s)};return d(()=>(u(e.current),()=>{l()}),[]),{toolInstanceRef:e,clearToolInstance:i}};export{m as useCustomToolInstance};
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.12.0-alpha.2",
3
+ "version": "1.12.0-alpha.4",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -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.2",
47
- "@labelbee/lb-utils": "1.8.0-alpha.2",
46
+ "@labelbee/lb-annotation": "1.16.0-alpha.4",
47
+ "@labelbee/lb-utils": "1.8.0-alpha.4",
48
48
  "ahooks": "^3.4.0",
49
49
  "classnames": "^2.3.0",
50
50
  "lodash": "^4.17.21",