@labelbee/lb-components 1.10.0-alpha.6 → 1.10.0-alpha.7

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 (45) hide show
  1. package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
  2. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  3. package/dist/components/pointCloudView/hooks/useSphere.js +1 -1
  4. package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
  5. package/dist/types/components/AnnotationView/pointCloudAnnotationView.d.ts +2 -2
  6. package/dist/types/components/annotationStepPopover/index.d.ts +2 -2
  7. package/dist/types/components/checkboxList/index.d.ts +2 -2
  8. package/dist/types/components/colorTag/index.d.ts +2 -2
  9. package/dist/types/components/customAntd/IconWithText/index.d.ts +1 -1
  10. package/dist/types/components/customResizeHook/index.d.ts +2 -2
  11. package/dist/types/components/fileException/FileError.d.ts +1 -1
  12. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -2
  13. package/dist/types/components/pointCloudView/PointCloudBackView.d.ts +2 -2
  14. package/dist/types/components/pointCloudView/PointCloudInfos.d.ts +4 -4
  15. package/dist/types/components/pointCloudView/components/EmptyPage/index.d.ts +7 -2
  16. package/dist/types/components/pointCloudView/components/UnifyParamsModal/index.d.ts +2 -2
  17. package/dist/types/components/pointCloudView/hooks/useHistory.d.ts +6 -4
  18. package/dist/types/components/predictTracking/predictTrackingIcon/index.d.ts +2 -2
  19. package/dist/types/components/predictTracking/previewResult/index.d.ts +2 -2
  20. package/dist/types/components/videoPlayer/TagToolInstanceAdaptor.d.ts +1 -1
  21. package/dist/types/components/videoPlayer/TagToolInstanceAdaptorI18nProvider.d.ts +2 -2
  22. package/dist/types/components/videoPlayer/components/controller/index.d.ts +2 -2
  23. package/dist/types/components/videoPlayer/index.d.ts +1 -1
  24. package/dist/types/views/MainView/annotationTips/index.d.ts +2 -2
  25. package/dist/types/views/MainView/sidebar/ClearIcon/index.d.ts +2 -2
  26. package/dist/types/views/MainView/sidebar/ImgAttributeInfo/index.d.ts +2 -2
  27. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/batchUpdateModal/index.d.ts +2 -2
  28. package/dist/types/views/MainView/sidebar/TagSidebar/index.d.ts +1 -1
  29. package/dist/types/views/MainView/sidebar/TextAreaFormat/index.d.ts +2 -2
  30. package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +2 -2
  31. package/dist/types/views/MainView/sidebar/ToolIcons.d.ts +2 -2
  32. package/dist/types/views/MainView/sidebar/ToolStyle/index.d.ts +2 -2
  33. package/dist/types/views/MainView/toolFooter/AnnotatedAttributes/index.d.ts +5 -5
  34. package/dist/types/views/MainView/toolFooter/FooterPopover.d.ts +1 -1
  35. package/dist/types/views/MainView/toolFooter/HiddenTips/index.d.ts +2 -2
  36. package/dist/types/views/MainView/toolFooter/PageNumber/index.d.ts +2 -2
  37. package/dist/types/views/MainView/toolFooter/Pagination.d.ts +1 -1
  38. package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
  39. package/dist/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
  40. package/es/components/pointCloudView/hooks/useHistory.js +1 -1
  41. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  42. package/es/components/pointCloudView/hooks/useSphere.js +1 -1
  43. package/es/components/pointCloudView/hooks/useStatus.js +1 -1
  44. package/es/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
  45. package/package.json +2 -2
