@labelbee/lb-components 1.24.0-alpha.1 → 1.24.0-alpha.11

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 (54) hide show
  1. package/dist/_virtual/2DViewWorker.js +1 -1
  2. package/dist/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
  3. package/dist/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
  4. package/dist/components/LLMMultiWheelView/index.js +1 -1
  5. package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -1
  6. package/dist/components/attributeList/index.js +1 -1
  7. package/dist/components/audioAnnotate/index.js +1 -1
  8. package/dist/components/audioAnnotate/textInput/index.js +1 -1
  9. package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  10. package/dist/components/audioPlayer/index.js +1 -1
  11. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  12. package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
  13. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  14. package/dist/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
  15. package/dist/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
  16. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  17. package/dist/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -1
  18. package/dist/components/pointCloudView/index.js +1 -1
  19. package/dist/index.css +18 -0
  20. package/dist/store/annotation/actionCreators.js +1 -1
  21. package/dist/store/annotation/reducer.js +1 -1
  22. package/dist/types/components/pointCloudView/hooks/usePointCloudAttribute.d.ts +3 -0
  23. package/dist/types/store/annotation/actionCreators.d.ts +1 -1
  24. package/dist/types/store/annotation/map.d.ts +1 -0
  25. package/dist/types/store/annotation/reducer.d.ts +4 -0
  26. package/dist/types/store/annotation/types.d.ts +3 -2
  27. package/dist/views/MainView/LLMMultiWheelLayout/index.js +1 -1
  28. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  29. package/dist/views/MainView/sidebar/ToolIcons.js +1 -1
  30. package/es/_virtual/2DViewWorker.js +1 -1
  31. package/es/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
  32. package/es/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
  33. package/es/components/LLMMultiWheelView/index.js +1 -1
  34. package/es/components/LLMMultiWheelView/sidebar/index.js +1 -1
  35. package/es/components/attributeList/index.js +1 -1
  36. package/es/components/audioAnnotate/index.js +1 -1
  37. package/es/components/audioAnnotate/textInput/index.js +1 -1
  38. package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  39. package/es/components/audioPlayer/index.js +1 -1
  40. package/es/components/pointCloud2DRectOperationView/index.js +1 -1
  41. package/es/components/pointCloudView/PointCloud3DView.js +1 -1
  42. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  43. package/es/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
  44. package/es/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
  45. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  46. package/es/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -1
  47. package/es/components/pointCloudView/index.js +1 -1
  48. package/es/index.css +18 -0
  49. package/es/store/annotation/actionCreators.js +1 -1
  50. package/es/store/annotation/reducer.js +1 -1
  51. package/es/views/MainView/LLMMultiWheelLayout/index.js +1 -1
  52. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  53. package/es/views/MainView/sidebar/ToolIcons.js +1 -1
  54. package/package.json +2 -2
