@labelbee/lb-components 1.10.0-alpha.2 → 1.10.0-alpha.20

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 (87) hide show
  1. package/dist/App.js +1 -1
  2. package/dist/components/attributeList/index.js +1 -1
  3. package/dist/components/colorPalette/index.js +1 -0
  4. package/dist/components/colorTag/index.js +1 -1
  5. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  6. package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
  7. package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
  8. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  9. package/dist/components/pointCloudView/hooks/useSphere.js +1 -1
  10. package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
  11. package/dist/components/predictTracking/predictTrackingIcon/index.js +1 -1
  12. package/dist/components/predictTracking/previewResult/index.js +1 -1
  13. package/dist/components/predictTracking/previewResult/util.js +1 -1
  14. package/dist/store/annotation/actionCreators.js +1 -1
  15. package/dist/types/App.d.ts +1 -0
  16. package/dist/types/components/AnnotationView/pointCloudAnnotationView.d.ts +2 -1
  17. package/dist/types/components/annotationStepPopover/index.d.ts +2 -1
  18. package/dist/types/components/attributeList/index.d.ts +2 -0
  19. package/dist/types/components/checkboxList/index.d.ts +2 -1
  20. package/dist/types/components/colorPalette/index.d.ts +12 -0
  21. package/dist/types/components/colorTag/index.d.ts +2 -1
  22. package/dist/types/components/customAntd/IconWithText/index.d.ts +1 -1
  23. package/dist/types/components/customResizeHook/index.d.ts +2 -2
  24. package/dist/types/components/fileException/FileError.d.ts +1 -1
  25. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -1
  26. package/dist/types/components/pointCloudView/PointCloudBackView.d.ts +2 -1
  27. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +1 -0
  28. package/dist/types/components/pointCloudView/PointCloudInfos.d.ts +4 -3
  29. package/dist/types/components/pointCloudView/components/EmptyPage/index.d.ts +7 -1
  30. package/dist/types/components/pointCloudView/components/UnifyParamsModal/index.d.ts +2 -1
  31. package/dist/types/components/pointCloudView/hooks/useHistory.d.ts +6 -4
  32. package/dist/types/components/pointCloudView/hooks/useSphere.d.ts +1 -0
  33. package/dist/types/components/predictTracking/predictTrackingIcon/index.d.ts +2 -1
  34. package/dist/types/components/predictTracking/previewResult/index.d.ts +2 -1
  35. package/dist/types/components/predictTracking/previewResult/util.d.ts +2 -1
  36. package/dist/types/components/videoPlayer/TagToolInstanceAdaptor.d.ts +1 -1
  37. package/dist/types/components/videoPlayer/TagToolInstanceAdaptorI18nProvider.d.ts +2 -1
  38. package/dist/types/components/videoPlayer/components/controller/index.d.ts +2 -1
  39. package/dist/types/components/videoPlayer/index.d.ts +1 -1
  40. package/dist/types/store/annotation/actionCreators.d.ts +1 -1
  41. package/dist/types/utils/colorUtils.d.ts +20 -0
  42. package/dist/types/views/MainView/annotationTips/index.d.ts +2 -1
  43. package/dist/types/views/MainView/sidebar/ClearIcon/index.d.ts +2 -1
  44. package/dist/types/views/MainView/sidebar/ImgAttributeInfo/index.d.ts +2 -1
  45. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/batchUpdateModal/index.d.ts +2 -1
  46. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/index.d.ts +3 -1
  47. package/dist/types/views/MainView/sidebar/TagSidebar/index.d.ts +1 -1
  48. package/dist/types/views/MainView/sidebar/TextAreaFormat/index.d.ts +2 -1
  49. package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +2 -2
  50. package/dist/types/views/MainView/sidebar/ToolIcons.d.ts +2 -1
  51. package/dist/types/views/MainView/sidebar/ToolStyle/index.d.ts +2 -1
  52. package/dist/types/views/MainView/sidebar/index.d.ts +1 -0
  53. package/dist/types/views/MainView/toolFooter/AnnotatedAttributes/index.d.ts +5 -4
  54. package/dist/types/views/MainView/toolFooter/FooterPopover.d.ts +1 -1
  55. package/dist/types/views/MainView/toolFooter/HiddenTips/index.d.ts +2 -1
  56. package/dist/types/views/MainView/toolFooter/PageNumber/index.d.ts +2 -1
  57. package/dist/types/views/MainView/toolFooter/Pagination.d.ts +1 -1
  58. package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
  59. package/dist/utils/colorUtils.js +1 -0
  60. package/dist/views/MainView/index.js +1 -1
  61. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  62. package/dist/views/MainView/sidebar/index.js +1 -1
  63. package/dist/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
  64. package/es/App.js +1 -1
  65. package/es/components/attributeList/index.js +1 -1
  66. package/es/components/colorPalette/index.js +1 -0
  67. package/es/components/colorTag/index.js +1 -1
  68. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  69. package/es/components/pointCloudView/PointCloudTopView.js +1 -1
  70. package/es/components/pointCloudView/hooks/useHistory.js +1 -1
  71. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  72. package/es/components/pointCloudView/hooks/useSphere.js +1 -1
  73. package/es/components/pointCloudView/hooks/useStatus.js +1 -1
  74. package/es/components/predictTracking/predictTrackingIcon/index.js +1 -1
  75. package/es/components/predictTracking/previewResult/index.js +1 -1
  76. package/es/components/predictTracking/previewResult/util.js +1 -1
  77. package/es/store/annotation/actionCreators.js +1 -1
  78. package/es/utils/colorUtils.js +1 -0
  79. package/es/views/MainView/index.js +1 -1
  80. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  81. package/es/views/MainView/sidebar/index.js +1 -1
  82. package/es/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
  83. package/package.json +10 -8
  84. package/LICENSE +0 -203
  85. package/dist/components/pointCloudView/hooks/useLine.js +0 -1
  86. package/dist/types/components/pointCloudView/hooks/useLine.d.ts +0 -12
  87. package/es/components/pointCloudView/hooks/useLine.js +0 -1