@@ -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,r)=>s in e?__defProp(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r,__spreadValues=(e,s)=>{for(var r in s||(s={}))__hasOwnProp.call(s,r)&&__defNormalProp(e,r,s[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(s))__propIsEnum.call(s,r)&&__defNormalProp(e,r,s[r]);return e};const useHistory=()=>{const{history:e,setPointCloudResult:s,setSelectedIDs:r,pointCloudBoxList:l,pointCloudSphereList:P,mainViewInstance:p,topViewInstance:L,polygonList:u,setPolygonList:f,lineList:c,setLineList:a,syncAllViewPointCloudColor:h}=React.useContext(PointCloudContext.PointCloudContext),g=({newBoxParams:t,newPolygon:o,newLine:i})=>{const n={pointCloudBoxList:l,polygonList:u,lineList:c};t&&(n.pointCloudBoxList=l.concat(t)),o&&(n.polygonList=u.concat(o)),i&&(n.lineList=c.concat(i)),e.pushHistory(n)},v=t=>{const o={pointCloudBoxList:l,polygonList:u,lineList:c};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),e.pushHistory(o)},x=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(n=>n.id===t.id?t:__spreadValues({},n));e.pushHistory({lineList:i}),a(i)}},_=t=>{t&&e.pushHistory({pointCloudSphereList:P})},H=t=>{if(u.find(i=>i.id===t.id)){const i=u.map(n=>n.id===t.id?t:__spreadValues({},n));e.pushHistory({pointCloudBoxList:l,polygonList:i}),f(i)}},w=({pointCloudBoxList:t,polygonList:o})=>{e.initRecord({pointCloudBoxList:t,polygonList:o},!0)},C=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:n=[]}=t;if(o){l.length!==o.length&&r();const B=l.filter(d=>o.every(y=>y.id!==d.id)),O=o.filter(d=>l.every(y=>y.id!==d.id));B.forEach(d=>{p==null||p.removeObjectByName(d.id)}),O.forEach(d=>{p==null||p.generateBox(d)}),s(o),h(o)}i&&f(i),n&&a(n),L==null||L.updatePolygonList(o!=null?o:[],i!=null?i:[]),L==null||L.updateLineList(n!=null?n:[])};return{addHistory:g,pushHistoryWithList:v,initHistory:w,pushHistoryUnderUpdatePoint:_,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:x,redo:()=>{C(e.redo())},undo:()=>{C(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,s,r)=>s in e?__defProp(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r,__spreadValues=(e,s)=>{for(var r in s||(s={}))__hasOwnProp.call(s,r)&&__defNormalProp(e,r,s[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(s))__propIsEnum.call(s,r)&&__defNormalProp(e,r,s[r]);return e};const useHistory=()=>{const{history:e,setPointCloudResult:s,setSelectedIDs:r,pointCloudBoxList:p,pointCloudSphereList:L,setPointCloudSphereList:x,mainViewInstance:u,topViewInstance:C,polygonList:y,setPolygonList:P,lineList:f,setLineList:g,syncAllViewPointCloudColor:_}=React.useContext(PointCloudContext.PointCloudContext),S=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:l})=>{const d={pointCloudBoxList:p,polygonList:y,lineList:f,pointCloudSphereList:L};t&&(d.pointCloudBoxList=p.concat(t)),o&&(d.polygonList=y.concat(o)),i&&(d.lineList=f.concat(i)),l&&(d.pointCloudSphereList=L.concat(l)),e.pushHistory(d)},B=t=>{const o={pointCloudBoxList:p,polygonList:y,lineList:f,pointCloudSphereList:L};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),e.pushHistory(o)},H=t=>{if(f.find(i=>i.id===t.id)){const i=f.map(l=>l.id===t.id?t:__spreadValues({},l));e.pushHistory({lineList:i}),g(i)}},O=t=>{if(y.find(i=>i.id===t.id)){const i=y.map(l=>l.id===t.id?t:__spreadValues({},l));e.pushHistory({pointCloudBoxList:p,polygonList:i}),P(i)}},w=({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:l=[],pointCloudSphereList:d=[]}=t;if(o){p.length!==o.length&&r();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&&r();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&&P(i),l&&g(l),C==null||C.updatePolygonList(o!=null?o:[],i!=null?i:[]),C==null||C.updateLineList(l!=null?l:[])};return{addHistory:S,pushHistoryWithList:B,initHistory:w,pushHistoryUnderUpdatePolygon:O,pushHistoryUnderUpdateLine:H,redo:()=>{v(e.redo())},undo:()=>{v(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((r,e)=>{var c=l=>{try{s(i.next(l))}catch(h){e(h)}},p=l=>{try{s(i.throw(l))}catch(h){e(h)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(c,p);s((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,r,e)=>{const{x:c,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:s}=lbUtils.DEFAULT_SPHERE_PARAMS,l={center:{x:c,y:p,z:s},id:t.id},h=r?__spreadValues(__spreadValues({},r),l):__spreadProps(__spreadValues({},l),{attribute:"",valid:!0});return e&&Object.assign(h,e),h},topViewPolygon2PointCloud=(t,o,i,r,e,c)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),s=0,l=1,h={};if(i){const y=i.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),s=(y.maxZ+y.minZ)/2,l=y.maxZ-y.minZ,h={count:y.zCount}}const[g,x,j]=p,b=lbAnnotation.MathUtils.getLineCenterPoint([g,j]),_=lbAnnotation.MathUtils.getLineLength(g,x),O=lbAnnotation.MathUtils.getLineLength(x,j),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,l=r.depth);const V={center:{x:b.x,y:b.y,z:s},width:O,height:_,depth:l,rotation:k,id:t.id},I=__spreadValues(r?__spreadValues(__spreadValues({},r),V):__spreadProps(__spreadValues({},V),{attribute:"",valid:!0}),h);e&&Object.assign(I,e);const D=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:I,newPointList:D}},sideViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-r.x,y:i.center.y,z:i.center.z-r.y}})},sideViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),b={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},_=lbAnnotation.MathUtils.getLineLength(e,c),O=lbAnnotation.MathUtils.getLineLength(s,l),k=_-O,V=lbAnnotation.MathUtils.getLineLength(c,p),I=lbAnnotation.MathUtils.getLineLength(l,h),D=V-I,{newBoxParams:y}=r.getNewBoxBySideUpdate(b,D,k,i);return y},backViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-r.x,z:i.center.z-r.y}})},backViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),b={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},_=lbAnnotation.MathUtils.getLineLength(e,c),O=lbAnnotation.MathUtils.getLineLength(s,l),k=_-O,V=lbAnnotation.MathUtils.getLineLength(c,p),I=lbAnnotation.MathUtils.getLineLength(l,h),D=V-I;let{newBoxParams:y}=r.getNewBoxByBackUpdate(b,D,k,i);return y},syncSideViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,i,r)=>{if(!i||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),r.render();const{toolInstance:e,pointCloudInstance:c}=i,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...e.pointList].map(l=>l.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):l);e.setResult(s),e.setSelectedID(o.id)},synchronizeTopView=(t,o,i,r)=>{var e;if(!i||!r)return;r.generateBox(t,o.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=i,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),l=[...c.polygonList],h=l.find(g=>g.id===o.id);h?h.pointList=s:l.push({id:o.id,pointList:s,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),c.setResultAndSelectedID(l,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:r,mainViewInstance:e,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:l,pointCloudBoxList:h,pointCloudSphereList:g,hideAttributes:x}=t,{addHistory:j,initHistory:b,pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdatePoint:O,pushHistoryUnderUpdateLine:k}=useHistory.useHistory(),{selectedPolygon:V}=usePolygon.usePolygon(),{updateSelectedBox:I,updateSelectedBoxes:D,getPointCloudByID:y}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:G,updatePointCloudSphere:H,selectedSphere:z}=useSphere.useSphere(),{currentData:w,config:L}=ctx.useSelector(n=>{const{stepList:a,step:P,imgList:u,imgIndex:d}=n.annotation;return{currentData:u[d],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,a).config)}}),F=ctx.useDispatch(),{selectedBox:T}=useSingleBox.useSingleBox(),{t:X}=reactI18next.useTranslation(),N=T==null?void 0:T.info;if(!o||!i||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,Y=n=>{e==null||e.generateBox(n),e==null||e.controls.update(),e==null||e.render()},Q=n=>{e==null||e.generateSphere(n),e==null||e.controls.update(),e==null||e.render()},J=({newPoint:n,size:a,zoom:P,trackConfigurable:u})=>{var d;const C={attribute:(d=o.toolInstance.defaultAttribute)!=null?d:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const f=topViewPoint2PointCloud(n,a,E,void 0,C);s(n.id);const v=p(f);M(PointCloudView.Top,n,f,P,v,L)},K=({polygon:n,size:a,imgList:P,trackConfigurable:u,zoom:d,intelligentFit:C})=>{var f;const v={attribute:(f=o.toolInstance.defaultAttribute)!=null?f:""};u===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:g})});const m=o==null?void 0:o.toolInstance,S=__spreadValues({},n),{boxParams:B,newPointList:A}=topViewPolygon2PointCloud(S,a,E,void 0,v,C);if((L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(X("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),m.deletePolygon(B.id);return}C&&(A==null?void 0:A.length)&&(S.pointList=A);const q=x.includes(S.attribute),U=c(B);q?s([]):(s(B.id),m.setSelectedIDs([S.id]),R(PointCloudView.Top,S,B,d,U),C&&synchronizeTopView(B,S,o,e)),j({newBoxParams:B})},$=({newSelectedBox:n,newPointCloudList:a,newSelectedSphere:P,newSphereList:u})=>{const d=o==null?void 0:o.toolInstance;if(!(l.length===0||!d)){if(n||(T==null?void 0:T.info)){const C=n!=null?n:T==null?void 0:T.info;d.setSelectedIDs(l);const f=d.selectedPolygon;if(l.length===1&&C){R(PointCloudView.Top,f,C,void 0,a);return}}if((P||z)&&l.length===1){const C=P!=null?P:z;d.setSelectedID(l[0]);const f=d.selectedPoint;C&&M(PointCloudView.Top,f,C,void 0,u,L)}}},W=(n,a,P)=>{if(N){let u,d;switch(P){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}if(d=u(n,a,N,i.pointCloudInstance),e){const{count:f}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(d).polygonPointList,[d.center.z-d.depth/2,d.center.z+d.depth/2]);d=__spreadProps(__spreadValues({},d),{count:f})}const C=I(d);return R(P,n,d,void 0,C),C}},Z=(n,a,P)=>{if(z){let u,d;switch(P){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}d=u(n,a,z);const C=H(d);return M(P,n,d,void 0,C,L),C}},tt=(n,a)=>{Z(n,a,PointCloudView.Side)},et=(n,a)=>{Z(n,a,PointCloudView.Back)},ot=(n,a)=>{W(n,a,PointCloudView.Side)},it=(n,a)=>{W(n,a,PointCloudView.Back)},nt=(n,a)=>{k(n)},st=(n,a)=>{const{x:P,y:u}=lbUtils.PointCloudUtils.transferCanvas2World(n,a);O(__spreadProps(__spreadValues({},n),{x:P,y:u}));const d=G(n.id),C=topViewPoint2PointCloud(n,a,E,d),f=H(C);M(PointCloudView.Top,n,C,void 0,f,L)},rt=(n,a)=>{if(V){const u=n[0].newPolygon;u.pointList=u.pointList.map(d=>lbUtils.PointCloudUtils.transferCanvas2World(d,a)),_(n[0].newPolygon);return}const P=n.map(({newPolygon:u})=>{const d=y(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,a,o.pointCloudInstance,d);return C});if(P.length===1){const{newPolygon:u}=n[0],d=D(P);R(PointCloudView.Top,u,P[0],void 0,d)}else{const u=D(P);u&&t.syncAllViewPointCloudColor(u)}},M=(n,a,P,u,d,C)=>__async(void 0,null,function*(){const f=w==null?void 0:w.url,v={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,a,i,f,C)},[PointCloudView.Back]:()=>{r&&syncBackViewByPoint(P,a,r,f,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,a,o,e)}};Object.keys(v).forEach(m=>{m!==n&&v[m]()}),u&&(e==null||e.updateCameraZoom(u)),Q(P)}),R=(n,a,P,u,d)=>__async(void 0,null,function*(){const C=w==null?void 0:w.url;d&&(yield t.syncAllViewPointCloudColor(d));const f={[PointCloudView.Side]:()=>{synchronizeSideView(P,a,i,C)},[PointCloudView.Back]:()=>{r&&synchronizeBackView(P,a,r,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,a,o,e)}};Object.keys(f).forEach(v=>{v!==n&&f[v]()}),u&&(e==null||e.updateCameraZoom(u)),Y(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 a={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};e.initOrthographicCamera(a),e.initRenderer(),e.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(a=w){var P,u,d,C,f,v;if(!(a==null?void 0:a.url)||!e)return;actionCreators.SetPointCloudLoading(F,!0),yield e.loadPCDFile(a.url,(P=L==null?void 0:L.radius)!=null?P:DEFAULT_RADIUS),h.forEach(U=>{e==null||e.removeObjectByName(U.id)}),g.forEach(U=>{e==null||e.removeObjectByName(U.id)});let m=[],S=[],B=[],A=[];w.result?(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(w.result),B=lbUtils.PointCloudUtils.getPolygonListFromResultList(w.result),S=lbUtils.PointCloudUtils.getLineListFromResultList(w.result),A=lbUtils.PointCloudUtils.getSphereParamsFromResultList(w.result),m.forEach(U=>{e==null||e.generateBox(U)}),A.forEach(U=>{e==null||e.generateSphere(U)}),t.syncAllViewPointCloudColor(m),t.setPointCloudResult(m),t.setPolygonList(B),t.setLineList(S),t.setPointCloudSphereList(A)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),b({pointCloudBoxList:m,polygonList:B}),e.updateTopCamera();const q=(d=(u=index.jsonParser(a.result))==null?void 0:u.valid)!=null?d:!0;t.setPointCloudValid(q),(C=t.sideViewInstance)==null||C.clearAllData(),(f=t.backViewInstance)==null||f.clearAllData(),o.updateData(a.url,a.result,{radius:(v=L==null?void 0:L.radius)!=null?v: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
+ "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((r,e)=>{var c=l=>{try{s(i.next(l))}catch(h){e(h)}},p=l=>{try{s(i.throw(l))}catch(h){e(h)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(c,p);s((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,r,e)=>{const{x:c,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:s}=lbUtils.DEFAULT_SPHERE_PARAMS,l={center:{x:c,y:p,z:s},id:t.id},h=r?__spreadValues(__spreadValues({},r),l):__spreadProps(__spreadValues({},l),{attribute:"",valid:!0});return e&&Object.assign(h,e),h},topViewPolygon2PointCloud=(t,o,i,r,e,c)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),s=0,l=1,h={};if(i){const y=i.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),s=(y.maxZ+y.minZ)/2,l=y.maxZ-y.minZ,h={count:y.zCount}}const[g,x,_]=p,V=lbAnnotation.MathUtils.getLineCenterPoint([g,_]),O=lbAnnotation.MathUtils.getLineLength(g,x),k=lbAnnotation.MathUtils.getLineLength(x,_),A=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,l=r.depth);const I={center:{x:V.x,y:V.y,z:s},width:k,height:O,depth:l,rotation:A,id:t.id},S=__spreadValues(r?__spreadValues(__spreadValues({},r),I):__spreadProps(__spreadValues({},I),{attribute:"",valid:!0}),h);e&&Object.assign(S,e);const j=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:S,newPointList:j}},sideViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-r.x,y:i.center.y,z:i.center.z-r.y}})},sideViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),V={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},O=lbAnnotation.MathUtils.getLineLength(e,c),k=lbAnnotation.MathUtils.getLineLength(s,l),A=O-k,I=lbAnnotation.MathUtils.getLineLength(c,p),S=lbAnnotation.MathUtils.getLineLength(l,h),j=I-S,{newBoxParams:y}=r.getNewBoxBySideUpdate(V,j,A,i);return y},backViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-r.x,z:i.center.z-r.y}})},backViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),V={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},O=lbAnnotation.MathUtils.getLineLength(e,c),k=lbAnnotation.MathUtils.getLineLength(s,l),A=O-k,I=lbAnnotation.MathUtils.getLineLength(c,p),S=lbAnnotation.MathUtils.getLineLength(l,h),j=I-S;let{newBoxParams:y}=r.getNewBoxByBackUpdate(V,j,A,i);return y},syncSideViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,i,r)=>{if(!i||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),r.render();const{toolInstance:e,pointCloudInstance:c}=i,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...e.pointList].map(l=>l.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):l);e.setResult(s),e.setSelectedID(o.id)},synchronizeTopView=(t,o,i,r)=>{var e;if(!i||!r)return;r.generateBox(t,o.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=i,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),l=[...c.polygonList],h=l.find(g=>g.id===o.id);h?h.pointList=s:l.push({id:o.id,pointList:s,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),c.setResultAndSelectedID(l,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:r,mainViewInstance:e,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:l,pointCloudBoxList:h,pointCloudSphereList:g,hideAttributes:x}=t,{addHistory:_,initHistory:V,pushHistoryUnderUpdatePolygon:O,pushHistoryUnderUpdateLine:k}=useHistory.useHistory(),{selectedPolygon:A}=usePolygon.usePolygon(),{updateSelectedBox:I,updateSelectedBoxes:S,getPointCloudByID:j}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:y,updatePointCloudSphere:H,selectedSphere:z}=useSphere.useSphere(),{currentData:w,config:L}=ctx.useSelector(n=>{const{stepList:a,step:P,imgList:u,imgIndex:d}=n.annotation;return{currentData:u[d],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,a).config)}}),F=ctx.useDispatch(),{selectedBox:T}=useSingleBox.useSingleBox(),{t:G}=reactI18next.useTranslation(),N=T==null?void 0:T.info;if(!o||!i||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,Q=n=>{e==null||e.generateBox(n),e==null||e.controls.update(),e==null||e.render()},X=n=>{e==null||e.generateSphere(n),e==null||e.controls.update(),e==null||e.render()},Y=({newPoint:n,size:a,zoom:P,trackConfigurable:u})=>{var d;const C={attribute:(d=o.toolInstance.defaultAttribute)!=null?d:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const f=topViewPoint2PointCloud(n,a,E,void 0,C);s(n.id);const v=p(f);M(PointCloudView.Top,n,f,P,v,L),_({newSphereParams:f})},J=({polygon:n,size:a,imgList:P,trackConfigurable:u,zoom:d,intelligentFit:C})=>{var f;const v={attribute:(f=o.toolInstance.defaultAttribute)!=null?f:""};u===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:g})});const m=o==null?void 0:o.toolInstance,b=__spreadValues({},n),{boxParams:B,newPointList:D}=topViewPolygon2PointCloud(b,a,E,void 0,v,C);if((L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(G("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),m.deletePolygon(B.id);return}C&&(D==null?void 0:D.length)&&(b.pointList=D);const q=x.includes(b.attribute),U=c(B);q?s([]):(s(B.id),m.setSelectedIDs([b.id]),R(PointCloudView.Top,b,B,d,U),C&&synchronizeTopView(B,b,o,e)),_({newBoxParams:B})},K=({newSelectedBox:n,newPointCloudList:a,newSelectedSphere:P,newSphereList:u})=>{const d=o==null?void 0:o.toolInstance;if(!(l.length===0||!d)){if(n||(T==null?void 0:T.info)){const C=n!=null?n:T==null?void 0:T.info;d.setSelectedIDs(l);const f=d.selectedPolygon;if(l.length===1&&C){R(PointCloudView.Top,f,C,void 0,a);return}}if((P||z)&&l.length===1){const C=P!=null?P:z;d.setSelectedID(l[0]);const f=d.selectedPoint;C&&M(PointCloudView.Top,f,C,void 0,u,L)}}},Z=(n,a,P)=>{if(N){let u,d;switch(P){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}if(d=u(n,a,N,i.pointCloudInstance),e){const{count:f}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(d).polygonPointList,[d.center.z-d.depth/2,d.center.z+d.depth/2]);d=__spreadProps(__spreadValues({},d),{count:f})}const C=I(d);return R(P,n,d,void 0,C),C}},W=(n,a,P)=>{if(z){let u,d;switch(P){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}d=u(n,a,z);const C=H(d);return M(P,n,d,void 0,C,L),C}},$=(n,a)=>{W(n,a,PointCloudView.Side)},tt=(n,a)=>{W(n,a,PointCloudView.Back)},et=(n,a)=>{Z(n,a,PointCloudView.Side)},ot=(n,a)=>{Z(n,a,PointCloudView.Back)},it=(n,a)=>{k(n)},nt=(n,a)=>{const P=y(n.id),u=topViewPoint2PointCloud(n,a,E,P),d=H(u);M(PointCloudView.Top,n,u,void 0,d,L)},st=(n,a)=>{if(A){const u=n[0].newPolygon;u.pointList=u.pointList.map(d=>lbUtils.PointCloudUtils.transferCanvas2World(d,a)),O(n[0].newPolygon);return}const P=n.map(({newPolygon:u})=>{const d=j(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,a,o.pointCloudInstance,d);return C});if(P.length===1){const{newPolygon:u}=n[0],d=S(P);R(PointCloudView.Top,u,P[0],void 0,d)}else{const u=S(P);u&&t.syncAllViewPointCloudColor(u)}},M=(n,a,P,u,d,C)=>__async(void 0,null,function*(){const f=w==null?void 0:w.url,v={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,a,i,f,C)},[PointCloudView.Back]:()=>{r&&syncBackViewByPoint(P,a,r,f,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,a,o,e)}};Object.keys(v).forEach(m=>{m!==n&&v[m]()}),u&&(e==null||e.updateCameraZoom(u)),X(P)}),R=(n,a,P,u,d)=>__async(void 0,null,function*(){const C=w==null?void 0:w.url;d&&(yield t.syncAllViewPointCloudColor(d));const f={[PointCloudView.Side]:()=>{synchronizeSideView(P,a,i,C)},[PointCloudView.Back]:()=>{r&&synchronizeBackView(P,a,r,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,a,o,e)}};Object.keys(f).forEach(v=>{v!==n&&f[v]()}),u&&(e==null||e.updateCameraZoom(u)),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),e==null||e.generateBoxes(n)},initPointCloud3d:n=>{if(!e)return;const a={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};e.initOrthographicCamera(a),e.initRenderer(),e.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(a=w){var P,u,d,C,f,v;if(!(a==null?void 0:a.url)||!e)return;actionCreators.SetPointCloudLoading(F,!0),yield e.loadPCDFile(a.url,(P=L==null?void 0:L.radius)!=null?P:DEFAULT_RADIUS),h.forEach(U=>{e==null||e.removeObjectByName(U.id)}),g.forEach(U=>{e==null||e.removeObjectByName(U.id)});let m=[],b=[],B=[],D=[];w.result?(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(w.result),B=lbUtils.PointCloudUtils.getPolygonListFromResultList(w.result),b=lbUtils.PointCloudUtils.getLineListFromResultList(w.result),D=lbUtils.PointCloudUtils.getSphereParamsFromResultList(w.result),m.forEach(U=>{e==null||e.generateBox(U)}),D.forEach(U=>{e==null||e.generateSphere(U)}),t.syncAllViewPointCloudColor(m),t.setPointCloudResult(m),t.setPolygonList(B),t.setLineList(b),t.setPointCloudSphereList(D)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),V({pointCloudBoxList:m,polygonList:B,pointCloudSphereList:D}),e.updateTopCamera();const q=(d=(u=index.jsonParser(a.result))==null?void 0:u.valid)!=null?d:!0;t.setPointCloudValid(q),(C=t.sideViewInstance)==null||C.clearAllData(),(f=t.backViewInstance)==null||f.clearAllData(),o.updateData(a.url,a.result,{radius:(v=L==null?void 0:L.radius)!=null?v: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"),PointCloudContext=require("../PointCloudContext.js"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_);const useSphere=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:u,selectedID:i,mainViewInstance:r}=React.useContext(PointCloudContext.PointCloudContext),l=React.useMemo(()=>e.find(t=>t.id===i),[i,e]),d=React.useCallback(t=>e.find(n=>n.id===t),[e]),s=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 u(o),o}return e},[e]),c=React.useCallback(t=>{const n=e.filter(o=>o.id!==t);u(n),r==null||r.removeObjectByName(t),r==null||r.render()},[e]);return{selectedSphere:l,getPointCloudSphereByID:d,updatePointCloudSphere:s,deletePointCloudSphere:c}};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");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_);const useSphere=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:u,selectedID:i,mainViewInstance:n}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:s}=useHistory.useHistory(),l=React.useMemo(()=>e.find(t=>t.id===i),[i,e]),d=React.useCallback(t=>e.find(o=>o.id===t),[e]),c=React.useCallback(t=>{const o=e.findIndex(r=>r.id===t.id);if(o>-1){e.splice(o,1,___default.default.merge(e[o],t));const r=___default.default.cloneDeep(e);return u(r),s({pointCloudSphereList:r}),r}return e},[e]),a=React.useCallback(t=>{const o=e.filter(r=>r.id!==t);u(o),n==null||n.removeObjectByName(t),n==null||n.render()},[e]);return{selectedSphere:l,getPointCloudSphereByID:d,updatePointCloudSphere:c,deletePointCloudSphere:a}};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");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:r,backViewInstance:a,mainViewInstance:t,pointCloudBoxList:c,pointCloudSphereList:d,setPointCloudResult:P,setPointCloudSphereList:C,setPolygonList:v,pointCloudPattern:u,setPointCloudPattern:n,syncAllViewPointCloudColor:h}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:y}=useHistory.useHistory(),p=()=>{c.forEach(e=>{t==null||t.removeObjectByName(e.id)}),d.forEach(e=>{t==null||t.removeObjectByName(e.id)}),t==null||t.render(),P([]),v([]),C([]),i==null||i.toolScheduler.clearStatusAndResult(),h([]),y({pointCloudBoxList:[],polygonList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),a==null||a.toolInstance.clearResult()};return{clearAllResult:p,updatePointCloudPattern:e=>{if(e===u)return;const s=[i,r,a];switch(e){case EToolName.Rect:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Rect)}),n(EToolName.Rect);break;case EToolName.Polygon:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Normal)}),n(EToolName.Polygon);break;case EToolName.Point:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Point)}),n(EToolName.Point);break;case EToolName.Line:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Line)}),n(EToolName.Line);break}},pointCloudPattern:u}};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");const{EToolName,EPolygonPattern}=lbAnnotation.cTool,useStatus=()=>{const{topViewInstance:i,sideViewInstance:r,backViewInstance:u,mainViewInstance:t,pointCloudBoxList:c,pointCloudSphereList:d,setPointCloudResult:P,setPointCloudSphereList:C,setPolygonList:v,pointCloudPattern:a,setPointCloudPattern:n,syncAllViewPointCloudColor:h}=React.useContext(PointCloudContext.PointCloudContext),{pushHistoryWithList:p}=useHistory.useHistory(),y=()=>{c.forEach(e=>{t==null||t.removeObjectByName(e.id)}),d.forEach(e=>{t==null||t.removeObjectByName(e.id)}),t==null||t.render(),P([]),v([]),C([]),i==null||i.toolScheduler.clearStatusAndResult(),h([]),p({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},l=()=>{r==null||r.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()};return{clearAllResult:y,updatePointCloudPattern:e=>{if(e===a)return;const s=[i,r,u];switch(e){case EToolName.Rect:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Rect)}),n(EToolName.Rect);break;case EToolName.Polygon:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.PointCloudPolygon),o==null||o.toolInstance.setPattern(EPolygonPattern.Normal)}),n(EToolName.Polygon);break;case EToolName.Point:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Point)}),n(EToolName.Point);break;case EToolName.Line:l(),s.forEach(o=>{o==null||o.switchToCanvas(EToolName.Line)}),n(EToolName.Line);break}},pointCloudPattern:a}};exports.useStatus=useStatus;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface IProps {
3
3
  src: string;
4
4
  result: string;
@@ -9,5 +9,5 @@ interface IProps {
9
9
  backgroundColor?: string;
10
10
  isOrthographicCamera?: boolean;
11
11
  }
12
- declare const PointCloudAnnotationView: (props: IProps) => JSX.Element;
12
+ declare const PointCloudAnnotationView: (props: IProps) => React.JSX.Element;
13
13
  export default PointCloudAnnotationView;
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IStepInfo } from '@/types/step';
3
3
  interface IProps {
4
4
  stepList: IStepInfo[];
5
5
  currentStep: number;
6
6
  updateStep: (step: number) => void;
7
7
  }