@@ -1 +1 @@
1
- import{EPointCloudName as st,TagUtils as oo,MathUtils as w,getCuboidFromPointCloudBox as eo}from"@labelbee/lb-annotation";import{EPerspectiveView as X,PointCloudUtils as O,POINT_CLOUD_DEFAULT_STEP as no,DEFAULT_SPHERE_PARAMS as io}from"@labelbee/lb-utils";import{useContext as mt,useCallback as xt}from"react";import{PointCloudContext as ht}from"../PointCloudContext.js";import{useSingleBox as so}from"./useSingleBox.js";import{useSphere as ro}from"./useSphere.js";import{pick as lo}from"lodash";import{useSelector as ao,useDispatch as co}from"../../../store/ctx.js";import uo from"../../../utils/StepUtils.js";import{EPointCloudBoxRenderTrigger as rt}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{jsonParser as lt,generatePointCloudBoxRects as po}from"../../../utils/index.js";import{PreDataProcess as dt,SetAnnotationLoading as Lt,SetLoadPCDFileLoading as vt}from"../../../store/annotation/actionCreators.js";import{useHistory as go}from"./useHistory.js";import{usePolygon as fo}from"./usePolygon.js";import{useLatest as $}from"ahooks";var Co=Object.defineProperty,Po=Object.defineProperties,mo=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,xo=Object.prototype.hasOwnProperty,ho=Object.prototype.propertyIsEnumerable,Bt=(e,n,t)=>n in e?Co(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,L=(e,n)=>{for(var t in n||(n={}))xo.call(n,t)&&Bt(e,t,n[t]);if(yt)for(var t of yt(n))ho.call(n,t)&&Bt(e,t,n[t]);return e},A=(e,n)=>Po(e,mo(n)),bt=(e,n,t)=>new Promise((c,p)=>{var o=d=>{try{u(t.next(d))}catch(x){p(x)}},f=d=>{try{u(t.throw(d))}catch(x){p(x)}},u=d=>d.done?c(d.value):Promise.resolve(d.value).then(o,f);u((t=t.apply(e,n)).next())});const tt=5,ot=90,wt=.01,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},at=(e,n,t,c,p)=>{const{x:o,y:f}=O.transferCanvas2World(e,n),{defaultZ:u}=io,d={center:{x:o,y:f,z:u},id:e.id},x=c?L(L({},c),d):A(L({},d),{attribute:"",valid:!0});return p&&Object.assign(x,p),x},ct=(e,n,t,c,p,o)=>{let f=e.pointList.map(I=>O.transferCanvas2World(I,n)),u=0,d=1,x={};if(t){const I=t.getSensesPointZAxisInPolygon(f,void 0,o);o&&I.fittedCoordinates.length>0&&(f=I.fittedCoordinates),u=(I.maxZ+I.minZ)/2,d=I.maxZ-I.minZ,x={count:I.zCount}}const[P,v,T]=f,V=w.getLineCenterPoint([P,T]),D=w.getLineLength(P,v),U=w.getLineLength(v,T),N=w.getRadiusFromQuadrangle(e.pointList);c&&(u=c.center.z,d=c.depth);const z={center:{x:V.x,y:V.y,z:u},width:o?U+wt:U,height:o?D+wt:D,depth:d,rotation:N,id:e.id},j=L(c?L(L({},c),z):A(L({},z),{attribute:"",valid:!0}),x);p&&Object.assign(j,p);const M=f.map(I=>O.transferWorld2Canvas(I,n));return{boxParams:j,newPointList:M}},It=(e,n,t)=>{const c={x:e.x-n.x,y:e.y-n.y};return A(L({},t),{center:{x:t.center.x-c.x,y:t.center.y,z:t.center.z-c.y}})},Dt=(e,n,t,c)=>{const[p,o,f]=e.pointList,[u,d,x]=n.pointList,P=w.getLineCenterPoint([p,f]),v=w.getLineCenterPoint([u,x]),V={x:{x:P.x-v.x,y:P.y-v.y}.x,y:0,z:P.y-v.y},D=w.getLineLength(p,o),U=w.getLineLength(u,d),N=D-U,z=w.getLineLength(o,f),j=w.getLineLength(d,x),M=z-j,{newBoxParams:I}=c.getNewBoxBySideUpdate(V,M,N,t);return I},Lo=(e,n,t)=>{const c={x:e.x-n.x,y:e.y-n.y};return A(L({},t),{center:{x:t.center.x,y:t.center.y-c.x,z:t.center.z-c.y}})},vo=(e,n,t,c)=>{const[p,o,f]=e.pointList,[u,d,x]=n.pointList,P=w.getLineCenterPoint([p,f]),v=w.getLineCenterPoint([u,x]),V={x:{x:P.x-v.x,y:P.y-v.y}.x,y:0,z:P.y-v.y},D=w.getLineLength(p,o),U=w.getLineLength(u,d),N=D-U,z=w.getLineLength(o,f),j=w.getLineLength(d,x),M=z-j;let{newBoxParams:I}=c.getNewBoxByBackUpdate(V,M,N,t);return I},St=(e,n,t,c,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(c,(o=p==null?void 0:p.radius)!=null?o:ot);const{cameraPositionVector:d}=u.updateOrthoCameraBySphere(e,X.Left);u.setInitCameraPosition(d);const{point2d:x,zoom:P}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(L(L({},n),x),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Rt=(e,n,t,c)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(c,e,{width:tt,depth:tt});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Left);o.setInitCameraPosition(f);const{polygon2d:u,zoom:d}=o.getBoxSidePolygon2DCoordinate(e);o.camera.zoom=d,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},_t=(e,n,t,c,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(c,(o=p==null?void 0:p.radius)!=null?o:ot);const{cameraPositionVector:d}=u.updateOrthoCameraBySphere(e,X.Back);u.setInitCameraPosition(d);const{point2d:x,zoom:P}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(L(L({},n),x),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Vt=(e,n,t,c)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(c,e,{height:tt,depth:tt});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Back);o.setInitCameraPosition(f);const{polygon2d:u,zoom:d}=o.getBoxBackPolygon2DCoordinate(e);o.camera.zoom=d,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},kt=(e,n,t,c)=>{if(!t||!c)return;c.generateSphere(e),c.updateCameraBySphere(e,X.Top),c.render();const{toolInstance:p,pointCloudInstance:o}=t,{point2d:f}=o.getSphereTopPoint2DCoordinate(e),u=[...p.pointList].map(d=>d.id===n.id?A(L(L({},n),f),{valid:e.valid,textAttribute:"",attribute:e.attribute}):d);p.setResult(u),p.setSelectedID(n.id)},ut=(e,n,t,c)=>{var p,o;if(!t||!c)return;c.generateBox(e),c.render();const{pointCloud2dOperation:f,pointCloudInstance:u}=t,{polygon2d:d}=u.getBoxTopPolygon2DCoordinate(e),x=[...f.polygonList],P=x.find(v=>v.id===n.id);P?(P.pointList=d,P.valid=(p=e.valid)!=null?p:!0):x.push({id:n.id,pointList:d,textAttribute:"",isRect:!0,valid:(o=e.valid)!=null?o:!0}),f.setResultAndSelectedID(x,n.id)},yo=e=>{const n=mt(ht),{topViewInstance:t,sideViewInstance:c,backViewInstance:p,mainViewInstance:o,addPointCloudBox:f,addPointCloudSphere:u,setSelectedIDs:d,selectedIDs:x,pointCloudBoxList:P,pointCloudSphereList:v,hideAttributes:T,setHighlight2DDataList:V,cuboidBoxIn2DView:D,imageSizes:U,history:N,linkageImageNameRectMap:z}=n,{addHistory:j,initHistory:M,pushHistoryUnderUpdatePolygon:I}=go(),{selectedPolygon:Ot}=fo(),{getPointCloudSphereByID:At,updatePointCloudSphere:pt,selectedSphere:Y}=ro(),{currentData:H,config:B}=ao(s=>{const{stepList:i,step:a,imgList:r,imgIndex:l}=s.annotation;return{currentData:r[l],config:lt(uo.getCurrentStepInfo(a,i).config)}}),F=co(),Tt=$(D),Ut=$(z),zt=xt((s,i)=>{const a=Ut.current,r=i.id;return s.filter(g=>{if(!g)return!1;const C=a.get(g.imageName);return C===void 0?!0:Boolean(C.get(r))})},[]),et=s=>{const{enableAutoMap2DRect:i=!1}=B;if(!Tt.current||i){const{mappingImgList:a=[]}=H;po({pointCloudBox:s,mappingImgList:a,imageSizes:U},{prepareRectsFn:zt})}},{selectedBox:k,updateSelectedBox:Nt,updateSelectedBoxes:nt,getPointCloudByID:jt}=so({generateRects:et}),gt=k==null?void 0:k.info;if(!t||!c||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:it}=t,Et=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},Mt=({newPoint:s,size:i,zoom:a,trackConfigurable:r})=>{var l;const g={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(g,{trackID:O.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const C=at(s,i,it,void 0,g);d(s.id);const m=u(C);G(y.Top,s,C,a,m,B),j({newSphereParams:C})},Ft=({polygon:s,size:i,imgList:a,trackConfigurable:r,zoom:l,intelligentFit:g})=>{var C,m,b;const S={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(S,{trackID:O.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:v})});const _=t==null?void 0:t.toolInstance,R=L({},s);let{boxParams:h,newPointList:E}=ct(R,i,it,void 0,S,g);h=F(dt({tool:st.PointCloud,dataList:[h],stepConfig:B,action:"viewUpdateBox"}))[0],g&&(E==null?void 0:E.length)&&(R.pointList=E);const Z=T.includes(R.attribute);et(h);const Q=f(h),q=(m=n==null?void 0:n.polygonList)!=null?m:[];h.subAttribute=oo.getDefaultResultByConfig((B==null?void 0:B.secondaryAttributeConfigurable)?(b=B==null?void 0:B.inputList)!=null?b:[]:[]),t==null||t.updatePolygonList(Q!=null?Q:[],q),Z?d([]):(d(h.id),_.selection.setSelectedIDs(R.id),W({omitView:y.Top,polygon:R,boxParams:h,zoom:l,newPointCloudBoxList:Q}),g&&ut(h,R,t,o)),j({newBoxParams:h})},Ht=s=>{const{boxID:i,imageName:a,width:r,height:l,x:g,y:C}=s,m=P.find(h=>h.id===i);if(!(m==null?void 0:m.rects)||!m.rects.find(h=>h.imageName===a))return;const S=m.rects.map(h=>h.imageName===a?A(L({},h),{width:r,height:l,x:g,y:C}):h),_=A(L({},m),{rects:S}),R=P.map(h=>h.id===i?_:h);return t==null||t.updatePolygonList(R!=null?R:[]),R},Wt=s=>{const{boxID:i,imageName:a}=s,r=P.find(m=>m.id===i);if(!(r==null?void 0:r.rects))return;const l=r.rects.filter(m=>m.imageName!==a),g=A(L({},r),{rects:l}),C=P.map(m=>m.id===i?g:m);return t==null||t.updatePolygonList(C!=null?C:[]),C},Zt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:a,newSphereList:r})=>{var l;const g=t==null?void 0:t.toolInstance;if(!(x.length===0||!g)){if(s||(k==null?void 0:k.info)){const C=s!=null?s:k==null?void 0:k.info;(l=g==null?void 0:g.selection)==null||l.setSelectedIDs(x[0]);const m=g.selectedPolygon;if(x.length===1&&C){W({omitView:y.Top,polygon:m,boxParams:C,newPointCloudBoxList:i});return}}if((a||Y)&&x.length===1){const C=a!=null?a:Y;g.setSelectedID(x[0]);const m=g.selectedPoint;C&&G(y.Top,m,C,void 0,r,B)}}},ft=(s,i,a)=>{if(gt){let r,l;switch(a){case y.Back:r=vo;break;case y.Side:r=Dt;break;default:r=Dt;break}if(l=r(s,i,gt,c.pointCloudInstance),o){const{count:S}=o.getSensesPointZAxisInPolygon(eo(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=A(L({},l),{count:S})}const C=F(dt({tool:st.PointCloud,dataList:[l],stepConfig:B,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;l=C;const b=Nt(l);return l=b.find(S=>S.id===l.id),W({omitView:m?void 0:a,polygon:s,boxParams:l,newPointCloudBoxList:b}),b}},Ct=(s,i,a)=>{if(Y){let r,l;switch(a){case y.Back:r=Lo;break;case y.Side:r=It;break;default:r=It;break}l=r(s,i,Y);const g=pt(l);return G(a,s,l,void 0,g,B),g}},Gt=(s,i)=>{Ct(s,i,y.Side)},Jt=(s,i)=>{Ct(s,i,y.Back)},Qt=(s,i)=>{ft(s,i,y.Side)},Xt=(s,i)=>{ft(s,i,y.Back)},Yt=(s,i)=>{const a=At(s.id),r=at(s,i,it,a),l=pt(r);G(y.Top,s,r,void 0,l,B)},qt=(s,i)=>{if(Ot){const r=L({},s[0].newPolygon);r.pointList=r.pointList.map(l=>O.transferCanvas2World(l,i)),I(r);return}let a=s.map(({newPolygon:r})=>{const l=jt(r.id),{boxParams:g}=ct(r,i,t.pointCloudInstance,l);return g});if(a=F(dt({tool:st.PointCloud,dataList:a,stepConfig:B,action:"viewUpdateBox"})),a.length===1){const{newPolygon:r}=s[0],l=nt(a);W({polygon:r,boxParams:a[0],newPointCloudBoxList:l})}else{const r=nt(a);r&&n.syncAllViewPointCloudColor(rt.MultiMove,r)}},Kt=s=>{var i,a,r,l,g;if(k){const C=Number(s.widthDefault),m=Number(s.depthDefault),b=Number(s.heightDefault),S=k==null?void 0:k.info.trackID,R=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(K=>(K==null?void 0:K.trackID)===S),h={width:(r=(a=t==null?void 0:t.toolInstance)==null?void 0:a.basicImgInfo)==null?void 0:r.width,height:(g=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:g.height},E=R.pointList.map(K=>O.transferCanvas2World(K,h)),J=w.getModifiedRectangleCoordinates(E,b,C),Z=J[0],Q=J[2],q=w.getLineCenterPoint([Z,Q]),$t=k.info.center.z-k.info.depth/2,Pt=A(L({},k.info),{center:{x:q.x,y:q.y,z:$t+m/2},width:C,height:b,depth:m,valid:!0}),to=nt([Pt]);W({omitView:y["3D"],polygon:R,boxParams:Pt,newPointCloudBoxList:to})}},G=(s,i,a,r,l,g)=>bt(void 0,null,function*(){const C=H==null?void 0:H.url,m={[y.Side]:()=>{St(a,i,c,C,g)},[y.Back]:()=>{p&&_t(a,i,p,C,g)},[y.Top]:()=>{kt(a,i,t,o)}};Object.keys(m).forEach(b=>{b!==s&&m[b]()}),r&&(o==null||o.updateCameraZoom(r)),Et(a)}),W=(s,i=rt.Default)=>{const{omitView:a,polygon:r,boxParams:l,zoom:g,newPointCloudBoxList:C}=s,m=H==null?void 0:H.url;C&&n.syncAllViewPointCloudColor(i,C);const b={[y.Side]:()=>{Rt(l,r,c,m)},[y.Back]:()=>{p&&Vt(l,r,p,m)},[y.Top]:()=>{ut(l,r,t,o)}};Object.keys(b).forEach(S=>{S!==a&&b[S]()}),g&&(o==null||o.updateCameraZoom(g))};return{topViewAddSphere:Mt,topViewAddBox:Ft,topViewSelectedChanged:Zt,topViewUpdatePoint:Yt,sideViewUpdatePoint:Gt,backViewUpdatePoint:Jt,topViewUpdateBox:qt,sideViewUpdateBox:Qt,backViewUpdateBox:Xt,syncPointCloudViews:W,syncPointCloudPoint:G,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=O.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>bt(void 0,[...s],function*(i=H){var a,r,l,g,C,m,b,S;if(!(i==null?void 0:i.url)||!o)return;V([]),Lt(F,!0),vt(F,!0),(a=e==null?void 0:e.setResourceLoading)==null||a.call(e,!0),yield o.loadPCDFile(i.url,(r=B==null?void 0:B.radius)!=null?r:ot),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let _=[],R=[],h=[],E=[];o.updateTopCamera();const J=(g=(l=lt(i.result))==null?void 0:l.valid)!=null?g:!0;if(n.setPointCloudValid(J),(C=n.sideViewInstance)==null||C.clearAllData(),(m=n.backViewInstance)==null||m.clearAllData(),i.result){if(_=O.getBoxParamsFromResultList(i.result),(_==null?void 0:_.length)>0&&i.isPreResult&&(B==null?void 0:B.lowerLimitPointsNumInBox)>0){_=yield o==null?void 0:o.filterPreResult(i.url,B,_);const Z=lt(i.result);Z[no].result=_,i.result=JSON.stringify(Z),n.setPointCloudResult(_)}h=O.getPolygonListFromResultList(i.result),R=O.getLineListFromResultList(i.result),E=O.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(b=B==null?void 0:B.radius)!=null?b:ot}),o==null||o.generateBoxes(_),o==null||o.generateSpheres(E),yield n.syncAllViewPointCloudColor(rt.Default,_,[])}M({pointCloudBoxList:_,polygonList:h,lineList:R,pointCloudSphereList:E}),Lt(F,!1),vt(F,!1),(S=e==null?void 0:e.setResourceLoading)==null||S.call(e,!1)}),updateViewsByDefaultSize:Kt,generateRects:et,update2DViewRect:Ht,remove2DViewRect:Wt}},Bo=()=>{const{pointCloudBoxList:e,rectList:n,setPointCloudResult:t}=mt(ht),c=$(e),p=$(n);return{syncToPointCloudBoxList:xt(()=>{const f=c.current,u=p.current;if(u.length===0)return null;const d=new Map,x=new Set;if(u.filter(P=>P.extId!==void 0).forEach(P=>{const v=P.extId,T=P.imageName,V=lo(P,["x","y","width","height"]);let D=d.get(v);D||(D=new Map,d.set(v,D)),D.set(T,V),x.add(v)}),d.size){const P=f.map(v=>{var T;const V=v.id;if(x.has(V)){const D=L({},v);return(T=D.rects)==null||T.forEach(U=>{var N;const z=U.imageName;Object.assign(U,(N=d.get(V))==null?void 0:N.get(z))}),D}return v});return t(P),P}return null},[])}};export{_t as syncBackViewByPoint,St as syncSideViewByPoint,kt as syncTopViewByPoint,Vt as synchronizeBackView,Rt as synchronizeSideView,ut as synchronizeTopView,at as topViewPoint2PointCloud,ct as topViewPolygon2PointCloud,yo as usePointCloudViews,Bo as useSyncRectPositionDimensionToPointCloudList};
1
+ import{EPointCloudName as st,TagUtils as oo,MathUtils as w,getCuboidFromPointCloudBox as eo}from"@labelbee/lb-annotation";import{EPerspectiveView as X,PointCloudUtils as O,POINT_CLOUD_DEFAULT_STEP as no,DEFAULT_SPHERE_PARAMS as io}from"@labelbee/lb-utils";import{useContext as mt,useCallback as ht}from"react";import{PointCloudContext as xt}from"../PointCloudContext.js";import{useSingleBox as so}from"./useSingleBox.js";import{useSphere as ro}from"./useSphere.js";import{pick as lo}from"lodash";import{useSelector as ao,useDispatch as co}from"../../../store/ctx.js";import uo from"../../../utils/StepUtils.js";import{EPointCloudBoxRenderTrigger as rt}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{jsonParser as lt,generatePointCloudBoxRects as po}from"../../../utils/index.js";import{PreDataProcess as dt,SetAnnotationLoading as Lt,SetLoadPCDFileLoading as vt}from"../../../store/annotation/actionCreators.js";import{useHistory as go}from"./useHistory.js";import{usePolygon as fo}from"./usePolygon.js";import{useLatest as $}from"ahooks";var Co=Object.defineProperty,Po=Object.defineProperties,mo=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,ho=Object.prototype.hasOwnProperty,xo=Object.prototype.propertyIsEnumerable,Bt=(e,n,t)=>n in e?Co(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,L=(e,n)=>{for(var t in n||(n={}))ho.call(n,t)&&Bt(e,t,n[t]);if(yt)for(var t of yt(n))xo.call(n,t)&&Bt(e,t,n[t]);return e},A=(e,n)=>Po(e,mo(n)),bt=(e,n,t)=>new Promise((d,p)=>{var o=a=>{try{u(t.next(a))}catch(h){p(h)}},f=a=>{try{u(t.throw(a))}catch(h){p(h)}},u=a=>a.done?d(a.value):Promise.resolve(a.value).then(o,f);u((t=t.apply(e,n)).next())});const tt=5,ot=90,wt=.01,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},at=(e,n,t,d,p)=>{const{x:o,y:f}=O.transferCanvas2World(e,n),{defaultZ:u}=io,a={center:{x:o,y:f,z:u},id:e.id},h=d?L(L({},d),a):A(L({},a),{attribute:"",valid:!0});return p&&Object.assign(h,p),h},ct=(e,n,t,d,p,o)=>{let f=e.pointList.map(I=>O.transferCanvas2World(I,n)),u=0,a=1,h={};if(t){const I=t.getSensesPointZAxisInPolygon(f,void 0,o);o&&I.fittedCoordinates.length>0&&(f=I.fittedCoordinates),u=(I.maxZ+I.minZ)/2,a=I.maxZ-I.minZ,h={count:I.zCount}}const[P,v,T]=f,V=w.getLineCenterPoint([P,T]),D=w.getLineLength(P,v),U=w.getLineLength(v,T),N=w.getRadiusFromQuadrangle(e.pointList);d&&(u=d.center.z,a=d.depth);const z={center:{x:V.x,y:V.y,z:u},width:o?U+wt:U,height:o?D+wt:D,depth:a,rotation:N,id:e.id},j=L(d?L(L({},d),z):A(L({},z),{attribute:"",valid:!0}),h);p&&Object.assign(j,p);const M=f.map(I=>O.transferWorld2Canvas(I,n));return{boxParams:j,newPointList:M}},It=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(L({},t),{center:{x:t.center.x-d.x,y:t.center.y,z:t.center.z-d.y}})},Dt=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),v=w.getLineCenterPoint([u,h]),V={x:{x:P.x-v.x,y:P.y-v.y}.x,y:0,z:P.y-v.y},D=w.getLineLength(p,o),U=w.getLineLength(u,a),N=D-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),M=z-j,{newBoxParams:I}=d.getNewBoxBySideUpdate(V,M,N,t);return I},Lo=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(L({},t),{center:{x:t.center.x,y:t.center.y-d.x,z:t.center.z-d.y}})},vo=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),v=w.getLineCenterPoint([u,h]),V={x:{x:P.x-v.x,y:P.y-v.y}.x,y:0,z:P.y-v.y},D=w.getLineLength(p,o),U=w.getLineLength(u,a),N=D-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),M=z-j;let{newBoxParams:I}=d.getNewBoxByBackUpdate(V,M,N,t);return I},St=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:ot);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Left);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(L(L({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Rt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{width:tt,depth:tt});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Left);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxSidePolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},_t=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:ot);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Back);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(L(L({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Vt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{height:tt,depth:tt});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Back);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxBackPolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},kt=(e,n,t,d)=>{if(!t||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,X.Top),d.render();const{toolInstance:p,pointCloudInstance:o}=t,{point2d:f}=o.getSphereTopPoint2DCoordinate(e),u=[...p.pointList].map(a=>a.id===n.id?A(L(L({},n),f),{valid:e.valid,textAttribute:"",attribute:e.attribute}):a);p.setResult(u),p.setSelectedID(n.id)},ut=(e,n,t,d)=>{var p,o;if(!t||!d)return;d.generateBox(e),d.setHighlightColor(e.id),d.render();const{pointCloud2dOperation:f,pointCloudInstance:u}=t,{polygon2d:a}=u.getBoxTopPolygon2DCoordinate(e),h=[...f.polygonList],P=h.find(v=>v.id===n.id);P?(P.pointList=a,P.valid=(p=e.valid)!=null?p:!0):h.push({id:n.id,pointList:a,textAttribute:"",isRect:!0,valid:(o=e.valid)!=null?o:!0}),f.setResultAndSelectedID(h,n.id)},yo=e=>{const n=mt(xt),{topViewInstance:t,sideViewInstance:d,backViewInstance:p,mainViewInstance:o,addPointCloudBox:f,addPointCloudSphere:u,setSelectedIDs:a,selectedIDs:h,pointCloudBoxList:P,pointCloudSphereList:v,hideAttributes:T,setHighlight2DDataList:V,cuboidBoxIn2DView:D,imageSizes:U,history:N,linkageImageNameRectMap:z}=n,{addHistory:j,initHistory:M,pushHistoryUnderUpdatePolygon:I}=go(),{selectedPolygon:Ot}=fo(),{getPointCloudSphereByID:At,updatePointCloudSphere:pt,selectedSphere:Y}=ro(),{currentData:F,config:B}=ao(s=>{const{stepList:i,step:c,imgList:r,imgIndex:l}=s.annotation;return{currentData:r[l],config:lt(uo.getCurrentStepInfo(c,i).config)}}),H=co(),Tt=$(D),Ut=$(z),zt=ht((s,i)=>{const c=Ut.current,r=i.id;return s.filter(g=>{if(!g)return!1;const C=c.get(g.imageName);return C===void 0?!0:Boolean(C.get(r))})},[]),et=s=>{const{enableAutoMap2DRect:i=!1}=B;if(!Tt.current||i){const{mappingImgList:c=[]}=F;po({pointCloudBox:s,mappingImgList:c,imageSizes:U},{prepareRectsFn:zt})}},{selectedBox:k,updateSelectedBox:Nt,updateSelectedBoxes:nt,getPointCloudByID:jt}=so({generateRects:et}),gt=k==null?void 0:k.info;if(!t||!d||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:it}=t,Et=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},Mt=({newPoint:s,size:i,zoom:c,trackConfigurable:r})=>{var l;const g={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(g,{trackID:O.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const C=at(s,i,it,void 0,g);a(s.id);const m=u(C);G(y.Top,s,C,c,m,B),j({newSphereParams:C})},Ht=({polygon:s,size:i,imgList:c,trackConfigurable:r,zoom:l,intelligentFit:g})=>{var C,m,b;const S={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(S,{trackID:O.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:v})});const _=t==null?void 0:t.toolInstance,R=L({},s);let{boxParams:x,newPointList:E}=ct(R,i,it,void 0,S,g);x=H(dt({tool:st.PointCloud,dataList:[x],stepConfig:B,action:"viewUpdateBox"}))[0],g&&(E==null?void 0:E.length)&&(R.pointList=E);const Z=T.includes(R.attribute);et(x);const Q=f(x),q=(m=n==null?void 0:n.polygonList)!=null?m:[];x.subAttribute=oo.getDefaultResultByConfig((B==null?void 0:B.secondaryAttributeConfigurable)?(b=B==null?void 0:B.inputList)!=null?b:[]:[]),t==null||t.updatePolygonList(Q!=null?Q:[],q),Z?a([]):(a(x.id),_.selection.setSelectedIDs(R.id),W({omitView:y.Top,polygon:R,boxParams:x,zoom:l,newPointCloudBoxList:Q}),g&&ut(x,R,t,o)),j({newBoxParams:x})},Ft=s=>{const{boxID:i,imageName:c,width:r,height:l,x:g,y:C}=s,m=P.find(x=>x.id===i);if(!(m==null?void 0:m.rects)||!m.rects.find(x=>x.imageName===c))return;const S=m.rects.map(x=>x.imageName===c?A(L({},x),{width:r,height:l,x:g,y:C}):x),_=A(L({},m),{rects:S}),R=P.map(x=>x.id===i?_:x);return t==null||t.updatePolygonList(R!=null?R:[]),R},Wt=s=>{const{boxID:i,imageName:c}=s,r=P.find(m=>m.id===i);if(!(r==null?void 0:r.rects))return;const l=r.rects.filter(m=>m.imageName!==c),g=A(L({},r),{rects:l}),C=P.map(m=>m.id===i?g:m);return t==null||t.updatePolygonList(C!=null?C:[]),C},Zt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:c,newSphereList:r})=>{var l;const g=t==null?void 0:t.toolInstance;if(!(h.length===0||!g)){if(s||(k==null?void 0:k.info)){const C=s!=null?s:k==null?void 0:k.info;(l=g==null?void 0:g.selection)==null||l.setSelectedIDs(h[0]);const m=g.selectedPolygon;if(h.length===1&&C){W({omitView:y.Top,polygon:m,boxParams:C,newPointCloudBoxList:i});return}}if((c||Y)&&h.length===1){const C=c!=null?c:Y;g.setSelectedID(h[0]);const m=g.selectedPoint;C&&G(y.Top,m,C,void 0,r,B)}}},ft=(s,i,c)=>{if(gt){let r,l;switch(c){case y.Back:r=vo;break;case y.Side:r=Dt;break;default:r=Dt;break}if(l=r(s,i,gt,d.pointCloudInstance),o){const{count:S}=o.getSensesPointZAxisInPolygon(eo(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=A(L({},l),{count:S})}const C=H(dt({tool:st.PointCloud,dataList:[l],stepConfig:B,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;l=C;const b=Nt(l);return l=b.find(S=>S.id===l.id),W({omitView:m?void 0:c,polygon:s,boxParams:l,newPointCloudBoxList:b}),b}},Ct=(s,i,c)=>{if(Y){let r,l;switch(c){case y.Back:r=Lo;break;case y.Side:r=It;break;default:r=It;break}l=r(s,i,Y);const g=pt(l);return G(c,s,l,void 0,g,B),g}},Gt=(s,i)=>{Ct(s,i,y.Side)},Jt=(s,i)=>{Ct(s,i,y.Back)},Qt=(s,i)=>{ft(s,i,y.Side)},Xt=(s,i)=>{ft(s,i,y.Back)},Yt=(s,i)=>{const c=At(s.id),r=at(s,i,it,c),l=pt(r);G(y.Top,s,r,void 0,l,B)},qt=(s,i)=>{if(Ot){const r=L({},s[0].newPolygon);r.pointList=r.pointList.map(l=>O.transferCanvas2World(l,i)),I(r);return}let c=s.map(({newPolygon:r})=>{const l=jt(r.id),{boxParams:g}=ct(r,i,t.pointCloudInstance,l);return g});if(c=H(dt({tool:st.PointCloud,dataList:c,stepConfig:B,action:"viewUpdateBox"})),c.length===1){const{newPolygon:r}=s[0],l=nt(c);W({polygon:r,boxParams:c[0],newPointCloudBoxList:l})}else{const r=nt(c);r&&n.syncAllViewPointCloudColor(rt.MultiMove,r)}},Kt=s=>{var i,c,r,l,g;if(k){const C=Number(s.widthDefault),m=Number(s.depthDefault),b=Number(s.heightDefault),S=k==null?void 0:k.info.trackID,R=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(K=>(K==null?void 0:K.trackID)===S),x={width:(r=(c=t==null?void 0:t.toolInstance)==null?void 0:c.basicImgInfo)==null?void 0:r.width,height:(g=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:g.height},E=R.pointList.map(K=>O.transferCanvas2World(K,x)),J=w.getModifiedRectangleCoordinates(E,b,C),Z=J[0],Q=J[2],q=w.getLineCenterPoint([Z,Q]),$t=k.info.center.z-k.info.depth/2,Pt=A(L({},k.info),{center:{x:q.x,y:q.y,z:$t+m/2},width:C,height:b,depth:m,valid:!0}),to=nt([Pt]);W({omitView:y["3D"],polygon:R,boxParams:Pt,newPointCloudBoxList:to})}},G=(s,i,c,r,l,g)=>bt(void 0,null,function*(){const C=F==null?void 0:F.url,m={[y.Side]:()=>{St(c,i,d,C,g)},[y.Back]:()=>{p&&_t(c,i,p,C,g)},[y.Top]:()=>{kt(c,i,t,o)}};Object.keys(m).forEach(b=>{b!==s&&m[b]()}),r&&(o==null||o.updateCameraZoom(r)),Et(c)}),W=(s,i=rt.Default)=>{const{omitView:c,polygon:r,boxParams:l,zoom:g,newPointCloudBoxList:C}=s,m=F==null?void 0:F.url;C&&n.syncAllViewPointCloudColor(i,C);const b={[y.Side]:()=>{Rt(l,r,d,m)},[y.Back]:()=>{p&&Vt(l,r,p,m)},[y.Top]:()=>{ut(l,r,t,o)}};Object.keys(b).forEach(S=>{S!==c&&b[S]()}),g&&(o==null||o.updateCameraZoom(g))};return{topViewAddSphere:Mt,topViewAddBox:Ht,topViewSelectedChanged:Zt,topViewUpdatePoint:Yt,sideViewUpdatePoint:Gt,backViewUpdatePoint:Jt,topViewUpdateBox:qt,sideViewUpdateBox:Qt,backViewUpdateBox:Xt,syncPointCloudViews:W,syncPointCloudPoint:G,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=O.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>bt(void 0,[...s],function*(i=F){var c,r,l,g,C,m,b,S;if(!(i==null?void 0:i.url)||!o)return;V([]),Lt(H,!0),vt(H,!0),(c=e==null?void 0:e.setResourceLoading)==null||c.call(e,!0),yield o.loadPCDFile(i.url,(r=B==null?void 0:B.radius)!=null?r:ot),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let _=[],R=[],x=[],E=[];o.updateTopCamera();const J=(g=(l=lt(i.result))==null?void 0:l.valid)!=null?g:!0;if(n.setPointCloudValid(J),(C=n.sideViewInstance)==null||C.clearAllData(),(m=n.backViewInstance)==null||m.clearAllData(),i.result){if(_=O.getBoxParamsFromResultList(i.result),(_==null?void 0:_.length)>0&&i.isPreResult&&(B==null?void 0:B.lowerLimitPointsNumInBox)>0){_=yield o==null?void 0:o.filterPreResult(i.url,B,_);const Z=lt(i.result);Z[no].result=_,i.result=JSON.stringify(Z),n.setPointCloudResult(_)}x=O.getPolygonListFromResultList(i.result),R=O.getLineListFromResultList(i.result),E=O.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(b=B==null?void 0:B.radius)!=null?b:ot}),o==null||o.generateBoxes(_),o==null||o.generateSpheres(E),yield n.syncAllViewPointCloudColor(rt.Default,_,[])}M({pointCloudBoxList:_,polygonList:x,lineList:R,pointCloudSphereList:E}),Lt(H,!1),vt(H,!1),(S=e==null?void 0:e.setResourceLoading)==null||S.call(e,!1)}),updateViewsByDefaultSize:Kt,generateRects:et,update2DViewRect:Ft,remove2DViewRect:Wt}},Bo=()=>{const{pointCloudBoxList:e,rectList:n,setPointCloudResult:t}=mt(xt),d=$(e),p=$(n);return{syncToPointCloudBoxList:ht(()=>{const f=d.current,u=p.current;if(u.length===0)return null;const a=new Map,h=new Set;if(u.filter(P=>P.extId!==void 0).forEach(P=>{const v=P.extId,T=P.imageName,V=lo(P,["x","y","width","height"]);let D=a.get(v);D||(D=new Map,a.set(v,D)),D.set(T,V),h.add(v)}),a.size){const P=f.map(v=>{var T;const V=v.id;if(h.has(V)){const D=L({},v);return(T=D.rects)==null||T.forEach(U=>{var N;const z=U.imageName;Object.assign(U,(N=a.get(V))==null?void 0:N.get(z))}),D}return v});return t(P),P}return null},[])}};export{_t as syncBackViewByPoint,St as syncSideViewByPoint,kt as syncTopViewByPoint,Vt as synchronizeBackView,Rt as synchronizeSideView,ut as synchronizeTopView,at as topViewPoint2PointCloud,ct as topViewPolygon2PointCloud,yo as usePointCloudViews,Bo as useSyncRectPositionDimensionToPointCloudList};
@@ -1 +1 @@
1
- import{useContext as w}from"react";import{useDispatch as D}from"../../../store/ctx.js";import{useSingleBox as b}from"./useSingleBox.js";import{PointCloudContext as T}from"../PointCloudContext.js";import{EPointCloudName as R}from"@labelbee/lb-annotation";import{PreDataProcess as H}from"../../../store/annotation/actionCreators.js";import{usePointCloudViews as E}from"./usePointCloudViews.js";import{useSphere as L}from"./useSphere.js";import{useHistory as _}from"./useHistory.js";import{EPointCloudBoxRenderTrigger as f}from"../../../utils/ToolPointCloudBoxRenderHelper.js";const P={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},k=(g,a)=>{const r=w(T),{topViewInstance:d,selectedIDs:i,pointCloudBoxList:l,mainViewInstance:c,selectedID:v}=r,h=D(),{selectedSphere:p}=L(),{syncPointCloudViews:C,syncPointCloudPoint:m,generateRects:V}=E({setResourceLoading:g}),{selectedBox:u,updateSelectedBox:j}=b({generateRects:V}),{pushHistoryWithList:x}=_(),y=({newSelectedSphere:e,newSphereList:o})=>{const n=d==null?void 0:d.toolInstance;if((e||p)&&i.length===1){const t=e!=null?e:p;n.setSelectedID(i[0]);const s=n.selectedPoint;t&&(m==null||m(P.Top,s,t,void 0,o,a))}},I=({trigger:e,newSelectedBox:o})=>{const n=d==null?void 0:d.toolInstance;if(!(i.length===0||!n)&&(o||(u==null?void 0:u.info))){const t=o!=null?o:u==null?void 0:u.info,s=o;if(t){C==null||C({omitView:P.Top,polygon:s,boxParams:t},e);return}}};return{updatePointCloudColor:e=>{if(l.forEach(o=>{var n,t,s;if(o&&i.includes(o.id)){o.attribute=e;const S=h(H({tool:R.PointCloud,dataList:[o],stepConfig:a,action:"viewUpdateBox"}));o.valid=S[0].valid,j(o),(s=(t=(n=r==null?void 0:r.topViewInstance)==null?void 0:n.pointCloud2dOperation)==null?void 0:t.setPolygonValidAndRender)==null||s.call(t,o.id,!0,o.valid),y({})}}),c){const o=i&&i.length>1?f.MulitSelect:f.Single;if(r.syncAllViewPointCloudColor(o,l),i&&i.length===1){const n=l.find(t=>t.id===i[0]);I({trigger:o,newSelectedBox:n})}c.generateBoxes(l)}v||x({pointCloudBoxList:l})}}};export{k as useUpdatePointCloudColor};
1
+ import{useContext as w}from"react";import{useDispatch as D}from"../../../store/ctx.js";import{useSingleBox as b}from"./useSingleBox.js";import{PointCloudContext as T}from"../PointCloudContext.js";import{EPointCloudName as H}from"@labelbee/lb-annotation";import{PreDataProcess as R}from"../../../store/annotation/actionCreators.js";import{usePointCloudViews as E}from"./usePointCloudViews.js";import{useSphere as L}from"./useSphere.js";import{useHistory as _}from"./useHistory.js";import{EPointCloudBoxRenderTrigger as m}from"../../../utils/ToolPointCloudBoxRenderHelper.js";const P={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},k=(g,c)=>{const r=w(T),{topViewInstance:d,selectedIDs:n,pointCloudBoxList:s,mainViewInstance:u,selectedID:v}=r,h=D(),{selectedSphere:p}=L(),{syncPointCloudViews:C,syncPointCloudPoint:f,generateRects:V}=E({setResourceLoading:g}),{selectedBox:a,updateSelectedBox:j}=b({generateRects:V}),{pushHistoryWithList:x}=_(),y=({newSelectedSphere:e,newSphereList:o})=>{const t=d==null?void 0:d.toolInstance;if((e||p)&&n.length===1){const i=e!=null?e:p;t.setSelectedID(n[0]);const l=t.selectedPoint;i&&(f==null||f(P.Top,l,i,void 0,o,c))}},I=({trigger:e,newSelectedBox:o})=>{const t=d==null?void 0:d.toolInstance;if(!(n.length===0||!t)&&(o||(a==null?void 0:a.info))){const i=o!=null?o:a==null?void 0:a.info,l=o;if(i){C==null||C({omitView:P.Top,polygon:l,boxParams:i},e);return}}};return{updatePointCloudColor:e=>{if(s.forEach(o=>{var t,i,l;if(o&&n.includes(o.id)){o.attribute=e;const S=h(R({tool:H.PointCloud,dataList:[o],stepConfig:c,action:"viewUpdateBox"}));o.valid=S[0].valid,j(o),(l=(i=(t=r==null?void 0:r.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null?void 0:i.setPolygonValidAndRender)==null||l.call(i,o.id,!0,o.valid),y({})}}),u){const o=n&&n.length>1?m.MulitSelect:m.Single;r.syncAllViewPointCloudColor(o,s);let t;n&&n.length===1&&(t=s.find(i=>i.id===n[0]),I({trigger:o,newSelectedBox:t})),u.generateBoxes(s),t&&(u.setHighlightColor(t.id),u.render())}v||x({pointCloudBoxList:s})}}};export{k as useUpdatePointCloudColor};
@@ -1 +1 @@
1
- import{getClassName as n}from"../../utils/dom.js";import t,{useContext as y,useState as R,useEffect as C}from"react";import _ from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import M from"./PointCloud2DView.js";import G from"./PointCloudListener.js";import O from"./PointCloudSegmentListener.js";import Z from"./PointCloudSegment.js";import U from"./PointCloudSegmentStatus.js";import W from"./PointCloudSegmentToolbar.js";import $ from"./PointCloudSegment2DView.js";import{connect as q}from"react-redux";import{LabelBeeContext as z,useDispatch as H}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as J,AnnotatedAttributesPanelFixedRight as K}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as Q}from"./PointCloudContext.js";import{PointCloudUtils as X,EPointCloudPattern as Y}from"@labelbee/lb-utils";import{useCustomToolInstance as tt}from"../../hooks/annotation.js";import{jsonParser as et}from"../../utils/index.js";import{a2MapStateToProps as ot}from"../../store/annotation/map.js";import L from"classnames";import nt from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as it}from"../../store/annotation/actionCreators.js";const lt=E=>{const{currentData:s,imgList:S,drawLayerSlot:d,checkMode:i,intelligentFit:w,imgIndex:x,config:b,measureVisible:j,setResourceLoading:v}=E,e=y(Q),{globalPattern:p,setGlobalPattern:V,selectedIDs:P}=e,h=H(),[l,f]=R(!1),D=(P==null?void 0:P.length)>0&&l,A=et(s.result),{toolInstanceRef:r,clearToolInstance:N}=tt({basicInfo:A});if(C(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==p&&(V(o),e.clearAllDetectionInstance(),N())}},[p]),C(()=>{var o;if(it(h,!0),s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:c,segmentation:I,rectList:T}=X.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(c),e.setRectList(T),e.setSegmentation(I)}},[x]),C(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u,c;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(c=e.segmentation)!=null?c:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),S.length===0)return null;if(p===Y.Segmentation)return t.createElement(t.Fragment,null,t.createElement(O,{checkMode:i,toolInstanceRef:r}),t.createElement(W,null),t.createElement("div",{className:n("point-cloud-layout")},t.createElement(Z,{checkMode:i}),t.createElement($,null)),t.createElement(U,{config:b}),d==null?void 0:d({direct:!0}));let g=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(k,{checkMode:i}),t.createElement(F,{checkMode:i}));return l&&(g=t.createElement(nt,{selectAndEnlarge:D,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(G,{checkMode:i,toolInstanceRef:r,setResourceLoading:v}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(J,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(_,null),g),t.createElement("div",{className:L({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(B,{drawLayerSlot:d,checkMode:i,intelligentFit:w,setIsEnlargeTopView:f,onExitZoom:()=>{f(!1)},isEnlargeTopView:l}),t.createElement("div",{className:L({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(M,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i,measureVisible:j})))),t.createElement(K,null))))};var rt=q(ot,null,null,{context:z})(lt);export{rt as default};
1
+ import{getClassName as n}from"../../utils/dom.js";import t,{useContext as y,useState as R,useEffect as C}from"react";import _ from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import M from"./PointCloud2DView.js";import G from"./PointCloudListener.js";import O from"./PointCloudSegmentListener.js";import Z from"./PointCloudSegment.js";import U from"./PointCloudSegmentStatus.js";import W from"./PointCloudSegmentToolbar.js";import $ from"./PointCloudSegment2DView.js";import{connect as q}from"react-redux";import{LabelBeeContext as z,useDispatch as H}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as J,AnnotatedAttributesPanelFixedRight as K}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as Q}from"./PointCloudContext.js";import{PointCloudUtils as X,EPointCloudPattern as Y}from"@labelbee/lb-utils";import{useCustomToolInstance as tt}from"../../hooks/annotation.js";import{jsonParser as et}from"../../utils/index.js";import{a2MapStateToProps as ot}from"../../store/annotation/map.js";import E from"classnames";import nt from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as it}from"../../store/annotation/actionCreators.js";const lt=S=>{const{currentData:s,imgList:w,drawLayerSlot:d,checkMode:i,intelligentFit:x,imgIndex:b,config:j,measureVisible:v,setResourceLoading:P}=S,e=y(Q),{globalPattern:p,setGlobalPattern:V,selectedIDs:f}=e,h=H(),[l,g]=R(!1),D=(f==null?void 0:f.length)>0&&l,A=et(s.result),{toolInstanceRef:r,clearToolInstance:N}=tt({basicInfo:A});if(C(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==p&&(V(o),e.clearAllDetectionInstance(),N())}},[p]),C(()=>{var o;if(it(h,!0),s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:c,segmentation:I,rectList:T}=X.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(c),e.setRectList(T),e.setSegmentation(I)}},[b]),C(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u,c;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(c=e.segmentation)!=null?c:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),w.length===0)return null;if(p===Y.Segmentation)return t.createElement(t.Fragment,null,t.createElement(O,{checkMode:i,toolInstanceRef:r}),t.createElement(W,null),t.createElement("div",{className:n("point-cloud-layout")},t.createElement(Z,{checkMode:i}),t.createElement($,null)),t.createElement(U,{config:j}),d==null?void 0:d({direct:!0}));let L=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(k,{checkMode:i}),t.createElement(F,{checkMode:i}));return l&&(L=t.createElement(nt,{selectAndEnlarge:D,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(G,{checkMode:i,toolInstanceRef:r,setResourceLoading:P}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(J,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(_,{setResourceLoading:P}),L),t.createElement("div",{className:E({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(B,{drawLayerSlot:d,checkMode:i,intelligentFit:x,setIsEnlargeTopView:g,onExitZoom:()=>{g(!1)},isEnlargeTopView:l}),t.createElement("div",{className:E({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(M,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i,measureVisible:v})))),t.createElement(K,null))))};var rt=q(ot,null,null,{context:z})(lt);export{rt as default};
package/es/index.css CHANGED
@@ -1018,6 +1018,16 @@
1018
1018
  .index-module_clearIcon__ZBZqI.index-module_disabled__zqh8C {
1019
1019
  cursor: not-allowed;
1020
1020
  }
1021
+
1022
+ .index-module_textInputBox__C6pdt {
1023
+ flex: 1;
1024
+ overflow: scroll;
1025
+ text-align: center;
1026
+ }
1027
+ .index-module_textInputBox__C6pdt .index-module_textInputChild__SOQT6 {
1028
+ display: inline-block;
1029
+ width: 65%;
1030
+ }
1021
1031
  .index-module_optionMenu__-aO65 {
1022
1032
  display: flex;
1023
1033
  flex-direction: column;
@@ -1537,6 +1547,14 @@
1537
1547
  .bee-sidebar__toolOption + .bee-sidebar__toolOption {
1538
1548
  margin-left: 16px;
1539
1549
  }
1550
+ .bee-sidebar__multiBox {
1551
+ display: flex;
1552
+ align-items: center;
1553
+ margin: 0 5px;
1554
+ }
1555
+ .bee-sidebar__dropdown .ant-dropdown-menu-item:not(.ant-dropdown-menu-item-selected) {
1556
+ color: #999999;
1557
+ }
1540
1558
  .bee-sidebar__singleTool {
1541
1559
  max-width: 20px;
1542
1560
  max-height: 20px;
@@ -1 +1 @@
1
- import{ANNOTATION_ACTIONS as a}from"../Actions.js";import{LoadFileAndFileData as N,getStepConfig as V}from"./reducer.js";import{ESubmitType as E}from"../../constant/index.js";import{EPageTurningOperation as y}from"../../data/enums/AnnotationSize.js";import J from"../../utils/PageOperator.js";import{jsonParser as X}from"../../utils/index.js";import{getBoxesByTrackID as Y}from"../../components/predictTracking/previewResult/util.js";var S=(t,n,e)=>new Promise((o,r)=>{var i=l=>{try{u(e.next(l))}catch(p){r(p)}},s=l=>{try{u(e.throw(l))}catch(p){r(p)}},u=l=>l.done?o(l.value):Promise.resolve(l.value).then(i,s);u((e=e.apply(t,n)).next())});const G=(t,n)=>n.map(e=>t(e)),W=t=>t===y.Forward?E.Forward:t===y.Backward?E.Backward:t===y.Jump?E.Jump:E.Forward,q=(t,n)=>{var e,o,r;const{imgList:i,imgIndex:s}=t,{dataSourceStep:u}=V(t.stepList,t.step);return((r=(o=X((e=i[s-1])==null?void 0:e.result)[`step_${u}`])==null?void 0:o.result)==null?void 0:r.length)-1||n};function z(t){return{type:a.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function w({stepList:t}){return{type:a.SET_TASK_STEP_LIST,payload:{stepList:t}}}function F({stepList:t,step:n}){return{type:a.SET_TASK_CONFIG,payload:{stepList:t,step:n}}}function L(t){return{type:a.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function D(t){return{type:a.UPDATE_ON_SAVE,payload:{onSave:t}}}function m(t){return{type:a.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function R(t){return{type:a.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function g(t){return{type:a.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function h(t){return{type:a.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function B(t){return{type:a.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function Z(){return{type:a.UPDATE_ROTATE}}function k(t){return{type:a.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function C(t){return{type:a.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function v(t){return{type:a.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function $(){return{type:a.COPY_BACKWARD_RESULT}}function b(t){return{type:a.UPDATE_IMG_INDEX_BY_EXTERNAL,payload:{getImgIndexByExternal:t}}}function Q({id:t,newID:n,rangeIndex:e,imgList:o}){return{type:a.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:n,rangeIndex:e,imgList:o}}}function tt(t,n,e){return{type:a.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:n,rangeIndex:e}}}function nt(){return{type:a.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const H=t=>({type:a.SET_CHECK_MODE,payload:{checkMode:t}}),x=t=>({type:a.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function et({onSubmit:t,onSave:n,onPageChange:e,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,step:u,stepList:l,skipBeforePageTurning:p,beforeRotate:_,checkMode:c,highlightAttribute:T,preDataProcess:f,getImgIndexByExternal:I}){const d=[];return t&&d.push(L(t)),n&&d.push(D(n)),e&&d.push(m(e)),o&&d.push(R(o)),r&&d.push(g(r)),s&&d.push(B(s)),i&&d.push(h(i)),p&&d.push(k(p)),_&&d.push(C(_)),f&&d.push(v(f)),typeof c=="boolean"&&d.push(H(c)),I&&d.push(b(I)),d.push(x(T)),d.push(F({stepList:l,step:u})),d.push({type:a.CALC_STEP_PROGRESS}),d.push({type:a.INIT_TOOL}),O=>G(O,d)}function at({onSubmit:t,onSave:n,onPageChange:e,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,stepList:u,beforeRotate:l,highlightAttribute:p,preDataProcess:_}){const c=[];return t&&c.push(L(t)),n&&c.push(D(n)),e&&c.push(m(e)),o&&c.push(R(o)),r&&c.push(g(r)),s&&c.push(B(s)),i&&c.push(h(i)),l&&c.push(C(l)),_&&c.push(v(_)),c.push(x(p)),c.push(w({stepList:u})),T=>G(T,c)}const ot=(t,n)=>{var e;const o=n==null?void 0:n.findIndex(r=>(r==null?void 0:r.step)===t);return(e=n[o+1])==null?void 0:e.step},rt=t=>(n,e)=>{const{annotation:o}=e(),{step:r,stepList:i}=o,s=ot(r,i);return[n(M(s,t))]},M=(t,n)=>(e,o)=>{var r,i;const{annotation:s}=o();(r=s==null?void 0:s.onStepChange)==null||r.call(s,t);const u=(i=s==null?void 0:s.imgIndex)!=null?i:0;return[e({type:a.SUBMIT_RESULT}),e({type:a.SUBMIT_FILE_DATA,payload:{submitType:E.StepChanged}}),e({type:a.SET_STEP,payload:{toStep:t}}),e({type:a.CALC_STEP_PROGRESS}),e(N(n!=null?n:u,0))]},A=t=>n=>[n({type:a.SUBMIT_RESULT}),n({type:a.SUBMIT_FILE_DATA,payload:{submitType:t}})],it=(t,n,e,o)=>S(void 0,null,function*(){t(A(e)),yield t(K(e)),t(N(n,o))}),ut=(t,n)=>[t({type:a.SUBMIT_RESULT}),t({type:a.SET_BASIC_INDEX,payload:{basicIndex:n}})],st=(t,n)=>{t({type:a.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:n}})},lt=(t=!1)=>(n,e)=>P(n,e,y.Backward,t),pt=(t=!1)=>(n,e)=>P(n,e,y.Forward,t),dt=(t,n=!1)=>(e,o)=>{if(t!==o().imgIndex)return P(e,o,y.Jump,n,t)},j=(t,n,e,o)=>S(void 0,null,function*(){var r;const{loadFileList:i,imgList:s,pageSize:u}=n().annotation,l=Math.floor(e/u);U(t,!0);try{const p=yield i(l,u);if(U(t,!1),!((r=p==null?void 0:p.fileList)==null?void 0:r.length)||!(p==null?void 0:p.total))throw new Error("fileList and total are required");const _=o?new Array(p.total):[...s];return _.splice(l*u,u,...p.fileList),t({type:a.UPDATE_IMG_LIST,payload:{imgList:_}}),!0}catch(p){U(t,!1),console.error(p)}}),P=(t,n,e,o=!1,r)=>S(void 0,null,function*(){var i,s;const u=n().annotation,l=W(e);let{fileIndexChanged:p,fileIndex:_,basicIndexChanged:c,basicIndex:T}=J.getNextPageInfo(e,u,r);const f=(i=u==null?void 0:u.getImgIndexByExternal)==null?void 0:i.call(u,u.imgIndex,l);if(f!==void 0&&(p=!0,_=f),st(t,o),p){if(u.loading||!u.imgList[_]&&!(yield j(t,n,_)))return;const I=n();(s=u.onPageChange)==null||s.call(u,_);const d=l===E.Backward?q(I.annotation,T):T;return it(t,_,l,d)}return c?ut(t,T):t(A(l))}),ct=t=>{t(A(E.Save)),t({type:a.SAVE_RESULT})},U=(t,n)=>{t({type:a.SET_LOADING,payload:{loading:n}})},_t=(t,n)=>{t({type:a.SET_LOADPCDFILE_LOADING,payload:{loadPCDFileLoading:n}})},Tt=t=>{t({type:a.INIT_ALL_STATE,payload:{}})},Et=(t,n)=>{t({type:a.SET_PREDICT_RESULT,payload:{result:n}})},yt=(t,n)=>{t({type:a.SET_PREDICT_RESULT_VISIBLE,payload:{visible:n}})},ft=(t,n)=>(e,o)=>{const{imgList:r,step:i}=o().annotation;return Y(r,i,t,n)},It=t=>(n,e)=>{var o,r;const{annotation:i}=e();return(r=(o=i==null?void 0:i.preDataProcess)==null?void 0:o.call(i,t))!=null?r:t.dataList},K=t=>(n,e)=>S(void 0,null,function*(){const{annotation:o}=e(),{onSubmit:r,imgIndex:i,imgList:s}=o;!r||(yield r([s[i]],t,i,s))});export{nt as BatchUpdateImgListResultByPredictResult,tt as BatchUpdateResultByTrackID,Q as BatchUpdateTrackID,ct as ChangeSave,$ as CopyBackWordResult,P as DispatcherTurning,ft as GetBoxesByID,Tt as InitAnnotationState,et as InitTaskData,lt as PageBackward,pt as PageForward,dt as PageJump,It as PreDataProcess,U as SetAnnotationLoading,_t as SetLoadPCDFileLoading,Et as SetPredictResult,yt as SetPredictResultVisible,F as SetTaskConfig,w as SetTaskStepList,K as SubmitHandler,rt as ToNextStep,A as ToSubmitFileData,C as UpdateBeforeRotate,H as UpdateCheckMode,g as UpdateGetFileData,B as UpdateGetFileList,x as UpdateHighlightAttribute,b as UpdateImgIndexByExternal,at as UpdateInjectFunc,m as UpdateOnPageChange,D as UpdateOnSave,R as UpdateOnStepChange,L as UpdateOnSubmit,h as UpdatePageSize,v as UpdatePreDataProcess,M as UpdateProcessingStep,Z as UpdateRotate,k as UpdateSkipBeforePageTurning,z as UpdateToolInstance,j as loadImgList};
1
+ import{ANNOTATION_ACTIONS as a}from"../Actions.js";import{LoadFileAndFileData as N,getStepConfig as V}from"./reducer.js";import{ESubmitType as E}from"../../constant/index.js";import{EPageTurningOperation as y}from"../../data/enums/AnnotationSize.js";import J from"../../utils/PageOperator.js";import{jsonParser as X}from"../../utils/index.js";import{getBoxesByTrackID as Y}from"../../components/predictTracking/previewResult/util.js";var S=(t,n,e)=>new Promise((o,r)=>{var i=l=>{try{u(e.next(l))}catch(p){r(p)}},s=l=>{try{u(e.throw(l))}catch(p){r(p)}},u=l=>l.done?o(l.value):Promise.resolve(l.value).then(i,s);u((e=e.apply(t,n)).next())});const G=(t,n)=>n.map(e=>t(e)),W=t=>t===y.Forward?E.Forward:t===y.Backward?E.Backward:t===y.Jump?E.Jump:E.Forward,q=(t,n)=>{var e,o,r;const{imgList:i,imgIndex:s}=t,{dataSourceStep:u}=V(t.stepList,t.step);return((r=(o=X((e=i[s-1])==null?void 0:e.result)[`step_${u}`])==null?void 0:o.result)==null?void 0:r.length)-1||n};function z(t){return{type:a.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function w({stepList:t}){return{type:a.SET_TASK_STEP_LIST,payload:{stepList:t}}}function F({stepList:t,step:n}){return{type:a.SET_TASK_CONFIG,payload:{stepList:t,step:n}}}function L(t){return{type:a.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function D(t){return{type:a.UPDATE_ON_SAVE,payload:{onSave:t}}}function m(t){return{type:a.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function R(t){return{type:a.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function g(t){return{type:a.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function h(t){return{type:a.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function B(t){return{type:a.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function Z(){return{type:a.UPDATE_ROTATE}}function k(t){return{type:a.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function C(t){return{type:a.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function v(t){return{type:a.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function $(){return{type:a.COPY_BACKWARD_RESULT}}function b(t){return{type:a.UPDATE_IMG_INDEX_BY_EXTERNAL,payload:{getImgIndexByExternal:t}}}function Q({id:t,newID:n,rangeIndex:e,imgList:o}){return{type:a.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:n,rangeIndex:e,imgList:o}}}function tt(t,n,e,o){return{type:a.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:n,rangeIndex:e,imgList:o}}}function nt(){return{type:a.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const H=t=>({type:a.SET_CHECK_MODE,payload:{checkMode:t}}),x=t=>({type:a.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function et({onSubmit:t,onSave:n,onPageChange:e,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,step:u,stepList:l,skipBeforePageTurning:p,beforeRotate:_,checkMode:c,highlightAttribute:T,preDataProcess:f,getImgIndexByExternal:I}){const d=[];return t&&d.push(L(t)),n&&d.push(D(n)),e&&d.push(m(e)),o&&d.push(R(o)),r&&d.push(g(r)),s&&d.push(B(s)),i&&d.push(h(i)),p&&d.push(k(p)),_&&d.push(C(_)),f&&d.push(v(f)),typeof c=="boolean"&&d.push(H(c)),I&&d.push(b(I)),d.push(x(T)),d.push(F({stepList:l,step:u})),d.push({type:a.CALC_STEP_PROGRESS}),d.push({type:a.INIT_TOOL}),O=>G(O,d)}function at({onSubmit:t,onSave:n,onPageChange:e,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,stepList:u,beforeRotate:l,highlightAttribute:p,preDataProcess:_}){const c=[];return t&&c.push(L(t)),n&&c.push(D(n)),e&&c.push(m(e)),o&&c.push(R(o)),r&&c.push(g(r)),s&&c.push(B(s)),i&&c.push(h(i)),l&&c.push(C(l)),_&&c.push(v(_)),c.push(x(p)),c.push(w({stepList:u})),T=>G(T,c)}const ot=(t,n)=>{var e;const o=n==null?void 0:n.findIndex(r=>(r==null?void 0:r.step)===t);return(e=n[o+1])==null?void 0:e.step},rt=t=>(n,e)=>{const{annotation:o}=e(),{step:r,stepList:i}=o,s=ot(r,i);return[n(M(s,t))]},M=(t,n)=>(e,o)=>{var r,i;const{annotation:s}=o();(r=s==null?void 0:s.onStepChange)==null||r.call(s,t);const u=(i=s==null?void 0:s.imgIndex)!=null?i:0;return[e({type:a.SUBMIT_RESULT}),e({type:a.SUBMIT_FILE_DATA,payload:{submitType:E.StepChanged}}),e({type:a.SET_STEP,payload:{toStep:t}}),e({type:a.CALC_STEP_PROGRESS}),e(N(n!=null?n:u,0))]},A=t=>n=>[n({type:a.SUBMIT_RESULT}),n({type:a.SUBMIT_FILE_DATA,payload:{submitType:t}})],it=(t,n,e,o)=>S(void 0,null,function*(){t(A(e)),yield t(K(e)),t(N(n,o))}),ut=(t,n)=>[t({type:a.SUBMIT_RESULT}),t({type:a.SET_BASIC_INDEX,payload:{basicIndex:n}})],st=(t,n)=>{t({type:a.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:n}})},lt=(t=!1)=>(n,e)=>P(n,e,y.Backward,t),pt=(t=!1)=>(n,e)=>P(n,e,y.Forward,t),dt=(t,n=!1)=>(e,o)=>{if(t!==o().imgIndex)return P(e,o,y.Jump,n,t)},j=(t,n,e,o)=>S(void 0,null,function*(){var r;const{loadFileList:i,imgList:s,pageSize:u}=n().annotation,l=Math.floor(e/u);U(t,!0);try{const p=yield i(l,u);if(U(t,!1),!((r=p==null?void 0:p.fileList)==null?void 0:r.length)||!(p==null?void 0:p.total))throw new Error("fileList and total are required");const _=o?new Array(p.total):[...s];return _.splice(l*u,u,...p.fileList),t({type:a.UPDATE_IMG_LIST,payload:{imgList:_}}),!0}catch(p){U(t,!1),console.error(p)}}),P=(t,n,e,o=!1,r)=>S(void 0,null,function*(){var i,s;const u=n().annotation,l=W(e);let{fileIndexChanged:p,fileIndex:_,basicIndexChanged:c,basicIndex:T}=J.getNextPageInfo(e,u,r);const f=(i=u==null?void 0:u.getImgIndexByExternal)==null?void 0:i.call(u,u.imgIndex,l);if(f!==void 0&&(p=!0,_=f),st(t,o),p){if(u.loading||!u.imgList[_]&&!(yield j(t,n,_)))return;const I=n();(s=u.onPageChange)==null||s.call(u,_);const d=l===E.Backward?q(I.annotation,T):T;return it(t,_,l,d)}return c?ut(t,T):t(A(l))}),ct=t=>{t(A(E.Save)),t({type:a.SAVE_RESULT})},U=(t,n)=>{t({type:a.SET_LOADING,payload:{loading:n}})},_t=(t,n)=>{t({type:a.SET_LOADPCDFILE_LOADING,payload:{loadPCDFileLoading:n}})},Tt=t=>{t({type:a.INIT_ALL_STATE,payload:{}})},Et=(t,n)=>{t({type:a.SET_PREDICT_RESULT,payload:{result:n}})},yt=(t,n)=>{t({type:a.SET_PREDICT_RESULT_VISIBLE,payload:{visible:n}})},ft=(t,n)=>(e,o)=>{const{imgList:r,step:i}=o().annotation;return Y(r,i,t,n)},It=t=>(n,e)=>{var o,r;const{annotation:i}=e();return(r=(o=i==null?void 0:i.preDataProcess)==null?void 0:o.call(i,t))!=null?r:t.dataList},K=t=>(n,e)=>S(void 0,null,function*(){const{annotation:o}=e(),{onSubmit:r,imgIndex:i,imgList:s}=o;!r||(yield r([s[i]],t,i,s))});export{nt as BatchUpdateImgListResultByPredictResult,tt as BatchUpdateResultByTrackID,Q as BatchUpdateTrackID,ct as ChangeSave,$ as CopyBackWordResult,P as DispatcherTurning,ft as GetBoxesByID,Tt as InitAnnotationState,et as InitTaskData,lt as PageBackward,pt as PageForward,dt as PageJump,It as PreDataProcess,U as SetAnnotationLoading,_t as SetLoadPCDFileLoading,Et as SetPredictResult,yt as SetPredictResultVisible,F as SetTaskConfig,w as SetTaskStepList,K as SubmitHandler,rt as ToNextStep,A as ToSubmitFileData,C as UpdateBeforeRotate,H as UpdateCheckMode,g as UpdateGetFileData,B as UpdateGetFileList,x as UpdateHighlightAttribute,b as UpdateImgIndexByExternal,at as UpdateInjectFunc,m as UpdateOnPageChange,D as UpdateOnSave,R as UpdateOnStepChange,L as UpdateOnSubmit,h as UpdatePageSize,v as UpdatePreDataProcess,M as UpdateProcessingStep,Z as UpdateRotate,k as UpdateSkipBeforePageTurning,z as UpdateToolInstance,j as loadImgList};
@@ -1 +1 @@
1
- import{getFormatSize as yt}from"../../components/customResizeHook/index.js";import{ESubmitType as W}from"../../constant/index.js";import Rt from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as x}from"../../utils/index.js";import Y from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as Pt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as dt,composeResult as J}from"../../utils/data.js";import h from"../../utils/StepUtils.js";import q from"../../utils/ToolUtils.js";import{MathUtils as pt,CommonToolUtils as Ct,AnnotationEngine as ht,ImgUtils as Ot}from"@labelbee/lb-annotation";import{PointCloudUtils as gt,i18n as M}from"@labelbee/lb-utils";import{Modal as _t}from"antd";import{message as It}from"antd/es";import mt from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as w}from"../../data/enums/ToolType.js";var bt=Object.defineProperty,Nt=Object.defineProperties,Ut=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable,Lt=(t,e,u)=>e in t?bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,o=(t,e)=>{for(var u in e||(e={}))Bt.call(e,u)&&Lt(t,u,e[u]);if(ft)for(var u of ft(e))xt.call(e,u)&&Lt(t,u,e[u]);return t},s=(t,e)=>Nt(t,Ut(e)),Tt=(t,e,u)=>new Promise((S,d)=>{var A=m=>{try{E(u.next(m))}catch(y){d(y)}},T=m=>{try{E(u.throw(m))}catch(y){d(y)}},E=m=>m.done?S(m.value):Promise.resolve(m.value).then(A,T);E((u=u.apply(t,e)).next())});const F=(t,e)=>t.find(u=>u.step===e),Et={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},wt=t=>{const{imgList:e,imgPageSize:u}=t;return Math.ceil(e.length/u)},St=(t,e)=>t.reduce((u,S)=>{if(S){const d=S.result;if(x(d)[`step_${e}`])return u+1}return u},0)/t.length,Ft=(t,e)=>{const{step:u,stepList:S}=t,d=h.getCurrentStepInfo(u,S),A=Pt.jsonParser(d.config);if(q.isVideoTool(d==null?void 0:d.tool)||q.isAudioTool(d==null?void 0:d.tool)||q.isPointCloudTool(d==null?void 0:d.tool)||[w.LLM,w.NLP,w.LLMMultiWheel].includes(d==null?void 0:d.tool))return;const T=document.getElementById("toolContainer");if(!T)throw"Not exist dom named id-toolContainer";const E=yt({width:window.innerWidth,height:window.innerHeight}),m=new ht({container:T,toolName:d.tool,size:E,imgNode:e,config:A,style:JSON.parse(Rt)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},jt=(t,e)=>(u,S)=>Tt(void 0,null,function*(){var d,A;const{stepList:T,step:E}=S().annotation,m=h.currentToolIsVideo(E,T),y=h.currentToolIsPointCloud(E,T),O=[w.LLM,w.LLMMultiWheel].includes((d=h.getCurrentStepInfo(E,T))==null?void 0:d.tool),b=((A=h.getCurrentStepInfo(E,T))==null?void 0:A.tool)===w.NLP,N=h.currentToolIsAudio(E,T);if($(u,!0),yield u(Gt(t)),m){u(Mt(t));return}if(y||O||N||b){u(Vt(t));return}u(kt(t,e))}),Gt=t=>(e,u)=>Tt(void 0,null,function*(){const{getFileData:S,imgList:d}=u().annotation;if(S){const A=yield S(d[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:A,index:t}})}}),Mt=t=>e=>{e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},Vt=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},kt=(t,e)=>(u,S)=>{var d;const{toolInstance:A,imgList:T}=S().annotation,E=(d=T==null?void 0:T[t])==null?void 0:d.url;Ot.load(E).then(m=>{$(u,!1),u({type:i.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(u,!1),A==null||A.setErrorImg(),u({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Ht=({toolInstance:t,imgList:e,imgIndex:u,stepList:S,step:d=1})=>{var A,T,E,m;const y=((A=e[u])==null?void 0:A.result)||"",[O,b,N]=(T=t==null?void 0:t.exportData())!=null?T:[],V=(m=(E=t==null?void 0:t.exportCustomData)==null?void 0:E.call(t))!=null?m:{},k=dt(y,b),H=J(k,{step:d,stepList:S},{rect:O},V);return e.map((j,z)=>z===u?o(s(o({},j),{result:H}),N):o({},j))},zt=(t=o({},Et),e)=>{var u,S,d,A,T,E,m,y,O,b,N,V,k,H,j,z,Z,Q,tt,et,nt,ot,lt,st,it,rt,ut,at;switch(e.type){case i.INIT_ALL_STATE:return o(o({},t),Et);case i.UPDATE_TOOL_INSTANCE:return s(o({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return s(o({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:n,step:l}=t,r=St(n,l);return s(o({},t),{stepProgress:r})}case i.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:l,step:r,stepList:a,toolInstance:p,onSubmit:c,resultList:f}=t;if(!p||!n[l])return t;const I=((u=n[l])==null?void 0:u.result)||"",[,_,g]=(S=p==null?void 0:p.exportData())!=null?S:[],L=(A=(d=p==null?void 0:p.exportCustomData)==null?void 0:d.call(p))!=null?A:{},D=dt(I,_),v=J(D,{step:r,stepList:a},{rect:f},L),P=t.imgList.map((C,R)=>{if(R===l){const G=Y.dataCorrection(v,I,r,a);return o(s(o({},C),{result:G}),g)}return C});if(((T=e.payload)==null?void 0:T.submitType)===W.SyncImgList)return s(o({},t),{imgList:P});const U=St(P,r);return s(o({},t),{stepProgress:U,imgList:P})}case i.SAVE_RESULT:{const{imgList:n,imgIndex:l,onSave:r}=t;return r==null||r(n[l],l,n),o({},t)}case i.SUBMIT_RESULT:{const{imgList:n,basicIndex:l,resultList:r,toolInstance:a,basicResultList:p}=t;if(!a)return t;const[c]=(E=a==null?void 0:a.exportData())!=null?E:[];let f=c;if((p==null?void 0:p.length)>0){const I=(m=p[l])==null?void 0:m.id,_=c.map(g=>s(o({},g),{sourceID:I}));f=mt.cloneDeep(r).filter(g=>g.sourceID!==I),f.push(..._)}return s(o({},t),{resultList:f,imgList:n})}case i.SET_BASIC_INDEX:{const{toolInstance:n,step:l,imgList:r,imgIndex:a,stepList:p,annotationEngine:c,resultList:f,basicResultList:I}=t;if(!n||!c)return t;const _=e.payload.basicIndex,g=(y=I[_])==null?void 0:y.id,L=x((O=r[a])==null?void 0:O.result),D=(f||[]).filter(G=>G.sourceID===g),v=F(p,l),{dataSourceStep:P,tool:U}=v,C=F(p,P);let R=[];return P&&U&&(R=(b=L[`step_${P}`])==null?void 0:b.result,(R==null?void 0:R.length)>0?(c==null||c.setBasicInfo(C.tool,R[_]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),It.info(M.t("NoDependency")))),n==null||n.setResult(D),n==null||n.history.initRecord(D,!0),s(o({},t),{basicIndex:_})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=e.payload;return s(o({},t),{triggerEventAfterIndexChanged:!!n})}case i.LOAD_FILE_DATA:{const{imgList:n,step:l,toolInstance:r,annotationEngine:a,stepList:p}=t;if(!r)return s(o({},t),{imgIndex:e.payload.nextIndex});const c=h.getCurrentStepInfo(l,p),{nextIndex:f,imgNode:I,nextBasicIndex:_,imgError:g}=e.payload,L=_!=null?_:0,D=x((N=n[f])==null?void 0:N.result),v=D[`step_${c.step}`],P=!v,U={rotate:(V=D.rotate)!=null?V:0,valid:(k=D.valid)!=null?k:!0};I&&g!==!0?a==null||a.setImgNode(I,U):r==null||r.setValid(U.valid);const C=F(p,c.step),{dataSourceStep:R,tool:G}=C,ct=F(p,R),X=R&&G,B=(j=(H=D[`step_${R}`])==null?void 0:H.result)!=null?j:[],K=Y.getInitialResultList(v==null?void 0:v.result,r,C,B,P);if(a==null||a.launchOperation(),X&&((B==null?void 0:B.length)>0?a==null||a.setBasicInfo(ct.tool,B[L]):(a==null||a.setBasicInfo(ct.tool),a==null||a.forbidOperation(),It.info(M.t("NoDependency")))),c.tool!=="check"&&X){const At=(Z=(z=B[L])==null?void 0:z.id)!=null?Z:"",Dt=X?K.filter(vt=>Ct.isSameSourceID(vt.sourceID,At)):K;(Q=r==null?void 0:r.history)==null||Q.initRecord(K,!0),r==null||r.setResult(Dt)}return s(o({},t),{imgIndex:f,basicIndex:L,basicResultList:B,resultList:K})}case i.UPDATE_ANNOTATION_CONFIG:return s(o({},t),{config:(tt=e.payload.config)!=null?tt:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:n}=e.payload;return s(o({},t),{stepList:n})}case i.SET_TASK_CONFIG:{const{stepList:n,step:l}=e.payload;return s(o({},t),{stepList:n,step:l})}case i.INIT_TOOL:{const{imgNode:n}=t,l=Ft(t,n);if(l){const{toolInstance:r,annotationEngine:a}=l;return s(o({},t),{toolInstance:r,annotationEngine:a})}return o({},t)}case i.SET_TOOL:{const n=(et=e.payload)==null?void 0:et.instance;return n?s(o({},t),{toolInstance:n}):o({},t)}case i.UPDATE_ON_SUBMIT:return s(o({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return s(o({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return s(o({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return s(o({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return s(o({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return s(o({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return s(o({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return s(o({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return s(o({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return s(o({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return s(o({},t),{preDataProcess:e.payload.preDataProcess});case i.UPDATE_IMG_INDEX_BY_EXTERNAL:return s(o({},t),{getImgIndexByExternal:e.payload.getImgIndexByExternal});case i.SKIP_BEFORE_PAGE_TURNING:return s(o({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:n,index:l}=e.payload,{imgList:r}=t,a=[...r];return a[l]=o(o({},a[l]),n),s(o({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:l}=t;return l&&l()===!1||(nt=n==null?void 0:n.updateRotate)==null||nt.call(n),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=t,l=(ot=n==null?void 0:n.valid)!=null?ot:!0;return _t.destroyAll(),_t.confirm({content:M.t(l?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!l)},okText:M.t("Confirm"),cancelText:M.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:l,imgList:r,step:a,stepList:p}=t;if(!n)return t;if(l===0||l>=r.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const c=r[l-1].result;if(!c)return t;const f=h.getCurrentStepInfo(a,p),I=(lt=f==null?void 0:f.step)!=null?lt:a,_=(st=n==null?void 0:n.valid)!=null?st:!0,g=Y.copyResultChange({copyResult:c,step:I,currentResult:(it=r[l].result)!=null?it:"",preMappingImgList:(rt=r[l-1].mappingImgList)!=null?rt:[],mappingImgList:(ut=r[l].mappingImgList)!=null?ut:[],valid:_});r[l]=s(o({},r[l]),{result:g});const D=x(g)[`step_${a}`],v=(D==null?void 0:D.result)||[];return n==null||n.setResult(v),n==null||n.history.pushHistory(v),(at=n==null?void 0:n.asyncData)==null||at.call(n,r[l]),s(o({},t),{imgList:[...r]})}case i.SET_STEP:{const{stepList:n,annotationEngine:l}=t,{toStep:r}=e.payload;if(l){const a=F(n,r);return l==null||l.setToolName(a.tool,a.config),s(o({},t),{step:r,toolInstance:l==null?void 0:l.toolInstance})}return s(o({},t),{step:r})}case i.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=e.payload;return s(o({},t),{loadPCDFileLoading:!!n})}case i.SET_LOADING:{const{loading:n}=e.payload;return s(o({},t),{loading:!!n})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=e.payload;return s(o({},t),{pointCloudLoading:!!n})}case i.SET_CHECK_MODE:{const{checkMode:n}=e.payload;return s(o({},t),{checkMode:!!n})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=e.payload;return s(o({},t),{highlightAttribute:n})}case i.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:l,rangeIndex:r,imgList:a}=e.payload,{imgIndex:p,onSubmit:c}=t,f=[],I=a.map((_,g)=>{if(pt.isInRange(g,r)){const L=s(o({},_),{result:gt.batchUpdateTrackID({id:n,newID:l,result:_.result})});return f.push({imgIndex:g,newInfo:L}),L}return _});return c&&c([I[p]],W.BatchUpdateTrackID,p,I,{updateImgList:f}),s(o({},t),{imgList:I})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:l,rangeIndex:r}=e.payload,{imgList:a,imgIndex:p,onSubmit:c}=t,f=[],I=a.map((_,g)=>{if(pt.isInRange(g,r)){const L=s(o({},_),{result:gt.batchUpdateResultByTrackID({id:n,newData:l,result:_.result})});return f.push({imgIndex:g,newInfo:L}),L}return _});return c&&c([I[p]],W.BatchUpdateTrackID,p,I,{updateImgList:f}),s(o({},t),{imgList:I})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:l,stepList:r,step:a,predictionResult:p}=t,c={};p.forEach(g=>{const{index:L}=g;c[L]=mt.pick(g,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const f=`step_${a}`,I=[],_=l.map((g,L)=>{if(c[L]){const D=g.result==="{}"?x(J("",{step:a,stepList:r},{rect:[]},{})):x(g.result);D[f].result.push(c[L]);const v=s(o({},g),{result:JSON.stringify(D)});return I.push({imgIndex:L,newInfo:v}),v}return g});return n==null||n(_,W.BatchUpdateImgList,-1,_,{updateImgList:I}),s(o({},t),{imgList:_})}default:return t}};export{jt as LoadFileAndFileData,zt as annotationReducer,Ht as composeResultByToolInstance,F as getStepConfig,wt as getTotalPage};
1
+ import{getFormatSize as yt}from"../../components/customResizeHook/index.js";import{ESubmitType as W}from"../../constant/index.js";import Rt from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as w}from"../../utils/index.js";import Y from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as Pt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as dt,composeResult as J}from"../../utils/data.js";import h from"../../utils/StepUtils.js";import q from"../../utils/ToolUtils.js";import{MathUtils as pt,CommonToolUtils as Ct,AnnotationEngine as ht,ImgUtils as Ot}from"@labelbee/lb-annotation";import{PointCloudUtils as gt,i18n as M}from"@labelbee/lb-utils";import{Modal as _t}from"antd";import{message as It}from"antd/es";import mt from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as x}from"../../data/enums/ToolType.js";var bt=Object.defineProperty,Nt=Object.defineProperties,Ut=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,Lt=(t,e,u)=>e in t?bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,o=(t,e)=>{for(var u in e||(e={}))Bt.call(e,u)&&Lt(t,u,e[u]);if(ft)for(var u of ft(e))wt.call(e,u)&&Lt(t,u,e[u]);return t},s=(t,e)=>Nt(t,Ut(e)),Tt=(t,e,u)=>new Promise((S,d)=>{var A=m=>{try{E(u.next(m))}catch(y){d(y)}},T=m=>{try{E(u.throw(m))}catch(y){d(y)}},E=m=>m.done?S(m.value):Promise.resolve(m.value).then(A,T);E((u=u.apply(t,e)).next())});const F=(t,e)=>t.find(u=>u.step===e),Et={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},xt=t=>{const{imgList:e,imgPageSize:u}=t;return Math.ceil(e.length/u)},St=(t,e)=>t.reduce((u,S)=>{if(S){const d=S.result;if(w(d)[`step_${e}`])return u+1}return u},0)/t.length,Ft=(t,e)=>{const{step:u,stepList:S}=t,d=h.getCurrentStepInfo(u,S),A=Pt.jsonParser(d.config);if(q.isVideoTool(d==null?void 0:d.tool)||q.isAudioTool(d==null?void 0:d.tool)||q.isPointCloudTool(d==null?void 0:d.tool)||[x.LLM,x.NLP,x.LLMMultiWheel].includes(d==null?void 0:d.tool))return;const T=document.getElementById("toolContainer");if(!T)throw"Not exist dom named id-toolContainer";const E=yt({width:window.innerWidth,height:window.innerHeight}),m=new ht({container:T,toolName:d.tool,size:E,imgNode:e,config:A,style:JSON.parse(Rt)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},jt=(t,e)=>(u,S)=>Tt(void 0,null,function*(){var d,A;const{stepList:T,step:E}=S().annotation,m=h.currentToolIsVideo(E,T),y=h.currentToolIsPointCloud(E,T),O=[x.LLM,x.LLMMultiWheel].includes((d=h.getCurrentStepInfo(E,T))==null?void 0:d.tool),b=((A=h.getCurrentStepInfo(E,T))==null?void 0:A.tool)===x.NLP,N=h.currentToolIsAudio(E,T);if($(u,!0),yield u(Gt(t)),m){u(Mt(t));return}if(y||O||N||b){u(Vt(t));return}u(kt(t,e))}),Gt=t=>(e,u)=>Tt(void 0,null,function*(){const{getFileData:S,imgList:d}=u().annotation;if(S){const A=yield S(d[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:A,index:t}})}}),Mt=t=>e=>{e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},Vt=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},kt=(t,e)=>(u,S)=>{var d;const{toolInstance:A,imgList:T}=S().annotation,E=(d=T==null?void 0:T[t])==null?void 0:d.url;Ot.load(E).then(m=>{$(u,!1),u({type:i.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(u,!1),A==null||A.setErrorImg(),u({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Ht=({toolInstance:t,imgList:e,imgIndex:u,stepList:S,step:d=1})=>{var A,T,E,m;const y=((A=e[u])==null?void 0:A.result)||"",[O,b,N]=(T=t==null?void 0:t.exportData())!=null?T:[],V=(m=(E=t==null?void 0:t.exportCustomData)==null?void 0:E.call(t))!=null?m:{},k=dt(y,b),H=J(k,{step:d,stepList:S},{rect:O},V);return e.map((j,z)=>z===u?o(s(o({},j),{result:H}),N):o({},j))},zt=(t=o({},Et),e)=>{var u,S,d,A,T,E,m,y,O,b,N,V,k,H,j,z,Z,Q,tt,et,nt,ot,lt,st,it,rt,ut,at;switch(e.type){case i.INIT_ALL_STATE:return o(o({},t),Et);case i.UPDATE_TOOL_INSTANCE:return s(o({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return s(o({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:n,step:l}=t,r=St(n,l);return s(o({},t),{stepProgress:r})}case i.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:l,step:r,stepList:a,toolInstance:g,onSubmit:c,resultList:f}=t;if(!g||!n[l])return t;const I=((u=n[l])==null?void 0:u.result)||"",[,_,p]=(S=g==null?void 0:g.exportData())!=null?S:[],L=(A=(d=g==null?void 0:g.exportCustomData)==null?void 0:d.call(g))!=null?A:{},D=dt(I,_),v=J(D,{step:r,stepList:a},{rect:f},L),P=t.imgList.map((C,R)=>{if(R===l){const G=Y.dataCorrection(v,I,r,a);return o(s(o({},C),{result:G}),p)}return C});if(((T=e.payload)==null?void 0:T.submitType)===W.SyncImgList)return s(o({},t),{imgList:P});const U=St(P,r);return s(o({},t),{stepProgress:U,imgList:P})}case i.SAVE_RESULT:{const{imgList:n,imgIndex:l,onSave:r}=t;return r==null||r(n[l],l,n),o({},t)}case i.SUBMIT_RESULT:{const{imgList:n,basicIndex:l,resultList:r,toolInstance:a,basicResultList:g}=t;if(!a)return t;const[c]=(E=a==null?void 0:a.exportData())!=null?E:[];let f=c;if((g==null?void 0:g.length)>0){const I=(m=g[l])==null?void 0:m.id,_=c.map(p=>s(o({},p),{sourceID:I}));f=mt.cloneDeep(r).filter(p=>p.sourceID!==I),f.push(..._)}return s(o({},t),{resultList:f,imgList:n})}case i.SET_BASIC_INDEX:{const{toolInstance:n,step:l,imgList:r,imgIndex:a,stepList:g,annotationEngine:c,resultList:f,basicResultList:I}=t;if(!n||!c)return t;const _=e.payload.basicIndex,p=(y=I[_])==null?void 0:y.id,L=w((O=r[a])==null?void 0:O.result),D=(f||[]).filter(G=>G.sourceID===p),v=F(g,l),{dataSourceStep:P,tool:U}=v,C=F(g,P);let R=[];return P&&U&&(R=(b=L[`step_${P}`])==null?void 0:b.result,(R==null?void 0:R.length)>0?(c==null||c.setBasicInfo(C.tool,R[_]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),It.info(M.t("NoDependency")))),n==null||n.setResult(D),n==null||n.history.initRecord(D,!0),s(o({},t),{basicIndex:_})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=e.payload;return s(o({},t),{triggerEventAfterIndexChanged:!!n})}case i.LOAD_FILE_DATA:{const{imgList:n,step:l,toolInstance:r,annotationEngine:a,stepList:g}=t;if(!r)return s(o({},t),{imgIndex:e.payload.nextIndex});const c=h.getCurrentStepInfo(l,g),{nextIndex:f,imgNode:I,nextBasicIndex:_,imgError:p}=e.payload,L=_!=null?_:0,D=w((N=n[f])==null?void 0:N.result),v=D[`step_${c.step}`],P=!v,U={rotate:(V=D.rotate)!=null?V:0,valid:(k=D.valid)!=null?k:!0};I&&p!==!0?a==null||a.setImgNode(I,U):r==null||r.setValid(U.valid);const C=F(g,c.step),{dataSourceStep:R,tool:G}=C,ct=F(g,R),X=R&&G,B=(j=(H=D[`step_${R}`])==null?void 0:H.result)!=null?j:[],K=Y.getInitialResultList(v==null?void 0:v.result,r,C,B,P);if(a==null||a.launchOperation(),X&&((B==null?void 0:B.length)>0?a==null||a.setBasicInfo(ct.tool,B[L]):(a==null||a.setBasicInfo(ct.tool),a==null||a.forbidOperation(),It.info(M.t("NoDependency")))),c.tool!=="check"&&X){const At=(Z=(z=B[L])==null?void 0:z.id)!=null?Z:"",Dt=X?K.filter(vt=>Ct.isSameSourceID(vt.sourceID,At)):K;(Q=r==null?void 0:r.history)==null||Q.initRecord(K,!0),r==null||r.setResult(Dt)}return s(o({},t),{imgIndex:f,basicIndex:L,basicResultList:B,resultList:K})}case i.UPDATE_ANNOTATION_CONFIG:return s(o({},t),{config:(tt=e.payload.config)!=null?tt:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:n}=e.payload;return s(o({},t),{stepList:n})}case i.SET_TASK_CONFIG:{const{stepList:n,step:l}=e.payload;return s(o({},t),{stepList:n,step:l})}case i.INIT_TOOL:{const{imgNode:n}=t,l=Ft(t,n);if(l){const{toolInstance:r,annotationEngine:a}=l;return s(o({},t),{toolInstance:r,annotationEngine:a})}return o({},t)}case i.SET_TOOL:{const n=(et=e.payload)==null?void 0:et.instance;return n?s(o({},t),{toolInstance:n}):o({},t)}case i.UPDATE_ON_SUBMIT:return s(o({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return s(o({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return s(o({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return s(o({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return s(o({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return s(o({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return s(o({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return s(o({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return s(o({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return s(o({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return s(o({},t),{preDataProcess:e.payload.preDataProcess});case i.UPDATE_IMG_INDEX_BY_EXTERNAL:return s(o({},t),{getImgIndexByExternal:e.payload.getImgIndexByExternal});case i.SKIP_BEFORE_PAGE_TURNING:return s(o({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:n,index:l}=e.payload,{imgList:r}=t,a=[...r];return a[l]=o(o({},a[l]),n),s(o({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:l}=t;return l&&l()===!1||(nt=n==null?void 0:n.updateRotate)==null||nt.call(n),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=t,l=(ot=n==null?void 0:n.valid)!=null?ot:!0;return _t.destroyAll(),_t.confirm({content:M.t(l?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!l)},okText:M.t("Confirm"),cancelText:M.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:l,imgList:r,step:a,stepList:g}=t;if(!n)return t;if(l===0||l>=r.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const c=r[l-1].result;if(!c)return t;const f=h.getCurrentStepInfo(a,g),I=(lt=f==null?void 0:f.step)!=null?lt:a,_=(st=n==null?void 0:n.valid)!=null?st:!0,p=Y.copyResultChange({copyResult:c,step:I,currentResult:(it=r[l].result)!=null?it:"",preMappingImgList:(rt=r[l-1].mappingImgList)!=null?rt:[],mappingImgList:(ut=r[l].mappingImgList)!=null?ut:[],valid:_});r[l]=s(o({},r[l]),{result:p});const D=w(p)[`step_${a}`],v=(D==null?void 0:D.result)||[];return n==null||n.setResult(v),n==null||n.history.pushHistory(v),(at=n==null?void 0:n.asyncData)==null||at.call(n,r[l]),s(o({},t),{imgList:[...r]})}case i.SET_STEP:{const{stepList:n,annotationEngine:l}=t,{toStep:r}=e.payload;if(l){const a=F(n,r);return l==null||l.setToolName(a.tool,a.config),s(o({},t),{step:r,toolInstance:l==null?void 0:l.toolInstance})}return s(o({},t),{step:r})}case i.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=e.payload;return s(o({},t),{loadPCDFileLoading:!!n})}case i.SET_LOADING:{const{loading:n}=e.payload;return s(o({},t),{loading:!!n})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=e.payload;return s(o({},t),{pointCloudLoading:!!n})}case i.SET_CHECK_MODE:{const{checkMode:n}=e.payload;return s(o({},t),{checkMode:!!n})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=e.payload;return s(o({},t),{highlightAttribute:n})}case i.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:l,rangeIndex:r,imgList:a}=e.payload,{imgIndex:g,onSubmit:c}=t,f=[],I=a.map((_,p)=>{if(pt.isInRange(p,r)){const L=s(o({},_),{result:gt.batchUpdateTrackID({id:n,newID:l,result:_.result})});return f.push({imgIndex:p,newInfo:L}),L}return _});return c&&c([I[g]],W.BatchUpdateTrackID,g,I,{updateImgList:f}),s(o({},t),{imgList:I})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const n=e,{id:l,newData:r,rangeIndex:a,imgList:g}=n.payload,{imgIndex:c,onSubmit:f}=t,I=[],_=g.map((p,L)=>{if(pt.isInRange(L,a)){const D=s(o({},p),{result:gt.batchUpdateResultByTrackID({id:l,newData:r,result:p.result})});return I.push({imgIndex:L,newInfo:D}),D}return p});return f&&f([_[c]],W.BatchUpdateTrackID,c,_,{updateImgList:I}),s(o({},t),{imgList:_})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:l,stepList:r,step:a,predictionResult:g}=t,c={};g.forEach(p=>{const{index:L}=p;c[L]=mt.pick(p,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const f=`step_${a}`,I=[],_=l.map((p,L)=>{if(c[L]){const D=p.result==="{}"?w(J("",{step:a,stepList:r},{rect:[]},{})):w(p.result);D[f].result.push(c[L]);const v=s(o({},p),{result:JSON.stringify(D)});return I.push({imgIndex:L,newInfo:v}),v}return p});return n==null||n(_,W.BatchUpdateImgList,-1,_,{updateImgList:I}),s(o({},t),{imgList:_})}default:return t}};export{jt as LoadFileAndFileData,zt as annotationReducer,Ht as composeResultByToolInstance,F as getStepConfig,xt as getTotalPage};
@@ -1 +1 @@
1
- import r from"../../../components/LLMMultiWheelView/index.js";import{prefix as l}from"../../../constant/index.js";import{classnames as m}from"../../../utils/index.js";import{getClassName as d}from"../../../utils/dom.js";import{Layout as a}from"antd/es";import t from"react";import s from"../sidebar/index.js";import c from"../toolFooter/index.js";const u=`${l}-LLMMultiWheelView`,{Sider:L,Content:f}=a,n=`${l}-layout`,M=e=>{var o,i;return t.createElement(a,{className:d("layout","container")},e==null?void 0:e.leftSider,t.createElement(f,{className:m({[`${n}__content`]:!0,[`${l}-LLMLayout`]:!0})},t.createElement(r,{showTips:e.showTips,tips:e.tips,drawLayerSlot:e.drawLayerSlot}),t.createElement(c,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer})),t.createElement(L,{className:`${n}__side`,width:600,style:{position:"relative"}},t.createElement(s,{sider:e==null?void 0:e.sider,checkMode:e==null?void 0:e.checkMode}),(i=e.drawLayerSlot)==null?void 0:i.call(e,{})))};export{u as LLMMultiWheelViewCls,M as default};
1
+ import n from"../../../components/LLMMultiWheelView/index.js";import{prefix as l}from"../../../constant/index.js";import{classnames as m}from"../../../utils/index.js";import{getClassName as d}from"../../../utils/dom.js";import{Layout as a}from"antd/es";import{Resizable as s}from"re-resizable";import t from"react";import c from"../sidebar/index.js";import u from"../toolFooter/index.js";const f=`${l}-LLMMultiWheelView`,{Sider:L,Content:h}=a,r=`${l}-layout`,M=e=>{var i,o;return t.createElement(a,{className:d("layout","container")},e==null?void 0:e.leftSider,t.createElement(h,{className:m({[`${r}__content`]:!0,[`${l}-LLMLayout`]:!0})},t.createElement(n,{showTips:e.showTips,tips:e.tips,drawLayerSlot:e.drawLayerSlot}),t.createElement(u,{style:(i=e.style)==null?void 0:i.footer,mode:e.mode,footer:e==null?void 0:e.footer})),t.createElement(s,{defaultSize:{width:600},maxWidth:"95%",enable:{left:!0}},t.createElement(L,{className:`${r}__side`,width:"100%",style:{position:"relative",height:"100%"}},t.createElement(c,{sider:e==null?void 0:e.sider,checkMode:e==null?void 0:e.checkMode}),(o=e.drawLayerSlot)==null?void 0:o.call(e,{}))))};export{f as LLMMultiWheelViewCls,M as default};
@@ -1 +1 @@
1
- import e,{useState as y,useContext as I,useEffect as L}from"react";import{EditFilled as ot}from"@ant-design/icons";import{ToolIcons as nt}from"../ToolIcons.js";import{EToolName as lt}from"../../../../data/enums/ToolType.js";import{cTool as it}from"@labelbee/lb-annotation";import{PointCloudContext as T}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as w,Input as rt,message as D}from"antd";import st from"../../../../utils/StepUtils.js";import{connect as at}from"react-redux";import{jsonParser as ct,classnames as ut}from"../../../../utils/index.js";import{useStatus as R}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as $}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as B}from"react-i18next";import{LabelBeeContext as mt,useDispatch as dt}from"../../../../store/ctx.js";import pt from"./components/batchUpdateModal/index.js";import ft from"./components/annotatedBox/index.js";import vt from"./components/rectRotateSensitivitySlider/index.js";import gt from"./components/findTrackIDIndex/index.js";import St from"./components/firstFrameDataSwitch/index.js";import bt from"./components/selectBoxVisibleSwitch/index.js";import{EPointCloudSegmentStatus as h,EPointCloudPattern as Ct}from"@labelbee/lb-utils";import xt from"../../../../components/attributeList/index.js";import{useAttribute as Et}from"../../../../components/pointCloudView/hooks/useAttribute.js";import Pt from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import yt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import wt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import Dt from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import ht from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as j}from"../index.js";import{SetTaskStepList as jt}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as It}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Lt from"../../../../components/subAttributeList/index.js";import Tt from"../../../../components/DynamicResizer/DynamicResizer.js";var Bt=Object.defineProperty,Vt=Object.defineProperties,kt=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,F=(o,t,n)=>t in o?Bt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,V=(o,t)=>{for(var n in t||(t={}))At.call(t,n)&&F(o,n,t[n]);if(z)for(var n of z(t))Nt.call(t,n)&&F(o,n,t[n]);return o},k=(o,t)=>Vt(o,kt(t));const Ot=()=>{const[o,t]=y(!1),n=I(T),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:l}=$(),[u,m]=y(""),{t:v}=B(),p=c==null?void 0:c.info.trackID,s=d=>!!a.find(b=>b.trackID===d&&b.id!==(c==null?void 0:c.info.id)),r=(d=!1)=>{const f=parseInt(u,10);if(d&&t(!1),isNaN(f)){D.error(v("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){D.error(v("NotAllowDecimalPointsInTrackID"));return}if(s(f)){D.error(v("DuplicateTrackIDsExist"));return}if(!(f>0)){D.error(v("PositiveIntegerCheck"));return}S(f)};L(()=>{t(!1)},[p]);const S=d=>{var f;const b=l({trackID:d});(f=n==null?void 0:n.topViewInstance)==null||f.updatePolygonList(b!=null?b:[]),n.mainViewInstance&&n.selectedPointCloudBox&&(n==null||n.mainViewInstance.generateBox(n==null?void 0:n.selectedPointCloudBox))};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,v("CurrentBoxTrackIDs")),p&&e.createElement(pt,{id:p,updateCurrentPolygonList:d=>S(d)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&p?e.createElement(rt,{defaultValue:p,onChange:d=>{m(d.target.value)},disabled:!p,size:"small",onBlur:()=>{r()},onPressEnter:()=>{r(!0)}}):e.createElement("span",null,p),e.createElement(ot,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{p&&t(!o)}})))},U=({segmentStatus:o,globalPattern:t})=>t===Ct.Segmentation&&![h.Edit,h.Ready].includes(o),H=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:l,enableColorPicker:u})=>{const[m,v]=y({segmentStatus:h.Ready}),{selectedBox:p}=$(),s=I(T),{ptSegmentInstance:r}=s,{t:S}=B(),{defaultAttribute:d}=Et(),f=It(),{isPointCloudSegmentationPattern:b}=R(),W=dt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};L(()=>{if(!!r)return r.on("syncPointCloudStatus",v),()=>{r.unbind("syncPointCloudStatus",v)}},[r]);const K=(i,C)=>{var x,E,P,A,N;const _=(x=a==null?void 0:a.attributeList)==null?void 0:x.map(g=>g.value===i?k(V({},g),{color:C}):g),O=k(V({},a),{attributeList:_}),tt=JSON.stringify(O),et=c==null?void 0:c.map(g=>(g==null?void 0:g.step)===(l==null?void 0:l.step)?k(V({},g),{config:tt}):g);(E=s==null?void 0:s.topViewInstance)==null||E.updateAttributeList(_),(P=s==null?void 0:s.sideViewInstance)==null||P.updateAttributeList(_),(A=s==null?void 0:s.backViewInstance)==null||A.updateAttributeList(_),(N=s==null?void 0:s.mainViewInstance)==null||N.setConfig(O),W(jt({stepList:et}))},X=i=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(i)},Y=i=>{U({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setDefaultAttribute(i)},q=(i,C)=>{U({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(i,C)},G=o.map(i=>({label:i.key,value:i.value,color:i==null?void 0:i.color,limit:i==null?void 0:i.limit,isDefault:i==null?void 0:i.isDefault})),Q=p||m.cacheSegData&&m.segmentStatus===h.Edit,Z=b;return e.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},e.createElement("div",{style:J},S("Attribute")),e.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},e.createElement(xt,{list:G,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:i=>Y(i),updateColorConfig:K,enableColorPicker:u,updateSize:X,forbidShowLimitPopover:Z}),e.createElement(w,{style:{margin:0}}),Q&&e.createElement(Lt,{subAttributeList:t,setSubAttribute:q,getValue:i=>{var C,x,E,P;return((x=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:x[i.value])||((P=(E=m.cacheSegData)==null?void 0:E.subAttribute)==null?void 0:P[i.value])}})))},Rt=[{toolName:"LassoSelector",commonSvg:Pt,selectedSvg:_t},{toolName:"RectSelector",commonSvg:Dt,selectedSvg:ht},{toolName:"CircleSelector",commonSvg:yt,selectedSvg:wt}],M=({toolInstance:o})=>{const{ptSegmentInstance:t}=I(T),[n,a]=y("LassoSelector"),{t:c}=B();return L(()=>{if(!t)return;const l=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},m=()=>{a("CircleSelector")};return t.on("LassoSelector",l),t.on("RectSelector",u),t.on("CircleSelector",m),()=>{t.unbind("LassoSelector",l),t.unbind("RectSelector",u),t.unbind("CircleSelector",m)}},[t]),e.createElement("div",{className:`${j}__level`},Rt.map(l=>{const u=n===l.toolName;return e.createElement("span",{className:`${j}__toolOption`,key:l.toolName,onClick:()=>t==null?void 0:t.emit(l.toolName)},e.createElement("img",{className:`${j}__singleTool`,src:u?l==null?void 0:l.selectedSvg:l==null?void 0:l.commonSvg}),e.createElement("span",{className:ut({[`${j}__toolOption__selected`]:u})},c(l.toolName)))}))},$t=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:l})=>{var u,m;const{updatePointCloudPattern:v,pointCloudPattern:p,isPointCloudSegmentationPattern:s}=R(),r=ct(o.config),S=(u=r==null?void 0:r.attributeList)!=null?u:[],d=(r==null?void 0:r.secondaryAttributeConfigurable)===!0?(m=r==null?void 0:r.inputList)!=null?m:[]:[];return s?e.createElement(e.Fragment,null,e.createElement(M,{toolInstance:t}),e.createElement(H,{toolInstance:t,attributeList:S,subAttributeList:d,config:r,stepList:c,stepInfo:o,enableColorPicker:l})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:it.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>v==null?void 0:v(f)}),e.createElement("div",{style:{flex:1,overflow:"hidden"}},e.createElement(Tt,{minTopHeight:42,defaultHeight:400,localKey:"id:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type)},e.createElement(H,{toolInstance:t,attributeList:S,subAttributeList:d,config:r,stepList:c,stepInfo:o,enableColorPicker:l}),(r==null?void 0:r.trackConfigurable)===!0&&p===lt.Rect?e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement(Ot,null),e.createElement(w,{style:{margin:0}}),e.createElement(ft,{imgList:n,imgIndex:a}),e.createElement(w,{style:{margin:0}}),e.createElement(gt,{imgList:n,imgIndex:a}),e.createElement(w,{style:{margin:0}}),e.createElement(vt,null),o.loadPreStep>0&&e.createElement(St,null),e.createElement(bt,null)):e.createElement("div",null))))},zt=o=>{var t,n,a,c;const l=st.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList),u=(a=o.annotation)==null?void 0:a.toolInstance,m=(c=o.annotation)==null?void 0:c.stepList;return{stepInfo:l,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:m}};var Ft=at(zt,null,null,{context:mt})($t);export{M as PointCloudSegToolIcon,Ft as default};
1
+ import e,{useState as w,useContext as T,useMemo as ot,useEffect as L}from"react";import{EditFilled as nt}from"@ant-design/icons";import{ToolIcons as lt}from"../ToolIcons.js";import{EToolName as it}from"../../../../data/enums/ToolType.js";import{cTool as rt}from"@labelbee/lb-annotation";import{PointCloudContext as B}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as D,Input as st,message as h}from"antd";import at from"../../../../utils/StepUtils.js";import{connect as ct}from"react-redux";import{jsonParser as ut,classnames as mt}from"../../../../utils/index.js";import{useStatus as $}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as z}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as dt,useDispatch as pt}from"../../../../store/ctx.js";import ft from"./components/batchUpdateModal/index.js";import vt from"./components/annotatedBox/index.js";import gt from"./components/rectRotateSensitivitySlider/index.js";import St from"./components/findTrackIDIndex/index.js";import bt from"./components/firstFrameDataSwitch/index.js";import Ct from"./components/selectBoxVisibleSwitch/index.js";import{EPointCloudSegmentStatus as j,EPointCloudPattern as xt}from"@labelbee/lb-utils";import Et from"../../../../components/attributeList/index.js";import{useAttribute as Pt}from"../../../../components/pointCloudView/hooks/useAttribute.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import yt from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import wt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import Dt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import ht from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import jt from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as I}from"../index.js";import{SetTaskStepList as It}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as Tt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Lt from"../../../../components/subAttributeList/index.js";import Bt from"../../../../components/DynamicResizer/DynamicResizer.js";import{isNumber as kt}from"lodash";var Vt=Object.defineProperty,At=Object.defineProperties,Nt=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,Ot=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,U=(o,t,n)=>t in o?Vt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,V=(o,t)=>{for(var n in t||(t={}))Ot.call(t,n)&&U(o,n,t[n]);if(F)for(var n of F(t))Rt.call(t,n)&&U(o,n,t[n]);return o},A=(o,t)=>At(o,Nt(t));const $t=()=>{const[o,t]=w(!1),n=T(B),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:l}=z(),[u,m]=w(""),{t:f}=k(),p=c==null?void 0:c.info.trackID,r=ot(()=>kt(p)&&p>=0,[p]),s=d=>!!a.find(C=>C.trackID===d&&C.id!==(c==null?void 0:c.info.id)),b=(d=!1)=>{const v=parseInt(u,10);if(d&&t(!1),isNaN(v)){h.error(f("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){h.error(f("NotAllowDecimalPointsInTrackID"));return}if(s(v)){h.error(f("DuplicateTrackIDsExist"));return}if(!(v>0)){h.error(f("PositiveIntegerCheck"));return}g(v)};L(()=>{t(!1)},[p]);const g=d=>{var v;const C=l({trackID:d});(v=n==null?void 0:n.topViewInstance)==null||v.updatePolygonList(C!=null?C:[]),n.mainViewInstance&&n.selectedPointCloudBox&&(n==null||n.mainViewInstance.generateBox(n==null?void 0:n.selectedPointCloudBox))};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,f("CurrentBoxTrackIDs")),r&&e.createElement(ft,{id:p,updateCurrentPolygonList:d=>g(d)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&r?e.createElement(st,{defaultValue:p,onChange:d=>{m(d.target.value)},disabled:!r,size:"small",onBlur:()=>{b()},onPressEnter:()=>{b(!0)}}):e.createElement("span",null,p),e.createElement(nt,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{r&&t(!o)}})))},H=({segmentStatus:o,globalPattern:t})=>t===xt.Segmentation&&![j.Edit,j.Ready].includes(o),M=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:l,enableColorPicker:u})=>{const[m,f]=w({segmentStatus:j.Ready}),{selectedBox:p}=z(),r=T(B),{ptSegmentInstance:s}=r,{t:b}=k(),{defaultAttribute:g}=Pt(),d=Tt(),{isPointCloudSegmentationPattern:v}=$(),C=pt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};L(()=>{if(!!s)return s.on("syncPointCloudStatus",f),()=>{s.unbind("syncPointCloudStatus",f)}},[s]);const K=(i,x)=>{var E,P,_,N,O;const y=(E=a==null?void 0:a.attributeList)==null?void 0:E.map(S=>S.value===i?A(V({},S),{color:x}):S),R=A(V({},a),{attributeList:y}),tt=JSON.stringify(R),et=c==null?void 0:c.map(S=>(S==null?void 0:S.step)===(l==null?void 0:l.step)?A(V({},S),{config:tt}):S);(P=r==null?void 0:r.topViewInstance)==null||P.updateAttributeList(y),(_=r==null?void 0:r.sideViewInstance)==null||_.updateAttributeList(y),(N=r==null?void 0:r.backViewInstance)==null||N.updateAttributeList(y),(O=r==null?void 0:r.mainViewInstance)==null||O.setConfig(R),C(It({stepList:et}))},X=i=>{d.updateViewsByDefaultSize&&d.updateViewsByDefaultSize(i)},Y=i=>{H({globalPattern:r.globalPattern,segmentStatus:m.segmentStatus})||n.setDefaultAttribute(i)},q=(i,x)=>{H({globalPattern:r.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(i,x)},G=o.map(i=>({label:i.key,value:i.value,color:i==null?void 0:i.color,limit:i==null?void 0:i.limit,isDefault:i==null?void 0:i.isDefault})),Q=p||m.cacheSegData&&m.segmentStatus===j.Edit,Z=v;return e.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},e.createElement("div",{style:J},b("Attribute")),e.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},e.createElement(Et,{list:G,forbidDefault:!0,selectedAttribute:g!=null?g:"",attributeChanged:i=>Y(i),updateColorConfig:K,enableColorPicker:u,updateSize:X,forbidShowLimitPopover:Z}),e.createElement(D,{style:{margin:0}}),Q&&e.createElement(Lt,{subAttributeList:t,setSubAttribute:q,getValue:i=>{var x,E,P,_;return((E=(x=r.selectedPointCloudBox)==null?void 0:x.subAttribute)==null?void 0:E[i.value])||((_=(P=m.cacheSegData)==null?void 0:P.subAttribute)==null?void 0:_[i.value])}})))},zt=[{toolName:"LassoSelector",commonSvg:_t,selectedSvg:yt},{toolName:"RectSelector",commonSvg:ht,selectedSvg:jt},{toolName:"CircleSelector",commonSvg:wt,selectedSvg:Dt}],W=({toolInstance:o})=>{const{ptSegmentInstance:t}=T(B),[n,a]=w("LassoSelector"),{t:c}=k();return L(()=>{if(!t)return;const l=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},m=()=>{a("CircleSelector")};return t.on("LassoSelector",l),t.on("RectSelector",u),t.on("CircleSelector",m),()=>{t.unbind("LassoSelector",l),t.unbind("RectSelector",u),t.unbind("CircleSelector",m)}},[t]),e.createElement("div",{className:`${I}__level`},zt.map(l=>{const u=n===l.toolName;return e.createElement("span",{className:`${I}__toolOption`,key:l.toolName,onClick:()=>t==null?void 0:t.emit(l.toolName)},e.createElement("img",{className:`${I}__singleTool`,src:u?l==null?void 0:l.selectedSvg:l==null?void 0:l.commonSvg}),e.createElement("span",{className:mt({[`${I}__toolOption__selected`]:u})},c(l.toolName)))}))},Ft=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:l})=>{var u,m;const{updatePointCloudPattern:f,pointCloudPattern:p,isPointCloudSegmentationPattern:r}=$(),s=ut(o.config),b=(u=s==null?void 0:s.attributeList)!=null?u:[],g=(s==null?void 0:s.secondaryAttributeConfigurable)===!0?(m=s==null?void 0:s.inputList)!=null?m:[]:[];return r?e.createElement(e.Fragment,null,e.createElement(W,{toolInstance:t}),e.createElement(M,{toolInstance:t,attributeList:b,subAttributeList:g,config:s,stepList:c,stepInfo:o,enableColorPicker:l})):e.createElement(e.Fragment,null,e.createElement(lt,{toolName:rt.EPointCloudName.PointCloud,selectedToolName:p,onChange:d=>f==null?void 0:f(d)}),e.createElement("div",{style:{flex:1,overflow:"hidden"}},e.createElement(Bt,{minTopHeight:42,defaultHeight:400,localKey:"id:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type)},e.createElement(M,{toolInstance:t,attributeList:b,subAttributeList:g,config:s,stepList:c,stepInfo:o,enableColorPicker:l}),(s==null?void 0:s.trackConfigurable)===!0&&p===it.Rect?e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement($t,null),e.createElement(D,{style:{margin:0}}),e.createElement(vt,{imgList:n,imgIndex:a}),e.createElement(D,{style:{margin:0}}),e.createElement(St,{imgList:n,imgIndex:a}),e.createElement(D,{style:{margin:0}}),e.createElement(gt,null),o.loadPreStep>0&&e.createElement(bt,null),e.createElement(Ct,null)):e.createElement("div",null))))},Ut=o=>{var t,n,a,c;const l=at.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList),u=(a=o.annotation)==null?void 0:a.toolInstance,m=(c=o.annotation)==null?void 0:c.stepList;return{stepInfo:l,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:m}};var Ht=ct(Ut,null,null,{context:dt})(Ft);export{W as PointCloudSegToolIcon,Ht as default};
@@ -1 +1 @@
1
- import{EToolName as e}from"../../../data/enums/ToolType.js";import t from"react";import{sidebarCls as s}from"./index.js";import p from"../../../assets/annotation/lineTool/icon_line.svg.js";import _ from"../../../assets/annotation/lineTool/icon_line_a.svg.js";import v from"../../../assets/annotation/pointTool/icon_point.svg.js";import d from"../../../assets/annotation/pointTool/icon_point_a.svg.js";import u from"../../../assets/annotation/polygonTool/icon_polygon_a.svg.js";import N from"../../../assets/annotation/polygonTool/icon_polygon.svg.js";import T from"../../../assets/annotation/rectTool/icon_rect.svg.js";import f from"../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{cTool as S}from"@labelbee/lb-annotation";import $ from"classnames";import{useTranslation as j}from"react-i18next";const{EPointCloudName:E,TOOL_NAME:y,TOOL_NAME_EN:O}=S,m=[{toolName:e.Rect,commonSvg:T,selectedSvg:f},{toolName:e.Polygon,commonSvg:N,selectedSvg:u},{toolName:e.Line,commonSvg:p,selectedSvg:_},{toolName:e.Point,commonSvg:v,selectedSvg:d}],P=n=>n==="en"?O:y,L=({toolName:n,selectedToolName:r,onChange:l})=>{const{i18n:c}=j(),i=m==null?void 0:m.filter(o=>n===E.PointCloud?[e.Polygon,e.Rect,e.Point,e.Line].includes(o==null?void 0:o.toolName):(o==null?void 0:o.toolName)===n),g=i.length>1;return t.createElement("div",{className:`${s}__level`},i.map(o=>{const a=g&&r===o.toolName;return t.createElement("span",{className:`${s}__toolOption`,key:o.toolName,onClick:()=>l==null?void 0:l(o.toolName)},t.createElement("img",{className:`${s}__singleTool`,src:a?o==null?void 0:o.selectedSvg:o==null?void 0:o.commonSvg}),t.createElement("span",{className:$({[`${s}__toolOption__selected`]:a})},P(c.language)[o.toolName]))}))};export{L as ToolIcons};
1
+ import{EToolName as t}from"../../../data/enums/ToolType.js";import e from"react";import{sidebarCls as n}from"./index.js";import E from"../../../assets/annotation/lineTool/icon_line.svg.js";import N from"../../../assets/annotation/lineTool/icon_line_a.svg.js";import S from"../../../assets/annotation/pointTool/icon_point.svg.js";import y from"../../../assets/annotation/pointTool/icon_point_a.svg.js";import P from"../../../assets/annotation/polygonTool/icon_polygon_a.svg.js";import R from"../../../assets/annotation/polygonTool/icon_polygon.svg.js";import{cTool as w}from"@labelbee/lb-annotation";import O from"classnames";import{useTranslation as $}from"react-i18next";import{Dropdown as j}from"antd";import{DownOutlined as C}from"@ant-design/icons";import{ReactComponent as c}from"../../../assets/annotation/rectTool/two_points_rect.svg.js";import{ReactComponent as u}from"../../../assets/annotation/rectTool/three_points_rect.svg.js";import{useLocalStorageState as M}from"ahooks";const{EPointCloudName:b,TOOL_NAME:h,TOOL_NAME_EN:k,ERectToolModeType:l,RECT_TOOL_MODE_NAME:L}=w,d=[{toolName:t.Rect,dropdownItems:[{key:l.ThreePoints,icon:e.createElement(u,null),label:"\u4E09\u70B9\u753B\u77E9\u5F62"},{key:l.TwoPoints,icon:e.createElement(c,null),label:"\u4E24\u70B9\u753B\u77E9\u5F62"}]},{toolName:t.Polygon,commonSvg:R,selectedSvg:P},{toolName:t.Line,commonSvg:E,selectedSvg:N},{toolName:t.Point,commonSvg:S,selectedSvg:y}],B=s=>s==="en"?k:h,x=({toolName:s,selectedToolName:p,onChange:r})=>{const{i18n:g}=$(),m=d==null?void 0:d.filter(o=>s===b.PointCloud?[t.Polygon,t.Rect,t.Point,t.Line].includes(o==null?void 0:o.toolName):(o==null?void 0:o.toolName)===s),_=m.length>1,[a,T]=M(L,{defaultValue:l.ThreePoints,serializer:o=>o!=null?o:"",deserializer:o=>o}),v=a===l.TwoPoints?c:u,f=o=>{T(o.key)};return e.createElement("div",{className:`${n}__level`},m.map(o=>{const i=_&&p===o.toolName;return e.createElement("span",{className:`${n}__toolOption`,key:o.toolName,onClick:()=>r==null?void 0:r(o.toolName)},o.dropdownItems?e.createElement(j,{overlayClassName:`${n}__dropdown`,menu:{items:o.dropdownItems,selectable:!0,defaultSelectedKeys:a?[a]:[],onClick:f}},e.createElement("div",{className:`${n}__multiBox`,style:{color:i?"#666fff":"#999999"}},e.createElement(v,null),e.createElement(C,null))):e.createElement("img",{className:`${n}__singleTool`,src:i?o==null?void 0:o.selectedSvg:o==null?void 0:o.commonSvg}),e.createElement("span",{className:O({[`${n}__toolOption__selected`]:i})},B(g.language)[o.toolName]))}))};export{x as ToolIcons};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.24.0-alpha.1",
3
+ "version": "1.24.0-alpha.11",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.28.0-alpha.1",
46
+ "@labelbee/lb-annotation": "1.28.0-alpha.6",
47
47
  "@labelbee/lb-utils": "1.19.0",
48
48
  "@labelbee/wavesurfer": "1.1.0",
49
49
  "@types/react-dom": "^18.2.7",