@@ -1 +1 @@
1
- import{getClassName as x}from"../../utils/dom.js";import{FooterDivider as B}from"../../views/MainView/toolFooter/index.js";import{ZoomController as Q}from"../../views/MainView/toolFooter/ZoomController/index.js";import{UpSquareOutlined as ee,DownSquareOutlined as te}from"@ant-design/icons";import{PointCloudAnnotation as oe,cTool as ne}from"@labelbee/lb-annotation";import{PointCloudUtils as D}from"@labelbee/lb-utils";import r,{useState as N,useRef as ie,useLayoutEffect as se,useEffect as h}from"react";import{PointCloudContext as le}from"./PointCloudContext.js";import{useRotate as re}from"./hooks/useRotate.js";import{useSingleBox as U}from"./hooks/useSingleBox.js";import{PointCloudContainer as ae}from"./PointCloudLayout.js";import{BoxInfos as ce,PointCloudValidity as de}from"./PointCloudInfos.js";import{usePolygon as pe}from"./hooks/usePolygon.js";import{useLine as ue}from"./hooks/useLine.js";import{useSphere as me}from"./hooks/useSphere.js";import{useZoom as Z}from"./hooks/useZoom.js";import{Slider as fe}from"antd";import{a2MapStateToProps as we}from"../../store/annotation/map.js";import{connect as ge}from"react-redux";import{usePointCloudViews as ve}from"./hooks/usePointCloudViews.js";import Ce from"../../hooks/useSize.js";import{useTranslation as Pe}from"react-i18next";import{LabelBeeContext as Ie}from"../../store/ctx.js";import{jsonParser as xe}from"../../utils/index.js";import ye from"../../utils/ToolUtils.js";var Ve=Object.defineProperty,he=Object.defineProperties,Oe=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,z=(o,s,l)=>s in o?Ve(o,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[s]=l,E=(o,s)=>{for(var l in s||(s={}))Se.call(s,l)&&z(o,l,s[l]);if(R)for(var l of R(s))be.call(s,l)&&z(o,l,s[l]);return o},T=(o,s)=>he(o,Oe(s));const{EPolygonPattern:_e}=ne,F=(o,s,l=1)=>{const{width:m,height:g}=s,C={x:o.x+m*l/2,y:o.y+g*l/2},v={x:s.width/2,y:s.height/2};return{offsetX:(v.x-C.x)/l,offsetY:-(v.y-C.y)/l}},Le=({currentData:o})=>{const{zoom:s,zoomIn:l,zoomOut:m,initialPosition:g}=Z(),{selectNextBox:C,selectPrevBox:v}=U(),{updateRotate:P}=re({currentData:o}),y=2,V=()=>{P(-y)},f=()=>{P(y)},t=()=>{P(180)};return r.createElement(r.Fragment,null,r.createElement("span",{onClick:f,className:x("point-cloud","rotate-reserve")}),r.createElement("span",{onClick:V,className:x("point-cloud","rotate")}),r.createElement("span",{onClick:t,className:x("point-cloud","rotate-180")}),r.createElement(B,null),r.createElement(ee,{onClick:()=>{v()},className:x("point-cloud","prev")}),r.createElement(te,{onClick:()=>{C()},className:x("point-cloud","next")}),r.createElement(B,null),r.createElement(Q,{initialPosition:g,zoomIn:l,zoomOut:m,zoom:s}))},je=({setZAxisLimit:o,zAxisLimit:s,checkMode:l})=>l?null:r.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},r.createElement(fe,{vertical:!0,step:.5,max:10,min:.5,defaultValue:s,onAfterChange:m=>{o(m)}})),Ee=({currentData:o,imgList:s,stepInfo:l,drawLayerSlot:m,checkMode:g,intelligentFit:C})=>{var v,P;const[y,V]=N({zoom:1,currentPos:{x:0,y:0}}),f=ie(null),t=r.useContext(le),a=Ce(f),I=xe(l.config),{setZoom:W,syncTopviewToolZoom:M}=Z(),{hideAttributes:k}=t,{addPolygon:X,deletePolygon:Y}=pe(),{addLine:q,deleteLine:H}=ue(),{deletePointCloudSphere:$}=me(),{deletePointCloudBox:A,changeValidByID:G}=U(),[O,J]=N(10),{t:K}=Pe(),p=ve();return se(()=>{if(!t.topViewInstance&&f.current&&(o==null?void 0:o.url)&&(o==null?void 0:o.result)){const n={width:f.current.clientWidth,height:f.current.clientHeight},u=new oe({container:f.current,size:n,pcdPath:o.url,config:T(E({},I),{pointCloudPattern:t.pointCloudPattern}),checkMode:g,toolName:ye.getPointCloudToolList()});t.setTopViewInstance(u)}},[o]),h(()=>{if(!a||!t.topViewInstance||!t.sideViewInstance)return;const{toolInstance:n}=t.topViewInstance;n.singleOn("lineCreated",(e,i)=>{const d=T(E({},e),{pointList:e.pointList.map(c=>D.transferCanvas2World(c,a))});q(d),t.setSelectedIDs(k.includes(e.attribute)?"":e.id)}),n.singleOn("lineDeleted",e=>{A(e),H(e)}),n.singleOn("lineSelected",e=>{t.setSelectedIDs([e])}),n.singleOn("updateLineByDrag",e=>{var i;(i=p.topViewUpdateLine)==null||i.call(p,e,a)}),n.singleOn("pointCreated",(e,i)=>{p.topViewAddSphere({newPoint:e,size:a,trackConfigurable:I.trackConfigurable,zoom:i})}),n.singleOn("pointDeleted",e=>{$(e)}),n.singleOn("pointSelected",e=>{t.setSelectedIDs([e])}),n.singleOn("updatePointByDrag",(e,i)=>{var d;(d=p.topViewUpdatePoint)==null||d.call(p,e,a)}),n.singleOn("polygonCreated",(e,i)=>{if(n.pattern===_e.Normal||!(o==null?void 0:o.url)){const d=T(E({},e),{pointList:e.pointList.map(c=>D.transferCanvas2World(c,a))});X(d),t.setSelectedIDs(k.includes(e.attribute)?"":e.id);return}p.topViewAddBox({polygon:e,size:a,imgList:s,trackConfigurable:I.trackConfigurable,zoom:i,intelligentFit:C})}),n.singleOn("deletedObject",({id:e})=>{A(e),Y(e)}),n.singleOn("deleteSelectedIDs",()=>{t.setSelectedIDs([])}),n.singleOn("addSelectedIDs",e=>{t.addSelectedID(e)}),n.singleOn("setSelectedIDs",e=>{t.setSelectedIDs(e)}),n.singleOn("updatePolygonByDrag",e=>{var i;(i=p.topViewUpdateBox)==null||i.call(p,e,a)});const u=e=>{var i;const d=G(e);d&&t.syncAllViewPointCloudColor(d),t.polygonList.find(c=>c.id===e)&&((i=t.topViewInstance)==null||i.toolInstance.setPolygonValidAndRender(e,!0))};return n.on("validUpdate",u),()=>{n.unbind("validUpdate",u)}},[t,a,o,p,t.polygonList,t.lineList,(v=t.topViewInstance)==null?void 0:v.toolInstance]),h(()=>{var n,u;if(!(a==null?void 0:a.width)||!t.topViewInstance)return;const e=(u=(n=I==null?void 0:I.attributeList)==null?void 0:n[0])==null?void 0:u.value;e&&t.topViewInstance.toolInstance.setDefaultAttribute(e),t.topViewInstance.initSize(a),t.topViewInstance.updatePolygonList(t.displayPointCloudList,t.polygonList),t.topViewInstance.updatePointList(t.displaySphereList);const{topViewInstance:{pointCloudInstance:i,toolInstance:d}}=t;d.singleOn("renderZoom",(c,w)=>{const{offsetX:S,offsetY:b}=F(w,a,c);if(i.camera.zoom=c,w){const{x:_,y:L,z:j}=i.initCameraPosition;i.camera.position.set(_+b,L-S,j)}i.camera.updateProjectionMatrix(),i.render(),W(c),M(w,c,a),V({zoom:c,currentPos:w})}),d.singleOn("dragMove",({currentPos:c,zoom:w})=>{const{offsetX:S,offsetY:b}=F(c,a,w);i.camera.zoom=w;const{x:_,y:L,z:j}=i.initCameraPosition;i.camera.position.set(_+b,L-S,j),i.render(),V({zoom:w,currentPos:c})})},[a,t.topViewInstance,(P=t.topViewInstance)==null?void 0:P.toolInstance]),h(()=>{var n,u;(u=(n=t.topViewInstance)==null?void 0:n.pointCloudInstance)==null||u.applyZAxisPoints(O)},[O]),h(()=>{p.topViewSelectedChanged({})},[t.selectedIDs]),r.createElement(ae,{className:x("point-cloud-container","top-view"),title:K("TopView"),toolbar:r.createElement(Le,{currentData:o})},r.createElement("div",{style:{position:"relative",flex:1}},r.createElement("div",{style:{width:"100%",height:"100%"},ref:f},m==null?void 0:m(y)),r.createElement(ce,{checkMode:g,config:I}),r.createElement(je,{checkMode:g,zAxisLimit:O,setZAxisLimit:J}),r.createElement(de,null)))};var Te=ge(we,null,null,{context:Ie})(Ee);export{Te as default};
1
+ import{getClassName as x}from"../../utils/dom.js";import{FooterDivider as D}from"../../views/MainView/toolFooter/index.js";import{ZoomController as te}from"../../views/MainView/toolFooter/ZoomController/index.js";import{UpSquareOutlined as oe,DownSquareOutlined as ne}from"@ant-design/icons";import{PointCloudAnnotation as ie,cTool as se,cAnnotation as le}from"@labelbee/lb-annotation";import{PointCloudUtils as U}from"@labelbee/lb-utils";import a,{useState as Z,useRef as re,useLayoutEffect as ae,useEffect as V}from"react";import{PointCloudContext as R}from"./PointCloudContext.js";import{useRotate as ce}from"./hooks/useRotate.js";import{useSingleBox as z}from"./hooks/useSingleBox.js";import{PointCloudContainer as de}from"./PointCloudLayout.js";import{BoxInfos as pe,PointCloudValidity as ue}from"./PointCloudInfos.js";import{usePolygon as me}from"./hooks/usePolygon.js";import{useSphere as F}from"./hooks/useSphere.js";import{useZoom as W}from"./hooks/useZoom.js";import{Slider as fe}from"antd";import{a2MapStateToProps as Ce}from"../../store/annotation/map.js";import{connect as Pe}from"react-redux";import{usePointCloudViews as ve}from"./hooks/usePointCloudViews.js";import we from"../../hooks/useSize.js";import{useTranslation as ge}from"react-i18next";import{LabelBeeContext as xe}from"../../store/ctx.js";import{jsonParser as Ie}from"../../utils/index.js";import ye from"../../utils/ToolUtils.js";import he from"lodash";var Ve=Object.defineProperty,Oe=Object.defineProperties,Se=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,X=(o,n,i)=>n in o?Ve(o,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[n]=i,k=(o,n)=>{for(var i in n||(n={}))_e.call(n,i)&&X(o,i,n[i]);if(M)for(var i of M(n))be.call(n,i)&&X(o,i,n[i]);return o},B=(o,n)=>Oe(o,Se(n));const{EPolygonPattern:Le,EToolName:O}=se,{ESortDirection:Y}=le,q=(o,n,i=1)=>{const{width:C,height:P}=n,g={x:o.x+C*i/2,y:o.y+P*i/2},w={x:n.width/2,y:n.height/2};return{offsetX:(w.x-g.x)/i,offsetY:-(w.y-g.y)/i}},Ee=({currentData:o})=>{var n,i;const{zoom:C,zoomIn:P,zoomOut:g,initialPosition:w}=W(),{selectNextBox:y,selectPrevBox:S}=z(),{switchToNextSphere:I}=F(),{updateRotate:p}=ce({currentData:o}),e=a.useContext(R),r=(i=(n=e==null?void 0:e.topViewInstance)==null?void 0:n.toolScheduler)==null?void 0:i.getCurrentToolName(),m=2,_=()=>{p(-m)},h=()=>{p(m)},b=()=>{p(180)};return a.createElement(a.Fragment,null,a.createElement("span",{onClick:h,className:x("point-cloud","rotate-reserve")}),a.createElement("span",{onClick:_,className:x("point-cloud","rotate")}),a.createElement("span",{onClick:b,className:x("point-cloud","rotate-180")}),a.createElement(D,null),a.createElement(oe,{onClick:()=>{r===O.PointCloudPolygon&&S(),r===O.Point&&I(Y.descend)},className:x("point-cloud","prev")}),a.createElement(ne,{onClick:()=>{r===O.PointCloudPolygon&&y(),r===O.Point&&I(Y.ascend)},className:x("point-cloud","next")}),a.createElement(D,null),a.createElement(te,{initialPosition:w,zoomIn:P,zoomOut:g,zoom:C}))},je=({setZAxisLimit:o,zAxisLimit:n,checkMode:i})=>i?null:a.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},a.createElement(fe,{vertical:!0,step:.5,max:10,min:.5,defaultValue:n,onAfterChange:C=>{o(C)}})),Te=({currentData:o,imgList:n,stepInfo:i,drawLayerSlot:C,checkMode:P,intelligentFit:g})=>{var w,y;const[S,I]=Z({zoom:1,currentPos:{x:0,y:0}}),p=re(null),e=a.useContext(R),r=we(p),m=Ie(i.config),{setZoom:_,syncTopviewToolZoom:h}=W(),{hideAttributes:b}=e,{addPolygon:H,deletePolygon:$}=me(),{deletePointCloudSphere:G}=F(),{deletePointCloudBox:J,changeValidByID:K}=z(),[L,Q]=Z(10),{t:ee}=ge(),v=ve();return ae(()=>{if(!e.topViewInstance&&p.current&&(o==null?void 0:o.url)&&(o==null?void 0:o.result)){const s={width:p.current.clientWidth,height:p.current.clientHeight},u=new ie({container:p.current,size:s,pcdPath:o.url,config:B(k({},m),{pointCloudPattern:e.pointCloudPattern}),checkMode:P,toolName:ye.getPointCloudToolList(),proxyMode:P});e.setTopViewInstance(u)}},[o]),V(()=>{if(!r||!e.topViewInstance||!e.sideViewInstance)return;const{toolInstance:s}=e.topViewInstance;s.singleOn("dataUpdated",(t,l)=>{const d=he.cloneDeep(t).map(c=>B(k({},c),{pointList:U.pointListTransferCanvas2World(c.pointList,r)}));e.setSelectedIDs(l),e.setLineList(d)}),s.singleOn("pointCreated",(t,l)=>{v.topViewAddSphere({newPoint:t,size:r,trackConfigurable:m.trackConfigurable,zoom:l})}),s.singleOn("pointDeleted",t=>{G(t)}),s.singleOn("pointSelected",t=>{e.setSelectedIDs([t])}),s.singleOn("updatePointByDrag",(t,l)=>{var d;(d=v.topViewUpdatePoint)==null||d.call(v,t,r)}),s.singleOn("polygonCreated",(t,l)=>{if(s.pattern===Le.Normal||!(o==null?void 0:o.url)){const d=B(k({},t),{pointList:t.pointList.map(c=>U.transferCanvas2World(c,r))});H(d),e.setSelectedIDs(b.includes(t.attribute)?"":t.id);return}v.topViewAddBox({polygon:t,size:r,imgList:n,trackConfigurable:m.trackConfigurable,zoom:l,intelligentFit:g})}),s.singleOn("deletedObject",({id:t})=>{J(t),$(t)}),s.singleOn("deleteSelectedIDs",()=>{e.setSelectedIDs([])}),s.singleOn("addSelectedIDs",t=>{e.addSelectedID(t)}),s.singleOn("setSelectedIDs",t=>{e.setSelectedIDs(t)}),s.singleOn("updatePolygonByDrag",t=>{var l;(l=v.topViewUpdateBox)==null||l.call(v,t,r)});const u=t=>{var l;const d=K(t);d&&e.syncAllViewPointCloudColor(d),e.polygonList.find(c=>c.id===t)&&((l=e.topViewInstance)==null||l.toolInstance.setPolygonValidAndRender(t,!0))};return s.on("validUpdate",u),()=>{s.unbind("validUpdate",u)}},[e,r,o,v,e.polygonList,e.lineList,(w=e.topViewInstance)==null?void 0:w.toolInstance]),V(()=>{var s,u;if(!(r==null?void 0:r.width)||!e.topViewInstance)return;const t=(u=(s=m==null?void 0:m.attributeList)==null?void 0:s[0])==null?void 0:u.value;t&&e.topViewInstance.toolInstance.setDefaultAttribute(t),e.topViewInstance.initSize(r),e.topViewInstance.updatePolygonList(e.displayPointCloudList,e.polygonList),e.topViewInstance.updatePointList(e.displaySphereList),e.topViewInstance.updateLineList(e.displayLineList);const{topViewInstance:{pointCloudInstance:l,toolInstance:d}}=e;d.singleOn("renderZoom",(c,f)=>{const{offsetX:E,offsetY:j}=q(f,r,c);if(l.camera.zoom=c,f){const{x:T,y:A,z:N}=l.initCameraPosition;l.camera.position.set(T+j,A-E,N)}l.camera.updateProjectionMatrix(),l.render(),_(c),h(f,c,r),I({zoom:c,currentPos:f})}),d.singleOn("dragMove",({currentPos:c,zoom:f})=>{const{offsetX:E,offsetY:j}=q(c,r,f);l.camera.zoom=f;const{x:T,y:A,z:N}=l.initCameraPosition;l.camera.position.set(T+j,A-E,N),l.render(),h(c,f,r),I({zoom:f,currentPos:c})})},[r,e.topViewInstance,(y=e.topViewInstance)==null?void 0:y.toolInstance]),V(()=>{var s,u;(u=(s=e.topViewInstance)==null?void 0:s.pointCloudInstance)==null||u.applyZAxisPoints(L)},[L]),V(()=>{v.topViewSelectedChanged({})},[e.selectedIDs]),a.createElement(de,{className:x("point-cloud-container","top-view"),title:ee("TopView"),toolbar:a.createElement(Ee,{currentData:o})},a.createElement("div",{style:{position:"relative",flex:1}},a.createElement("div",{style:{width:"100%",height:"100%"},ref:p},C==null?void 0:C(S)),a.createElement(pe,{checkMode:P,config:m}),a.createElement(je,{checkMode:P,zAxisLimit:L,setZAxisLimit:Q}),a.createElement(ue,null)))};var Ae=Pe(Ce,null,null,{context:xe})(Te);export{Ae as default};
@@ -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:f,polygonList:y,setPolygonList:a,lineList:C,setLineList:g,syncAllViewPointCloudColor:w}=I(b),H=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:r})=>{const d={pointCloudBoxList:p,polygonList:y,lineList:C,pointCloudSphereList:c};t&&(d.pointCloudBoxList=p.concat(t)),o&&(d.polygonList=y.concat(o)),i&&(d.lineList=C.concat(i)),r&&(d.pointCloudSphereList=c.concat(r)),e.pushHistory(d)},O=t=>{const o={pointCloudBoxList:p,polygonList:y,lineList:C,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(C.find(i=>i.id===t.id)){const i=C.map(r=>r.id===t.id?t:_({},r));e.pushHistory({lineList:i}),g(i)}},E=t=>{if(y.find(i=>i.id===t.id)){const i=y.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),f==null||f.updatePolygonList(o!=null?o:[],i!=null?i:[]),f==null||f.updateLineList(r!=null?r:[]),f==null||f.updatePointList(d)};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 v,getCuboidFromPointCloudBox as _t}from"@labelbee/lb-annotation";import{EPerspectiveView as N,PointCloudUtils as I,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},A=(t,e)=>Zt(t,Wt(e)),q=(t,e,n)=>new Promise((d,o)=>{var c=l=>{try{r(n.next(l))}catch(P){o(P)}},p=l=>{try{r(n.throw(l))}catch(P){o(P)}},r=l=>l.done?d(l.value):Promise.resolve(l.value).then(c,p);r((n=n.apply(t,e)).next())});const G=5,Q=90,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(t,e,n,d,o)=>{const{x:c,y:p}=I.transferCanvas2World(t,e),{defaultZ:r}=Vt,l={center:{x:c,y:p,z:r},id:t.id},P=d?m(m({},d),l):A(m({},l),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},K=(t,e,n,d,o,c)=>{let p=t.pointList.map(y=>I.transferCanvas2World(y,e)),r=0,l=1,P={};if(n){const y=n.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),r=(y.maxZ+y.minZ)/2,l=y.maxZ-y.minZ,P={count:y.zCount}}const[g,B,j]=p,V=v.getLineCenterPoint([g,j]),T=v.getLineLength(g,B),z=v.getLineLength(B,j),R=v.getRadiusFromQuadrangle(t.pointList);d&&(r=d.center.z,l=d.depth);const U={center:{x:V.x,y:V.y,z:r},width:z,height:T,depth:l,rotation:R,id:t.id},D=m(d?m(m({},d),U):A(m({},U),{attribute:"",valid:!0}),P);o&&Object.assign(D,o);const E=p.map(y=>I.transferWorld2Canvas(y,e));return{boxParams:D,newPointList:E}},ct=(t,e,n)=>{const d={x:t.x-e.x,y:t.y-e.y};return A(m({},n),{center:{x:n.center.x-d.x,y:n.center.y,z:n.center.z-d.y}})},ut=(t,e,n,d)=>{const[o,c,p]=t.pointList,[r,l,P]=e.pointList,g=v.getLineCenterPoint([o,p]),B=v.getLineCenterPoint([r,P]),V={x:{x:g.x-B.x,y:g.y-B.y}.x,y:0,z:g.y-B.y},T=v.getLineLength(o,c),z=v.getLineLength(r,l),R=T-z,U=v.getLineLength(c,p),D=v.getLineLength(l,P),E=U-D,{newBoxParams:y}=d.getNewBoxBySideUpdate(V,E,R,n);return y},Qt=(t,e,n)=>{const d={x:t.x-e.x,y:t.y-e.y};return A(m({},n),{center:{x:n.center.x,y:n.center.y-d.x,z:n.center.z-d.y}})},Xt=(t,e,n,d)=>{const[o,c,p]=t.pointList,[r,l,P]=e.pointList,g=v.getLineCenterPoint([o,p]),B=v.getLineCenterPoint([r,P]),V={x:{x:g.x-B.x,y:g.y-B.y}.x,y:0,z:g.y-B.y},T=v.getLineLength(o,c),z=v.getLineLength(r,l),R=T-z,U=v.getLineLength(c,p),D=v.getLineLength(l,P),E=U-D;let{newBoxParams:y}=d.getNewBoxByBackUpdate(V,E,R,n);return y},pt=(t,e,n,d,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(d,(c=o==null?void 0:o.radius)!=null?c:Q);const{cameraPositionVector:l}=r.updateOrthoCameraBySphere(t,N.Left);r.setInitCameraPosition(l);const{point2d:P,zoom:g}=r.getSphereSidePoint2DCoordinate(t);r.camera.zoom=g,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([A(m(m({},e),P),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},ft=(t,e,n,d)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(d,t,{width:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Left);c.setInitCameraPosition(p);const{polygon2d:r,zoom:l}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(l),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Ct=(t,e,n,d,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(d,(c=o==null?void 0:o.radius)!=null?c:Q);const{cameraPositionVector:l}=r.updateOrthoCameraBySphere(t,N.Back);r.setInitCameraPosition(l);const{point2d:P,zoom:g}=r.getSphereBackPoint2DCoordinate(t);r.camera.zoom=g,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([A(m(m({},e),P),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},Pt=(t,e,n,d)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(d,t,{height:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Back);c.setInitCameraPosition(p);const{polygon2d:r,zoom:l}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(l),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},gt=(t,e,n,d)=>{if(!n||!d)return;d.generateSphere(t),d.updateCameraBySphere(t,N.Top),d.render();const{toolInstance:o,pointCloudInstance:c}=n,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),r=[...o.pointList].map(l=>l.id===e.id?A(m(m({},e),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):l);o.setResult(r),o.setSelectedID(e.id)},$=(t,e,n,d)=>{var o;if(!n||!d)return;d.generateBox(t,e.id),d.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=n,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(t),l=[...c.polygonList],P=l.find(g=>g.id===e.id);P?P.pointList=r:l.push({id:e.id,pointList:r,textAttribute:"",isRect:!0,valid:(o=t.valid)!=null?o:!0}),c.setResultAndSelectedID(l,e.id)},Yt=()=>{const t=Ut(kt),{topViewInstance:e,sideViewInstance:n,backViewInstance:d,mainViewInstance:o,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:l,pointCloudBoxList:P,pointCloudSphereList:g,hideAttributes:B}=t,{addHistory:j,initHistory:V,pushHistoryUnderUpdatePolygon:T,pushHistoryUnderUpdateLine:z}=Ht(),{selectedPolygon:R}=Ft(),{updateSelectedBox:U,updateSelectedBoxes:D,getPointCloudByID:E}=st(),{getPointCloudSphereByID:y,updatePointCloudSphere:tt,selectedSphere:Z}=At(),{currentData:F,config:S}=jt(i=>{const{stepList:s,step:f,imgList:u,imgIndex:a}=i.annotation;return{currentData:u[a],config:rt(zt.getCurrentStepInfo(f,s).config)}}),ot=Tt(),{selectedBox:H}=st(),{t:ht}=Et(),et=H==null?void 0:H.info;if(!e||!n||!d)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:s,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:g})});const h=J(i,s,X,void 0,C);r(i.id);const x=p(h);W(L.Top,i,h,f,x,S),j({newSphereParams:h})},vt=({polygon:i,size:s,imgList:f,trackConfigurable:u,zoom:a,intelligentFit:C})=>{var h;const x={attribute:(h=e.toolInstance.defaultAttribute)!=null?h:""};u===!0&&Object.assign(x,{trackID:I.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:g})});const w=e==null?void 0:e.toolInstance,O=m({},i),{boxParams:b,newPointList:k}=K(O,s,X,void 0,x,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&&(k==null?void 0:k.length)&&(O.pointList=k);const Y=B.includes(O.attribute),_=c(b);Y?r([]):(r(b.id),w.setSelectedIDs([O.id]),M(L.Top,O,b,a,_),C&&$(b,O,e,o)),j({newBoxParams:b})},xt=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:f,newSphereList:u})=>{const a=e==null?void 0:e.toolInstance;if(!(l.length===0||!a)){if(i||(H==null?void 0:H.info)){const C=i!=null?i:H==null?void 0:H.info;a==null||a.setSelectedIDs(l);const h=a.selectedPolygon;if(l.length===1&&C){M(L.Top,h,C,void 0,s);return}}if((f||Z)&&l.length===1){const C=f!=null?f:Z;a.setSelectedID(l[0]);const h=a.selectedPoint;C&&W(L.Top,h,C,void 0,u,S)}}},nt=(i,s,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,s,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=A(m({},a),{count:h})}const C=U(a);return M(f,i,a,void 0,C),C}},it=(i,s,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,s,Z);const C=tt(a);return W(f,i,a,void 0,C,S),C}},Bt=(i,s)=>{it(i,s,L.Side)},St=(i,s)=>{it(i,s,L.Back)},bt=(i,s)=>{nt(i,s,L.Side)},wt=(i,s)=>{nt(i,s,L.Back)},It=(i,s)=>{z(i)},Dt=(i,s)=>{const f=y(i.id),u=J(i,s,X,f),a=tt(u);W(L.Top,i,u,void 0,a,S)},Ot=(i,s)=>{if(R){const u=i[0].newPolygon;u.pointList=u.pointList.map(a=>I.transferCanvas2World(a,s)),T(i[0].newPolygon);return}const f=i.map(({newPolygon:u})=>{const a=E(u.id),{boxParams:C}=K(u,s,e.pointCloudInstance,a);return C});if(f.length===1){const{newPolygon:u}=i[0],a=D(f);M(L.Top,u,f[0],void 0,a)}else{const u=D(f);u&&t.syncAllViewPointCloudColor(u)}},W=(i,s,f,u,a,C)=>q(void 0,null,function*(){const h=F==null?void 0:F.url,x={[L.Side]:()=>{pt(f,s,n,h,C)},[L.Back]:()=>{d&&Ct(f,s,d,h,C)},[L.Top]:()=>{gt(f,s,e,o)}};Object.keys(x).forEach(w=>{w!==i&&x[w]()}),u&&(o==null||o.updateCameraZoom(u)),mt(f)}),M=(i,s,f,u,a)=>q(void 0,null,function*(){const C=F==null?void 0:F.url;a&&(yield t.syncAllViewPointCloudColor(a));const h={[L.Side]:()=>{ft(f,s,n,C)},[L.Back]:()=>{d&&Pt(f,s,d,C)},[L.Top]:()=>{$(f,s,e,o)}};Object.keys(h).forEach(x=>{x!==i&&h[x]()}),u&&(o==null||o.updateCameraZoom(u)),Lt(f)});return{topViewAddSphere:yt,topViewAddBox:vt,topViewSelectedChanged:xt,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 s={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>q(void 0,[...i],function*(s=F){var f,u,a,C,h,x;if(!(s==null?void 0:s.url)||!o)return;dt(ot,!0),yield o.loadPCDFile(s.url,(f=S==null?void 0:S.radius)!=null?f:Q),P.forEach(_=>{o==null||o.removeObjectByName(_.id)}),g.forEach(_=>{o==null||o.removeObjectByName(_.id)});let w=[],O=[],b=[],k=[];s.result?(w=I.getBoxParamsFromResultList(s.result),b=I.getPolygonListFromResultList(s.result),O=I.getLineListFromResultList(s.result),k=I.getSphereParamsFromResultList(s.result),w.forEach(_=>{o==null||o.generateBox(_)}),k.forEach(_=>{o==null||o.generateSphere(_)}),t.syncAllViewPointCloudColor(w),t.setPointCloudResult(w),t.setPolygonList(b),t.setLineList(O),t.setPointCloudSphereList(k)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),V({pointCloudBoxList:w,polygonList:b,pointCloudSphereList:k}),o.updateTopCamera();const Y=(a=(u=rt(s.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(s.url,s.result,{radius:(x=S==null?void 0:S.radius)!=null?x: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 w,useMemo as D,useCallback as d}from"react";import{PointCloudContext as b}from"../PointCloudContext.js";import h from"lodash";import{useHistory as y}from"./useHistory.js";import{cAnnotation as g}from"@labelbee/lb-annotation";const{ESortDirection:S}=g,j=()=>{const{pointCloudSphereList:e,setPointCloudSphereList:c,selectedID:l,setSelectedIDs:a,mainViewInstance:s,topViewInstance:r}=w(b),{pushHistoryWithList:f}=y(),m=D(()=>e.find(t=>t.id===l),[l,e]),C=d(t=>e.find(n=>n.id===t),[e]),I=d(t=>{const n=e.findIndex(o=>o.id===t.id);if(n>-1){e.splice(n,1,h.merge(e[n],t));const o=h.cloneDeep(e);return c(o),f({pointCloudSphereList:o}),o}return e},[e]),x=d(t=>{const n=e.filter(o=>o.id!==t);c(n),s==null||s.removeObjectByName(t),s==null||s.render()},[e]),L=d((t=S.ascend)=>{if(!r)return;const n=r.toolInstance.pointList,o=r.toolInstance.selectedID,u=n.findIndex(i=>(i==null?void 0:i.id)===o);if(u>-1){let i=1;t===S.descend&&(i=-1);const p=n.length,P=n[(u+i+p)%p];a(P.id)}},[r]);return{selectedSphere:m,getPointCloudSphereByID:C,updatePointCloudSphere:I,deletePointCloudSphere:x,switchToNextSphere:L}};export{j as useSphere};
@@ -1 +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 b}from"../PointCloudContext.js";import{cTool as R}from"@labelbee/lb-annotation";import{useHistory as E}from"./useHistory.js";const{EToolName:t,EPolygonPattern:d}=R,I=()=>{const{topViewInstance:r,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,pointCloudBoxList:P,pointCloudSphereList:C,setPointCloudResult:p,setPointCloudSphereList:v,setPolygonList:h,pointCloudPattern:c,setPointCloudPattern:l,syncAllViewPointCloudColor:m,setLineList:y}=w(b),{pushHistoryWithList:L}=E(),f=()=>{P.forEach(n=>{e==null||e.removeObjectByName(n.id)}),C.forEach(n=>{e==null||e.removeObjectByName(n.id)}),e==null||e.render(),p([]),h([]),v([]),y([]),r==null||r.toolScheduler.clearStatusAndResult(),m([]),L({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()};return{clearAllResult:f,updatePointCloudPattern:n=>{if(n===c)return;const s=[r,a,u];switch(n){case t.Rect:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Rect)}),l(t.Rect);break;case t.Polygon:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(d.Normal)}),l(t.Polygon);break;case t.Point:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),l(t.Point);break;case t.Line:i(),s.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),l(t.Line);break}},pointCloudPattern:c}};export{I as useStatus};
@@ -1 +1 @@
1
- import{Button as p,message as l}from"antd";import u from"react";import{useTranslation as g}from"react-i18next";import{connect as x}from"react-redux";import h from"../../../assets/predictTracking/icon.svg.js";import{useSingleBox as y}from"../../pointCloudView/hooks/useSingleBox.js";import{ChangeSave as P,GetBoxesByID as v,SetPointCloudLoading as B,SetPredictResult as S,SetPredictResultVisible as k}from"../../../store/annotation/actionCreators.js";import{LabelBeeContext as C,useDispatch as T}from"../../../store/ctx.js";import{predict as I}from"../previewResult/util.js";var j=(i,n,e)=>new Promise((a,c)=>{var d=t=>{try{r(e.next(t))}catch(o){c(o)}},s=t=>{try{r(e.throw(t))}catch(o){c(o)}},r=t=>t.done?a(t.value):Promise.resolve(t.value).then(d,s);r((e=e.apply(i,n)).next())});const D=i=>{const n=T(),{t:e}=g(),{loading:a}=i,{selectedBox:c}=y(),d=()=>j(void 0,null,function*(){if(a)return;const s=c==null?void 0:c.info.trackID;if(!s){l.error(e("BeforePredictStarting"));return}yield n(P);const r=yield n(v(s));if(r.length<2){l.error(e("BeforePredictStarting"));return}const t=r[r.length-2],o=r[r.length-1],m=o.index-t.index;if(m<2){l.error(e("BeforePredictStarting"));return}if(m>8){l.error(e("ThePredictedPointCloud"));return}B(n,!0);const f=I(t,o);S(n,f),k(n,!0)});return u.createElement(p,{type:"link",onClick:d,style:{display:"flex",flexDirection:"column",height:"auto",alignItems:"center"}},u.createElement("img",{src:h,style:{alignSelf:"center"}}),u.createElement("span",{style:{color:"#797979"}},e("ComplementaryTracking")))},w=i=>({loading:i.annotation.loading});var R=x(w,null,null,{context:C})(D);export{R as default};
1
+ import{Button as v,message as a}from"antd";import f from"react";import{useTranslation as y}from"react-i18next";import{connect as P}from"react-redux";import h from"../../../assets/predictTracking/icon.svg.js";import{useSingleBox as B}from"../../pointCloudView/hooks/useSingleBox.js";import{ChangeSave as k,GetBoxesByID as I,SetPointCloudLoading as S,SetPredictResult as C,SetPredictResultVisible as D}from"../../../store/annotation/actionCreators.js";import{LabelBeeContext as T,useDispatch as j}from"../../../store/ctx.js";import{predict as w}from"../previewResult/util.js";var R=(c,n,t)=>new Promise((l,r)=>{var d=e=>{try{o(t.next(e))}catch(i){r(i)}},s=e=>{try{o(t.throw(e))}catch(i){r(i)}},o=e=>e.done?l(e.value):Promise.resolve(e.value).then(d,s);o((t=t.apply(c,n)).next())});const b=c=>{const n=j(),{t}=y(),{loading:l}=c,{selectedBox:r}=B(),d=()=>R(void 0,null,function*(){if(l)return;const s=r==null?void 0:r.info.trackID;if(!s){a.error(t("BeforePredictStarting"));return}yield n(k);const o=r==null?void 0:r.info.id,e=yield n(I(s,o));if(e.length<2){a.error(t("MarkOnlyOne"));return}const i=e.findIndex(g=>g.id===o),u=e[i-1],m=e[i],p=m.index-u.index;if(p<2){a.error(t("HaveNoNeed"));return}if(p>8){a.error(t("ThePredictedPointCloud"));return}a.success(t("PredictingDataFrom",{startPage:u.index+1,endPage:m.index+1,selectedBoxTrackID:s})),S(n,!0);const x=w(u,m);C(n,x),D(n,!0)});return f.createElement(v,{type:"link",onClick:d,style:{display:"flex",flexDirection:"column",height:"auto",alignItems:"center"}},f.createElement("img",{src:h,style:{alignSelf:"center"}}),f.createElement("span",{style:{color:"#797979"}},t("ComplementaryTracking")))},E=c=>({loading:c.annotation.loading});var L=P(E,null,null,{context:T})(b);export{L as default};
@@ -1 +1 @@
1
- import C from"classnames";import n,{useState as j,useRef as S,useEffect as F}from"react";import{useTranslation as _}from"react-i18next";import{connect as L}from"react-redux";import{PointCloudContext as B}from"../../pointCloudView/PointCloudContext.js";import{SetPredictResultVisible as D,SetPredictResult as T,SetPointCloudLoading as v,BatchUpdateImgListResultByPredictResult as I}from"../../../store/annotation/actionCreators.js";import{LabelBeeContext as $,useDispatch as E}from"../../../store/ctx.js";import{getClassName as o}from"../../../utils/dom.js";import{PointCloud as z}from"@labelbee/lb-annotation";import{toolStyleConverter as U}from"@labelbee/lb-utils";import{views as A,sleep as G,getViewsDataUrl as Z}from"./util.js";var q=Object.defineProperty,H=Object.defineProperties,J=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,N=(i,e,t)=>e in i?q(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Q=(i,e)=>{for(var t in e||(e={}))K.call(e,t)&&N(i,t,e[t]);if(k)for(var t of k(e))M.call(e,t)&&N(i,t,e[t]);return i},W=(i,e)=>H(i,J(e)),O=(i,e,t)=>new Promise((d,r)=>{var s=c=>{try{l(t.next(c))}catch(u){r(u)}},a=c=>{try{l(t.throw(c))}catch(u){r(u)}},l=c=>c.done?d(c.value):Promise.resolve(c.value).then(s,a);l((t=t.apply(i,e)).next())});const X=i=>{const{predictionResult:e,predictionResultVisible:t,imgList:d}=i,[r,s]=j([]),a=E(),{t:l}=_(),c=()=>{D(a,!1),T(a,[]),s([])},u=()=>O(void 0,null,function*(){v(a,!0),yield a(I()),v(a,!1),c()});return t?n.createElement(n.Fragment,null,r.length>0&&n.createElement("div",{className:o("point-cloud-predict-tracking-container")},n.createElement("div",{className:o("point-cloud-predict-tracking-container","bar")},n.createElement("div",{className:o("point-cloud-predict-tracking-container","title")},n.createElement("div",null,l("ComplementaryTrackingPrediction"),r.length>0?`\uFF08${r.length}\uFF09`:""),n.createElement("div",{className:o("point-cloud-predict-tracking-container","option")},n.createElement("div",{className:C([o("point-cloud-predict-tracking-container","cancelOption"),o("point-cloud-predict-tracking-container","button")]),onClick:c},l("Cancel")),n.createElement("div",{className:C([o("point-cloud-predict-tracking-container","okOption"),o("point-cloud-predict-tracking-container","button")]),onClick:u},l("Apply")))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","content")},n.createElement(Y,{list:r})))),e.length>0&&n.createElement(ee,{result:e,imgList:d,setList:s})):null},Y=i=>{const{list:e}=i,{t}=_(),d=[t("TopView"),t("SideView"),t("BackView")];return n.createElement(n.Fragment,null,n.createElement("div",{className:o("point-cloud-predict-tracking-container","left")},d.map(r=>n.createElement("div",{className:o("point-cloud-predict-tracking-container","title"),key:r},r))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","right")},e.map(r=>n.createElement("div",{className:o("point-cloud-predict-tracking-container","item"),key:r.id},A.map(s=>{const a=r[s];return n.createElement("div",{className:o("point-cloud-predict-tracking-container","view"),key:`${r.id}-${s}`},n.createElement("img",{src:a}))})))))},ee=i=>{const e=n.useContext(B),t=E(),{result:d,imgList:r,setList:s}=i,a=S(null),l={width:600,height:600};return F(()=>{(()=>O(void 0,null,function*(){var u,h,y,P,w,b;const f=(u=e.mainViewInstance)==null?void 0:u.config;if(f&&a.current){const R={left:-l.width/2,right:l.width/2,top:l.height/2,bottom:-l.height/2,near:200,far:-200},p=new z({container:a.current,isOrthographicCamera:!0,orthographicParams:R,config:f});p.setShowDirection(!1);for(const m of d){const{index:g}=m,x=r[g].url?r[g].url:(w=(P=(y=(h=r[g])==null?void 0:h.webPointCloudFile)==null?void 0:y.lidar)==null?void 0:P.url)!=null?w:"";yield p.loadPCDFileByBox(x,m,{width:2,height:2,depth:2}),yield p.updateCameraZoom(e.zoom);const V=(b=U.getColorFromConfig({attribute:m.attribute},W(Q({},f),{attributeConfigurable:!0}),{}))==null?void 0:b.hex;p.generateBox(m,V),yield G(500),yield Z(p,m,e.zoom),yield p.removeObjectByName(m.id),yield p.clearPointCloudAndRender()}s(d),v(t,!1)}}))()},[]),n.createElement("div",{style:l,ref:a,className:"generate-view"})},te=i=>({predictionResult:i.annotation.predictionResult,predictionResultVisible:i.annotation.predictionResultVisible,imgList:i.annotation.imgList});var ne=L(te,null,null,{context:$})(X);export{ne as default};
1
+ import C from"classnames";import n,{useState as j,useRef as S,useEffect as F}from"react";import{useTranslation as _}from"react-i18next";import{connect as L}from"react-redux";import{PointCloudContext as B}from"../../pointCloudView/PointCloudContext.js";import{SetPredictResultVisible as D,SetPredictResult as T,SetPointCloudLoading as v,BatchUpdateImgListResultByPredictResult as I}from"../../../store/annotation/actionCreators.js";import{LabelBeeContext as $,useDispatch as E}from"../../../store/ctx.js";import{getClassName as o}from"../../../utils/dom.js";import{PointCloud as z}from"@labelbee/lb-annotation";import{toolStyleConverter as U}from"@labelbee/lb-utils";import{views as A,sleep as G,getViewsDataUrl as Z}from"./util.js";var q=Object.defineProperty,H=Object.defineProperties,J=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,N=(i,e,t)=>e in i?q(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Q=(i,e)=>{for(var t in e||(e={}))K.call(e,t)&&N(i,t,e[t]);if(k)for(var t of k(e))M.call(e,t)&&N(i,t,e[t]);return i},W=(i,e)=>H(i,J(e)),O=(i,e,t)=>new Promise((d,r)=>{var s=c=>{try{a(t.next(c))}catch(u){r(u)}},l=c=>{try{a(t.throw(c))}catch(u){r(u)}},a=c=>c.done?d(c.value):Promise.resolve(c.value).then(s,l);a((t=t.apply(i,e)).next())});const X=i=>{const{predictionResult:e,predictionResultVisible:t,imgList:d}=i,[r,s]=j([]),l=E(),{t:a}=_(),c=()=>{D(l,!1),T(l,[]),s([])},u=()=>O(void 0,null,function*(){v(l,!0),yield l(I()),v(l,!1),c()});return t?n.createElement(n.Fragment,null,r.length>0&&n.createElement("div",{className:o("point-cloud-predict-tracking-container")},n.createElement("div",{className:o("point-cloud-predict-tracking-container","bar")},n.createElement("div",{className:o("point-cloud-predict-tracking-container","title")},n.createElement("div",null,a("ComplementaryTrackingPrediction"),r.length>0?`\uFF08${r.length}\uFF09`:""),n.createElement("div",{className:o("point-cloud-predict-tracking-container","option")},n.createElement("div",{className:C([o("point-cloud-predict-tracking-container","cancelOption"),o("point-cloud-predict-tracking-container","button")]),onClick:c},a("Cancel")),n.createElement("div",{className:C([o("point-cloud-predict-tracking-container","okOption"),o("point-cloud-predict-tracking-container","button")]),onClick:u},a("Apply")))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","content")},n.createElement(Y,{list:r})))),e.length>0&&n.createElement(ee,{result:e,imgList:d,setList:s})):null},Y=i=>{const{list:e}=i,{t}=_(),d=[t("TopView"),t("SideView"),t("BackView")];return n.createElement(n.Fragment,null,n.createElement("div",{className:o("point-cloud-predict-tracking-container","left")},d.map(r=>n.createElement("div",{className:o("point-cloud-predict-tracking-container","title"),key:r},r))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","right")},e.map(r=>n.createElement("div",{className:o("point-cloud-predict-tracking-container","item"),key:r.id},A.map(s=>{const l=r[s];return n.createElement("div",{className:o("point-cloud-predict-tracking-container","view"),key:`${r.id}-${s}`},n.createElement("img",{src:l}))})))))},ee=i=>{const e=n.useContext(B),t=E(),{result:d,imgList:r,setList:s}=i,l=S(null),a={width:600,height:600};return F(()=>{(()=>O(void 0,null,function*(){var u,h,y,P,w,b;const f=(u=e.mainViewInstance)==null?void 0:u.config;if(f&&l.current){const R={left:-a.width/2,right:a.width/2,top:a.height/2,bottom:-a.height/2,near:200,far:-200},p=new z({container:l.current,isOrthographicCamera:!0,orthographicParams:R,config:f});p.setShowDirection(!1);for(const m of d){const{index:g}=m,x=r[g].url?r[g].url:(w=(P=(y=(h=r[g])==null?void 0:h.webPointCloudFile)==null?void 0:y.lidar)==null?void 0:P.url)!=null?w:"";yield p.loadPCDFileByBox(x,m,{width:2,height:2,depth:2}),yield p.updateCameraZoom(e.zoom);const V=(b=U.getColorFromConfig({attribute:m.attribute},W(Q({},f),{attributeConfigurable:!0}),{}))==null?void 0:b.fill;p.generateBox(m,V),yield G(500),yield Z(p,m,e.zoom),yield p.removeObjectByName(m.id),yield p.clearPointCloudAndRender()}s(d),v(t,!1)}}))()},[]),n.createElement("div",{style:a,ref:l,className:"generate-view"})},te=i=>({predictionResult:i.annotation.predictionResult,predictionResultVisible:i.annotation.predictionResultVisible,imgList:i.annotation.imgList});var ne=L(te,null,null,{context:$})(X);export{ne as default};
@@ -1 +1 @@
1
- import{jsonParser as E}from"../../../utils/index.js";import{uuid as O}from"@labelbee/lb-annotation";import{EPerspectiveView as f}from"@labelbee/lb-utils";var b=Object.defineProperty,g=Object.defineProperties,I=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable,m=(t,e,r)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_=(t,e)=>{for(var r in e||(e={}))B.call(e,r)&&m(t,r,e[r]);if(v)for(var r of v(e))D.call(e,r)&&m(t,r,e[r]);return t},w=(t,e)=>g(t,I(e)),P=(t,e,r)=>new Promise((o,i)=>{var s=n=>{try{c(r.next(n))}catch(l){i(l)}},u=n=>{try{c(r.throw(n))}catch(l){i(l)}},c=n=>n.done?o(n.value):Promise.resolve(n.value).then(s,u);c((r=r.apply(t,e)).next())});const h={width:160,height:110},j=(t,e=2)=>P(void 0,null,function*(){return S(t.domElement,h.width,h.height,e)}),A=(t=300)=>new Promise(e=>{setTimeout(()=>{e("")},t)}),x=[f.Top,f.Left,f.Back],C=(t,e,r)=>P(void 0,null,function*(){for(const o of x)yield t.updateCameraByBox(e,o),e[o]=yield j(t.renderer,r)}),S=(t,e,r,o)=>{if(!t)return"";const i=t.width/2,s=t.height/2,u=i-e/2,c=s-r/2,n=document.createElement("canvas");n.width=e*o,n.height=r*o;const l=n.getContext("2d");return l==null||l.drawImage(t,u,c,e,r,0,0,e*o,r*o),n.toDataURL()},V=(t,e,r)=>{const o=[];return t.forEach((i,s)=>{var u;const c=E(i==null?void 0:i.result),n=(u=c==null?void 0:c[`step_${e}`])==null?void 0:u.result,l=n==null?void 0:n.find(p=>p.trackID===r);l&&o.push(w(_({},l),{index:s}))}),o},L=(t,e)=>{const o=e.index-t.index-1,i=[],s={},u=["x","y","z"],c=["center","depth","height","index","rotation","width"];u.forEach(n=>{s[n]=y(t.center[n],e.center[n],o)}),c.forEach(n=>{n!=="center"&&(s[n]=y(t[n],e[n],o))});for(let n=0;n<o;n++){const l=u.reduce((a,d)=>(a[d]=s[d][n],a),{x:0,y:0,z:0}),p=c.reduce((a,d)=>(d==="center"||(a[d]=s[d][n]),a),w(_({},t),{id:O(),center:l}));i.push(p)}return i},y=(t=0,e=0,r=0)=>{const o=(e-t)/(r+1),i=new Array(r);for(let s=0;s<r;s++)i[s]=t+o*(s+1);return i};export{V as getBoxesByTrackID,C as getViewsDataUrl,L as predict,A as sleep,x as views};
1
+ import{jsonParser as E}from"../../../utils/index.js";import{uuid as O}from"@labelbee/lb-annotation";import{EPerspectiveView as f}from"@labelbee/lb-utils";var b=Object.defineProperty,g=Object.defineProperties,I=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable,m=(t,e,r)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_=(t,e)=>{for(var r in e||(e={}))B.call(e,r)&&m(t,r,e[r]);if(v)for(var r of v(e))D.call(e,r)&&m(t,r,e[r]);return t},w=(t,e)=>g(t,I(e)),P=(t,e,r)=>new Promise((o,i)=>{var s=n=>{try{c(r.next(n))}catch(l){i(l)}},u=n=>{try{c(r.throw(n))}catch(l){i(l)}},c=n=>n.done?o(n.value):Promise.resolve(n.value).then(s,u);c((r=r.apply(t,e)).next())});const h={width:160,height:110},j=(t,e=2)=>P(void 0,null,function*(){return S(t.domElement,h.width,h.height,e)}),A=(t=300)=>new Promise(e=>{setTimeout(()=>{e("")},t)}),x=[f.Top,f.Left,f.Back],C=(t,e,r)=>P(void 0,null,function*(){for(const o of x)yield t.updateCameraByBox(e,o),e[o]=yield j(t.renderer,r)}),S=(t,e,r,o)=>{if(!t)return"";const i=t.width/2,s=t.height/2,u=i-e/2,c=s-r/2,n=document.createElement("canvas");n.width=e*o,n.height=r*o;const l=n.getContext("2d");return l==null||l.drawImage(t,u,c,e,r,0,0,e*o,r*o),n.toDataURL()},V=(t,e,r,o)=>{const i=[];return t.some((s,u)=>{var c;const n=E(s==null?void 0:s.result),l=(c=n==null?void 0:n[`step_${e}`])==null?void 0:c.result,d=l==null?void 0:l.find(a=>a.trackID===r);return d&&i.push(w(_({},d),{index:u})),(d==null?void 0:d.id)===o}),i},L=(t,e)=>{const o=e.index-t.index-1,i=[],s={},u=["x","y","z"],c=["center","depth","height","index","rotation","width"];u.forEach(n=>{s[n]=y(t.center[n],e.center[n],o)}),c.forEach(n=>{n!=="center"&&(s[n]=y(t[n],e[n],o))});for(let n=0;n<o;n++){const l=u.reduce((a,p)=>(a[p]=s[p][n],a),{x:0,y:0,z:0}),d=c.reduce((a,p)=>(p==="center"||(a[p]=s[p][n]),a),w(_({},e),{id:O(),center:l}));i.push(d)}return i},y=(t=0,e=0,r=0)=>{const o=(e-t)/(r+1),i=new Array(r);for(let s=0;s<r;s++)i[s]=t+o*(s+1);return i};export{V as getBoxesByTrackID,C as getViewsDataUrl,L as predict,A as sleep,x as views};
@@ -1 +1 @@
1
- import{ANNOTATION_ACTIONS as a}from"../Actions.js";import{LoadFileAndFileData as B,getStepConfig as k}from"./reducer.js";import{ESubmitType as T}from"../../constant/index.js";import{EPageTurningOperation as y}from"../../data/enums/AnnotationSize.js";import F from"../../utils/PageOperator.js";import{jsonParser as b}from"../../utils/index.js";import{getBoxesByTrackID as M}from"../../components/predictTracking/previewResult/util.js";var g=(t,e,n)=>new Promise((o,i)=>{var p=u=>{try{l(n.next(u))}catch(r){i(r)}},s=u=>{try{l(n.throw(u))}catch(r){i(r)}},l=u=>u.done?o(u.value):Promise.resolve(u.value).then(p,s);l((n=n.apply(t,e)).next())});const h=(t,e)=>e.map(n=>t(n)),j=t=>t===y.Forward?T.Forward:t===y.Backward?T.Backward:t===y.Jump?T.Jump:T.Forward,H=(t,e)=>{var n,o;const{imgList:i,imgIndex:p}=t,{dataSourceStep:s}=k(t.stepList,t.step);return((o=(n=b(i[p-1].result)[`step_${s}`])==null?void 0:n.result)==null?void 0:o.length)-1||e};function K(t){return{type:a.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function O({stepList:t}){return{type:a.SET_TASK_STEP_LIST,payload:{stepList:t}}}function v({stepList:t,step:e}){return{type:a.SET_TASK_CONFIG,payload:{stepList:t,step:e}}}function I(t){return{type:a.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function A(t){return{type:a.UPDATE_ON_SAVE,payload:{onSave:t}}}function U(t){return{type:a.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function P(t){return{type:a.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function L(t){return{type:a.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function m(t){return{type:a.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function D(t){return{type:a.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function V(){return{type:a.UPDATE_ROTATE}}function N(t){return{type:a.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function R(t){return{type:a.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function J(){return{type:a.COPY_BACKWARD_RESULT}}function Y({id:t,newID:e,rangeIndex:n,imgList:o}){return{type:a.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:e,rangeIndex:n,imgList:o}}}function W(t,e,n){return{type:a.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:e,rangeIndex:n}}}function X(){return{type:a.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const x=t=>({type:a.SET_CHECK_MODE,payload:{checkMode:t}});function q({onSubmit:t,onSave:e,onPageChange:n,onStepChange:o,getFileData:i,pageSize:p,loadFileList:s,step:l,stepList:u,skipBeforePageTurning:r,beforeRotate:c,checkMode:_}){const d=[];return t&&d.push(I(t)),e&&d.push(A(e)),n&&d.push(U(n)),o&&d.push(P(o)),i&&d.push(L(i)),s&&d.push(D(s)),p&&d.push(m(p)),r&&d.push(N(r)),c&&d.push(R(c)),typeof _=="boolean"&&d.push(x(_)),d.push(v({stepList:u,step:l})),d.push({type:a.CALC_STEP_PROGRESS}),d.push({type:a.INIT_TOOL}),C=>h(C,d)}function z({onSubmit:t,onSave:e,onPageChange:n,onStepChange:o,getFileData:i,pageSize:p,loadFileList:s,stepList:l,beforeRotate:u}){const r=[];return t&&r.push(I(t)),e&&r.push(A(e)),n&&r.push(U(n)),o&&r.push(P(o)),i&&r.push(L(i)),s&&r.push(D(s)),p&&r.push(m(p)),u&&r.push(R(u)),r.push(O({stepList:l})),c=>h(c,r)}const Z=(t,e)=>{var n;const o=e==null?void 0:e.findIndex(i=>(i==null?void 0:i.step)===t);return(n=e[o+1])==null?void 0:n.step},$=t=>(e,n)=>{const{annotation:o}=n(),{step:i,stepList:p}=o,s=Z(i,p);return[e(G(s,t))]},G=(t,e)=>(n,o)=>{var i,p;const{annotation:s}=o();(i=s==null?void 0:s.onStepChange)==null||i.call(s,t);const l=(p=s==null?void 0:s.imgIndex)!=null?p:0;return[n({type:a.SUBMIT_RESULT}),n({type:a.SUBMIT_FILE_DATA,payload:{submitType:T.StepChanged}}),n({type:a.SET_STEP,payload:{toStep:t}}),n({type:a.CALC_STEP_PROGRESS}),n(B(e!=null?e:l,0))]},E=t=>e=>[e({type:a.SUBMIT_RESULT}),e({type:a.SUBMIT_FILE_DATA,payload:{submitType:t}})],Q=(t,e,n,o)=>[t(E(n)),t(B(e,o))],tt=(t,e)=>[t({type:a.SUBMIT_RESULT}),t({type:a.SET_BASIC_INDEX,payload:{basicIndex:e}})],et=(t,e)=>{t({type:a.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:e}})},nt=(t=!1)=>(e,n)=>f(e,n,y.Backward,t),at=(t=!1)=>(e,n)=>f(e,n,y.Forward,t),ot=(t,e=!1)=>(n,o)=>{if(t!==o().imgIndex)return f(n,o,y.Jump,e,t)},w=(t,e,n,o)=>g(void 0,null,function*(){var i;const{loadFileList:p,imgList:s,pageSize:l}=e().annotation,u=Math.floor(n/l);S(t,!0);try{const r=yield p(u,l);if(S(t,!1),!((i=r==null?void 0:r.fileList)==null?void 0:i.length)||!(r==null?void 0:r.total))throw new Error("fileList and total are required");const c=o?new Array(r.total):[...s];return c.splice(u*l,l,...r.fileList),t({type:a.UPDATE_IMG_LIST,payload:{imgList:c}}),!0}catch(r){S(t,!1),console.error(r)}}),f=(t,e,n,o=!1,i)=>g(void 0,null,function*(){var p;const s=e().annotation,{fileIndexChanged:l,fileIndex:u,basicIndexChanged:r,basicIndex:c}=F.getNextPageInfo(n,s,i),_=j(n);if(et(t,o),l){if(s.loading||!s.imgList[u]&&!(yield w(t,e,u)))return;(p=s.onPageChange)==null||p.call(s,u);const d=_===T.Backward?H(e().annotation,c):c;return Q(t,u,_,d)}return r?tt(t,c):t(E(_))}),rt=t=>{t(E(T.Save)),t({type:a.SAVE_RESULT})},S=(t,e)=>{t({type:a.SET_LOADING,payload:{loading:e}})},it=(t,e)=>{t({type:a.SET_LOADING,payload:{loading:e}})},st=t=>{t({type:a.INIT_ALL_STATE,payload:{}})},ut=(t,e)=>{t({type:a.SET_PREDICT_RESULT,payload:{result:e}})},pt=(t,e)=>{t({type:a.SET_PREDICT_RESULT_VISIBLE,payload:{visible:e}})},lt=t=>(e,n)=>{const{imgList:o,step:i}=n().annotation;return M(o,i,t)};export{X as BatchUpdateImgListResultByPredictResult,W as BatchUpdateResultByTrackID,Y as BatchUpdateTrackID,rt as ChangeSave,J as CopyBackWordResult,f as DispatcherTurning,lt as GetBoxesByID,st as InitAnnotationState,q as InitTaskData,nt as PageBackward,at as PageForward,ot as PageJump,S as SetAnnotationLoading,it as SetPointCloudLoading,ut as SetPredictResult,pt as SetPredictResultVisible,v as SetTaskConfig,O as SetTaskStepList,$ as ToNextStep,E as ToSubmitFileData,R as UpdateBeforeRotate,x as UpdateCheckMode,L as UpdateGetFileData,D as UpdateGetFileList,z as UpdateInjectFunc,U as UpdateOnPageChange,A as UpdateOnSave,P as UpdateOnStepChange,I as UpdateOnSubmit,m as UpdatePageSize,G as UpdateProcessingStep,V as UpdateRotate,N as UpdateSkipBeforePageTurning,K as UpdateToolInstance,w as loadImgList};
1
+ import{ANNOTATION_ACTIONS as a}from"../Actions.js";import{LoadFileAndFileData as B,getStepConfig as k}from"./reducer.js";import{ESubmitType as T}from"../../constant/index.js";import{EPageTurningOperation as y}from"../../data/enums/AnnotationSize.js";import F from"../../utils/PageOperator.js";import{jsonParser as b}from"../../utils/index.js";import{getBoxesByTrackID as M}from"../../components/predictTracking/previewResult/util.js";var g=(t,e,n)=>new Promise((o,i)=>{var u=p=>{try{l(n.next(p))}catch(r){i(r)}},s=p=>{try{l(n.throw(p))}catch(r){i(r)}},l=p=>p.done?o(p.value):Promise.resolve(p.value).then(u,s);l((n=n.apply(t,e)).next())});const h=(t,e)=>e.map(n=>t(n)),j=t=>t===y.Forward?T.Forward:t===y.Backward?T.Backward:t===y.Jump?T.Jump:T.Forward,H=(t,e)=>{var n,o;const{imgList:i,imgIndex:u}=t,{dataSourceStep:s}=k(t.stepList,t.step);return((o=(n=b(i[u-1].result)[`step_${s}`])==null?void 0:n.result)==null?void 0:o.length)-1||e};function K(t){return{type:a.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function O({stepList:t}){return{type:a.SET_TASK_STEP_LIST,payload:{stepList:t}}}function v({stepList:t,step:e}){return{type:a.SET_TASK_CONFIG,payload:{stepList:t,step:e}}}function I(t){return{type:a.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function A(t){return{type:a.UPDATE_ON_SAVE,payload:{onSave:t}}}function U(t){return{type:a.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function P(t){return{type:a.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function L(t){return{type:a.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function m(t){return{type:a.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function D(t){return{type:a.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function V(){return{type:a.UPDATE_ROTATE}}function N(t){return{type:a.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function R(t){return{type:a.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function J(){return{type:a.COPY_BACKWARD_RESULT}}function Y({id:t,newID:e,rangeIndex:n,imgList:o}){return{type:a.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:e,rangeIndex:n,imgList:o}}}function W(t,e,n){return{type:a.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:e,rangeIndex:n}}}function X(){return{type:a.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const x=t=>({type:a.SET_CHECK_MODE,payload:{checkMode:t}});function q({onSubmit:t,onSave:e,onPageChange:n,onStepChange:o,getFileData:i,pageSize:u,loadFileList:s,step:l,stepList:p,skipBeforePageTurning:r,beforeRotate:c,checkMode:_}){const d=[];return t&&d.push(I(t)),e&&d.push(A(e)),n&&d.push(U(n)),o&&d.push(P(o)),i&&d.push(L(i)),s&&d.push(D(s)),u&&d.push(m(u)),r&&d.push(N(r)),c&&d.push(R(c)),typeof _=="boolean"&&d.push(x(_)),d.push(v({stepList:p,step:l})),d.push({type:a.CALC_STEP_PROGRESS}),d.push({type:a.INIT_TOOL}),C=>h(C,d)}function z({onSubmit:t,onSave:e,onPageChange:n,onStepChange:o,getFileData:i,pageSize:u,loadFileList:s,stepList:l,beforeRotate:p}){const r=[];return t&&r.push(I(t)),e&&r.push(A(e)),n&&r.push(U(n)),o&&r.push(P(o)),i&&r.push(L(i)),s&&r.push(D(s)),u&&r.push(m(u)),p&&r.push(R(p)),r.push(O({stepList:l})),c=>h(c,r)}const Z=(t,e)=>{var n;const o=e==null?void 0:e.findIndex(i=>(i==null?void 0:i.step)===t);return(n=e[o+1])==null?void 0:n.step},$=t=>(e,n)=>{const{annotation:o}=n(),{step:i,stepList:u}=o,s=Z(i,u);return[e(G(s,t))]},G=(t,e)=>(n,o)=>{var i,u;const{annotation:s}=o();(i=s==null?void 0:s.onStepChange)==null||i.call(s,t);const l=(u=s==null?void 0:s.imgIndex)!=null?u:0;return[n({type:a.SUBMIT_RESULT}),n({type:a.SUBMIT_FILE_DATA,payload:{submitType:T.StepChanged}}),n({type:a.SET_STEP,payload:{toStep:t}}),n({type:a.CALC_STEP_PROGRESS}),n(B(e!=null?e:l,0))]},E=t=>e=>[e({type:a.SUBMIT_RESULT}),e({type:a.SUBMIT_FILE_DATA,payload:{submitType:t}})],Q=(t,e,n,o)=>[t(E(n)),t(B(e,o))],tt=(t,e)=>[t({type:a.SUBMIT_RESULT}),t({type:a.SET_BASIC_INDEX,payload:{basicIndex:e}})],et=(t,e)=>{t({type:a.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:e}})},nt=(t=!1)=>(e,n)=>f(e,n,y.Backward,t),at=(t=!1)=>(e,n)=>f(e,n,y.Forward,t),ot=(t,e=!1)=>(n,o)=>{if(t!==o().imgIndex)return f(n,o,y.Jump,e,t)},w=(t,e,n,o)=>g(void 0,null,function*(){var i;const{loadFileList:u,imgList:s,pageSize:l}=e().annotation,p=Math.floor(n/l);S(t,!0);try{const r=yield u(p,l);if(S(t,!1),!((i=r==null?void 0:r.fileList)==null?void 0:i.length)||!(r==null?void 0:r.total))throw new Error("fileList and total are required");const c=o?new Array(r.total):[...s];return c.splice(p*l,l,...r.fileList),t({type:a.UPDATE_IMG_LIST,payload:{imgList:c}}),!0}catch(r){S(t,!1),console.error(r)}}),f=(t,e,n,o=!1,i)=>g(void 0,null,function*(){var u;const s=e().annotation,{fileIndexChanged:l,fileIndex:p,basicIndexChanged:r,basicIndex:c}=F.getNextPageInfo(n,s,i),_=j(n);if(et(t,o),l){if(s.loading||!s.imgList[p]&&!(yield w(t,e,p)))return;(u=s.onPageChange)==null||u.call(s,p);const d=_===T.Backward?H(e().annotation,c):c;return Q(t,p,_,d)}return r?tt(t,c):t(E(_))}),rt=t=>{t(E(T.Save)),t({type:a.SAVE_RESULT})},S=(t,e)=>{t({type:a.SET_LOADING,payload:{loading:e}})},it=(t,e)=>{t({type:a.SET_LOADING,payload:{loading:e}})},st=t=>{t({type:a.INIT_ALL_STATE,payload:{}})},ut=(t,e)=>{t({type:a.SET_PREDICT_RESULT,payload:{result:e}})},pt=(t,e)=>{t({type:a.SET_PREDICT_RESULT_VISIBLE,payload:{visible:e}})},lt=(t,e)=>(n,o)=>{const{imgList:i,step:u}=o().annotation;return M(i,u,t,e)};export{X as BatchUpdateImgListResultByPredictResult,W as BatchUpdateResultByTrackID,Y as BatchUpdateTrackID,rt as ChangeSave,J as CopyBackWordResult,f as DispatcherTurning,lt as GetBoxesByID,st as InitAnnotationState,q as InitTaskData,nt as PageBackward,at as PageForward,ot as PageJump,S as SetAnnotationLoading,it as SetPointCloudLoading,ut as SetPredictResult,pt as SetPredictResultVisible,v as SetTaskConfig,O as SetTaskStepList,$ as ToNextStep,E as ToSubmitFileData,R as UpdateBeforeRotate,x as UpdateCheckMode,L as UpdateGetFileData,D as UpdateGetFileList,z as UpdateInjectFunc,U as UpdateOnPageChange,A as UpdateOnSave,P as UpdateOnStepChange,I as UpdateOnSubmit,m as UpdatePageSize,G as UpdateProcessingStep,V as UpdateRotate,N as UpdateSkipBeforePageTurning,K as UpdateToolInstance,w as loadImgList};
@@ -0,0 +1 @@
1
+ const u=r=>{if(!r)return;const t=r.replace(/[rgba()]/g,"").split(",");if(t){const[e,b,a,n]=t;return{r:Number(e),g:Number(b),b:Number(a),a:Number(n)}}},g=r=>`rgba(${r.r},${r.g},${r.b},${r.a})`;export{u as toRGBAObj,g as toRGBAStr};
@@ -1 +1 @@
1
- import{ViewportProvider as _}from"../../components/customResizeHook/index.js";import{prefix as y}from"../../constant/index.js";import{Spin as E}from"antd";import{Layout as c}from"antd/es";import o from"react";import g from"./annotationOperation/index.js";import x from"./annotationTips/index.js";import h from"./sidebar/index.js";import s from"./toolFooter/index.js";import j from"./toolHeader/index.js";import{getStepConfig as w}from"../../store/annotation/reducer.js";import P from"../../components/videoAnnotate/index.js";import{connect as T}from"react-redux";import u from"../../utils/ToolUtils.js";import N from"../../components/pointCloudView/index.js";import{getClassName as C}from"../../utils/dom.js";import{classnames as O}from"../../utils/index.js";import{LabelBeeContext as S}from"../../store/ctx.js";import V from"../../components/predictTracking/previewResult/index.js";var A=Object.defineProperty,f=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,v=(e,t,n)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))b.call(t,n)&&v(e,n,t[n]);if(f)for(var n of f(t))F.call(t,n)&&v(e,n,t[n]);return e};const{Sider:L,Content:I}=c,d=`${y}-layout`,$=e=>{var t;return o.createElement(o.Fragment,null,e.showTips===!0&&o.createElement(x,{path:e.path,tips:e.tips}),o.createElement(g,m({},e)),o.createElement(s,{style:(t=e.style)==null?void 0:t.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},k=e=>{var t;return o.createElement(o.Fragment,null,o.createElement(N,{drawLayerSlot:e.drawLayerSlot,checkMode:e.checkMode,intelligentFit:e.intelligentFit}),o.createElement(s,{style:(t=e.style)==null?void 0:t.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},M=e=>{var t;const{stepList:n,step:r}=e,a=(t=w(n,r))==null?void 0:t.tool,i=u.isVideoTool(a),l=u.isPointCloudTool(a);return i?o.createElement(P,m({},e)):l?o.createElement(k,m({},e)):o.createElement($,m({},e))},R=e=>{var t,n,r,a,i;const l=(n=(t=e.style)==null?void 0:t.sider)==null?void 0:n.width;return o.createElement(_,null,o.createElement(E,{spinning:e.loading},o.createElement(c,{className:O([d,e.className]),style:(r=e.style)==null?void 0:r.layout},o.createElement("header",{className:`${d}__header`,style:(a=e.style)==null?void 0:a.header},o.createElement(j,{header:e==null?void 0:e.header,headerName:e.headerName,goBack:e.goBack,exportData:e.exportData})),o.createElement(c,{className:C("layout","container")},e==null?void 0:e.leftSider,o.createElement(I,{className:`${d}__content`},o.createElement(M,m({},e))),o.createElement(L,{className:`${d}__side`,width:l!=null?l:240,style:(i=e.style)==null?void 0:i.sider},o.createElement(h,{sider:e==null?void 0:e.sider})),o.createElement(V,null)))))},B=({annotation:e})=>{var t,n,r;const{imgList:a,loading:i}=e,l=(t=a[e.imgIndex])!=null?t:{};return{path:(r=(n=l==null?void 0:l.path)!=null?n:l==null?void 0:l.url)!=null?r:"",loading:i}};var H=T(B,null,null,{context:S})(R);export{H as default};
1
+ import{ViewportProvider as _}from"../../components/customResizeHook/index.js";import{prefix as y}from"../../constant/index.js";import{Spin as E}from"antd";import{Layout as c}from"antd/es";import o from"react";import g from"./annotationOperation/index.js";import x from"./annotationTips/index.js";import h from"./sidebar/index.js";import s from"./toolFooter/index.js";import j from"./toolHeader/index.js";import{getStepConfig as w}from"../../store/annotation/reducer.js";import P from"../../components/videoAnnotate/index.js";import{connect as T}from"react-redux";import u from"../../utils/ToolUtils.js";import C from"../../components/pointCloudView/index.js";import{getClassName as N}from"../../utils/dom.js";import{classnames as O}from"../../utils/index.js";import{LabelBeeContext as S}from"../../store/ctx.js";import b from"../../components/predictTracking/previewResult/index.js";var V=Object.defineProperty,f=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,v=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))A.call(t,n)&&v(e,n,t[n]);if(f)for(var n of f(t))k.call(t,n)&&v(e,n,t[n]);return e};const{Sider:F,Content:L}=c,d=`${y}-layout`,I=e=>{var t;return o.createElement(o.Fragment,null,e.showTips===!0&&o.createElement(x,{path:e.path,tips:e.tips}),o.createElement(g,m({},e)),o.createElement(s,{style:(t=e.style)==null?void 0:t.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},$=e=>{var t;return o.createElement(o.Fragment,null,o.createElement(C,{drawLayerSlot:e.drawLayerSlot,checkMode:e.checkMode,intelligentFit:e.intelligentFit}),o.createElement(s,{style:(t=e.style)==null?void 0:t.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},M=e=>{var t;const{stepList:n,step:r}=e,a=(t=w(n,r))==null?void 0:t.tool,i=u.isVideoTool(a),l=u.isPointCloudTool(a);return i?o.createElement(P,m({},e)):l?o.createElement($,m({},e)):o.createElement(I,m({},e))},R=e=>{var t,n,r,a,i;const l=(n=(t=e.style)==null?void 0:t.sider)==null?void 0:n.width;return o.createElement(_,null,o.createElement(E,{spinning:e.loading},o.createElement(c,{className:O([d,e.className]),style:(r=e.style)==null?void 0:r.layout},o.createElement("header",{className:`${d}__header`,style:(a=e.style)==null?void 0:a.header},o.createElement(j,{header:e==null?void 0:e.header,headerName:e.headerName,goBack:e.goBack,exportData:e.exportData})),o.createElement(c,{className:N("layout","container")},e==null?void 0:e.leftSider,o.createElement(L,{className:`${d}__content`},o.createElement(M,m({},e))),o.createElement(F,{className:`${d}__side`,width:l!=null?l:240,style:(i=e.style)==null?void 0:i.sider},o.createElement(h,{sider:e==null?void 0:e.sider,enableColorPicker:e==null?void 0:e.enableColorPicker})),o.createElement(b,null)))))},B=({annotation:e})=>{var t,n,r;const{imgList:a,loading:i}=e,l=(t=a[e.imgIndex])!=null?t:{};return{path:(r=(n=l==null?void 0:l.path)!=null?n:l==null?void 0:l.url)!=null?r:"",loading:i}};var H=T(B,null,null,{context:S})(R);export{H as default};
@@ -1 +1 @@
1
- import e,{useContext as I,useState as C,useEffect as B}from"react";import{EditFilled as w}from"@ant-design/icons";import{ToolIcons as L}from"../ToolIcons.js";import{cTool as j}from"@labelbee/lb-annotation";import{PointCloudContext as b}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as E,Tag as _,Input as A,Select as T,message as v}from"antd";import F from"../../../../utils/StepUtils.js";import{connect as V}from"react-redux";import{jsonParser as N}from"../../../../utils/index.js";import{useStatus as U}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as h}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as M}from"../../../../store/ctx.js";import z from"./components/batchUpdateModal/index.js";import{PointCloudUtils as W}from"@labelbee/lb-utils";import P from"../../../../components/attributeList/index.js";import{useAttribute as O}from"../../../../components/pointCloudView/hooks/useAttribute.js";const R=({imgList:n,imgIndex:u})=>{const c=I(b),[a,m]=C([]),{t:i}=k();B(()=>{const r=n;let o=new Map;m(W.getAllPointCloudResult({imgList:r,extraBoxList:f,ignoreIndexList:[u]}).filter(l=>!l.trackID||o.get(l.trackID)?!1:(o.set(l.trackID,!0),!0)).sort((l,s)=>{var d,t;const x=(d=l==null?void 0:l.trackID)!=null?d:0,g=(t=s==null?void 0:s.trackID)!=null?t:0;return x-g}).map(l=>{var s;return(s=l==null?void 0:l.trackID)!=null?s:0}))},[c.pointCloudBoxList,n]);const{pointCloudBoxList:f}=c;return e.createElement("div",{style:{padding:24,borderBottom:"1px solid #eee"}},e.createElement("div",{style:{marginBottom:16}},i("AllTrackIDs")),e.createElement("div",null,a.map(r=>e.createElement(_,{color:"#F3F4FF",key:r,style:{color:"#666",marginBottom:8}},r))))},$=()=>{const[n,u]=C(!1),{pointCloudBoxList:c}=I(b),{selectedBox:a,updateSelectedBox:m}=h(),[i,f]=C(""),{t:r}=k(),o=a==null?void 0:a.info.trackID,l=d=>!!c.find(x=>x.trackID===d&&x.id!==(a==null?void 0:a.info.id)),s=(d=!1)=>{const t=parseInt(i,10);if(d&&u(!1),isNaN(t)){v.error(r("PositiveIntegerCheck"));return}if(i.indexOf(".")>-1){v.error(r("NotAllowDecimalPointsInTrackID"));return}if(l(t)){v.error(r("DuplicateTrackIDsExist"));return}if(!(t>0)){v.error(r("PositiveIntegerCheck"));return}m({trackID:t})};return B(()=>{u(!1)},[o]),e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,r("CurrentBoxTrackIDs")),o&&e.createElement(z,{id:o})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n&&o?e.createElement(A,{defaultValue:o,onChange:d=>{f(d.target.value)},disabled:!o,size:"small",onBlur:()=>{s()},onPressEnter:()=>{s(!0)}}):e.createElement("span",null,o),e.createElement(w,{style:{color:"#999",marginLeft:16,cursor:typeof o!="undefined"?"pointer":"not-allowed"},onClick:()=>{o&&u(!n)}})))},q=({attributeList:n,subAttributeList:u,toolInstance:c})=>{const{selectedBox:a}=h(),m=I(b),{t:i}=k(),{defaultAttribute:f}=O(),r={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},o={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},l=t=>{c.setDefaultAttribute(t)},s=(t,x)=>{c.setSubAttribute(t,x)},d=n.map(t=>({label:t.key,value:t.value,color:t==null?void 0:t.color}));return e.createElement("div",null,e.createElement("div",{style:r},i("Attribute")),e.createElement(P,{list:d,forbidDefault:!0,selectedAttribute:f!=null?f:"",attributeChanged:t=>l(t)}),e.createElement(E,{style:{margin:0}}),a&&e.createElement(e.Fragment,null,u.map(t=>{var x,g,y,D,S;return(t==null?void 0:t.subSelected)&&e.createElement("div",{style:{marginTop:12},key:t.value},e.createElement("div",{style:o},i("SubAttribute"),"-",t.key),((x=t.subSelected)==null?void 0:x.length)<5?e.createElement(P,{list:t.subSelected.map(p=>({label:p.key,value:p.value})),selectedAttribute:(y=(g=m.selectedPointCloudBox)==null?void 0:g.subAttribute)==null?void 0:y[t.value],num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:p=>s(t.value,p),style:{marginBottom:12}}):e.createElement(T,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:(S=(D=m.selectedPointCloudBox)==null?void 0:D.subAttribute)==null?void 0:S[t.value],placeholder:i("PleaseSelect"),onChange:p=>s(t.value,p),allowClear:!0},t.subSelected.map(p=>e.createElement(T.Option,{key:p.value,value:p.value},p.key))),e.createElement(E,{style:{margin:0}}))})))},G=({stepInfo:n,toolInstance:u,imgList:c,imgIndex:a})=>{var m,i;const{updatePointCloudPattern:f,pointCloudPattern:r}=U(),o=N(n.config),l=(m=o==null?void 0:o.attributeList)!=null?m:[],s=(o==null?void 0:o.secondaryAttributeConfigurable)===!0?(i=o==null?void 0:o.inputList)!=null?i:[]:[];return e.createElement(e.Fragment,null,e.createElement(L,{toolName:j.EPointCloudName.PointCloud,selectedToolName:r,onChange:d=>f==null?void 0:f(d)}),(o==null?void 0:o.trackConfigurable)===!0&&e.createElement(e.Fragment,null,e.createElement(R,{imgList:c,imgIndex:a}),e.createElement($,null),e.createElement(E,{style:{margin:0}})),e.createElement(q,{toolInstance:u,attributeList:l,subAttributeList:s}))},H=n=>{var u,c,a;const m=F.getCurrentStepInfo((u=n.annotation)==null?void 0:u.step,(c=n.annotation)==null?void 0:c.stepList),i=(a=n.annotation)==null?void 0:a.toolInstance;return{stepInfo:m,toolInstance:i,imgList:n.annotation.imgList,imgIndex:n.annotation.imgIndex}};var J=V(H,null,null,{context:M})(G);export{J as default};
1
+ import t,{useContext as P,useState as D,useEffect as A}from"react";import{EditFilled as $}from"@ant-design/icons";import{ToolIcons as q}from"../ToolIcons.js";import{cTool as G}from"@labelbee/lb-annotation";import{PointCloudContext as w}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as L,Tag as H,Input as K,Select as V,message as k}from"antd";import Q from"../../../../utils/StepUtils.js";import{connect as X}from"react-redux";import{jsonParser as Y}from"../../../../utils/index.js";import{useStatus as Z}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as F}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as B}from"react-i18next";import{LabelBeeContext as tt,useDispatch as et}from"../../../../store/ctx.js";import ot from"./components/batchUpdateModal/index.js";import{PointCloudUtils as nt}from"@labelbee/lb-utils";import N from"../../../../components/attributeList/index.js";import{useAttribute as lt}from"../../../../components/pointCloudView/hooks/useAttribute.js";import{SetTaskStepList as rt}from"../../../../store/annotation/actionCreators.js";var it=Object.defineProperty,at=Object.defineProperties,st=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,ut=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable,M=(e,o,r)=>o in e?it(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,h=(e,o)=>{for(var r in o||(o={}))ut.call(o,r)&&M(e,r,o[r]);if(U)for(var r of U(o))ct.call(o,r)&&M(e,r,o[r]);return e},T=(e,o)=>at(e,st(o));const dt=({imgList:e,imgIndex:o})=>{const r=P(w),[u,m]=D([]),{t:f}=B();A(()=>{const a=e;let n=new Map;m(nt.getAllPointCloudResult({imgList:a,extraBoxList:v,ignoreIndexList:[o]}).filter(s=>!s.trackID||n.get(s.trackID)?!1:(n.set(s.trackID,!0),!0)).sort((s,i)=>{var d,p;const g=(d=s==null?void 0:s.trackID)!=null?d:0,S=(p=i==null?void 0:i.trackID)!=null?p:0;return g-S}).map(s=>{var i;return(i=s==null?void 0:s.trackID)!=null?i:0}))},[r.pointCloudBoxList,e]);const{pointCloudBoxList:v}=r;return t.createElement("div",{style:{padding:24,borderBottom:"1px solid #eee"}},t.createElement("div",{style:{marginBottom:16}},f("AllTrackIDs")),t.createElement("div",null,u.map(a=>t.createElement(H,{color:"#F3F4FF",key:a,style:{color:"#666",marginBottom:8}},a))))},pt=()=>{const[e,o]=D(!1),{pointCloudBoxList:r}=P(w),{selectedBox:u,updateSelectedBox:m}=F(),[f,v]=D(""),{t:a}=B(),n=u==null?void 0:u.info.trackID,s=d=>!!r.find(g=>g.trackID===d&&g.id!==(u==null?void 0:u.info.id)),i=(d=!1)=>{const p=parseInt(f,10);if(d&&o(!1),isNaN(p)){k.error(a("PositiveIntegerCheck"));return}if(f.indexOf(".")>-1){k.error(a("NotAllowDecimalPointsInTrackID"));return}if(s(p)){k.error(a("DuplicateTrackIDsExist"));return}if(!(p>0)){k.error(a("PositiveIntegerCheck"));return}m({trackID:p})};return A(()=>{o(!1)},[n]),t.createElement("div",{style:{padding:24}},t.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},t.createElement("span",null,a("CurrentBoxTrackIDs")),n&&t.createElement(ot,{id:n})),t.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},e&&n?t.createElement(K,{defaultValue:n,onChange:d=>{v(d.target.value)},disabled:!n,size:"small",onBlur:()=>{i()},onPressEnter:()=>{i(!0)}}):t.createElement("span",null,n),t.createElement($,{style:{color:"#999",marginLeft:16,cursor:typeof n!="undefined"?"pointer":"not-allowed"},onClick:()=>{n&&o(!e)}})))},mt=({attributeList:e,subAttributeList:o,toolInstance:r,config:u,stepList:m,stepInfo:f,enableColorPicker:v})=>{const{selectedBox:a}=F(),n=P(w),{t:s}=B(),{defaultAttribute:i}=lt(),d=et(),p={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},g={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},S=(l,b)=>{var C,I,y,E,c;const _=(C=u==null?void 0:u.attributeList)==null?void 0:C.map(x=>x.value===l?T(h({},x),{color:b}):x),O=T(h({},u),{attributeList:_}),R=JSON.stringify(O),J=m==null?void 0:m.map(x=>(x==null?void 0:x.step)===(f==null?void 0:f.step)?T(h({},x),{config:R}):x);(I=n==null?void 0:n.topViewInstance)==null||I.updateAttributeList(_),(y=n==null?void 0:n.sideViewInstance)==null||y.updateAttributeList(_),(E=n==null?void 0:n.backViewInstance)==null||E.updateAttributeList(_),(c=n==null?void 0:n.mainViewInstance)==null||c.setConfig(O),d(rt({stepList:J}))},z=l=>{r.setDefaultAttribute(l)},j=(l,b)=>{r.setSubAttribute(l,b)},W=e.map(l=>({label:l.key,value:l.value,color:l==null?void 0:l.color}));return t.createElement("div",null,t.createElement("div",{style:p},s("Attribute")),t.createElement(N,{list:W,forbidDefault:!0,selectedAttribute:i!=null?i:"",attributeChanged:l=>z(l),updateColorConfig:S,enableColorPicker:v}),t.createElement(L,{style:{margin:0}}),a&&t.createElement(t.Fragment,null,o.map(l=>{var b,C,I,y,E;return(l==null?void 0:l.subSelected)&&t.createElement("div",{style:{marginTop:12},key:l.value},t.createElement("div",{style:g},s("SubAttribute"),"-",l.key),((b=l.subSelected)==null?void 0:b.length)<5?t.createElement(N,{list:l.subSelected.map(c=>({label:c.key,value:c.value})),selectedAttribute:(I=(C=n.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:I[l.value],num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:c=>j(l.value,c),style:{marginBottom:12}}):t.createElement(V,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:(E=(y=n.selectedPointCloudBox)==null?void 0:y.subAttribute)==null?void 0:E[l.value],placeholder:s("PleaseSelect"),onChange:c=>j(l.value,c),allowClear:!0},l.subSelected.map(c=>t.createElement(V.Option,{key:c.value,value:c.value},c.key))),t.createElement(L,{style:{margin:0}}))})))},ft=({stepInfo:e,toolInstance:o,imgList:r,imgIndex:u,stepList:m,enableColorPicker:f})=>{var v,a;const{updatePointCloudPattern:n,pointCloudPattern:s}=Z(),i=Y(e.config),d=(v=i==null?void 0:i.attributeList)!=null?v:[],p=(i==null?void 0:i.secondaryAttributeConfigurable)===!0?(a=i==null?void 0:i.inputList)!=null?a:[]:[];return t.createElement(t.Fragment,null,t.createElement(q,{toolName:G.EPointCloudName.PointCloud,selectedToolName:s,onChange:g=>n==null?void 0:n(g)}),(i==null?void 0:i.trackConfigurable)===!0&&t.createElement(t.Fragment,null,t.createElement(dt,{imgList:r,imgIndex:u}),t.createElement(pt,null),t.createElement(L,{style:{margin:0}})),t.createElement(mt,{toolInstance:o,attributeList:d,subAttributeList:p,config:i,stepList:m,stepInfo:e,enableColorPicker:f}))},vt=e=>{var o,r,u,m;const f=Q.getCurrentStepInfo((o=e.annotation)==null?void 0:o.step,(r=e.annotation)==null?void 0:r.stepList),v=(u=e.annotation)==null?void 0:u.toolInstance,a=(m=e.annotation)==null?void 0:m.stepList;return{stepInfo:f,toolInstance:v,imgList:e.annotation.imgList,imgIndex:e.annotation.imgIndex,stepList:a}};var gt=X(vt,null,null,{context:tt})(ft);export{gt as default};
@@ -1 +1 @@
1
- import{prefix as y}from"../../../constant/index.js";import{EToolName as n}from"../../../data/enums/ToolType.js";import P from"../../../utils/StepUtils.js";import{Collapse as m}from"antd/es";import e from"react";import{useTranslation as h}from"react-i18next";import L from"./AnnotationText/index.js";import O from"./ClearIcon/index.js";import R,{PointCloudOperation as x}from"./GeneralOperation/index.js";import w from"./ImgAttributeInfo/index.js";import z from"./SwitchAttributeList/index.js";import s,{expandIconFuc as N}from"./TagSidebar/index.js";import g from"./TextToolSidebar/index.js";import I from"./PointCloudToolSidebar/index.js";import B from"./ToolStyle/index.js";import{cTool as G}from"@labelbee/lb-annotation";import K from"./ScribbleSidebar/index.js";import{ToolIcons as U}from"./ToolIcons.js";import{useSelector as V}from"../../../store/ctx.js";const{EVideoToolName:k,EPointCloudName:F}=G,{Panel:j}=m,t=`${y}-sidebar`,q=({sider:r})=>{const d=V(l=>P.getCurrentStepInfo(l.annotation.step,l.annotation.stepList)),o=d==null?void 0:d.tool,{t:u}=h();if(!o)return null;const v=l=>{const S=e.createElement(B,null);return e.createElement(j,{header:u("Style"),className:"panel",key:l},S)},p=e.createElement(U,{toolName:o,onChange:()=>{}}),i=e.createElement(z,null),f=e.createElement(L,null),E=e.createElement(m,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:N},v("1")),b=e.createElement(m,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:N},e.createElement(j,{header:e.createElement("div",null,u("Adjust"),e.createElement(O,null)),className:"panel",key:"imgAttribute"},e.createElement(w,null))),a=e.createElement(R,null),C=e.createElement(s,null),$=e.createElement(g,null),T=e.createElement(K,{onChange:(l,S)=>{}}),c=e.createElement("div",{className:`${t}__horizontal`}),_=e.createElement(I,null),A=e.createElement(x,null);return r?typeof r=="function"?e.createElement("div",{className:`${t}`},r({toolIcon:p,attributeList:i,annotationText:f,toolStyle:E,imageAttributeInfo:b,operation:a,tagToolSideBar:C,textToolSideBar:$,horizontal:c,pointCloudToolSidebar:_,pointCloudOperation:A,scribbleSidebar:T})):r:[n.Rect,n.Point,n.Line,n.Rect,n.Polygon,n.Cuboid].includes(o)?e.createElement("div",{className:`${t}`},p,c,i,f,c,e.createElement("div",{className:`${t}__content`},E,b),a):o===n.Tag?e.createElement("div",{className:`${t}`},e.createElement(s,null)):o===k.VideoTagTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},e.createElement(s,null)),a):o===n.Text?e.createElement("div",{className:`${t}`},e.createElement(g,null)):o===F.PointCloud?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},e.createElement(I,null)),e.createElement(x,null)):o===n.ScribbleTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},T,i),a):null};export{q as default,t as sidebarCls};
1
+ import{prefix as P}from"../../../constant/index.js";import{EToolName as n}from"../../../data/enums/ToolType.js";import h from"../../../utils/StepUtils.js";import{Collapse as m}from"antd/es";import e from"react";import{useTranslation as L}from"react-i18next";import O from"./AnnotationText/index.js";import R from"./ClearIcon/index.js";import w,{PointCloudOperation as x}from"./GeneralOperation/index.js";import z from"./ImgAttributeInfo/index.js";import B from"./SwitchAttributeList/index.js";import s,{expandIconFuc as N}from"./TagSidebar/index.js";import g from"./TextToolSidebar/index.js";import I from"./PointCloudToolSidebar/index.js";import G from"./ToolStyle/index.js";import{cTool as K}from"@labelbee/lb-annotation";import U from"./ScribbleSidebar/index.js";import{ToolIcons as V}from"./ToolIcons.js";import{useSelector as k}from"../../../store/ctx.js";const{EVideoToolName:F,EPointCloudName:q}=K,{Panel:j}=m,t=`${P}-sidebar`,D=({sider:r,enableColorPicker:v})=>{const d=k(l=>h.getCurrentStepInfo(l.annotation.step,l.annotation.stepList)),o=d==null?void 0:d.tool,{t:u}=L();if(!o)return null;const C=l=>{const S=e.createElement(G,null);return e.createElement(j,{header:u("Style"),className:"panel",key:l},S)},p=e.createElement(V,{toolName:o,onChange:()=>{}}),i=e.createElement(B,null),f=e.createElement(O,null),E=e.createElement(m,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:N},C("1")),b=e.createElement(m,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:N},e.createElement(j,{header:e.createElement("div",null,u("Adjust"),e.createElement(R,null)),className:"panel",key:"imgAttribute"},e.createElement(z,null))),a=e.createElement(w,null),$=e.createElement(s,null),_=e.createElement(g,null),T=e.createElement(U,{onChange:(l,S)=>{}}),c=e.createElement("div",{className:`${t}__horizontal`}),A=e.createElement(I,{enableColorPicker:v}),y=e.createElement(x,null);return r?typeof r=="function"?e.createElement("div",{className:`${t}`},r({toolIcon:p,attributeList:i,annotationText:f,toolStyle:E,imageAttributeInfo:b,operation:a,tagToolSideBar:$,textToolSideBar:_,horizontal:c,pointCloudToolSidebar:A,pointCloudOperation:y,scribbleSidebar:T})):r:[n.Rect,n.Point,n.Line,n.Rect,n.Polygon,n.Cuboid].includes(o)?e.createElement("div",{className:`${t}`},p,c,i,f,c,e.createElement("div",{className:`${t}__content`},E,b),a):o===n.Tag?e.createElement("div",{className:`${t}`},e.createElement(s,null)):o===F.VideoTagTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},e.createElement(s,null)),a):o===n.Text?e.createElement("div",{className:`${t}`},e.createElement(g,null)):o===q.PointCloud?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},e.createElement(I,null)),e.createElement(x,null)):o===n.ScribbleTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},T,i),a):null};export{D as default,t as sidebarCls};
@@ -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.2",
3
+ "version": "1.10.0-alpha.20",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -18,8 +18,7 @@
18
18
  "commit": "git-cz",
19
19
  "lint": "eslint 'src/**/*.{ts,tsx,js,jsx}' && npm run build:type",
20
20
  "lint:fix": "eslint 'src/**/*.{ts,tsx,js,jsx}' --fix",
21
- "commitmsg": "commitlint -e $GIT_PARAMS",
22
- "prepublishOnly": "npm run build"
21
+ "commitmsg": "commitlint -e $GIT_PARAMS"
23
22
  },
24
23
  "author": "laoluo",
25
24
  "contributors": [
@@ -33,6 +32,9 @@
33
32
  "canvas",
34
33
  "react"
35
34
  ],
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
36
38
  "license": "Apache-2.0",
37
39
  "homepage": "https://github.com/open-mmlab/labelbee/tree/main/packages/lb-components",
38
40
  "bugs": {
@@ -41,8 +43,8 @@
41
43
  },
42
44
  "dependencies": {
43
45
  "@ant-design/icons": "^4.6.2",
44
- "@labelbee/lb-annotation": "^1.14.0-alpha.2",
45
- "@labelbee/lb-utils": "^1.7.0-alpha.2",
46
+ "@labelbee/lb-annotation": "1.14.0-alpha.19",
47
+ "@labelbee/lb-utils": "1.7.0-alpha.9",
46
48
  "ahooks": "^3.4.0",
47
49
  "classnames": "^2.3.0",
48
50
  "lodash": "^4.17.21",
@@ -52,7 +54,8 @@
52
54
  "redux": "^4.0.5",
53
55
  "redux-actions": "^2.6.5",
54
56
  "redux-thunk": "^2.3.0",
55
- "resize-observer-polyfill": "^1.5.1"
57
+ "resize-observer-polyfill": "^1.5.1",
58
+ "react-colorful": "^5.6.1"
56
59
  },
57
60
  "peerDependencies": {
58
61
  "antd": ">=4.15.0",
@@ -96,6 +99,5 @@
96
99
  "commitizen": {
97
100
  "path": "node_modules/cz-conventional-changelog"
98
101
  }
99
- },
100
- "gitHead": "a7db5e1d7448a47848f6a338d1ecd5646ade27ff"
102
+ }
101
103
  }