8
- declare const AnnotationStepPopover: (props: IProps) => JSX.Element;
8
+ declare const AnnotationStepPopover: (props: IProps) => React.JSX.Element;
9
9
  export default AnnotationStepPopover;
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface IProps {
3
3
  selectedAttribute: string[];
4
4
  attributeChanged: () => void;
5
5
  num?: any;
6
6
  list?: any[];
7
7
  }
8
- declare const CheckboxList: (props: IProps) => JSX.Element;
8
+ declare const CheckboxList: (props: IProps) => React.JSX.Element;
9
9
  export default CheckboxList;
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export declare const ColorTag: ({ color, style }: any) => JSX.Element;
1
+ import React from 'react';
2
+ export declare const ColorTag: ({ color, style }: any) => React.JSX.Element;
@@ -5,5 +5,5 @@ interface IProps {
5
5
  iconChildren: React.ReactNode;
6
6
  marginLeft?: number;
7
7
  }
8
- declare const IconWithText: (props: IProps) => JSX.Element;
8
+ declare const IconWithText: (props: IProps) => React.JSX.Element;
9
9
  export default IconWithText;
@@ -4,8 +4,8 @@ export declare const viewportContext: React.Context<{
4
4
  width: number;
5
5
  height: number;
6
6
  }>;
7
- export declare const ViewportProviderComponent: (props: any) => JSX.Element;
8
- export declare const ViewportProvider: import("react-redux").ConnectedComponent<(props: any) => JSX.Element, import("react-redux").Omit<any, "annotation" | "dispatch">>;
7
+ export declare const ViewportProviderComponent: (props: any) => React.JSX.Element;
8
+ export declare const ViewportProvider: import("react-redux").ConnectedComponent<(props: any) => React.JSX.Element, import("react-redux").Omit<any, "annotation" | "dispatch">>;
9
9
  export declare const useViewport: () => {
10
10
  width: number;
11
11
  height: number;
@@ -11,5 +11,5 @@ export interface IFileErrorProps {
11
11
  fileType?: string;
12
12
  isError?: boolean;
13
13
  }
14
- declare const FileError: (props: IFileErrorProps) => JSX.Element;
14
+ declare const FileError: (props: IFileErrorProps) => React.JSX.Element;
15
15
  export default FileError;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IA2MapStateProps } from '@/store/annotation/map';
3
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config }: IA2MapStateProps) => JSX.Element, import("react-redux").Omit<IA2MapStateProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
3
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config }: IA2MapStateProps) => React.JSX.Element, import("react-redux").Omit<IA2MapStateProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
4
4
  export default _default;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IA2MapStateProps } from '@/store/annotation/map';
3
3
  interface IProps {
4
4
  checkMode?: boolean;
5
5
  }
6
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, checkMode }: IA2MapStateProps & IProps) => JSX.Element, import("react-redux").Omit<IA2MapStateProps & IProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
6
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, checkMode }: IA2MapStateProps & IProps) => React.JSX.Element, import("react-redux").Omit<IA2MapStateProps & IProps, "imgIndex" | "imgList" | "config" | "currentData" | "stepInfo" | "configString">>;
7
7
  export default _default;
@@ -3,8 +3,8 @@
3
3
  * @file Display selected box's infos
4
4
  * @createdate 2022-07-13
5
5
  */
6
- /// <reference types="react" />
7
6
  import { EPerspectiveView, IPointCloudConfig } from '@labelbee/lb-utils';
7
+ import React from 'react';
8
8
  /**
9
9
  * Display size info for views
10
10
  * @param param0
@@ -12,12 +12,12 @@ import { EPerspectiveView, IPointCloudConfig } from '@labelbee/lb-utils';
12
12
  */
13
13
  export declare const SizeInfoForView: ({ perspectiveView }: {
14
14
  perspectiveView: EPerspectiveView;
15
- }) => JSX.Element | null;
15
+ }) => React.JSX.Element | null;
16
16
  /**
17
17
  * Display selected box's infos
18
18
  */
19
19
  export declare const BoxInfos: ({ checkMode, config, }: {
20
20
  checkMode?: boolean | undefined;
21
21
  config: IPointCloudConfig;
22
- }) => JSX.Element | null;
23
- export declare const PointCloudValidity: () => JSX.Element | null;
22
+ }) => React.JSX.Element | null;
23
+ export declare const PointCloudValidity: () => React.JSX.Element | null;
@@ -1,3 +1,8 @@
1
- /// <reference types="react" />
2
- declare const EmptyPage: () => JSX.Element;
1
+ /**
2
+ * @file EmptyPage
3
+ * @createDate 2022-08-31
4
+ * @author Ron <ron.f.luo@gmail.com>
5
+ */
6
+ import React from 'react';
7
+ declare const EmptyPage: () => React.JSX.Element;
3
8
  export default EmptyPage;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IPointCloudConfig } from '@labelbee/lb-utils';
3
3
  import { AnnotationFileList } from '@/types/data';
4
4
  interface IProps {
@@ -9,5 +9,5 @@ interface IProps {
9
9
  imgList: AnnotationFileList;
10
10
  imgIndex: number;
11
11
  }
12
- declare const _default: import("react-redux").ConnectedComponent<({ id, visible, onCancel, config, imgList, imgIndex }: IProps) => JSX.Element, import("react-redux").Omit<IProps, "imgIndex">>;
12
+ declare const _default: import("react-redux").ConnectedComponent<({ id, visible, onCancel, config, imgList, imgIndex }: IProps) => React.JSX.Element, import("react-redux").Omit<IProps, "imgIndex">>;
13
13
  export default _default;
@@ -1,20 +1,22 @@
1
- import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointUnit, ILine } from '@labelbee/lb-utils';
1
+ import { IPointCloudBox, IPointCloudBoxList, IPointCloudSphere, IPointCloudSphereList, IPolygonData, ILine } from '@labelbee/lb-utils';
2
2
  export declare const useHistory: () => {
3
- addHistory: ({ newBoxParams, newPolygon, newLine, }: {
3
+ addHistory: ({ newBoxParams, newPolygon, newLine, newSphereParams, }: {
4
4
  newBoxParams?: IPointCloudBox | undefined;
5
5
  newPolygon?: IPolygonData | undefined;
6
6
  newLine?: ILine | undefined;
7
+ newSphereParams?: IPointCloudSphere | undefined;
7
8
  }) => void;
8
9
  pushHistoryWithList: (params: Partial<{
9
10
  pointCloudBoxList: IPointCloudBoxList;
10
11
  polygonList: IPolygonData[];
11
12
  lineList: ILine[];
13
+ pointCloudSphereList: IPointCloudSphereList;
12
14
  }>) => void;
13
- initHistory: ({ pointCloudBoxList, polygonList, }: {
15
+ initHistory: ({ pointCloudBoxList, polygonList, pointCloudSphereList, }: {
14
16
  pointCloudBoxList: IPointCloudBoxList;
15
17
  polygonList: IPolygonData[];
18
+ pointCloudSphereList: IPointCloudSphereList;
16
19
  }) => void;
17
- pushHistoryUnderUpdatePoint: (point: IPointUnit) => void;
18
20
  pushHistoryUnderUpdatePolygon: (polygon: IPolygonData) => void;
19
21
  pushHistoryUnderUpdateLine: (line: ILine) => void;
20
22
  redo: () => void;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  declare const _default: import("react-redux").ConnectedComponent<(props: {
3
3
  loading: boolean;
4
- }) => JSX.Element, import("react-redux").Omit<{
4
+ }) => React.JSX.Element, import("react-redux").Omit<{
5
5
  loading: boolean;
6
6
  }, "loading">>;
7
7
  export default _default;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IPointCloudBoxWithIndex } from '@/store/annotation/types';
3
3
  import { IFileItem } from '@/types/data';
4
4
  interface IProps {
@@ -6,5 +6,5 @@ interface IProps {
6
6
  predictionResultVisible: boolean;
7
7
  predictionResult: IPointCloudBoxWithIndex[];
8
8
  }
9
- declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => JSX.Element | null, import("react-redux").Omit<IProps, "imgList" | "predictionResult" | "predictionResultVisible">>;
9
+ declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "imgList" | "predictionResult" | "predictionResultVisible">>;
10
10
  export default _default;
@@ -85,6 +85,6 @@ export declare class TagToolInstanceAdaptor extends React.Component<IVideoTagIns
85
85
  setResultFromImgList: (props: IVideoTagInstanceAdaptorProps) => void;
86
86
  /** Observer imgIndex and set tagResult */
87
87
  shouldComponentUpdate(props: IVideoTagInstanceAdaptorProps): boolean;
88
- render(): JSX.Element;
88
+ render(): React.JSX.Element;
89
89
  }
90
90
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IVideoTagInstanceAdaptorProps } from './TagToolInstanceAdaptor';
3
3
  /**
4
4
  * I18n provider for InstanceAdaptorI18nProvider
@@ -6,4 +6,4 @@ import { IVideoTagInstanceAdaptorProps } from './TagToolInstanceAdaptor';
6
6
  */
7
7
  export declare const VideoTagTool: (props: IVideoTagInstanceAdaptorProps & {
8
8
  lang?: string;
9
- }) => JSX.Element;
9
+ }) => React.JSX.Element;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- declare const VideoController: () => JSX.Element;
1
+ import React from 'react';
2
+ declare const VideoController: () => React.JSX.Element;
3
3
  export default VideoController;
@@ -68,6 +68,6 @@ export declare class VideoPlayer extends React.Component<IVideoPlayerProps, IVid
68
68
  onError: () => void;
69
69
  componentDidMount(): void;
70
70
  componentWillUnmount(): void;
71
- render(): JSX.Element;
71
+ render(): React.JSX.Element;
72
72
  }
73
73
  export default VideoPlayer;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface IProps {
3
3
  tips?: string;
4
4
  path?: string;
5
5
  }
6
- declare const AnnotationTips: ({ path, tips }: IProps) => JSX.Element | null;
6
+ declare const AnnotationTips: ({ path, tips }: IProps) => React.JSX.Element | null;
7
7
  export default AnnotationTips;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- declare const clearIcon: () => JSX.Element;
1
+ import React from 'react';
2
+ declare const clearIcon: () => React.JSX.Element;
3
3
  export default clearIcon;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { ImgAttributeState } from '@/store/imgAttribute/types';
3
3
  interface IProps {
4
4
  imgAttribute: ImgAttributeState;
5
5
  }
6
- declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => JSX.Element, import("react-redux").Omit<IProps, "imgAttribute">>;
6
+ declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => React.JSX.Element, import("react-redux").Omit<IProps, "imgAttribute">>;
7
7
  export default _default;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
1
  import { ToolInstance } from '@/store/annotation/types';
3
2
  import { AnnotationFileList } from '@/types/data';
4
3
  import { IStepInfo } from '@/types/step';
4
+ import React from 'react';
5
5
  /**
6
6
  * 检查当前数字是否为有效数字
7
7
  * @param value
@@ -16,5 +16,5 @@ interface IProps {
16
16
  imgIndex: number;
17
17
  stepList: IStepInfo[];
18
18
  }
19
- declare const _default: import("react-redux").ConnectedComponent<({ id, stepList, imgList, imgIndex, toolInstance }: IProps) => JSX.Element, import("react-redux").Omit<IProps, "stepList" | "imgIndex" | "imgList" | "toolInstance">>;
19
+ declare const _default: import("react-redux").ConnectedComponent<({ id, stepList, imgList, imgIndex, toolInstance }: IProps) => React.JSX.Element, import("react-redux").Omit<IProps, "stepList" | "imgIndex" | "imgList" | "toolInstance">>;
20
20
  export default _default;
@@ -4,7 +4,7 @@ interface IProps {
4
4
  imgIndex: number;
5
5
  toolInstance: TagOperation;
6
6
  }
7
- export declare const expandIconFuc: ({ isActive }: any) => JSX.Element;
7
+ export declare const expandIconFuc: ({ isActive }: any) => React.JSX.Element;
8
8
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
9
9
  children?: React.ReactNode;
10
10
  }, "imgIndex" | "toolInstance">>;
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface IProps {
3
3
  onChange: (value: string, isSubmit?: boolean) => void;
4
4
  textValue: string | undefined;
5
5
  checkString: string;
6
6
  textCheckType: number;
7
7
  }
8
- declare const TextAreaFormat: (props: IProps) => JSX.Element;
8
+ declare const TextAreaFormat: (props: IProps) => React.JSX.Element;
9
9
  export default TextAreaFormat;
@@ -5,7 +5,7 @@ interface ITextareaWithFooterProps {
5
5
  textareaProps?: any;
6
6
  footer?: any;
7
7
  }
8
- export declare const TextareaWithFooter: (props: ITextareaWithFooterProps) => JSX.Element;
8
+ export declare const TextareaWithFooter: (props: ITextareaWithFooterProps) => React.JSX.Element;
9
9
  interface IProps {
10
10
  dispatch: Function;
11
11
  toolInstance: TextToolOperation;
@@ -15,7 +15,7 @@ interface IProps {
15
15
  stepList: IStepInfo[];
16
16
  basicResultList: any[];
17
17
  }
18
- export declare const SingleTextInput: (props: any) => JSX.Element;
18
+ export declare const SingleTextInput: (props: any) => React.JSX.Element;
19
19
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
20
20
  children?: React.ReactNode;
21
21
  }, "stepList" | "step" | "imgIndex" | "basicResultList" | "toolInstance" | "triggerEventAfterIndexChanged" | "dispatch">>;
@@ -3,10 +3,10 @@
3
3
  * @author Glenfiddish <edwinlee0927@hotmail.com>
4
4
  * @createdate 2022-07-14
5
5
  */
6
- /// <reference types="react" />
7
6
  import { EToolName } from '@/data/enums/ToolType';
7
+ import React from 'react';
8
8
  export declare const ToolIcons: ({ toolName, selectedToolName, onChange, }: {
9
9
  toolName: string;
10
10
  selectedToolName?: string | undefined;
11
11
  onChange: (toolName: EToolName) => void;
12
- }) => JSX.Element;
12
+ }) => React.JSX.Element;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { ToolStyleState } from '@/store/toolStyle/types';
3
3
  interface IProps {
4
4
  toolStyle: ToolStyleState;
5
5
  config: string;
6
6
  }
7
- declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => JSX.Element, import("react-redux").Omit<IProps, "config" | "toolStyle">>;
7
+ declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => React.JSX.Element, import("react-redux").Omit<IProps, "config" | "toolStyle">>;
8
8
  export default _default;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- export declare const AnnotatedAttributesPanel: () => JSX.Element;
3
- export declare const AnnotatedAttributesPanelFixedLeft: () => JSX.Element | null;
4
- export declare const AnnotatedAttributesPanelFixedRight: () => JSX.Element | null;
5
- export declare const AnnotatedAttributesIcon: () => JSX.Element | null;
1
+ import React from 'react';
2
+ export declare const AnnotatedAttributesPanel: () => React.JSX.Element;
3
+ export declare const AnnotatedAttributesPanelFixedLeft: () => React.JSX.Element | null;
4
+ export declare const AnnotatedAttributesPanelFixedRight: () => React.JSX.Element | null;
5
+ export declare const AnnotatedAttributesIcon: () => React.JSX.Element | null;
@@ -6,5 +6,5 @@ declare const FooterPopover: ({ hoverIcon, icon, containerStyle, content, title,
6
6
  containerStyle?: React.CSSProperties | undefined;
7
7
  content: React.ReactNode;
8
8
  title: string;
9
- }) => JSX.Element;
9
+ }) => React.JSX.Element;
10
10
  export default FooterPopover;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { ToolInstance } from '@/store/annotation/types';
3
3
  interface IProps {
4
4
  toolInstance: ToolInstance;
5
5
  }
6
- declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => JSX.Element | null, import("react-redux").Omit<IProps, "toolInstance">>;
6
+ declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "toolInstance">>;
7
7
  export default _default;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { GraphToolInstance } from '@/store/annotation/types';
3
3
  interface IProps {
4
4
  toolInstance: GraphToolInstance;
5
5
  }
6
- declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => JSX.Element | null, import("react-redux").Omit<IProps, "toolInstance">>;
6
+ declare const _default: import("react-redux").ConnectedComponent<(props: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "toolInstance">>;
7
7
  export default _default;
@@ -17,6 +17,6 @@ interface IPageProps {
17
17
  * @param props
18
18
  * @returns
19
19
  */
20
- export declare const PageInput: (props: IPageProps) => JSX.Element;
20
+ export declare const PageInput: (props: IPageProps) => React.JSX.Element;
21
21
  export declare const Pagination: React.FC<IPaginationProps>;
22
22
  export {};
@@ -17,7 +17,7 @@ interface IProps {
17
17
  skipBeforePageTurning?: (pageTurning: Function) => void;
18
18
  }
19
19
  export declare const footerCls: string;
20
- export declare const FooterDivider: () => JSX.Element;
20
+ export declare const FooterDivider: () => React.JSX.Element;
21
21
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
22
22
  children?: React.ReactNode;
23
23
  }, "stepList" | "step" | "imgIndex" | "basicResultList" | "basicIndex" | "skipBeforePageTurning" | "totalPage">>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),React=require("react"),selectors=require("../../../../store/annotation/selectors.js"),ctx=require("../../../../store/ctx.js"),lbUtils=require("@labelbee/lb-utils"),icons=require("@ant-design/icons"),useHistory=require("../../../../components/pointCloudView/hooks/useHistory.js"),dom=require("../../../../utils/dom.js"),StepUtils=require("../../../../utils/StepUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),FooterPopover=require("../FooterPopover.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const AnnotatedAttributesItem=({attribute:e})=>{const n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:t,pointCloudSphereList:a,hideAttributes:s,toggleAttributesVisible:u,polygonList:o,setPolygonList:p,lineList:c,setLineList:i,setPointCloudResult:x,setPointCloudSphereList:y,reRender:b,selectSpecAttr:L}=n,[f,E]=React.useState(!0),{pushHistoryWithList:A}=useHistory.useHistory(),v=[...t,...o,...a,...c].filter(l=>l.attribute===e.value),g=()=>{u(e.value)},h=s.includes(e.value),_=({trackID:l,order:r})=>l||r,N=({trackID:l,order:r})=>l?`trackID_${l}`:`order_${r}`,O=l=>{if(v.length===0)return;const r=o.filter(d=>l!==d.attribute),m=t.filter(d=>l!==d.attribute),C=c.filter(d=>l!==d.attribute),P=a.filter(d=>l!==d.attribute);b(m,r,P,C),p(r),x(m),y(P),i(C),A({pointCloudBoxList:m,polygonList:r,lineList:C})},F=l=>{antd.Modal.confirm({content:lbUtils.i18n.t("onDeleteGraphByAttr",{attribute:l.key}),onOk:()=>{O(l.value)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")})};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","item")},h?React__default.default.createElement(icons.EyeInvisibleFilled,{onClick:g}):React__default.default.createElement(icons.EyeFilled,{onClick:g}),React__default.default.createElement(icons.CaretDownFilled,{rotate:f?0:270,onClick:()=>{E(!f)}}),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","item","text"),onClick:()=>{L(e.value)}},e.key),React__default.default.createElement(icons.DeleteOutlined,{onClick:()=>F(e)})),f&&v.map((l,r)=>React__default.default.createElement("div",{key:N(__spreadProps(__spreadValues({},l),{order:r})),style:{paddingLeft:54}},`${_(__spreadProps(__spreadValues({},l),{order:r}))}.${e.key}`)))},AnnotatedAttributesPanel=()=>{const e=ctx.useSelector(selectors.stepConfigSelector),{attrPanelLayout:n,setAttrPanelLayout:t,pointCloudBoxList:a,polygonList:s,lineList:u}=React.useContext(PointCloudContext.PointCloudContext),{t:o}=reactI18next.useTranslation(),p=React.useMemo(()=>[...a,...s,...u].map(i=>i.attribute),[a,s,u]),c=React.useMemo(()=>e.attributeList.filter(i=>p.includes(i.value)),[p]);return React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute")},n?React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",null,o("AnnotatedResult")),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","pin"),onClick:()=>{t("")}},React__default.default.createElement(icons.PushpinFilled,null),o("CancelFixed"))):React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",{onClick:()=>{t("left")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),o("FixedOnLeft")),React__default.default.createElement("span",{onClick:()=>{t("right")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),o("FixedOnRight"))),React__default.default.createElement("div",null,c.length>0?c.map(i=>React__default.default.createElement(AnnotatedAttributesItem,{attribute:i,key:i.value})):React__default.default.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},o("NoData"))))},AnnotatedAttributesPanelFixedLeft=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="left"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesPanelFixedRight=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="right"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesIcon=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext),{t:n}=reactI18next.useTranslation(),t=ctx.useSelector(a=>{var s,u;return StepUtils.getCurrentStepInfo((s=a==null?void 0:a.annotation)==null?void 0:s.step,(u=a.annotation)==null?void 0:u.stepList)});return(t==null?void 0:t.tool)!==lbAnnotation.EPointCloudName.PointCloud||e?null:React__default.default.createElement(FooterPopover,{hoverIcon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),icon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),title:n("AnnotatedList"),content:React__default.default.createElement(AnnotatedAttributesPanel,null)})};exports.AnnotatedAttributesIcon=AnnotatedAttributesIcon,exports.AnnotatedAttributesPanel=AnnotatedAttributesPanel,exports.AnnotatedAttributesPanelFixedLeft=AnnotatedAttributesPanelFixedLeft,exports.AnnotatedAttributesPanelFixedRight=AnnotatedAttributesPanelFixedRight;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),React=require("react"),selectors=require("../../../../store/annotation/selectors.js"),ctx=require("../../../../store/ctx.js"),lbUtils=require("@labelbee/lb-utils"),icons=require("@ant-design/icons"),useHistory=require("../../../../components/pointCloudView/hooks/useHistory.js"),dom=require("../../../../utils/dom.js"),StepUtils=require("../../../../utils/StepUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),FooterPopover=require("../FooterPopover.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const AnnotatedAttributesItem=({attribute:e})=>{const n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:t,pointCloudSphereList:o,hideAttributes:i,toggleAttributesVisible:s,polygonList:c,setPolygonList:u,lineList:p,setLineList:f,setPointCloudResult:a,setPointCloudSphereList:y,reRender:L,selectSpecAttr:b}=n,[m,E]=React.useState(!0),{pushHistoryWithList:A}=useHistory.useHistory(),P=[...t,...c,...o,...p].filter(l=>l.attribute===e.value),x=()=>{s(e.value)},h=i.includes(e.value),_=({trackID:l,order:r})=>l||r,N=({trackID:l,order:r})=>l?`trackID_${l}`:`order_${r}`,O=l=>{if(P.length===0)return;const r=c.filter(d=>l!==d.attribute),C=t.filter(d=>l!==d.attribute),v=p.filter(d=>l!==d.attribute),g=o.filter(d=>l!==d.attribute);L(C,r,g,v),u(r),a(C),y(g),f(v),A({pointCloudBoxList:C,polygonList:r,lineList:v,pointCloudSphereList:g})},F=l=>{antd.Modal.confirm({content:lbUtils.i18n.t("onDeleteGraphByAttr",{attribute:l.key}),onOk:()=>{O(l.value)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")})};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","item")},h?React__default.default.createElement(icons.EyeInvisibleFilled,{onClick:x}):React__default.default.createElement(icons.EyeFilled,{onClick:x}),React__default.default.createElement(icons.CaretDownFilled,{rotate:m?0:270,onClick:()=>{E(!m)}}),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","item","text"),onClick:()=>{b(e.value)}},e.key),React__default.default.createElement(icons.DeleteOutlined,{onClick:()=>F(e)})),m&&P.map((l,r)=>React__default.default.createElement("div",{key:N(__spreadProps(__spreadValues({},l),{order:r})),style:{paddingLeft:54}},`${_(__spreadProps(__spreadValues({},l),{order:r}))}.${e.key}`)))},AnnotatedAttributesPanel=()=>{const e=ctx.useSelector(selectors.stepConfigSelector),{attrPanelLayout:n,setAttrPanelLayout:t,pointCloudBoxList:o,pointCloudSphereList:i,polygonList:s,lineList:c}=React.useContext(PointCloudContext.PointCloudContext),{t:u}=reactI18next.useTranslation(),p=React.useMemo(()=>[...o,...i,...s,...c].map(a=>a.attribute),[o,i,s,c]),f=React.useMemo(()=>e.attributeList.filter(a=>p.includes(a.value)),[p]);return React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute")},n?React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",null,u("AnnotatedResult")),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","pin"),onClick:()=>{t("")}},React__default.default.createElement(icons.PushpinFilled,null),u("CancelFixed"))):React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",{onClick:()=>{t("left")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),u("FixedOnLeft")),React__default.default.createElement("span",{onClick:()=>{t("right")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),u("FixedOnRight"))),React__default.default.createElement("div",null,f.length>0?f.map(a=>React__default.default.createElement(AnnotatedAttributesItem,{attribute:a,key:a.value})):React__default.default.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},u("NoData"))))},AnnotatedAttributesPanelFixedLeft=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="left"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesPanelFixedRight=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="right"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesIcon=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext),{t:n}=reactI18next.useTranslation(),t=ctx.useSelector(o=>{var i,s;return StepUtils.getCurrentStepInfo((i=o==null?void 0:o.annotation)==null?void 0:i.step,(s=o.annotation)==null?void 0:s.stepList)});return(t==null?void 0:t.tool)!==lbAnnotation.EPointCloudName.PointCloud||e?null:React__default.default.createElement(FooterPopover,{hoverIcon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),icon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),title:n("AnnotatedList"),content:React__default.default.createElement(AnnotatedAttributesPanel,null)})};exports.AnnotatedAttributesIcon=AnnotatedAttributesIcon,exports.AnnotatedAttributesPanel=AnnotatedAttributesPanel,exports.AnnotatedAttributesPanelFixedLeft=AnnotatedAttributesPanelFixedLeft,exports.AnnotatedAttributesPanelFixedRight=AnnotatedAttributesPanelFixedRight;
@@ -1 +1 @@
1
- import{useContext as j}from"react";import{PointCloudContext as E}from"../PointCloudContext.js";var R=Object.defineProperty,P=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,h=(n,s,r)=>s in n?R(n,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[s]=r,g=(n,s)=>{for(var r in s||(s={}))S.call(s,r)&&h(n,r,s[r]);if(P)for(var r of P(s))V.call(s,r)&&h(n,r,s[r]);return n};const b=()=>{const{history:n,setPointCloudResult:s,setSelectedIDs:r,pointCloudBoxList:l,pointCloudSphereList:x,mainViewInstance:p,topViewInstance:L,polygonList:u,setPolygonList:f,lineList:c,setLineList:a,syncAllViewPointCloudColor:v}=j(E),H=({newBoxParams:t,newPolygon:o,newLine:i})=>{const e={pointCloudBoxList:l,polygonList:u,lineList:c};t&&(e.pointCloudBoxList=l.concat(t)),o&&(e.polygonList=u.concat(o)),i&&(e.lineList=c.concat(i)),n.pushHistory(e)},_=t=>{const o={pointCloudBoxList:l,polygonList:u,lineList:c};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),n.pushHistory(o)},w=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(e=>e.id===t.id?t:g({},e));n.pushHistory({lineList:i}),a(i)}},B=t=>{t&&n.pushHistory({pointCloudSphereList:x})},O=t=>{if(u.find(i=>i.id===t.id)){const i=u.map(e=>e.id===t.id?t:g({},e));n.pushHistory({pointCloudBoxList:l,polygonList:i}),f(i)}},m=({pointCloudBoxList:t,polygonList:o})=>{n.initRecord({pointCloudBoxList:t,polygonList:o},!0)},C=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:e=[]}=t;if(o){l.length!==o.length&&r();const U=l.filter(d=>o.every(y=>y.id!==d.id)),I=o.filter(d=>l.every(y=>y.id!==d.id));U.forEach(d=>{p==null||p.removeObjectByName(d.id)}),I.forEach(d=>{p==null||p.generateBox(d)}),s(o),v(o)}i&&f(i),e&&a(e),L==null||L.updatePolygonList(o!=null?o:[],i!=null?i:[]),L==null||L.updateLineList(e!=null?e:[])};return{addHistory:H,pushHistoryWithList:_,initHistory:m,pushHistoryUnderUpdatePoint:B,pushHistoryUnderUpdatePolygon:O,pushHistoryUnderUpdateLine:w,redo:()=>{C(n.redo())},undo:()=>{C(n.undo())}}};export{b as useHistory};
1
+ import{useContext as I}from"react";import{PointCloudContext as b}from"../PointCloudContext.js";var R=Object.defineProperty,x=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,S=(e,s,l)=>s in e?R(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l,_=(e,s)=>{for(var l in s||(s={}))U.call(s,l)&&S(e,l,s[l]);if(x)for(var l of x(s))V.call(s,l)&&S(e,l,s[l]);return e};const N=()=>{const{history:e,setPointCloudResult:s,setSelectedIDs:l,pointCloudBoxList:p,pointCloudSphereList:c,setPointCloudSphereList:B,mainViewInstance:u,topViewInstance:C,polygonList:f,setPolygonList:a,lineList:y,setLineList:g,syncAllViewPointCloudColor:w}=I(b),H=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:r})=>{const d={pointCloudBoxList:p,polygonList:f,lineList:y,pointCloudSphereList:c};t&&(d.pointCloudBoxList=p.concat(t)),o&&(d.polygonList=f.concat(o)),i&&(d.lineList=y.concat(i)),r&&(d.pointCloudSphereList=c.concat(r)),e.pushHistory(d)},O=t=>{const o={pointCloudBoxList:p,polygonList:f,lineList:y,pointCloudSphereList:c};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),e.pushHistory(o)},m=t=>{if(y.find(i=>i.id===t.id)){const i=y.map(r=>r.id===t.id?t:_({},r));e.pushHistory({lineList:i}),g(i)}},E=t=>{if(f.find(i=>i.id===t.id)){const i=f.map(r=>r.id===t.id?t:_({},r));e.pushHistory({pointCloudBoxList:p,polygonList:i}),a(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(L=>L.id!==n.id)),P=o.filter(n=>p.every(L=>L.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),P.forEach(n=>{u==null||u.generateBox(n)}),s(o),w(o)}if(d){c.length!==d.length&&l();let h=c.filter(n=>d.every(L=>L.id!==n.id)),P=d.filter(n=>c.every(L=>L.id!==n.id));h.forEach(n=>{u==null||u.removeObjectByName(n.id)}),P.forEach(n=>{u==null||u.generateSphere(n)}),B(d)}i&&a(i),r&&g(r),C==null||C.updatePolygonList(o!=null?o:[],i!=null?i:[]),C==null||C.updateLineList(r!=null?r:[])};return{addHistory:H,pushHistoryWithList:O,initHistory:j,pushHistoryUnderUpdatePolygon:E,pushHistoryUnderUpdateLine:m,redo:()=>{v(e.redo())},undo:()=>{v(e.undo())}}};export{N as useHistory};
@@ -1 +1 @@
1
- import{MathUtils as x,getCuboidFromPointCloudBox as Vt}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 At}from"../PointCloudContext.js";import{useSingleBox as st}from"./useSingleBox.js";import{useSphere as jt}from"./useSphere.js";import{useSelector as Tt,useDispatch as zt}from"../../../store/ctx.js";import Rt from"../../../utils/StepUtils.js";import{jsonParser as rt}from"../../../utils/index.js";import{SetPointCloudLoading as dt}from"../../../store/annotation/actionCreators.js";import{message as Et}from"antd";import{useTranslation as Ht}from"react-i18next";import{useHistory as Ft}from"./useHistory.js";import{usePolygon as Nt}from"./usePolygon.js";var Wt=Object.defineProperty,Zt=Object.defineProperties,Mt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,Gt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,at=(t,e,n)=>e in t?Wt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,L=(t,e)=>{for(var n in e||(e={}))Gt.call(e,n)&&at(t,n,e[n]);if(lt)for(var n of lt(e))Xt.call(e,n)&&at(t,n,e[n]);return t},V=(t,e)=>Zt(t,Mt(e)),q=(t,e,n)=>new Promise((r,o)=>{var c=d=>{try{s(n.next(d))}catch(g){o(g)}},p=d=>{try{s(n.throw(d))}catch(g){o(g)}},s=d=>d.done?r(d.value):Promise.resolve(d.value).then(c,p);s((n=n.apply(t,e)).next())});const G=5,X=90,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(t,e,n,r,o)=>{const{x:c,y:p}=I.transferCanvas2World(t,e),{defaultZ:s}=Ut,d={center:{x:c,y:p,z:s},id:t.id},g=r?L(L({},r),d):V(L({},d),{attribute:"",valid:!0});return o&&Object.assign(g,o),g},K=(t,e,n,r,o,c)=>{let p=t.pointList.map(m=>I.transferCanvas2World(m,e)),s=0,d=1,g={};if(n){const m=n.getSensesPointZAxisInPolygon(p,void 0,c);c&&m.fittedCoordinates.length>0&&(p=m.fittedCoordinates),s=(m.maxZ+m.minZ)/2,d=m.maxZ-m.minZ,g={count:m.zCount}}const[P,B,H]=p,U=x.getLineCenterPoint([P,H]),T=x.getLineLength(P,B),z=x.getLineLength(B,H),R=x.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,d=r.depth);const k={center:{x:U.x,y:U.y,z:s},width:z,height:T,depth:d,rotation:R,id:t.id},A=L(r?L(L({},r),k):V(L({},k),{attribute:"",valid:!0}),g);o&&Object.assign(A,o);const j=p.map(m=>I.transferWorld2Canvas(m,e));return{boxParams:A,newPointList:j}},ct=(t,e,n)=>{const r={x:t.x-e.x,y:t.y-e.y};return V(L({},n),{center:{x:n.center.x-r.x,y:n.center.y,z:n.center.z-r.y}})},ut=(t,e,n,r)=>{const[o,c,p]=t.pointList,[s,d,g]=e.pointList,P=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([s,g]),U={x:{x:P.x-B.x,y:P.y-B.y}.x,y:0,z:P.y-B.y},T=x.getLineLength(o,c),z=x.getLineLength(s,d),R=T-z,k=x.getLineLength(c,p),A=x.getLineLength(d,g),j=k-A,{newBoxParams:m}=r.getNewBoxBySideUpdate(U,j,R,n);return m},Yt=(t,e,n)=>{const r={x:t.x-e.x,y:t.y-e.y};return V(L({},n),{center:{x:n.center.x,y:n.center.y-r.x,z:n.center.z-r.y}})},Qt=(t,e,n,r)=>{const[o,c,p]=t.pointList,[s,d,g]=e.pointList,P=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([s,g]),U={x:{x:P.x-B.x,y:P.y-B.y}.x,y:0,z:P.y-B.y},T=x.getLineLength(o,c),z=x.getLineLength(s,d),R=T-z,k=x.getLineLength(c,p),A=x.getLineLength(d,g),j=k-A;let{newBoxParams:m}=r.getNewBoxByBackUpdate(U,j,R,n);return m},pt=(t,e,n,r,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=o==null?void 0:o.radius)!=null?c:X);const{cameraPositionVector:d}=s.updateOrthoCameraBySphere(t,N.Left);s.setInitCameraPosition(d);const{point2d:g,zoom:P}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=P,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(P),p.setResult([V(L(L({},e),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},ft=(t,e,n,r)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{width:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:d}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Ct=(t,e,n,r,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=o==null?void 0:o.radius)!=null?c:X);const{cameraPositionVector:d}=s.updateOrthoCameraBySphere(t,N.Back);s.setInitCameraPosition(d);const{point2d:g,zoom:P}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=P,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(P),p.setResult([V(L(L({},e),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},gt=(t,e,n,r)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{height:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:d}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Pt=(t,e,n,r)=>{if(!n||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,N.Top),r.render();const{toolInstance:o,pointCloudInstance:c}=n,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...o.pointList].map(d=>d.id===e.id?V(L(L({},e),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);o.setResult(s),o.setSelectedID(e.id)},$=(t,e,n,r)=>{var o;if(!n||!r)return;r.generateBox(t,e.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=n,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),d=[...c.polygonList],g=d.find(P=>P.id===e.id);g?g.pointList=s:d.push({id:e.id,pointList:s,textAttribute:"",isRect:!0,valid:(o=t.valid)!=null?o:!0}),c.setResultAndSelectedID(d,e.id)},qt=()=>{const t=kt(At),{topViewInstance:e,sideViewInstance:n,backViewInstance:r,mainViewInstance:o,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:P,hideAttributes:B}=t,{addHistory:H,initHistory:U,pushHistoryUnderUpdatePolygon:T,pushHistoryUnderUpdatePoint:z,pushHistoryUnderUpdateLine:R}=Ft(),{selectedPolygon:k}=Nt(),{updateSelectedBox:A,updateSelectedBoxes:j,getPointCloudByID:m}=st(),{getPointCloudSphereByID:ht,updatePointCloudSphere:tt,selectedSphere:W}=jt(),{currentData:D,config:S}=Tt(i=>{const{stepList:l,step:f,imgList:u,imgIndex:a}=i.annotation;return{currentData:u[a],config:rt(Rt.getCurrentStepInfo(f,l).config)}}),ot=zt(),{selectedBox:F}=st(),{t:yt}=Ht(),et=F==null?void 0:F.info;if(!e||!n||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:Y}=e,Lt=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()},xt=({newPoint:i,size:l,zoom:f,trackConfigurable:u})=>{var a;const C={attribute:(a=e.toolInstance.defaultAttribute)!=null?a:""};u===!0&&Object.assign(C,{trackID:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:P})});const h=J(i,l,Y,void 0,C);s(i.id);const v=p(h);Z(y.Top,i,h,f,v,S)},vt=({polygon:i,size:l,imgList:f,trackConfigurable:u,zoom:a,intelligentFit:C})=>{var h;const v={attribute:(h=e.toolInstance.defaultAttribute)!=null?h:""};u===!0&&Object.assign(v,{trackID:I.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:P})});const w=e==null?void 0:e.toolInstance,O=L({},i),{boxParams:b,newPointList:E}=K(O,l,Y,void 0,v,C);if((S==null?void 0:S.lowerLimitPointsNumInBox)&&typeof b.count=="number"&&b.count<S.lowerLimitPointsNumInBox){Et.info(yt("LowerLimitPointsNumInBox",{num:S.lowerLimitPointsNumInBox})),w.deletePolygon(b.id);return}C&&(E==null?void 0:E.length)&&(O.pointList=E);const Q=B.includes(O.attribute),_=c(b);Q?s([]):(s(b.id),w.setSelectedIDs([O.id]),M(y.Top,O,b,a,_),C&&$(b,O,e,o)),H({newBoxParams:b})},Bt=({newSelectedBox:i,newPointCloudList:l,newSelectedSphere:f,newSphereList:u})=>{const a=e==null?void 0:e.toolInstance;if(!(d.length===0||!a)){if(i||(F==null?void 0:F.info)){const C=i!=null?i:F==null?void 0:F.info;a.setSelectedIDs(d);const h=a.selectedPolygon;if(d.length===1&&C){M(y.Top,h,C,void 0,l);return}}if((f||W)&&d.length===1){const C=f!=null?f:W;a.setSelectedID(d[0]);const h=a.selectedPoint;C&&Z(y.Top,h,C,void 0,u,S)}}},nt=(i,l,f)=>{if(et){let u,a;switch(f){case y.Back:u=Qt;break;case y.Side:u=ut;break;default:u=ut;break}if(a=u(i,l,et,n.pointCloudInstance),o){const{count:h}=o.getSensesPointZAxisInPolygon(Vt(a).polygonPointList,[a.center.z-a.depth/2,a.center.z+a.depth/2]);a=V(L({},a),{count:h})}const C=A(a);return M(f,i,a,void 0,C),C}},it=(i,l,f)=>{if(W){let u,a;switch(f){case y.Back:u=Yt;break;case y.Side:u=ct;break;default:u=ct;break}a=u(i,l,W);const C=tt(a);return Z(f,i,a,void 0,C,S),C}},St=(i,l)=>{it(i,l,y.Side)},bt=(i,l)=>{it(i,l,y.Back)},wt=(i,l)=>{nt(i,l,y.Side)},It=(i,l)=>{nt(i,l,y.Back)},Dt=(i,l)=>{R(i)},Ot=(i,l)=>{const{x:f,y:u}=I.transferCanvas2World(i,l);z(V(L({},i),{x:f,y:u}));const a=ht(i.id),C=J(i,l,Y,a),h=tt(C);Z(y.Top,i,C,void 0,h,S)},_t=(i,l)=>{if(k){const u=i[0].newPolygon;u.pointList=u.pointList.map(a=>I.transferCanvas2World(a,l)),T(i[0].newPolygon);return}const f=i.map(({newPolygon:u})=>{const a=m(u.id),{boxParams:C}=K(u,l,e.pointCloudInstance,a);return C});if(f.length===1){const{newPolygon:u}=i[0],a=j(f);M(y.Top,u,f[0],void 0,a)}else{const u=j(f);u&&t.syncAllViewPointCloudColor(u)}},Z=(i,l,f,u,a,C)=>q(void 0,null,function*(){const h=D==null?void 0:D.url,v={[y.Side]:()=>{pt(f,l,n,h,C)},[y.Back]:()=>{r&&Ct(f,l,r,h,C)},[y.Top]:()=>{Pt(f,l,e,o)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),u&&(o==null||o.updateCameraZoom(u)),mt(f)}),M=(i,l,f,u,a)=>q(void 0,null,function*(){const C=D==null?void 0:D.url;a&&(yield t.syncAllViewPointCloudColor(a));const h={[y.Side]:()=>{ft(f,l,n,C)},[y.Back]:()=>{r&&gt(f,l,r,C)},[y.Top]:()=>{$(f,l,e,o)}};Object.keys(h).forEach(v=>{v!==i&&h[v]()}),u&&(o==null||o.updateCameraZoom(u)),Lt(f)});return{topViewAddSphere:xt,topViewAddBox:vt,topViewSelectedChanged:Bt,topViewUpdatePoint:Ot,sideViewUpdatePoint:St,backViewUpdatePoint:bt,topViewUpdateBox:_t,topViewUpdateLine:Dt,sideViewUpdateBox:wt,backViewUpdateBox:It,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const l={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};o.initOrthographicCamera(l),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>q(void 0,[...i],function*(l=D){var f,u,a,C,h,v;if(!(l==null?void 0:l.url)||!o)return;dt(ot,!0),yield o.loadPCDFile(l.url,(f=S==null?void 0:S.radius)!=null?f:X),g.forEach(_=>{o==null||o.removeObjectByName(_.id)}),P.forEach(_=>{o==null||o.removeObjectByName(_.id)});let w=[],O=[],b=[],E=[];D.result?(w=I.getBoxParamsFromResultList(D.result),b=I.getPolygonListFromResultList(D.result),O=I.getLineListFromResultList(D.result),E=I.getSphereParamsFromResultList(D.result),w.forEach(_=>{o==null||o.generateBox(_)}),E.forEach(_=>{o==null||o.generateSphere(_)}),t.syncAllViewPointCloudColor(w),t.setPointCloudResult(w),t.setPolygonList(b),t.setLineList(O),t.setPointCloudSphereList(E)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),U({pointCloudBoxList:w,polygonList:b}),o.updateTopCamera();const Q=(a=(u=rt(l.result))==null?void 0:u.valid)!=null?a:!0;t.setPointCloudValid(Q),(C=t.sideViewInstance)==null||C.clearAllData(),(h=t.backViewInstance)==null||h.clearAllData(),e.updateData(l.url,l.result,{radius:(v=S==null?void 0:S.radius)!=null?v:X}),dt(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,qt as usePointCloudViews};
1
+ import{MathUtils as x,getCuboidFromPointCloudBox as _t}from"@labelbee/lb-annotation";import{EPerspectiveView as N,PointCloudUtils as D,DEFAULT_SPHERE_PARAMS as Vt}from"@labelbee/lb-utils";import{useContext as Ut}from"react";import{PointCloudContext as kt}from"../PointCloudContext.js";import{useSingleBox as st}from"./useSingleBox.js";import{useSphere as At}from"./useSphere.js";import{useSelector as jt,useDispatch as Tt}from"../../../store/ctx.js";import zt from"../../../utils/StepUtils.js";import{jsonParser as rt}from"../../../utils/index.js";import{SetPointCloudLoading as dt}from"../../../store/annotation/actionCreators.js";import{message as Rt}from"antd";import{useTranslation as Et}from"react-i18next";import{useHistory as Ht}from"./useHistory.js";import{usePolygon as Ft}from"./usePolygon.js";var Nt=Object.defineProperty,Zt=Object.defineProperties,Wt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,at=(t,e,n)=>e in t?Nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,m=(t,e)=>{for(var n in e||(e={}))Mt.call(e,n)&&at(t,n,e[n]);if(lt)for(var n of lt(e))Gt.call(e,n)&&at(t,n,e[n]);return t},j=(t,e)=>Zt(t,Wt(e)),q=(t,e,n)=>new Promise((r,o)=>{var c=d=>{try{s(n.next(d))}catch(P){o(P)}},p=d=>{try{s(n.throw(d))}catch(P){o(P)}},s=d=>d.done?r(d.value):Promise.resolve(d.value).then(c,p);s((n=n.apply(t,e)).next())});const G=5,Q=90,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(t,e,n,r,o)=>{const{x:c,y:p}=D.transferCanvas2World(t,e),{defaultZ:s}=Vt,d={center:{x:c,y:p,z:s},id:t.id},P=r?m(m({},r),d):j(m({},d),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},K=(t,e,n,r,o,c)=>{let p=t.pointList.map(y=>D.transferCanvas2World(y,e)),s=0,d=1,P={};if(n){const y=n.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),s=(y.maxZ+y.minZ)/2,d=y.maxZ-y.minZ,P={count:y.zCount}}const[g,B,T]=p,U=x.getLineCenterPoint([g,T]),z=x.getLineLength(g,B),R=x.getLineLength(B,T),E=x.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,d=r.depth);const k={center:{x:U.x,y:U.y,z:s},width:R,height:z,depth:d,rotation:E,id:t.id},O=m(r?m(m({},r),k):j(m({},k),{attribute:"",valid:!0}),P);o&&Object.assign(O,o);const H=p.map(y=>D.transferWorld2Canvas(y,e));return{boxParams:O,newPointList:H}},ct=(t,e,n)=>{const r={x:t.x-e.x,y:t.y-e.y};return j(m({},n),{center:{x:n.center.x-r.x,y:n.center.y,z:n.center.z-r.y}})},ut=(t,e,n,r)=>{const[o,c,p]=t.pointList,[s,d,P]=e.pointList,g=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([s,P]),U={x:{x:g.x-B.x,y:g.y-B.y}.x,y:0,z:g.y-B.y},z=x.getLineLength(o,c),R=x.getLineLength(s,d),E=z-R,k=x.getLineLength(c,p),O=x.getLineLength(d,P),H=k-O,{newBoxParams:y}=r.getNewBoxBySideUpdate(U,H,E,n);return y},Qt=(t,e,n)=>{const r={x:t.x-e.x,y:t.y-e.y};return j(m({},n),{center:{x:n.center.x,y:n.center.y-r.x,z:n.center.z-r.y}})},Xt=(t,e,n,r)=>{const[o,c,p]=t.pointList,[s,d,P]=e.pointList,g=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([s,P]),U={x:{x:g.x-B.x,y:g.y-B.y}.x,y:0,z:g.y-B.y},z=x.getLineLength(o,c),R=x.getLineLength(s,d),E=z-R,k=x.getLineLength(c,p),O=x.getLineLength(d,P),H=k-O;let{newBoxParams:y}=r.getNewBoxByBackUpdate(U,H,E,n);return y},pt=(t,e,n,r,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=o==null?void 0:o.radius)!=null?c:Q);const{cameraPositionVector:d}=s.updateOrthoCameraBySphere(t,N.Left);s.setInitCameraPosition(d);const{point2d:P,zoom:g}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([j(m(m({},e),P),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},ft=(t,e,n,r)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{width:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:d}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Ct=(t,e,n,r,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=o==null?void 0:o.radius)!=null?c:Q);const{cameraPositionVector:d}=s.updateOrthoCameraBySphere(t,N.Back);s.setInitCameraPosition(d);const{point2d:P,zoom:g}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([j(m(m({},e),P),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},Pt=(t,e,n,r)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{height:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:d}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},gt=(t,e,n,r)=>{if(!n||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,N.Top),r.render();const{toolInstance:o,pointCloudInstance:c}=n,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...o.pointList].map(d=>d.id===e.id?j(m(m({},e),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);o.setResult(s),o.setSelectedID(e.id)},$=(t,e,n,r)=>{var o;if(!n||!r)return;r.generateBox(t,e.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=n,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),d=[...c.polygonList],P=d.find(g=>g.id===e.id);P?P.pointList=s:d.push({id:e.id,pointList:s,textAttribute:"",isRect:!0,valid:(o=t.valid)!=null?o:!0}),c.setResultAndSelectedID(d,e.id)},Yt=()=>{const t=Ut(kt),{topViewInstance:e,sideViewInstance:n,backViewInstance:r,mainViewInstance:o,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:d,pointCloudBoxList:P,pointCloudSphereList:g,hideAttributes:B}=t,{addHistory:T,initHistory:U,pushHistoryUnderUpdatePolygon:z,pushHistoryUnderUpdateLine:R}=Ht(),{selectedPolygon:E}=Ft(),{updateSelectedBox:k,updateSelectedBoxes:O,getPointCloudByID:H}=st(),{getPointCloudSphereByID:y,updatePointCloudSphere:tt,selectedSphere:Z}=At(),{currentData:I,config:S}=jt(i=>{const{stepList:l,step:f,imgList:u,imgIndex:a}=i.annotation;return{currentData:u[a],config:rt(zt.getCurrentStepInfo(f,l).config)}}),ot=Tt(),{selectedBox:F}=st(),{t:ht}=Et(),et=F==null?void 0:F.info;if(!e||!n||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:X}=e,Lt=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()},yt=({newPoint:i,size:l,zoom:f,trackConfigurable:u})=>{var a;const C={attribute:(a=e.toolInstance.defaultAttribute)!=null?a:""};u===!0&&Object.assign(C,{trackID:D.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const h=J(i,l,X,void 0,C);s(i.id);const v=p(h);W(L.Top,i,h,f,v,S),T({newSphereParams:h})},xt=({polygon:i,size:l,imgList:f,trackConfigurable:u,zoom:a,intelligentFit:C})=>{var h;const v={attribute:(h=e.toolInstance.defaultAttribute)!=null?h:""};u===!0&&Object.assign(v,{trackID:D.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:g})});const w=e==null?void 0:e.toolInstance,_=m({},i),{boxParams:b,newPointList:A}=K(_,l,X,void 0,v,C);if((S==null?void 0:S.lowerLimitPointsNumInBox)&&typeof b.count=="number"&&b.count<S.lowerLimitPointsNumInBox){Rt.info(ht("LowerLimitPointsNumInBox",{num:S.lowerLimitPointsNumInBox})),w.deletePolygon(b.id);return}C&&(A==null?void 0:A.length)&&(_.pointList=A);const Y=B.includes(_.attribute),V=c(b);Y?s([]):(s(b.id),w.setSelectedIDs([_.id]),M(L.Top,_,b,a,V),C&&$(b,_,e,o)),T({newBoxParams:b})},vt=({newSelectedBox:i,newPointCloudList:l,newSelectedSphere:f,newSphereList:u})=>{const a=e==null?void 0:e.toolInstance;if(!(d.length===0||!a)){if(i||(F==null?void 0:F.info)){const C=i!=null?i:F==null?void 0:F.info;a.setSelectedIDs(d);const h=a.selectedPolygon;if(d.length===1&&C){M(L.Top,h,C,void 0,l);return}}if((f||Z)&&d.length===1){const C=f!=null?f:Z;a.setSelectedID(d[0]);const h=a.selectedPoint;C&&W(L.Top,h,C,void 0,u,S)}}},nt=(i,l,f)=>{if(et){let u,a;switch(f){case L.Back:u=Xt;break;case L.Side:u=ut;break;default:u=ut;break}if(a=u(i,l,et,n.pointCloudInstance),o){const{count:h}=o.getSensesPointZAxisInPolygon(_t(a).polygonPointList,[a.center.z-a.depth/2,a.center.z+a.depth/2]);a=j(m({},a),{count:h})}const C=k(a);return M(f,i,a,void 0,C),C}},it=(i,l,f)=>{if(Z){let u,a;switch(f){case L.Back:u=Qt;break;case L.Side:u=ct;break;default:u=ct;break}a=u(i,l,Z);const C=tt(a);return W(f,i,a,void 0,C,S),C}},Bt=(i,l)=>{it(i,l,L.Side)},St=(i,l)=>{it(i,l,L.Back)},bt=(i,l)=>{nt(i,l,L.Side)},wt=(i,l)=>{nt(i,l,L.Back)},It=(i,l)=>{R(i)},Dt=(i,l)=>{const f=y(i.id),u=J(i,l,X,f),a=tt(u);W(L.Top,i,u,void 0,a,S)},Ot=(i,l)=>{if(E){const u=i[0].newPolygon;u.pointList=u.pointList.map(a=>D.transferCanvas2World(a,l)),z(i[0].newPolygon);return}const f=i.map(({newPolygon:u})=>{const a=H(u.id),{boxParams:C}=K(u,l,e.pointCloudInstance,a);return C});if(f.length===1){const{newPolygon:u}=i[0],a=O(f);M(L.Top,u,f[0],void 0,a)}else{const u=O(f);u&&t.syncAllViewPointCloudColor(u)}},W=(i,l,f,u,a,C)=>q(void 0,null,function*(){const h=I==null?void 0:I.url,v={[L.Side]:()=>{pt(f,l,n,h,C)},[L.Back]:()=>{r&&Ct(f,l,r,h,C)},[L.Top]:()=>{gt(f,l,e,o)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),u&&(o==null||o.updateCameraZoom(u)),mt(f)}),M=(i,l,f,u,a)=>q(void 0,null,function*(){const C=I==null?void 0:I.url;a&&(yield t.syncAllViewPointCloudColor(a));const h={[L.Side]:()=>{ft(f,l,n,C)},[L.Back]:()=>{r&&Pt(f,l,r,C)},[L.Top]:()=>{$(f,l,e,o)}};Object.keys(h).forEach(v=>{v!==i&&h[v]()}),u&&(o==null||o.updateCameraZoom(u)),Lt(f)});return{topViewAddSphere:yt,topViewAddBox:xt,topViewSelectedChanged:vt,topViewUpdatePoint:Dt,sideViewUpdatePoint:Bt,backViewUpdatePoint:St,topViewUpdateBox:Ot,topViewUpdateLine:It,sideViewUpdateBox:bt,backViewUpdateBox:wt,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const l={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};o.initOrthographicCamera(l),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>q(void 0,[...i],function*(l=I){var f,u,a,C,h,v;if(!(l==null?void 0:l.url)||!o)return;dt(ot,!0),yield o.loadPCDFile(l.url,(f=S==null?void 0:S.radius)!=null?f:Q),P.forEach(V=>{o==null||o.removeObjectByName(V.id)}),g.forEach(V=>{o==null||o.removeObjectByName(V.id)});let w=[],_=[],b=[],A=[];I.result?(w=D.getBoxParamsFromResultList(I.result),b=D.getPolygonListFromResultList(I.result),_=D.getLineListFromResultList(I.result),A=D.getSphereParamsFromResultList(I.result),w.forEach(V=>{o==null||o.generateBox(V)}),A.forEach(V=>{o==null||o.generateSphere(V)}),t.syncAllViewPointCloudColor(w),t.setPointCloudResult(w),t.setPolygonList(b),t.setLineList(_),t.setPointCloudSphereList(A)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),U({pointCloudBoxList:w,polygonList:b,pointCloudSphereList:A}),o.updateTopCamera();const Y=(a=(u=rt(l.result))==null?void 0:u.valid)!=null?a:!0;t.setPointCloudValid(Y),(C=t.sideViewInstance)==null||C.clearAllData(),(h=t.backViewInstance)==null||h.clearAllData(),e.updateData(l.url,l.result,{radius:(v=S==null?void 0:S.radius)!=null?v:Q}),dt(ot,!1)})}};export{Ct as syncBackViewByPoint,pt as syncSideViewByPoint,gt as syncTopViewByPoint,Pt as synchronizeBackView,ft as synchronizeSideView,$ as synchronizeTopView,J as topViewPoint2PointCloud,K as topViewPolygon2PointCloud,Yt as usePointCloudViews};
@@ -1 +1 @@
1
- import{useContext as h,useMemo as m,useCallback as i}from"react";import{PointCloudContext as S}from"../PointCloudContext.js";import l from"lodash";const f=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:d,selectedID:s,mainViewInstance:r}=h(S),u=m(()=>e.find(t=>t.id===s),[s,e]),c=i(t=>e.find(o=>o.id===t),[e]),p=i(t=>{const o=e.findIndex(n=>n.id===t.id);if(o>-1){e.splice(o,1,l.merge(e[o],t));const n=l.cloneDeep(e);return d(n),n}return e},[e]),C=i(t=>{const o=e.filter(n=>n.id!==t);d(o),r==null||r.removeObjectByName(t),r==null||r.render()},[e]);return{selectedSphere:u,getPointCloudSphereByID:c,updatePointCloudSphere:p,deletePointCloudSphere:C}};export{f as useSphere};
1
+ import{useContext as m,useMemo as S,useCallback as r}from"react";import{PointCloudContext as f}from"../PointCloudContext.js";import u from"lodash";import{useHistory as P}from"./useHistory.js";const a=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:s,selectedID:d,mainViewInstance:i}=m(f),{pushHistoryWithList:l}=P(),p=S(()=>e.find(t=>t.id===d),[d,e]),c=r(t=>e.find(o=>o.id===t),[e]),C=r(t=>{const o=e.findIndex(n=>n.id===t.id);if(o>-1){e.splice(o,1,u.merge(e[o],t));const n=u.cloneDeep(e);return s(n),l({pointCloudSphereList:n}),n}return e},[e]),h=r(t=>{const o=e.filter(n=>n.id!==t);s(o),i==null||i.removeObjectByName(t),i==null||i.render()},[e]);return{selectedSphere:p,getPointCloudSphereByID:c,updatePointCloudSphere:C,deletePointCloudSphere:h}};export{a as useSphere};
@@ -1 +1 @@
1
- import{useContext as w}from"react";import{PointCloudContext as b}from"../PointCloudContext.js";import{cTool as L}from"@labelbee/lb-annotation";import{useHistory as R}from"./useHistory.js";const{EToolName:t,EPolygonPattern:d}=L,E=()=>{const{topViewInstance:r,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,pointCloudBoxList:P,pointCloudSphereList:C,setPointCloudResult:v,setPointCloudSphereList:h,setPolygonList:p,pointCloudPattern:c,setPointCloudPattern:n,syncAllViewPointCloudColor:m}=w(b),{pushHistoryWithList:y}=R(),f=()=>{P.forEach(l=>{e==null||e.removeObjectByName(l.id)}),C.forEach(l=>{e==null||e.removeObjectByName(l.id)}),e==null||e.render(),v([]),p([]),h([]),r==null||r.toolScheduler.clearStatusAndResult(),m([]),y({pointCloudBoxList:[],polygonList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()};return{clearAllResult:f,updatePointCloudPattern:l=>{if(l===c)return;const s=[r,a,u];switch(l){case t.Rect:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Rect)}),n(t.Rect);break;case t.Polygon:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Normal)}),n(t.Polygon);break;case t.Point:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),n(t.Point);break;case t.Line:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),n(t.Line);break}},pointCloudPattern:c}};export{E as useStatus};
1
+ import{useContext as w}from"react";import{PointCloudContext as L}from"../PointCloudContext.js";import{cTool as b}from"@labelbee/lb-annotation";import{useHistory as R}from"./useHistory.js";const{EToolName:t,EPolygonPattern:d}=b,E=()=>{const{topViewInstance:r,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,pointCloudBoxList:P,pointCloudSphereList:C,setPointCloudResult:p,setPointCloudSphereList:v,setPolygonList:h,pointCloudPattern:c,setPointCloudPattern:n,syncAllViewPointCloudColor:m}=w(L),{pushHistoryWithList:y}=R(),f=()=>{P.forEach(l=>{e==null||e.removeObjectByName(l.id)}),C.forEach(l=>{e==null||e.removeObjectByName(l.id)}),e==null||e.render(),p([]),h([]),v([]),r==null||r.toolScheduler.clearStatusAndResult(),m([]),y({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()};return{clearAllResult:f,updatePointCloudPattern:l=>{if(l===c)return;const s=[r,a,u];switch(l){case t.Rect:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Rect)}),n(t.Rect);break;case t.Polygon:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Normal)}),n(t.Polygon);break;case t.Point:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),n(t.Point);break;case t.Line:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),n(t.Line);break}},pointCloudPattern:c}};export{E as useStatus};
@@ -1 +1 @@
1
- import{PointCloudContext as f}from"../../../../components/pointCloudView/PointCloudContext.js";import{Modal as K}from"antd";import t,{useContext as y,useMemo as _,useState as W}from"react";import{stepConfigSelector as q}from"../../../../store/annotation/selectors.js";import{useSelector as O}from"../../../../store/ctx.js";import{i18n as P}from"@labelbee/lb-utils";import{UnorderedListOutlined as w,PushpinFilled as b,EyeInvisibleFilled as z,EyeFilled as J,CaretDownFilled as Q,DeleteOutlined as X}from"@ant-design/icons";import{useHistory as Y}from"../../../../components/pointCloudView/hooks/useHistory.js";import{getClassName as c}from"../../../../utils/dom.js";import Z from"../../../../utils/StepUtils.js";import{EPointCloudName as tt}from"@labelbee/lb-annotation";import{useTranslation as k}from"react-i18next";import et from"../FooterPopover.js";var nt=Object.defineProperty,ot=Object.defineProperties,rt=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,S=(e,o,n)=>o in e?nt(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,N=(e,o)=>{for(var n in o||(o={}))lt.call(o,n)&&S(e,n,o[n]);if(F)for(var n of F(o))it.call(o,n)&&S(e,n,o[n]);return e},j=(e,o)=>ot(e,rt(o));const at=({attribute:e})=>{const o=y(f),{pointCloudBoxList:n,pointCloudSphereList:i,hideAttributes:u,toggleAttributesVisible:m,polygonList:a,setPolygonList:C,lineList:d,setLineList:s,setPointCloudResult:I,setPointCloudSphereList:R,reRender:D,selectSpecAttr:B}=o,[L,H]=W(!0),{pushHistoryWithList:V}=Y(),h=[...n,...a,...i,...d].filter(r=>r.attribute===e.value),x=()=>{m(e.value)},$=u.includes(e.value),G=({trackID:r,order:l})=>r||l,T=({trackID:r,order:l})=>r?`trackID_${r}`:`order_${l}`,U=r=>{if(h.length===0)return;const l=a.filter(p=>r!==p.attribute),v=n.filter(p=>r!==p.attribute),E=d.filter(p=>r!==p.attribute),A=i.filter(p=>r!==p.attribute);D(v,l,A,E),C(l),I(v),R(A),s(E),V({pointCloudBoxList:v,polygonList:l,lineList:E})},M=r=>{K.confirm({content:P.t("onDeleteGraphByAttr",{attribute:r.key}),onOk:()=>{U(r.value)},okText:P.t("Confirm"),cancelText:P.t("Cancel")})};return t.createElement(t.Fragment,null,t.createElement("div",{className:c("annotated-attribute","item")},$?t.createElement(z,{onClick:x}):t.createElement(J,{onClick:x}),t.createElement(Q,{rotate:L?0:270,onClick:()=>{H(!L)}}),t.createElement("span",{className:c("annotated-attribute","item","text"),onClick:()=>{B(e.value)}},e.key),t.createElement(X,{onClick:()=>M(e)})),L&&h.map((r,l)=>t.createElement("div",{key:T(j(N({},r),{order:l})),style:{paddingLeft:54}},`${G(j(N({},r),{order:l}))}.${e.key}`)))},g=()=>{const e=O(q),{attrPanelLayout:o,setAttrPanelLayout:n,pointCloudBoxList:i,polygonList:u,lineList:m}=y(f),{t:a}=k(),C=_(()=>[...i,...u,...m].map(s=>s.attribute),[i,u,m]),d=_(()=>e.attributeList.filter(s=>C.includes(s.value)),[C]);return t.createElement("div",{className:c("annotated-attribute")},o?t.createElement("div",{className:c("annotated-attribute","text")},t.createElement("span",null,a("AnnotatedResult")),t.createElement("span",{className:c("annotated-attribute","pin"),onClick:()=>{n("")}},t.createElement(b,null),a("CancelFixed"))):t.createElement("div",{className:c("annotated-attribute","text")},t.createElement("span",{onClick:()=>{n("left")},className:c("annotated-attribute","pin")},t.createElement(b,null),a("FixedOnLeft")),t.createElement("span",{onClick:()=>{n("right")},className:c("annotated-attribute","pin")},t.createElement(b,null),a("FixedOnRight"))),t.createElement("div",null,d.length>0?d.map(s=>t.createElement(at,{attribute:s,key:s.value})):t.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},a("NoData"))))},st=()=>{const{attrPanelLayout:e}=y(f);return e==="left"?t.createElement(g,null):null},ct=()=>{const{attrPanelLayout:e}=y(f);return e==="right"?t.createElement(g,null):null},ut=()=>{const{attrPanelLayout:e}=y(f),{t:o}=k(),n=O(i=>{var u,m;return Z.getCurrentStepInfo((u=i==null?void 0:i.annotation)==null?void 0:u.step,(m=i.annotation)==null?void 0:m.stepList)});return(n==null?void 0:n.tool)!==tt.PointCloud||e?null:t.createElement(et,{hoverIcon:t.createElement(w,{style:{marginRight:4}}),icon:t.createElement(w,{style:{marginRight:4}}),title:o("AnnotatedList"),content:t.createElement(g,null)})};export{ut as AnnotatedAttributesIcon,g as AnnotatedAttributesPanel,st as AnnotatedAttributesPanelFixedLeft,ct as AnnotatedAttributesPanelFixedRight};
1
+ import{PointCloudContext as C}from"../../../../components/pointCloudView/PointCloudContext.js";import{Modal as K}from"antd";import t,{useContext as y,useMemo as O,useState as W}from"react";import{stepConfigSelector as q}from"../../../../store/annotation/selectors.js";import{useSelector as S}from"../../../../store/ctx.js";import{i18n as h}from"@labelbee/lb-utils";import{UnorderedListOutlined as w,PushpinFilled as x,EyeInvisibleFilled as z,EyeFilled as J,CaretDownFilled as Q,DeleteOutlined as X}from"@ant-design/icons";import{useHistory as Y}from"../../../../components/pointCloudView/hooks/useHistory.js";import{getClassName as s}from"../../../../utils/dom.js";import Z from"../../../../utils/StepUtils.js";import{EPointCloudName as tt}from"@labelbee/lb-annotation";import{useTranslation as k}from"react-i18next";import et from"../FooterPopover.js";var nt=Object.defineProperty,ot=Object.defineProperties,rt=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,N=(e,o,n)=>o in e?nt(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,j=(e,o)=>{for(var n in o||(o={}))lt.call(o,n)&&N(e,n,o[n]);if(F)for(var n of F(o))it.call(o,n)&&N(e,n,o[n]);return e},I=(e,o)=>ot(e,rt(o));const at=({attribute:e})=>{const o=y(C),{pointCloudBoxList:n,pointCloudSphereList:i,hideAttributes:c,toggleAttributesVisible:u,polygonList:d,setPolygonList:p,lineList:f,setLineList:L,setPointCloudResult:a,setPointCloudSphereList:R,reRender:D,selectSpecAttr:B}=o,[v,H]=W(!0),{pushHistoryWithList:V}=Y(),A=[...n,...d,...i,...f].filter(r=>r.attribute===e.value),_=()=>{u(e.value)},$=c.includes(e.value),G=({trackID:r,order:l})=>r||l,T=({trackID:r,order:l})=>r?`trackID_${r}`:`order_${l}`,U=r=>{if(A.length===0)return;const l=d.filter(m=>r!==m.attribute),E=n.filter(m=>r!==m.attribute),P=f.filter(m=>r!==m.attribute),b=i.filter(m=>r!==m.attribute);D(E,l,b,P),p(l),a(E),R(b),L(P),V({pointCloudBoxList:E,polygonList:l,lineList:P,pointCloudSphereList:b})},M=r=>{K.confirm({content:h.t("onDeleteGraphByAttr",{attribute:r.key}),onOk:()=>{U(r.value)},okText:h.t("Confirm"),cancelText:h.t("Cancel")})};return t.createElement(t.Fragment,null,t.createElement("div",{className:s("annotated-attribute","item")},$?t.createElement(z,{onClick:_}):t.createElement(J,{onClick:_}),t.createElement(Q,{rotate:v?0:270,onClick:()=>{H(!v)}}),t.createElement("span",{className:s("annotated-attribute","item","text"),onClick:()=>{B(e.value)}},e.key),t.createElement(X,{onClick:()=>M(e)})),v&&A.map((r,l)=>t.createElement("div",{key:T(I(j({},r),{order:l})),style:{paddingLeft:54}},`${G(I(j({},r),{order:l}))}.${e.key}`)))},g=()=>{const e=S(q),{attrPanelLayout:o,setAttrPanelLayout:n,pointCloudBoxList:i,pointCloudSphereList:c,polygonList:u,lineList:d}=y(C),{t:p}=k(),f=O(()=>[...i,...c,...u,...d].map(a=>a.attribute),[i,c,u,d]),L=O(()=>e.attributeList.filter(a=>f.includes(a.value)),[f]);return t.createElement("div",{className:s("annotated-attribute")},o?t.createElement("div",{className:s("annotated-attribute","text")},t.createElement("span",null,p("AnnotatedResult")),t.createElement("span",{className:s("annotated-attribute","pin"),onClick:()=>{n("")}},t.createElement(x,null),p("CancelFixed"))):t.createElement("div",{className:s("annotated-attribute","text")},t.createElement("span",{onClick:()=>{n("left")},className:s("annotated-attribute","pin")},t.createElement(x,null),p("FixedOnLeft")),t.createElement("span",{onClick:()=>{n("right")},className:s("annotated-attribute","pin")},t.createElement(x,null),p("FixedOnRight"))),t.createElement("div",null,L.length>0?L.map(a=>t.createElement(at,{attribute:a,key:a.value})):t.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},p("NoData"))))},st=()=>{const{attrPanelLayout:e}=y(C);return e==="left"?t.createElement(g,null):null},ct=()=>{const{attrPanelLayout:e}=y(C);return e==="right"?t.createElement(g,null):null},ut=()=>{const{attrPanelLayout:e}=y(C),{t:o}=k(),n=S(i=>{var c,u;return Z.getCurrentStepInfo((c=i==null?void 0:i.annotation)==null?void 0:c.step,(u=i.annotation)==null?void 0:u.stepList)});return(n==null?void 0:n.tool)!==tt.PointCloud||e?null:t.createElement(et,{hoverIcon:t.createElement(w,{style:{marginRight:4}}),icon:t.createElement(w,{style:{marginRight:4}}),title:o("AnnotatedList"),content:t.createElement(g,null)})};export{ut as AnnotatedAttributesIcon,g as AnnotatedAttributesPanel,st as AnnotatedAttributesPanelFixedLeft,ct as AnnotatedAttributesPanelFixedRight};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.10.0-alpha.6",
3
+ "version": "1.10.0-alpha.7",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.14.0-alpha.6",
46
+ "@labelbee/lb-annotation": "1.14.0-alpha.7",
47
47
  "@labelbee/lb-utils": "1.7.0-alpha.5",
48
48
  "ahooks": "^3.4.0",
49
49
  "classnames": "^2.3.0",