@labelbee/lb-components 1.23.0-alpha.46 → 1.23.0-alpha.48

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 (25) hide show
  1. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  2. package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  3. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  4. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  5. package/dist/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -1
  6. package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
  7. package/dist/components/pointCloudView/utils/map.js +1 -0
  8. package/dist/index.js +1 -1
  9. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +7 -5
  10. package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +2 -1
  11. package/dist/types/components/pointCloudView/utils/map.d.ts +11 -0
  12. package/dist/types/index.d.ts +2 -1
  13. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.d.ts +9 -0
  14. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/index.d.ts +1 -0
  15. package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
  16. package/es/components/pointCloud2DRectOperationView/index.js +1 -1
  17. package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  18. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  19. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  20. package/es/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -1
  21. package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
  22. package/es/components/pointCloudView/utils/map.js +1 -0
  23. package/es/index.js +1 -1
  24. package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
  25. package/package.json +2 -2
@@ -1 +1 @@
1
- "use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,i,l)=>i in u?__defProp(u,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[i]=l,__spreadValues=(u,i)=>{for(var l in i||(i={}))__hasOwnProp.call(i,l)&&__defNormalProp(u,l,i[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(i))__propIsEnum.call(i,l)&&__defNormalProp(u,l,i[l]);return u},__spreadProps=(u,i)=>__defProps(u,__getOwnPropDescs(i)),__async=(u,i,l)=>new Promise((c,d)=>{var v=a=>{try{p(l.next(a))}catch(f){d(f)}},R=a=>{try{p(l.throw(a))}catch(f){d(f)}},p=a=>a.done?c(a.value):Promise.resolve(a.value).then(v,R);p((l=l.apply(u,i)).next())});const PointCloud2DRectOperationView=u=>{var i,l;const{mappingData:c,size:d,config:v,checkMode:R,afterImgOnLoad:p,shouldExcludePointCloudBoxListUpdate:a}=u,f=(i=c==null?void 0:c.url)!=null?i:"",m=(l=c==null?void 0:c.fallbackUrl)!=null?l:"",{pointCloudBoxList:b,setPointCloudResult:y,defaultAttribute:D,rectList:w,addRectIn2DView:N,updateRectIn2DView:x,removeRectIn2DView:B}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:M,remove2DViewRect:z}=usePointCloudViews.usePointCloudViews(),P=React__default.default.useRef(null),n=React.useRef(null),O=ahooks.useMemoizedFn(M),L=ahooks.useMemoizedFn(z),C=React.useRef(null),[A,E]=React.useState(!0),h=React.useMemo(()=>w==null?void 0:w.filter(e=>e.imageName===(c==null?void 0:c.path)),[c==null?void 0:c.path,w]),g=ahooks.useLatest(c==null?void 0:c.path),V=e=>{const{boxID:o}=e;if(!a&&o){const t=O==null?void 0:O(e);C.current=t,y(t);return}x(e,!0)},S=e=>{g.current&&N(__spreadProps(__spreadValues({},e),{imageName:g.current}))},j=e=>{if(!a){const o=e.find(t=>t.boxID);if(o){const t=L==null?void 0:L(o);C.current=t,y(t),_();return}}B(e)},F=ahooks.useMemoizedFn(()=>{let e=[];return b.forEach(o=>{const{rects:t=[],id:r,attribute:s,trackID:I}=o,q=t.find(k=>k.imageName===g.current),U=r+"_"+g.current;q&&(e=[...e,__spreadProps(__spreadValues({},q),{boxID:r,id:U,attribute:s,order:I})])}),e}),_=ahooks.useMemoizedFn(()=>{var e,o,t;const r=a?[]:F(),s=(e=n.current)==null?void 0:e.selectedRectID;(o=n.current)==null||o.setResult([...r,...h]),s&&((t=n.current)==null||t.setSelectedRectID(s))});return React.useEffect(()=>{if(P.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:P.current,size:d,config:__spreadProps(__spreadValues({},v),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:R});return n.current=e,n.current.init(),n.current.on("updateDragResult",V),n.current.on("afterAddingDrawingRect",S),n.current.on("deleteSelectedRects",j),()=>{var o,t,r,s;(o=n.current)==null||o.unbind("updateDragResult",V),(t=n.current)==null||t.unbind("afterAddingDrawingRect",S),(r=n.current)==null||r.unbind("deleteSelectedRects",j),(s=n.current)==null||s.destroy()}}},[]),React.useEffect(()=>{const e=t=>__async(void 0,null,function*(){try{return yield lbAnnotation.ImgUtils.load(t)}catch(r){return console.error("Error loading image:",r),null}}),o=()=>__async(void 0,null,function*(){var t;E(!0);let r=yield e(f);!r&&m&&(r=yield e(m)),r&&((t=n.current)==null||t.setImgNode(r),p(r)),E(!1)});n.current&&(f||m)&&o()},[f,m]),React.useEffect(()=>{var e;(e=n.current)==null||e.setSize(d)},[d]),React.useEffect(()=>{b!==C.current&&_()},[b]),React.useEffect(()=>{var e,o,t;const r=h.find(s=>s.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,D),r&&x(__spreadProps(__spreadValues({},(t=n.current)==null?void 0:t.selectedRect),{attribute:D})),_()},[D]),React.useEffect(()=>{_()},[h]),React.useEffect(()=>{_()},[a]),React.useEffect(()=>{var e,o,t,r;const s=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},I=__spreadProps(__spreadValues({},s),{attributeList:(t=v.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(I))},[v.attributeList]),React__default.default.createElement(es.Spin,{spinning:A},React__default.default.createElement("div",{ref:P,style:__spreadValues({position:"relative"},d)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
1
+ "use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,i,l)=>i in u?__defProp(u,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[i]=l,__spreadValues=(u,i)=>{for(var l in i||(i={}))__hasOwnProp.call(i,l)&&__defNormalProp(u,l,i[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(i))__propIsEnum.call(i,l)&&__defNormalProp(u,l,i[l]);return u},__spreadProps=(u,i)=>__defProps(u,__getOwnPropDescs(i)),__async=(u,i,l)=>new Promise((a,d)=>{var v=s=>{try{p(l.next(s))}catch(f){d(f)}},D=s=>{try{p(l.throw(s))}catch(f){d(f)}},p=s=>s.done?a(s.value):Promise.resolve(s.value).then(v,D);p((l=l.apply(u,i)).next())});const PointCloud2DRectOperationView=u=>{var i,l;const{mappingData:a,size:d,config:v,checkMode:D,afterImgOnLoad:p,shouldExcludePointCloudBoxListUpdate:s}=u,f=(i=a==null?void 0:a.url)!=null?i:"",_=(l=a==null?void 0:a.fallbackUrl)!=null?l:"",{pointCloudBoxList:w,setPointCloudResult:I,defaultAttribute:P,rectList:h,addRectIn2DView:q,updateRectIn2DView:O,removeRectIn2DView:B}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:M,remove2DViewRect:z}=usePointCloudViews.usePointCloudViews(),x=React__default.default.useRef(null),r=React.useRef(null),E=ahooks.useMemoizedFn(M),g=ahooks.useMemoizedFn(z),R=React.useRef(null),[A,L]=React.useState(!0),C=React.useMemo(()=>h==null?void 0:h.filter(e=>e.imageName===(a==null?void 0:a.path)),[a==null?void 0:a.path,h]),b=ahooks.useLatest(a==null?void 0:a.path),V=e=>{const{boxID:o}=e;if(!s&&o){const t=E==null?void 0:E(e);R.current=t,I(t);return}O(e,!0)},S=e=>{b.current&&q(__spreadProps(__spreadValues({},e),{imageName:b.current}))},N=e=>{if(e.length===0)return;if(!s){const t=e.find(n=>n.boxID);if(t){const n=g==null?void 0:g(t);R.current=n,I(n),m();return}}const o=e.find(t=>t.extId);if(o){const{imageName:t,extId:n}=o,c=g==null?void 0:g({boxID:n,imageName:t});R.current=c,I(c)}B(e)},F=ahooks.useMemoizedFn(()=>{let e=[];return w.forEach(o=>{const{rects:t=[],id:n,attribute:c,trackID:y}=o,j=t.find(k=>k.imageName===b.current),U=n+"_"+b.current;j&&(e=[...e,__spreadProps(__spreadValues({},j),{boxID:n,id:U,attribute:c,order:y})])}),e}),m=ahooks.useMemoizedFn(()=>{var e,o,t;const n=s?[]:F(),c=(e=r.current)==null?void 0:e.selectedRectID;(o=r.current)==null||o.setResult([...n,...C]),c&&((t=r.current)==null||t.setSelectedRectID(c))});return React.useEffect(()=>{if(x.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:x.current,size:d,config:__spreadProps(__spreadValues({},v),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:D});return r.current=e,r.current.init(),r.current.on("updateDragResult",V),r.current.on("afterAddingDrawingRect",S),r.current.on("deleteSelectedRects",N),()=>{var o,t,n,c;(o=r.current)==null||o.unbind("updateDragResult",V),(t=r.current)==null||t.unbind("afterAddingDrawingRect",S),(n=r.current)==null||n.unbind("deleteSelectedRects",N),(c=r.current)==null||c.destroy()}}},[]),React.useEffect(()=>{const e=t=>__async(void 0,null,function*(){try{return yield lbAnnotation.ImgUtils.load(t)}catch(n){return console.error("Error loading image:",n),null}}),o=()=>__async(void 0,null,function*(){var t;L(!0);let n=yield e(f);!n&&_&&(n=yield e(_)),n&&((t=r.current)==null||t.setImgNode(n),p(n)),L(!1)});r.current&&(f||_)&&o()},[f,_]),React.useEffect(()=>{var e;(e=r.current)==null||e.setSize(d)},[d]),React.useEffect(()=>{w!==R.current&&m()},[w]),React.useEffect(()=>{var e,o,t;const n=C.find(c=>c.id===r.current.selectedRectID);(o=(e=r.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,P),n&&O(__spreadProps(__spreadValues({},(t=r.current)==null?void 0:t.selectedRect),{attribute:P})),m()},[P]),React.useEffect(()=>{m()},[C]),React.useEffect(()=>{m()},[s]),React.useEffect(()=>{var e,o,t,n;const c=(o=(e=r.current)==null?void 0:e.config)!=null?o:{},y=__spreadProps(__spreadValues({},c),{attributeList:(t=v.attributeList)!=null?t:[]});(n=r.current)==null||n.setConfig(JSON.stringify(y))},[v.attributeList]),React__default.default.createElement(es.Spin,{spinning:A},React__default.default.createElement("div",{ref:x,style:__spreadValues({position:"relative"},d)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),useDataLinkSwitch=require("./hooks/useDataLinkSwitch.js"),index$1=require("../pointCloud2DRectOperationView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,a,i)=>new Promise((l,u)=>{var f=t=>{try{o(i.next(t))}catch(n){u(n)}},r=t=>{try{o(i.throw(t))}catch(n){u(n)}},o=t=>t.done?l(t.value):Promise.resolve(t.value).then(f,r);o((i=i.apply(e,a)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:a,currentData:i,showEnlarge:l,checkMode:u=!1,measureVisible:f})=>{var r,o;const t=React.useRef(null),n=React.useRef(),{selectedBox:c}=useSingleBox.useSingleBox(),m=useSize(t),{url:p,fallbackUrl:x,calib:v,path:y}=e,{toggle2dVisible:j,isHighlightVisible:q}=useHighlight.useHighlight({currentData:i}),[P,k]=React.useState(!1),{cuboidBoxIn2DView:h,cacheImageNodeSize:_}=React.useContext(PointCloudContext.PointCloudContext),B=!e,V=React.useMemo(()=>({zIndex:l?-1:101,is2DView:!h,imageName:e.path}),[l,h,e.path]),{rendered:z,isLinking:I}=useDataLinkSwitch(V),b=d=>{g(),_({path:y,imgNode:d})},g=React.useCallback(()=>{var d,C;const L=(d=n.current)==null?void 0:d.toolInstance;if(a(""),!c||!L)return;const s=e.annotations.find(E=>E.annotation.id===c.info.id);let S="";s&&((C=s==null?void 0:s.annotation.pointList)==null?void 0:C.length)>0&&(L.focusPositionByPointList(s==null?void 0:s.annotation.pointList),S=c.info.id,a(S))},[c,n.current,e.annotations]);React.useEffect(()=>{g()},[g]);const R=()=>__async(void 0,null,function*(){k(!0),yield j(p,x!=null?x:"",v),k(!1)});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:t},h?React__default.default.createElement(index,{src:(r=e==null?void 0:e.url)!=null?r:"",fallbackSrc:(o=e==null?void 0:e.fallbackUrl)!=null?o:"",annotations:e.annotations,size:m,ref:n,globalStyle:{display:B?"none":"block"},afterImgOnLoad:b,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:f}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{shouldExcludePointCloudBoxListUpdate:!I,mappingData:e,size:m,checkMode:u,afterImgOnLoad:b}),z),v&&React__default.default.createElement(index$2,{visible:q(p),onClick:R,loading:P,style:{position:"absolute",right:16,top:16,zIndex:l?-1:101}}))};module.exports=PointCloud2DSingleView;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),useDataLinkSwitch=require("./hooks/useDataLinkSwitch.js"),index$1=require("../pointCloud2DRectOperationView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,u,i)=>new Promise((l,s)=>{var f=t=>{try{o(i.next(t))}catch(n){s(n)}},r=t=>{try{o(i.throw(t))}catch(n){s(n)}},o=t=>t.done?l(t.value):Promise.resolve(t.value).then(f,r);o((i=i.apply(e,u)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:u,currentData:i,showEnlarge:l,checkMode:s=!1,measureVisible:f})=>{var r,o;const t=React.useRef(null),n=React.useRef(),{selectedBox:c}=useSingleBox.useSingleBox(),m=useSize(t),{url:p,fallbackUrl:x,calib:v,path:y}=e,{toggle2dVisible:j,isHighlightVisible:q}=useHighlight.useHighlight({currentData:i}),[P,b]=React.useState(!1),{cuboidBoxIn2DView:h,cacheImageNodeSize:_}=React.useContext(PointCloudContext.PointCloudContext),B=!e,V=React.useMemo(()=>({zIndex:l?-1:101,is2DView:!h,imageName:e.path}),[l,h,e.path]),{rendered:z,isLinking:I}=useDataLinkSwitch(V),k=d=>{g(),_({path:y,imgNode:d})},g=React.useCallback(()=>{var d,C;const L=(d=n.current)==null?void 0:d.toolInstance;if(u(""),!c||!L)return;const a=e.annotations.find(E=>E.annotation.id===c.info.id);let S="";a&&((C=a==null?void 0:a.annotation.pointList)==null?void 0:C.length)>0&&(L.focusPositionByPointList(a==null?void 0:a.annotation.pointList),S=c.info.id,u(S))},[c,n.current,e.annotations]);React.useEffect(()=>{g()},[g]);const R=()=>__async(void 0,null,function*(){b(!0),yield j(p,x!=null?x:"",v),b(!1)});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:t},h?React__default.default.createElement(index,{src:(r=e==null?void 0:e.url)!=null?r:"",fallbackSrc:(o=e==null?void 0:e.fallbackUrl)!=null?o:"",annotations:e.annotations,size:m,ref:n,globalStyle:{display:B?"none":"block"},afterImgOnLoad:k,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:f}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{shouldExcludePointCloudBoxListUpdate:!I,mappingData:e,size:m,checkMode:s,afterImgOnLoad:k}),!s&&z),v&&React__default.default.createElement(index$2,{visible:q(p),onClick:R,loading:P,style:{position:"absolute",right:16,top:16,zIndex:l?-1:101}}))};module.exports=PointCloud2DSingleView;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js"),_=require("lodash");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,e,l)=>e in o?__defProp(o,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[e]=l,__spreadValues=(o,e)=>{for(var l in e||(e={}))__hasOwnProp.call(e,l)&&__defNormalProp(o,l,e[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(e))__propIsEnum.call(e,l)&&__defNormalProp(o,l,e[l]);return o},__spreadProps=(o,e)=>__defProps(o,__getOwnPropDescs(e)),__async=(o,e,l)=>new Promise((w,x)=>{var R=f=>{try{I(l.next(f))}catch(b){x(b)}},H=f=>{try{I(l.throw(f))}catch(b){x(b)}},I=f=>f.done?w(f.value):Promise.resolve(f.value).then(R,H);I((l=l.apply(o,e)).next())});const pickRectObject=o=>___default.default.pick(o,["id","attribute","width","height","x","y","imageName"]),PointCloudContext=React__default.default.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:o=>{},imageSizes:{},cacheImageNodeSize:()=>{},unlinkImageItems:[],addRectFromPointCloudBoxByImageName:o=>!1,removeRectBySpecifyId:(o,e,l)=>!1,removeRectByPointCloudBoxId:o=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{}}),PointCloudProvider=({children:o})=>{const[e,l]=React.useState([]),[w,x]=React.useState([]),[R,H]=React.useState([]),[I,f]=React.useState([]),[b,ut]=React.useState([]),[m,E]=React.useState([]),[A,j]=React.useState([]),[Z,ft]=React.useState(!0),[U,pt]=React.useState(2),[J,gt]=React.useState(!0),[K,vt]=React.useState(1),[p,Q]=React.useState(),[W,X]=React.useState(),[Y,$]=React.useState(),[d,tt]=React.useState(),[et,ht]=React.useState(""),[k,mt]=React.useState(lbAnnotation.EToolName.Rect),Pt=React.useRef(new lbAnnotation.ActionsHistory).current,[g,F]=React.useState([]),[nt,St]=React.useState(""),[q,It]=React.useState(lbUtils.EPointCloudPattern.Detection),[L,it]=React.useState(void 0),[z,bt]=React.useState([]),[M,yt]=React.useState([]),v=index(),[ot,Ct]=React.useState({}),wt=ctx.useDispatch(),Lt=s=>{const{imgNode:r,path:i}=s;i&&r&&Ct(u=>__spreadProps(__spreadValues({},u),{[i]:{width:r.width,height:r.height}}))},st=React.useMemo(()=>m.length===1?m[0]:"",[m]),V=React.useCallback((s,r,i="extId")=>{const u=i||"id",c=new Set(r);return f(h=>{let y=!1;const C=h.filter(O=>{const G=O[u],N=c.has(G)?O.imageName!==s:!0;return N||(y=!0),N});return y?C:h}),!0},[]),rt=React.useCallback(s=>{const r=e.map(i=>i.id);return V(s,r,"extId")},[e,V]),lt=React.useCallback(s=>{if(!s)return!1;const r=e.filter(i=>Array.isArray(i.rects)).map(i=>{const{id:u,attribute:c,trackID:h}=i,y=i.rects.find(C=>C.imageName===s);if(y){const C=___default.default.pick(y,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},C),{id:lbAnnotation.uuid(),attribute:c,order:h,extId:u,lineDash:[]})}return null}).filter(i=>i!==null);return r.length?(f(i=>{const u=new Set(i.filter(h=>s===h.imageName).map(h=>h.extId)),c=r.filter(h=>u.has(h.extId)===!1);return c.length?[...i,...c]:i}),!0):!1},[e]),B=React.useMemo(()=>{const s=e.find(t=>t.id===st),r=t=>{const n=e.concat(t);return l(n),n},i=t=>{const n=w.concat(t);return x(n),n},u=t=>{ft(t!==!1)},c=t=>{t===void 0&&E([]),typeof t=="string"&&E([t]),Array.isArray(t)&&E(Array.from(new Set(t)))},h=t=>{m.includes(t)?c(m.filter(n=>n!==t)):c([...m,t])},y=t=>{const n=pickRectObject(t);f(a=>[...a,n])},C=(t,n=!1)=>{const a=pickRectObject(t);f(S=>S.map(P=>P.id===t.id?n?__spreadValues(__spreadValues({},P),a):a:P))},O=t=>{f(n=>n.filter(a=>!t.find(S=>S.id===a.id)))},G=t=>{A.includes(t)?j([]):j([t])},N=()=>{if(k===lbAnnotation.EToolName.Rect){const t=e.map(n=>n.id);c(t),p==null||p.pointCloud2dOperation.setSelectedIDs(t)}},xt=t=>{c(e.filter(n=>n.attribute===t).map(n=>n.id))},T=e.filter(t=>!g.includes(t.attribute)),at=w.filter(t=>!g.includes(t.attribute)),ct=b.filter(t=>t.attribute&&!g.includes(t.attribute)),Rt=t=>{if(g.includes(t))F(g.filter(n=>n!==t));else{const n=g.concat(t);F(n)}},_t=(()=>{const t=T.map(a=>a.id),n=new Set(t);return I.filter(a=>a.extId&&n.has(a.extId)).map(a=>a.imageName)})(),At=(t=T,n=R,a=at,S=ct,P=z)=>{var D;d==null||d.clearAllBox(),d==null||d.clearAllSphere(),p==null||p.updatePolygonList(t,n),p==null||p.updatePointList(a),p==null||p.updateLineList(S),d==null||d.generateBoxes(t),d==null||d.generateSpheres(a),(D=L==null?void 0:L.store)==null||D.updateCurrentSegment(P),dt(t)},Vt=()=>{Q(void 0),X(void 0),$(void 0),tt(void 0)},dt=(t,n)=>__async(void 0,null,function*(){var a;if(!d)return;const S=d.pointCloudObject;if(!!S)try{const P=yield d.getHighlightIndexByMappingImgList({mappingImgList:n!=null?n:M,points:S.geometry.attributes.position.array}),D=yield d==null?void 0:d.highlightOriginPointCloud(t,P);return D&&((a=p==null?void 0:p.pointCloudInstance)==null||a.updateColor(D)),D}catch(P){console.error(P)}});return{selectedID:st,pointCloudBoxList:e,pointCloudSphereList:w,displayPointCloudList:T,displaySphereList:at,displayLineList:ct,selectedIDs:m,setPointCloudResult:l,setSelectedIDs:c,addPointCloudBox:r,addPointCloudSphere:i,setPointCloudSphereList:x,valid:Z,selectedPointCloudBox:s,setPointCloudValid:u,addSelectedID:h,addHighlightID:G,selectedAllBoxes:N,topViewInstance:p,setTopViewInstance:Q,sideViewInstance:W,setSideViewInstance:X,backViewInstance:Y,setBackViewInstance:$,mainViewInstance:d,setMainViewInstance:tt,polygonList:R,setPolygonList:H,rectList:I,setRectList:f,addRectIn2DView:y,removeRectIn2DView:O,updateRectIn2DView:C,lineList:b,setLineList:ut,zoom:K,setZoom:vt,history:Pt,toggleAttributesVisible:Rt,hideAttributes:g,setHideAttributes:F,reRender:At,attrPanelLayout:nt,setAttrPanelLayout:St,syncAllViewPointCloudColor:dt,defaultAttribute:et,setDefaultAttribute:ht,pointCloudPattern:k,setPointCloudPattern:mt,selectSpecAttr:xt,globalPattern:q,setGlobalPattern:t=>{q!==t&&(wt(actionCreators.ChangeSave),It(t),t===lbUtils.EPointCloudPattern.Detection&&it(void 0))},ptSegmentInstance:L,setPtSegmentInstance:it,segmentation:z,setSegmentation:bt,clearAllDetectionInstance:Vt,highlight2DDataList:M,setHighlight2DDataList:yt,cuboidBoxIn2DView:J,setCuboidBoxIn2DView:gt,imageSizes:ot,cacheImageNodeSize:Lt,highlightIDs:A,setHighlightIDs:j,unlinkImageItems:_t,removeRectByPointCloudBoxId:rt,removeRectBySpecifyId:V,addRectFromPointCloudBoxByImageName:lt,rectRotateSensitivity:U,setRectRotateSensitivity:pt}},[Z,m,e,w,R,b,I,p,W,Y,d,K,g,nt,et,k,q,L,z,M,J,ot,A,rt,V,lt,U]);React.useEffect(()=>{var s,r,i;(s=v==null?void 0:v.setPointCloudBoxList)==null||s.call(v,e),(r=v==null?void 0:v.setHighlightIDs)==null||r.call(v,A),(i=v==null?void 0:v.setSelectedIDs)==null||i.call(v,m)},[e,m,A]),React.useEffect(()=>{var s;(s=v==null?void 0:v.setPtCtx)==null||s.call(v,B)},[B]);const Dt=()=>{const s=e.filter(c=>g.includes(c.attribute)),{setSelectedIDs:r,reRender:i}=B,u=s.map(c=>c.id);u.length>0&&r(m.filter(c=>!u.includes(c))),i()};return React.useEffect(()=>{var s,r,i,u;Dt(),(r=(s=p==null?void 0:p.toolInstance)==null?void 0:s.setHiddenAttributes)==null||r.call(s,g),(u=(i=L==null?void 0:L.store)==null?void 0:i.setHiddenAttributes)==null||u.call(i,g)},[g]),React__default.default.createElement(PointCloudContext.Provider,{value:B},o)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js"),_=require("lodash"),map=require("./utils/map.js");function _interopDefaultLegacy(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(a,n,l)=>n in a?__defProp(a,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[n]=l,__spreadValues=(a,n)=>{for(var l in n||(n={}))__hasOwnProp.call(n,l)&&__defNormalProp(a,l,n[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(n))__propIsEnum.call(n,l)&&__defNormalProp(a,l,n[l]);return a},__spreadProps=(a,n)=>__defProps(a,__getOwnPropDescs(n)),__async=(a,n,l)=>new Promise((w,D)=>{var R=p=>{try{P(l.next(p))}catch(y){D(y)}},O=p=>{try{P(l.throw(p))}catch(y){D(y)}},P=p=>p.done?w(p.value):Promise.resolve(p.value).then(R,O);P((l=l.apply(a,n)).next())});const pickRectObject=a=>___default.default.pick(a,["id","attribute","width","height","x","y","imageName"]),PointCloudContext=React__default.default.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:a=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:a=>!1,removeRectBySpecifyId:(a,n,l)=>!1,removeRectByPointCloudBoxId:a=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map}),PointCloudProvider=({children:a})=>{const[n,l]=React.useState([]),[w,D]=React.useState([]),[R,O]=React.useState([]),[P,p]=React.useState([]),[y,fe]=React.useState([]),[h,H]=React.useState([]),[A,E]=React.useState([]),[T,ge]=React.useState(!0),[W,me]=React.useState(2),[Z,ve]=React.useState(!0),[U,he]=React.useState(1),[f,J]=React.useState(),[K,Q]=React.useState(),[X,Y]=React.useState(),[d,$]=React.useState(),[ee,Pe]=React.useState(""),[j,Ie]=React.useState(lbAnnotation.EToolName.Rect),Se=React.useRef(new lbAnnotation.ActionsHistory).current,[g,k]=React.useState([]),[te,ye]=React.useState(""),[F,Ce]=React.useState(lbUtils.EPointCloudPattern.Detection),[x,ne]=React.useState(void 0),[q,be]=React.useState([]),[z,we]=React.useState([]),m=index(),[ie,xe]=React.useState({}),Le=ctx.useDispatch(),De=i=>{const{imgNode:o,path:t}=i;t&&o&&xe(c=>__spreadProps(__spreadValues({},c),{[t]:{width:o.width,height:o.height}}))},oe=React.useMemo(()=>h.length===1?h[0]:"",[h]),B=React.useCallback((i,o,t="extId")=>{const c=t||"id",r=new Set(o);return p(u=>{let C=!1;const b=u.filter(N=>{const G=N[c],M=r.has(G)?N.imageName!==i:!0;return M||(C=!0),M});return C?b:u}),!0},[]),se=React.useCallback(i=>{const o=n.map(t=>t.id);return B(i,o,"extId")},[n,B]),ae=React.useCallback(i=>{if(!i)return!1;const o=n.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:c,attribute:r,trackID:u}=t,C=t.rects.find(b=>b.imageName===i);if(C){const b=___default.default.pick(C,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},b),{id:lbAnnotation.uuid(),attribute:r,order:u,extId:c,lineDash:[]})}return null}).filter(t=>t!==null);return o.length?(p(t=>{const c=new Set(t.filter(u=>i===u.imageName).map(u=>u.extId)),r=o.filter(u=>c.has(u.extId)===!1);return r.length?[...t,...r]:t}),!0):!1},[n]),re=React.useMemo(()=>n.filter(o=>Array.isArray(o.rects)&&o.rects.length>0).reduce((o,t)=>{var c;return(c=t.rects)==null||c.forEach(r=>{const{imageName:u}=r;if(!u){console.warn("Missing image name"),console.trace(r,t);return}map.addMapIndirectWeakSetItem(o,u,t.id,t)}),o},new Map),[n]),le=React.useMemo(()=>P.filter(i=>i.extId!==void 0&&i.id!==void 0).reduce((i,o)=>{const t=o.imageName;return t?(map.addMapIndirectWeakSetItem(i,t,o.extId,o),i):(console.warn("missing image name"),console.log(o,P),i)},new Map),[P]),V=React.useMemo(()=>{const i=n.find(e=>e.id===oe),o=e=>{const s=n.concat(e);return l(s),s},t=e=>{const s=w.concat(e);return D(s),s},c=e=>{ge(e!==!1)},r=e=>{e===void 0&&H([]),typeof e=="string"&&H([e]),Array.isArray(e)&&H(Array.from(new Set(e)))},u=e=>{h.includes(e)?r(h.filter(s=>s!==e)):r([...h,e])},C=e=>{const s=pickRectObject(e);p(v=>[...v,s])},b=(e,s=!1)=>{const v=pickRectObject(e);p(S=>S.map(I=>I.id===e.id?s?__spreadValues(__spreadValues({},I),v):v:I))},N=e=>{p(s=>s.filter(v=>!e.find(S=>S.id===v.id)))},G=e=>{A.includes(e)?E([]):E([e])},M=()=>{if(j===lbAnnotation.EToolName.Rect){const e=n.map(s=>s.id);r(e),f==null||f.pointCloud2dOperation.setSelectedIDs(e)}},_e=e=>{r(n.filter(s=>s.attribute===e).map(s=>s.id))},ce=n.filter(e=>!g.includes(e.attribute)),de=w.filter(e=>!g.includes(e.attribute)),ue=y.filter(e=>e.attribute&&!g.includes(e.attribute)),Ae=e=>{if(g.includes(e))k(g.filter(s=>s!==e));else{const s=g.concat(e);k(s)}},Be=(e=ce,s=R,v=de,S=ue,I=q)=>{var L;d==null||d.clearAllBox(),d==null||d.clearAllSphere(),f==null||f.updatePolygonList(e,s),f==null||f.updatePointList(v),f==null||f.updateLineList(S),d==null||d.generateBoxes(e),d==null||d.generateSpheres(v),(L=x==null?void 0:x.store)==null||L.updateCurrentSegment(I),pe(e)},Ve=()=>{J(void 0),Q(void 0),Y(void 0),$(void 0)},pe=(e,s)=>__async(void 0,null,function*(){var v;if(!d)return;const S=d.pointCloudObject;if(!!S)try{const I=yield d.getHighlightIndexByMappingImgList({mappingImgList:s!=null?s:z,points:S.geometry.attributes.position.array}),L=yield d==null?void 0:d.highlightOriginPointCloud(e,I);return L&&((v=f==null?void 0:f.pointCloudInstance)==null||v.updateColor(L)),L}catch(I){console.error(I)}});return{selectedID:oe,pointCloudBoxList:n,pointCloudSphereList:w,displayPointCloudList:ce,displaySphereList:de,displayLineList:ue,selectedIDs:h,setPointCloudResult:l,setSelectedIDs:r,addPointCloudBox:o,addPointCloudSphere:t,setPointCloudSphereList:D,valid:T,selectedPointCloudBox:i,setPointCloudValid:c,addSelectedID:u,addHighlightID:G,selectedAllBoxes:M,topViewInstance:f,setTopViewInstance:J,sideViewInstance:K,setSideViewInstance:Q,backViewInstance:X,setBackViewInstance:Y,mainViewInstance:d,setMainViewInstance:$,polygonList:R,setPolygonList:O,rectList:P,setRectList:p,addRectIn2DView:C,removeRectIn2DView:N,updateRectIn2DView:b,lineList:y,setLineList:fe,zoom:U,setZoom:he,history:Se,toggleAttributesVisible:Ae,hideAttributes:g,setHideAttributes:k,reRender:Be,attrPanelLayout:te,setAttrPanelLayout:ye,syncAllViewPointCloudColor:pe,defaultAttribute:ee,setDefaultAttribute:Pe,pointCloudPattern:j,setPointCloudPattern:Ie,selectSpecAttr:_e,globalPattern:F,setGlobalPattern:e=>{F!==e&&(Le(actionCreators.ChangeSave),Ce(e),e===lbUtils.EPointCloudPattern.Detection&&ne(void 0))},ptSegmentInstance:x,setPtSegmentInstance:ne,segmentation:q,setSegmentation:be,clearAllDetectionInstance:Ve,highlight2DDataList:z,setHighlight2DDataList:we,cuboidBoxIn2DView:Z,setCuboidBoxIn2DView:ve,imageSizes:ie,cacheImageNodeSize:De,highlightIDs:A,setHighlightIDs:E,removeRectByPointCloudBoxId:se,removeRectBySpecifyId:B,addRectFromPointCloudBoxByImageName:ae,rectRotateSensitivity:W,setRectRotateSensitivity:me,imageNamePointCloudBoxMap:re,linkageImageNameRectMap:le}},[T,h,n,w,R,y,P,f,K,X,d,U,g,te,ee,j,F,x,q,z,Z,ie,A,se,B,ae,W,re,le]);React.useEffect(()=>{var i,o,t;(i=m==null?void 0:m.setPointCloudBoxList)==null||i.call(m,n),(o=m==null?void 0:m.setHighlightIDs)==null||o.call(m,A),(t=m==null?void 0:m.setSelectedIDs)==null||t.call(m,h)},[n,h,A]),React.useEffect(()=>{var i;(i=m==null?void 0:m.setPtCtx)==null||i.call(m,V)},[V]);const Re=()=>{const i=n.filter(r=>g.includes(r.attribute)),{setSelectedIDs:o,reRender:t}=V,c=i.map(r=>r.id);c.length>0&&o(h.filter(r=>!c.includes(r))),t()};return React.useEffect(()=>{var i,o,t,c;Re(),(o=(i=f==null?void 0:f.toolInstance)==null?void 0:i.setHiddenAttributes)==null||o.call(i,g),(c=(t=x==null?void 0:x.store)==null?void 0:t.setHiddenAttributes)==null||c.call(t,g)},[g]),React__default.default.createElement(PointCloudContext.Provider,{value:V},a)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
@@ -1 +1 @@
1
- "use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),reactI18next=require("react-i18next"),actionCreators=require("../../store/annotation/actionCreators.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,r,u)=>r in l?__defProp(l,r,{enumerable:!0,configurable:!0,writable:!0,value:u}):l[r]=u,__spreadValues=(l,r)=>{for(var u in r||(r={}))__hasOwnProp.call(r,u)&&__defNormalProp(l,u,r[u]);if(__getOwnPropSymbols)for(var u of __getOwnPropSymbols(r))__propIsEnum.call(r,u)&&__defNormalProp(l,u,r[u]);return l},__spreadProps=(l,r)=>__defProps(l,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:l,config:r,checkMode:u,configString:V,imgIndex:C,toolInstanceRef:a})=>{const t=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:B,selectNextBox:L,selectPrevBox:q,updateSelectedBox:f,deleteSelectedPointCloudBoxAndPolygon:O}=useSingleBox.useSingleBox(),{selectedSphere:P,updatePointCloudSphere:A}=useSphere.useSphere(),{clearAllResult:y,updatePointCloudPattern:j}=useStatus.useStatus(),{copySelectedBoxes:I,pasteSelectedBoxes:T,copiedBoxes:D}=useBoxes.useBoxes({config:r}),{updateRotate:g}=useRotate.useRotate({currentData:l}),{updateRotateEdge:N}=useRotateEdge.useRotateEdge({currentData:l}),{updatePointCloudData:v,topViewSelectedChanged:m}=usePointCloudViews.usePointCloudViews(),{redo:h,undo:S,pushHistoryWithList:R,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:K}=useHistory.useHistory(),U=ctx.useDispatch(),{syncThreeViewsAttribute:x}=useAttribute.useAttribute(),{syncAllViewsConfig:z,reRenderTopViewRange:F}=useConfig.useConfig(),{selectedPolygon:k}=usePolygon.usePolygon(),{selectedLine:_}=useLine.useLine(),{t:w}=reactI18next.useTranslation(),b=e=>{var o;const{topViewInstance:s}=t;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(e)},G=(e,o)=>{var s,i;const{topViewInstance:c,mainViewInstance:n}=t;if(!c)return;const{pointCloud2dOperation:d}=c;switch(e){case"q":{g(t.rectRotateSensitivity);break}case"e":g(-Number(t.rectRotateSensitivity));break;case"g":N(-90);break;case"u":{const p=d.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;j(p);const W={[lbAnnotation.EToolName.Polygon]:w("PolygonPattern"),[lbAnnotation.EToolName.Rect]:w("RectPattern")};antd.message.success(w("ChangePatternMsg",{pattern:W[p]})),d.clearActiveStatus(),d.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":t.setPointCloudValid(!t.valid);break;case"tab":if(o.shiftKey){q();break}L(),o.preventDefault();break;case"f":B();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":O();break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=lbAnnotation.AttributeUtils.getAttributeByKeycode(o.keyCode,r.attributeList);p!==void 0&&((i=a.current)==null||i.setDefaultAttribute(p))}return}}},M=(e,o)=>{switch(e){case"c":I();break;case"v":T();break;case"a":o.preventDefault(),t.selectedAllBoxes();break;case"z":{o.shiftKey?h():S();break}}},E=e=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(e)||u===!0)return;const o=e.key.toLocaleLowerCase();if(e.ctrlKey){M(o,e);return}G(o,e)};return React.useEffect(()=>{const{topViewInstance:e}=t;if(!!e)return window.addEventListener("keydown",E),()=>{window.removeEventListener("keydown",E)}},[t,D,r,t.pointCloudBoxList,t.polygonList]),React.useEffect(()=>{z(r)},[V]),React.useEffect(()=>{(r==null?void 0:r.radius)&&F(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{v==null||v()},[C,t.mainViewInstance]),React.useEffect(()=>{t.setHideAttributes([])},[C]),React.useEffect(()=>{a.current.setDefaultAttribute=e=>{var o,s,i,c;x(e);const n=t.selectedPointCloudBox;if(n){n.attribute=e;const d=U(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[n],stepConfig:r,action:"viewUpdateBox"}));n.valid=d[0].valid;const p=f(n);(i=(s=(o=t==null?void 0:t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:s.setPolygonValidAndRender)==null||i.call(s,n.id,!0,n.valid),t.mainViewInstance&&m({newSelectedBox:n,newPointCloudList:p})}if(k&&H(__spreadProps(__spreadValues({},k),{attribute:e})),_&&K(__spreadProps(__spreadValues({},_),{attribute:e})),P){const d=A(__spreadProps(__spreadValues({},P),{attribute:e}));t.mainViewInstance&&((c=t.mainViewInstance)==null||c.generateSpheres(d),m({newSelectedSphere:P,newSphereList:d}))}},a.current.setSubAttribute=(e,o)=>{var s;const i=t.selectedPointCloudBox;if(i){const c=(s=i==null?void 0:i.subAttribute)!=null?s:{};i.subAttribute=__spreadProps(__spreadValues({},c),{[e]:o}),f(i)}},a.current.clearResult=()=>{y==null||y()},a.current.redo=()=>{h()},a.current.undo=()=>{S()},a.current.setValid=e=>{a.current.valid=e,setTimeout(()=>{t.setPointCloudValid(e),e===!1&&y()})},a.current.setForbidOperation=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&t.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)},a.current.asyncData=e=>{setTimeout(()=>{v==null||v(e)})}},[t.pointCloudBoxList,t.pointCloudSphereList,t.selectedID,t.valid,t.polygonList,t.lineList,t.mainViewInstance,t.ptSegmentInstance]),React.useEffect(()=>{a.current.updateSegmentTool=e=>{var o;(o=t.ptSegmentInstance)==null||o.emit(e)},a.current.segmentInstance=t.ptSegmentInstance},[t.ptSegmentInstance]),React.useEffect(()=>{a.current.history={pushHistory:e=>{R({pointCloudBoxList:e})},initRecord:()=>{}}},[]),React.useEffect(()=>{var e;const o=(e=t.topViewInstance)==null?void 0:e.toolInstance;if(!o||u)return;const s=n=>{x(n)},i=n=>{antd.message.error(n)},c=n=>{antd.message.info(n)};return o.on("syncAttribute",s),o.on("messageError",i),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",i),o.unbind("messageInfo",c)}},[t.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
1
+ "use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),reactI18next=require("react-i18next"),actionCreators=require("../../store/annotation/actionCreators.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,r,l)=>r in u?__defProp(u,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[r]=l,__spreadValues=(u,r)=>{for(var l in r||(r={}))__hasOwnProp.call(r,l)&&__defNormalProp(u,l,r[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(r))__propIsEnum.call(r,l)&&__defNormalProp(u,l,r[l]);return u},__spreadProps=(u,r)=>__defProps(u,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:u,config:r,checkMode:l,configString:L,imgIndex:C,toolInstanceRef:a})=>{const t=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:V,selectNextBox:B,selectPrevBox:q,updateSelectedBox:f,deleteSelectedPointCloudBoxAndPolygon:O}=useSingleBox.useSingleBox(),{selectedSphere:P,updatePointCloudSphere:A}=useSphere.useSphere(),{clearAllResult:y,updatePointCloudPattern:j}=useStatus.useStatus(),{copySelectedBoxes:I,pasteSelectedBoxes:T,copiedBoxes:D}=useBoxes.useBoxes({config:r}),{updateRotate:g}=useRotate.useRotate({currentData:u}),{updateRotateEdge:N}=useRotateEdge.useRotateEdge({currentData:u}),{updatePointCloudData:v,topViewSelectedChanged:h}=usePointCloudViews.usePointCloudViews(),{redo:m,undo:S,pushHistoryWithList:R,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:K}=useHistory.useHistory(),U=ctx.useDispatch(),{syncThreeViewsAttribute:x}=useAttribute.useAttribute(),{syncAllViewsConfig:z,reRenderTopViewRange:F}=useConfig.useConfig(),{selectedPolygon:k}=usePolygon.usePolygon(),{selectedLine:_}=useLine.useLine(),{t:w}=reactI18next.useTranslation(),G=ahooks.useLatest(u),b=e=>{var o;const{topViewInstance:s}=t;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(e)},M=(e,o)=>{var s,i;const{topViewInstance:c,mainViewInstance:n}=t;if(!c)return;const{pointCloud2dOperation:d}=c;switch(e){case"q":{g(t.rectRotateSensitivity);break}case"e":g(-Number(t.rectRotateSensitivity));break;case"g":N(-90);break;case"u":{const p=d.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;j(p);const Y={[lbAnnotation.EToolName.Polygon]:w("PolygonPattern"),[lbAnnotation.EToolName.Rect]:w("RectPattern")};antd.message.success(w("ChangePatternMsg",{pattern:Y[p]})),d.clearActiveStatus(),d.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":t.setPointCloudValid(!t.valid);break;case"tab":if(o.shiftKey){q();break}B(),o.preventDefault();break;case"f":V();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":O(G.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=lbAnnotation.AttributeUtils.getAttributeByKeycode(o.keyCode,r.attributeList);p!==void 0&&((i=a.current)==null||i.setDefaultAttribute(p))}return}}},W=(e,o)=>{switch(e){case"c":I();break;case"v":T();break;case"a":o.preventDefault(),t.selectedAllBoxes();break;case"z":{o.shiftKey?m():S();break}}},E=e=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(e)||l===!0)return;const o=e.key.toLocaleLowerCase();if(e.ctrlKey){W(o,e);return}M(o,e)};return React.useEffect(()=>{const{topViewInstance:e}=t;if(!!e)return window.addEventListener("keydown",E),()=>{window.removeEventListener("keydown",E)}},[t,D,r,t.pointCloudBoxList,t.polygonList]),React.useEffect(()=>{z(r)},[L]),React.useEffect(()=>{(r==null?void 0:r.radius)&&F(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{v==null||v()},[C,t.mainViewInstance]),React.useEffect(()=>{t.setHideAttributes([])},[C]),React.useEffect(()=>{a.current.setDefaultAttribute=e=>{var o,s,i,c;x(e);const n=t.selectedPointCloudBox;if(n){n.attribute=e;const d=U(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[n],stepConfig:r,action:"viewUpdateBox"}));n.valid=d[0].valid;const p=f(n);(i=(s=(o=t==null?void 0:t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:s.setPolygonValidAndRender)==null||i.call(s,n.id,!0,n.valid),t.mainViewInstance&&h({newSelectedBox:n,newPointCloudList:p})}if(k&&H(__spreadProps(__spreadValues({},k),{attribute:e})),_&&K(__spreadProps(__spreadValues({},_),{attribute:e})),P){const d=A(__spreadProps(__spreadValues({},P),{attribute:e}));t.mainViewInstance&&((c=t.mainViewInstance)==null||c.generateSpheres(d),h({newSelectedSphere:P,newSphereList:d}))}},a.current.setSubAttribute=(e,o)=>{var s;const i=t.selectedPointCloudBox;if(i){const c=(s=i==null?void 0:i.subAttribute)!=null?s:{};i.subAttribute=__spreadProps(__spreadValues({},c),{[e]:o}),f(i)}},a.current.clearResult=()=>{y==null||y()},a.current.redo=()=>{m()},a.current.undo=()=>{S()},a.current.setValid=e=>{a.current.valid=e,setTimeout(()=>{t.setPointCloudValid(e),e===!1&&y()})},a.current.setForbidOperation=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&t.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)},a.current.asyncData=e=>{setTimeout(()=>{v==null||v(e)})}},[t.pointCloudBoxList,t.pointCloudSphereList,t.selectedID,t.valid,t.polygonList,t.lineList,t.mainViewInstance,t.ptSegmentInstance]),React.useEffect(()=>{a.current.updateSegmentTool=e=>{var o;(o=t.ptSegmentInstance)==null||o.emit(e)},a.current.segmentInstance=t.ptSegmentInstance},[t.ptSegmentInstance]),React.useEffect(()=>{a.current.history={pushHistory:e=>{R({pointCloudBoxList:e})},initRecord:()=>{}}},[]),React.useEffect(()=>{var e;const o=(e=t.topViewInstance)==null?void 0:e.toolInstance;if(!o||l)return;const s=n=>{x(n)},i=n=>{antd.message.error(n)},c=n=>{antd.message.info(n)};return o.on("syncAttribute",s),o.on("messageError",i),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",i),o.unbind("messageInfo",c)}},[t.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),ahooks=require("ahooks"),PointCloudContext=require("../PointCloudContext.js"),icon_link=require("../../../assets/annotation/icon_link.svg.js"),icon_unlink=require("../../../assets/annotation/icon_unlink.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const iconSize={width:16,height:16},useDataLinkSwitch=e=>{e.imageName||console.warn("missing imageName");const[n,l]=React.useState(!0),r=React.useRef(e.imageName);r.current=e.imageName;const{unlinkImageItems:c,addRectFromPointCloudBoxByImageName:d,removeRectByPointCloudBoxId:m}=React.useContext(PointCloudContext.PointCloudContext),g=ahooks.useLatest(d),f=ahooks.useLatest(m),i=React.useCallback(t=>{const a=r.current;if(!a){console.warn("invalid image name");return}l(t),t?f.current(a):g.current(a)},[]),u=React.useCallback(()=>{i(!n)},[i,n]),h=React.useMemo(()=>{var t;if(!e.is2DView)return null;const o={zIndex:(t=e.zIndex)!=null?t:999,position:"absolute",top:16,right:16+28+12,background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,cursor:"pointer"};return React__default.default.createElement("div",{style:o,onClick:u},n&&React__default.default.createElement("img",{src:icon_link,style:iconSize}),!n&&React__default.default.createElement("img",{src:icon_unlink,style:iconSize}))},[n,e.is2DView,e.zIndex,u]),s=React.useCallback(()=>{if(!e.is2DView)return;const t=r.current;if(!t){console.warn("invalid image name");return}const o=new Set(c).has(t)===!1;i(o)},[e.is2DView,c,i]);return React.useEffect(()=>{s()},[s]),{rendered:h,isLinking:n,swapSwitch:i,syncIsLinking:s}};module.exports=useDataLinkSwitch;
1
+ "use strict";var React=require("react"),ahooks=require("ahooks"),PointCloudContext=require("../PointCloudContext.js"),icon_link=require("../../../assets/annotation/icon_link.svg.js"),icon_unlink=require("../../../assets/annotation/icon_unlink.svg.js"),BatchSwitchConnectIn2DView=require("../../../views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const iconSize={width:16,height:16},useDataLinkSwitch=e=>{e.imageName||console.warn("missing imageName");const[i,h]=React.useState(!0),l=ahooks.useLatest(e.imageName),{addRectFromPointCloudBoxByImageName:v,removeRectByPointCloudBoxId:w,imageNamePointCloudBoxMap:o,linkageImageNameRectMap:m}=React.useContext(PointCloudContext.PointCloudContext),r=React.useMemo(()=>e.imageName?o.has(e.imageName):(console.error("Missing image name"),!1),[e.imageName,o]),C=ahooks.useLatest(r),I=ahooks.useLatest(v),k=ahooks.useLatest(w),a=React.useCallback(n=>{if(!C.current)return;const t=l.current;if(!t){console.warn("invalid image name");return}h(n),n?k.current(t):I.current(t)},[]),x=React.useCallback(()=>{a(!i)},[a,i]),N=React.useMemo(()=>{var n;if(!e.is2DView||!r)return null;const s={zIndex:(n=e.zIndex)!=null?n:999,position:"absolute",top:16,right:16+28+12,background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28};return React__default.default.createElement("div",{style:s},i&&React__default.default.createElement("img",{src:icon_link,style:iconSize}),!i&&React__default.default.createElement("img",{src:icon_unlink,style:iconSize}))},[i,e.is2DView,e.zIndex,x,r]),c=React.useCallback(()=>{var n,t,s,d;if(!e.is2DView)return;const u=l.current;if(!u){console.warn("invalid image name");return}const B=new Set([...(t=(n=o.get(u))==null?void 0:n.keys())!=null?t:[]]),g=[...(d=(s=m.get(u))==null?void 0:s.keys())!=null?d:[]];let f=!0;g.length&&(f=Boolean(g.find(b=>B.has(b)))===!1),a(f)},[e.is2DView,m,o,a]);return React.useEffect(()=>{c()},[c]),React.useEffect(()=>{const n=t=>{a(t)};return lbAnnotation.EventBus.on(BatchSwitchConnectIn2DView.EventBusEvent.switchConnect,n),()=>lbAnnotation.EventBus.unbind(BatchSwitchConnectIn2DView.EventBusEvent.switchConnect,n)},[a]),{rendered:N,isLinking:i,swapSwitch:a,syncIsLinking:c}};module.exports=useDataLinkSwitch;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(n,e,i)=>e in n?__defProp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,__spreadValues=(n,e)=>{for(var i in e||(e={}))__hasOwnProp.call(e,i)&&__defNormalProp(n,i,e[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(e))__propIsEnum.call(e,i)&&__defNormalProp(n,i,e[i]);return n},__spreadProps=(n,e)=>__defProps(n,__getOwnPropDescs(e));const{ESortDirection}=lbAnnotation.cAnnotation,useSingleBox=n=>{const{pointCloudBoxList:e,setPointCloudResult:i,topViewInstance:d,backViewInstance:P,sideViewInstance:y,selectedIDs:f,selectedID:x,mainViewInstance:a,setSelectedIDs:m,syncAllViewPointCloudColor:B,polygonList:D,pointCloudPattern:C}=React.useContext(PointCloudContext.PointCloudContext),{selectedPolygon:u,updateSelectedPolygon:V,updatePolygonValidByID:h,deletePolygon:L}=usePolygon.usePolygon(),{pushHistoryWithList:b}=useHistory.useHistory(),r=React.useMemo(()=>{const o=e.findIndex(l=>l.id===x);if(o>-1)return{info:e[o],index:o}},[x,e]),w=React.useCallback(o=>{var l;if(r==null?void 0:r.info){(l=n==null?void 0:n.generateRects)==null||l.call(n,o),e.splice(r.index,1,___default.default.merge(r.info,o));const t=___default.default.cloneDeep(e);return i(t),b({pointCloudBoxList:t}),t}return e},[x,e]),S=React.useCallback((o,l)=>{const t=e.findIndex(s=>s.id===l);if(t>-1){e.splice(t,1,___default.default.merge(e[t],o));const s=___default.default.cloneDeep(e);return i(s),s}return e},[e]),p=React.useCallback(o=>{d==null||d.pointCloud2dOperation.setPolygonValidAndRender(o,!0),y==null||y.pointCloud2dOperation.setPolygonValidAndRender(o,!0),P==null||P.pointCloud2dOperation.setPolygonValidAndRender(o,!0)},[d,y,P]),j=React.useCallback(()=>{if(r==null?void 0:r.info){const{id:o,valid:l=!0}=r.info,t=w({valid:!l});B(t),p(o)}u&&(V(__spreadProps(__spreadValues({},u),{valid:!u.valid})),d==null||d.pointCloud2dOperation.setPolygonValidAndRender(u.id,!0))},[p,r,u]),k=React.useCallback(o=>{const l=e.find(t=>t.id===o);if(l){const{id:t,valid:s=!0}=l,v=S({valid:!s},t);return p(t),v}h(o)},[p,e,D]),I=React.useCallback((o=ESortDirection.ascend,l=!1)=>{if(!d||f.length>1)return;if(C!==lbAnnotation.EToolName.Rect&&C!==lbAnnotation.EToolName.Polygon){l&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:o!==ESortDirection.ascend}));return}const{pointCloud2dOperation:t}=d,s=t.switchToNextPolygon(o);s&&m(s)},[d,C,d==null?void 0:d.toolInstance]),R=(o=!1)=>{I(ESortDirection.descend,o)},A=(o=!1)=>{I(ESortDirection.ascend,o)},O=o=>{const l=e.filter(t=>t.id!==o);i(l),a==null||a.removeObjectByName(o,"box"),a==null||a.render(),B(l)},E=()=>{r&&(O(r.info.id),d==null||d.pointCloud2dOperation.deletePolygon(r.info.id)),u&&(L(u.id),d==null||d.pointCloud2dOperation.deletePolygon(u.id))},N=React.useMemo(()=>e.filter(o=>f.includes(o.id)),[f,e]),q=React.useCallback(o=>{var l;const t=___default.default.cloneDeep(e);let s=!1;for(const v of o){const g=t.findIndex(c=>c.id===v.id);if(g>-1){const c=___default.default.merge(t[g],v);(l=n==null?void 0:n.generateRects)==null||l.call(n,c),t.splice(g,1,c),a==null||a.generateBox(c),s=!0}}if(s)return i(t),b({pointCloudBoxList:t}),a==null||a.render(),t},[f,e]),H=React.useCallback(o=>e.find(l=>l.id===o),[e]);return{selectedBox:r,updateSelectedBox:w,changeSelectedBoxValid:j,changeValidByID:k,selectNextBox:A,selectPrevBox:R,deletePointCloudBox:O,selectedBoxes:N,updateSelectedBoxes:q,getPointCloudByID:H,deleteSelectedPointCloudBoxAndPolygon:E}};exports.useSingleBox=useSingleBox;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,t,i)=>t in l?__defProp(l,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):l[t]=i,__spreadValues=(l,t)=>{for(var i in t||(t={}))__hasOwnProp.call(t,i)&&__defNormalProp(l,i,t[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(t))__propIsEnum.call(t,i)&&__defNormalProp(l,i,t[i]);return l},__spreadProps=(l,t)=>__defProps(l,__getOwnPropDescs(t));const{ESortDirection}=lbAnnotation.cAnnotation,useSingleBox=l=>{const{pointCloudBoxList:t,setPointCloudResult:i,topViewInstance:a,backViewInstance:m,sideViewInstance:w,selectedIDs:P,selectedID:b,mainViewInstance:u,setSelectedIDs:N,syncAllViewPointCloudColor:h,polygonList:j,pointCloudPattern:B,rectList:O,removeRectIn2DView:D,addRectIn2DView:V}=React.useContext(PointCloudContext.PointCloudContext),{selectedPolygon:c,updateSelectedPolygon:k,updatePolygonValidByID:A,deletePolygon:M}=usePolygon.usePolygon(),{pushHistoryWithList:S}=useHistory.useHistory(),s=React.useMemo(()=>{const e=t.findIndex(n=>n.id===b);if(e>-1)return{info:t[e],index:e}},[b,t]),L=React.useCallback(e=>{var n;if(s==null?void 0:s.info){(n=l==null?void 0:l.generateRects)==null||n.call(l,e),t.splice(s.index,1,___default.default.merge(s.info,e));const o=___default.default.cloneDeep(t);return i(o),S({pointCloudBoxList:o}),o}return t},[b,t]),q=React.useCallback((e,n)=>{const o=t.findIndex(d=>d.id===n);if(o>-1){t.splice(o,1,___default.default.merge(t[o],e));const d=___default.default.cloneDeep(t);return i(d),d}return t},[t]),y=React.useCallback(e=>{a==null||a.pointCloud2dOperation.setPolygonValidAndRender(e,!0),w==null||w.pointCloud2dOperation.setPolygonValidAndRender(e,!0),m==null||m.pointCloud2dOperation.setPolygonValidAndRender(e,!0)},[a,w,m]),H=React.useCallback(()=>{if(s==null?void 0:s.info){const{id:e,valid:n=!0}=s.info,o=L({valid:!n});h(o),y(e)}c&&(k(__spreadProps(__spreadValues({},c),{valid:!c.valid})),a==null||a.pointCloud2dOperation.setPolygonValidAndRender(c.id,!0))},[y,s,c]),T=React.useCallback(e=>{const n=t.find(o=>o.id===e);if(n){const{id:o,valid:d=!0}=n,g=q({valid:!d},o);return y(o),g}A(e)},[y,t,j]),E=React.useCallback((e=ESortDirection.ascend,n=!1)=>{if(!a||P.length>1)return;if(B!==lbAnnotation.EToolName.Rect&&B!==lbAnnotation.EToolName.Polygon){n&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:e!==ESortDirection.ascend}));return}const{pointCloud2dOperation:o}=a,d=o.switchToNextPolygon(e);d&&N(d)},[a,B,a==null?void 0:a.toolInstance]),K=(e=!1)=>{E(ESortDirection.descend,e)},W=(e=!1)=>{E(ESortDirection.ascend,e)},R=e=>{const n=t.filter(o=>o.id!==e);i(n),u==null||u.removeObjectByName(e,"box"),u==null||u.render(),h(n)},z=React.useCallback((e,n)=>{var o,d;const g=new Set((d=(o=n.mappingImgList)==null?void 0:o.map(r=>r.path))!=null?d:[]),p=new Map;e.forEach(r=>{const C=r.id;(r.rects||[]).forEach(I=>{const{imageName:x}=I;if(g.has(x)){let v=p.get(x);v||(v=new Set,p.set(x,v)),v.add(C)}})});const f=O.filter(r=>{var C;const I=r.extId,x=r.imageName;if(x!==void 0&&I!==void 0){const v=p.get(x);return(C=v==null?void 0:v.has(I))!=null?C:!1}return!1});D(f),f.forEach(r=>{V(r)})},[O,D,V]),F=e=>{s&&(R(s.info.id),a==null||a.pointCloud2dOperation.deletePolygon(s.info.id),z([s.info],e)),c&&(M(c.id),a==null||a.pointCloud2dOperation.deletePolygon(c.id))},G=React.useMemo(()=>t.filter(e=>P.includes(e.id)),[P,t]),J=React.useCallback(e=>{var n;const o=___default.default.cloneDeep(t);let d=!1;for(const g of e){const p=o.findIndex(f=>f.id===g.id);if(p>-1){const f=___default.default.merge(o[p],g);(n=l==null?void 0:l.generateRects)==null||n.call(l,f),o.splice(p,1,f),u==null||u.generateBox(f),d=!0}}if(d)return i(o),S({pointCloudBoxList:o}),u==null||u.render(),o},[P,t]),Q=React.useCallback(e=>t.find(n=>n.id===e),[t]);return{selectedBox:s,updateSelectedBox:L,changeSelectedBoxValid:H,changeValidByID:T,selectNextBox:W,selectPrevBox:K,deletePointCloudBox:R,selectedBoxes:G,updateSelectedBoxes:J,getPointCloudByID:Q,deleteSelectedPointCloudBoxAndPolygon:F}};exports.useSingleBox=useSingleBox;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const addMapIndirectWeakSetItem=(r,d,s,a)=>{let e=r.get(d);e||(e=new Map,r.set(d,e));let t=e.get(s);return t||(t=new WeakSet,e.set(s,t)),t.add(a),r};exports.addMapIndirectWeakSetItem=addMapIndirectWeakSetItem;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),index$3=require("./components/NLPToolView/textContent/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$5=require("./components/predictTracking/predictTrackingIcon/index.js"),index$4=require("./components/LLMToolView/index.js"),index$6=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),index$7=require("./components/measureCanvas/index.js"),index$8=require("./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js"),index$9=require("./views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js"),index$a=require("./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js"),index$b=require("./components/audioPlayer/index.js"),index$c=require("./utils/index.js"),index$d=require("./components/subAttributeList/index.js"),index$e=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,i]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:o=>{const n=~~o-1;store.dispatch(actionCreators.PageJump(n))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:o=>{var n;i(o),(n=e.onLoad)==null||n.call(e,{toolInstance:o})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2.default,exports.TextContent=index$3,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$5,exports.LLMToolView=index$4,exports.SwitchCuboidBoxIn2DView=index$6,exports.MeasureCanvas=index$7,exports.AnnotatedBox=index$8,exports.RectRotateSensitivitySlider=index$9,exports.FindTrackIDIndex=index$a.FindTrackIDIndexInCheckMode,exports.AudioPlayer=index$b.WrapAudioPlayer,exports.generatePointCloudBoxRects=index$c.generatePointCloudBoxRects,exports.SubAttributeList=index$d,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$e.EDataFormatType}}),Object.defineProperty(exports,"ELLMDataType",{enumerable:!0,get:function(){return index$e.ELLMDataType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$e.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$e.ESubmitType}}),exports.componentCls=index$e.componentCls,exports.prefix=index$e.prefix,exports.default=index,exports.store=store;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),index$3=require("./components/NLPToolView/textContent/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$5=require("./components/predictTracking/predictTrackingIcon/index.js"),index$4=require("./components/LLMToolView/index.js"),index$6=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),BatchSwitchConnectIn2DView=require("./views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js"),index$7=require("./components/measureCanvas/index.js"),index$8=require("./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js"),index$9=require("./views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js"),index$a=require("./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js"),index$b=require("./components/audioPlayer/index.js"),index$c=require("./utils/index.js"),index$d=require("./components/subAttributeList/index.js"),index$e=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,i]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:n=>{const o=~~n-1;store.dispatch(actionCreators.PageJump(o))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:n=>{var o;i(n),(o=e.onLoad)==null||o.call(e,{toolInstance:n})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2.default,exports.TextContent=index$3,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$5,exports.LLMToolView=index$4,exports.SwitchCuboidBoxIn2DView=index$6,exports.BatchSwitchConnectIn2DView=BatchSwitchConnectIn2DView.default,exports.MeasureCanvas=index$7,exports.AnnotatedBox=index$8,exports.RectRotateSensitivitySlider=index$9,exports.FindTrackIDIndex=index$a.FindTrackIDIndexInCheckMode,exports.AudioPlayer=index$b.WrapAudioPlayer,exports.generatePointCloudBoxRects=index$c.generatePointCloudBoxRects,exports.SubAttributeList=index$d,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$e.EDataFormatType}}),Object.defineProperty(exports,"ELLMDataType",{enumerable:!0,get:function(){return index$e.ELLMDataType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$e.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$e.ESubmitType}}),exports.componentCls=index$e.componentCls,exports.prefix=index$e.prefix,exports.default=index,exports.store=store;
@@ -1,6 +1,7 @@
1
1
  import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointCloudSphereList, IPointCloudSphere, ILine, EPointCloudPattern, IPointCloudSegmentation, ICalib, ISize, IPointCloudBoxRect, IPointCloud2DRectOperationViewRect } from '@labelbee/lb-utils';
2
- import React from 'react';
2
+ import React, { PropsWithChildren } from 'react';
3
3
  import { PointCloud, PointCloudAnnotation, ActionsHistory, EToolName } from '@labelbee/lb-annotation';
4
+ import type { MapIndirectWeakSet } from './utils/map';
4
5
  interface IPointCloudContextInstances {
5
6
  topViewInstance?: PointCloudAnnotation;
6
7
  sideViewInstance?: PointCloudAnnotation;
@@ -19,7 +20,6 @@ interface IPointCloudSegment {
19
20
  ptSegmentInstance?: PointCloud;
20
21
  setPtSegmentInstance: (instance?: PointCloud) => void;
21
22
  }
22
- type UnlinkImageItem = string;
23
23
  type AttrPanelLayout = '' | 'left' | 'right';
24
24
  interface IHighlight2DData {
25
25
  url: string;
@@ -85,14 +85,16 @@ export interface IPointCloudContext extends IPointCloudContextInstances, IPointC
85
85
  imgNode: HTMLImageElement;
86
86
  path: string;
87
87
  }) => void;
88
- /** 未关联(联动)项列表 */
89
- unlinkImageItems: UnlinkImageItem[];
90
88
  addRectFromPointCloudBoxByImageName: (imageName: string) => boolean;
91
89
  removeRectBySpecifyId: (imageName: string, ids: string[], idField?: keyof IPointCloudBoxRect) => boolean;
92
90
  removeRectByPointCloudBoxId: (imageName: string) => boolean;
93
91
  rectRotateSensitivity: number;
94
92
  setRectRotateSensitivity: (sensitivity: number) => void;
93
+ /** imageName -> pointCloudBox.id -> [pointCloudBox, ...] */
94
+ imageNamePointCloudBoxMap: MapIndirectWeakSet<IPointCloudBox>;
95
+ /** imageName -> pointCloudBox.id -> [rect, ...] */
96
+ linkageImageNameRectMap: MapIndirectWeakSet<IPointCloudBoxRect>;
95
97
  }
96
98
  export declare const PointCloudContext: React.Context<IPointCloudContext>;
97
- export declare const PointCloudProvider: React.FC<{}>;
99
+ export declare const PointCloudProvider: React.FC<PropsWithChildren<{}>>;
98
100
  export {};
@@ -1,4 +1,5 @@
1
1
  import { IPointCloudBox, PartialIPointCloudBoxList } from '@labelbee/lb-utils';
2
+ import { IFileItem } from '@/types/data';
2
3
  interface IUseSingleBoxParams {
3
4
  generateRects?: (box: IPointCloudBox) => void;
4
5
  }
@@ -17,6 +18,6 @@ export declare const useSingleBox: (props?: IUseSingleBoxParams) => {
17
18
  selectedBoxes: IPointCloudBox[];
18
19
  updateSelectedBoxes: (updateList: PartialIPointCloudBoxList) => import("@labelbee/lb-utils").IPointCloudBoxList | undefined;
19
20
  getPointCloudByID: (id: string) => IPointCloudBox | undefined;
20
- deleteSelectedPointCloudBoxAndPolygon: () => void;
21
+ deleteSelectedPointCloudBoxAndPolygon: (currentData: IFileItem) => void;
21
22
  };
22
23
  export {};
@@ -0,0 +1,11 @@
1
+ export type MapIndirectWeakSet<T extends object> = Map<string, Map<string, WeakSet<T>>>;
2
+ /**
3
+ * Update MapIndirectWeakSet
4
+ *
5
+ * @param map The map will be changed
6
+ * @param key0 The top key
7
+ * @param key1 The inner key
8
+ * @param value The target to be set
9
+ * @returns return map
10
+ */
11
+ export declare const addMapIndirectWeakSetItem: <T extends object>(map: MapIndirectWeakSet<T>, key0: string, key1: string, value: T) => MapIndirectWeakSet<T>;
@@ -10,6 +10,7 @@ import './index.scss';
10
10
  import PredictTracking from '@/components/predictTracking';
11
11
  import LLMToolView from '@/components/LLMToolView';
12
12
  import SwitchCuboidBoxIn2DView from '@/views/MainView/toolFooter/SwitchCuboidBoxIn2DView';
13
+ import BatchSwitchConnectIn2DView from '@/views/MainView/toolFooter/BatchSwitchConnectIn2DView';
13
14
  import MeasureCanvas from './components/measureCanvas';
14
15
  import AnnotatedBox from './views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox';
15
16
  import RectRotateSensitivitySlider from './views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider';
@@ -22,6 +23,6 @@ export declare const store: import("redux").Store<{}, import("redux").Action<any
22
23
  };
23
24
  declare const _default: React.ForwardRefExoticComponent<AppProps & React.RefAttributes<unknown>>;
24
25
  export default _default;
25
- export { AnnotationView, PointCloudAnnotationView, QuestionView, TextContent, LLMToolView, i18n, VideoTagTool, PredictTracking, SwitchCuboidBoxIn2DView, MeasureCanvas, AnnotatedBox, RectRotateSensitivitySlider, FindTrackIDIndex, AudioPlayer, generatePointCloudBoxRects, SubAttributeList, };
26
+ export { AnnotationView, PointCloudAnnotationView, QuestionView, TextContent, LLMToolView, i18n, VideoTagTool, PredictTracking, SwitchCuboidBoxIn2DView, BatchSwitchConnectIn2DView, MeasureCanvas, AnnotatedBox, RectRotateSensitivitySlider, FindTrackIDIndex, AudioPlayer, generatePointCloudBoxRects, SubAttributeList, };
26
27
  export * from './constant';
27
28
  export * from './typeTem';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The component which provides the batch operation for connection/disconnection
3
+ */
4
+ import { FC } from 'react';
5
+ export declare enum EventBusEvent {
6
+ switchConnect = "batch:switch-connect"
7
+ }
8
+ declare const BatchSwitchConnectIn2DView: FC;
9
+ export default BatchSwitchConnectIn2DView;
@@ -0,0 +1 @@
1
+ export { default, EventBusEvent as BatchSwitchConnectionEventBusEvent } from './BatchSwitchConnectIn2DView';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),antd=require("antd"),reactI18next=require("react-i18next"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);exports.EventBusEvent=void 0,function(e){e.switchConnect="batch:switch-connect"}(exports.EventBusEvent||(exports.EventBusEvent={}));const BatchSwitchConnectIn2DView=()=>{const{cuboidBoxIn2DView:e}=React.useContext(PointCloudContext.PointCloudContext),{t}=reactI18next.useTranslation(),n=React.useCallback((o,r)=>{lbAnnotation.EventBus.emit(exports.EventBusEvent.switchConnect,r)},[]),c=React.useCallback(o=>{n(o,!0)},[n]),a=React.useCallback(o=>{n(o,!1)},[n]);return e?null:React__default.default.createElement("div",{style:{margin:"0 10px"}},t("2DImageBatch")," \xA0",React__default.default.createElement(antd.Popconfirm,{title:t("ConfirmToBatchConnect"),onConfirm:c,okText:t("Confirm"),cancelText:t("Cancel")},React__default.default.createElement(antd.Button,{size:"small"},t("Connect"))),"\xA0",React__default.default.createElement(antd.Popconfirm,{title:t("ConfirmToBatchDisconnect"),onConfirm:a,okText:t("Confirm"),cancelText:t("Cancel")},React__default.default.createElement(antd.Button,{size:"small"},t("Disconnect"))))};exports.default=BatchSwitchConnectIn2DView;
@@ -1 +1 @@
1
- import{useMemoizedFn as w,useLatest as Y}from"ahooks";import{Spin as Z}from"antd/es";import V,{useContext as ee,useRef as z,useState as te,useMemo as re,useEffect as d}from"react";import{connect as ne}from"react-redux";import{usePointCloudViews as oe}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as ie}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as le}from"../../store/annotation/map.js";import{LabelBeeContext as ce}from"../../store/ctx.js";import{PointCloud2DRectOperation as ue,ImgUtils as ae}from"@labelbee/lb-annotation";var se=Object.defineProperty,de=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,J=(c,i,l)=>i in c?se(c,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):c[i]=l,m=(c,i)=>{for(var l in i||(i={}))pe.call(i,l)&&J(c,l,i[l]);if(F)for(var l of F(i))me.call(i,l)&&J(c,l,i[l]);return c},R=(c,i)=>de(c,fe(i)),T=(c,i,l)=>new Promise((u,f)=>{var v=a=>{try{_(l.next(a))}catch(p){f(p)}},P=a=>{try{_(l.throw(a))}catch(p){f(p)}},_=a=>a.done?u(a.value):Promise.resolve(a.value).then(v,P);_((l=l.apply(c,i)).next())});const ve=c=>{var i,l;const{mappingData:u,size:f,config:v,checkMode:P,afterImgOnLoad:_,shouldExcludePointCloudBoxListUpdate:a}=c,p=(i=u==null?void 0:u.url)!=null?i:"",b=(l=u==null?void 0:u.fallbackUrl)!=null?l:"",{pointCloudBoxList:I,setPointCloudResult:S,defaultAttribute:h,rectList:C,addRectIn2DView:$,updateRectIn2DView:N,removeRectIn2DView:q}=ee(ie),{update2DViewRect:G,remove2DViewRect:H}=oe(),y=V.useRef(null),n=z(null),j=w(G),B=w(H),O=z(null),[K,E]=te(!0),x=re(()=>C==null?void 0:C.filter(e=>e.imageName===(u==null?void 0:u.path)),[u==null?void 0:u.path,C]),D=Y(u==null?void 0:u.path),U=e=>{const{boxID:o}=e;if(!a&&o){const t=j==null?void 0:j(e);O.current=t,S(t);return}N(e,!0)},A=e=>{D.current&&$(R(m({},e),{imageName:D.current}))},k=e=>{if(!a){const o=e.find(t=>t.boxID);if(o){const t=B==null?void 0:B(o);O.current=t,S(t),g();return}}q(e)},Q=w(()=>{let e=[];return I.forEach(o=>{const{rects:t=[],id:r,attribute:s,trackID:L}=o,M=t.find(X=>X.imageName===D.current),W=r+"_"+D.current;M&&(e=[...e,R(m({},M),{boxID:r,id:W,attribute:s,order:L})])}),e}),g=w(()=>{var e,o,t;const r=a?[]:Q(),s=(e=n.current)==null?void 0:e.selectedRectID;(o=n.current)==null||o.setResult([...r,...x]),s&&((t=n.current)==null||t.setSelectedRectID(s))});return d(()=>{if(y.current){const e=new ue({container:y.current,size:f,config:R(m({},v),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:P});return n.current=e,n.current.init(),n.current.on("updateDragResult",U),n.current.on("afterAddingDrawingRect",A),n.current.on("deleteSelectedRects",k),()=>{var o,t,r,s;(o=n.current)==null||o.unbind("updateDragResult",U),(t=n.current)==null||t.unbind("afterAddingDrawingRect",A),(r=n.current)==null||r.unbind("deleteSelectedRects",k),(s=n.current)==null||s.destroy()}}},[]),d(()=>{const e=t=>T(void 0,null,function*(){try{return yield ae.load(t)}catch(r){return console.error("Error loading image:",r),null}}),o=()=>T(void 0,null,function*(){var t;E(!0);let r=yield e(p);!r&&b&&(r=yield e(b)),r&&((t=n.current)==null||t.setImgNode(r),_(r)),E(!1)});n.current&&(p||b)&&o()},[p,b]),d(()=>{var e;(e=n.current)==null||e.setSize(f)},[f]),d(()=>{I!==O.current&&g()},[I]),d(()=>{var e,o,t;const r=x.find(s=>s.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,h),r&&N(R(m({},(t=n.current)==null?void 0:t.selectedRect),{attribute:h})),g()},[h]),d(()=>{g()},[x]),d(()=>{g()},[a]),d(()=>{var e,o,t,r;const s=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},L=R(m({},s),{attributeList:(t=v.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(L))},[v.attributeList]),V.createElement(Z,{spinning:K},V.createElement("div",{ref:y,style:m({position:"relative"},f)}))};var _e=ne(le,null,null,{context:ce})(ve);export{_e as default};
1
+ import{useMemoizedFn as P,useLatest as Y}from"ahooks";import{Spin as Z}from"antd/es";import N,{useContext as ee,useRef as z,useState as te,useMemo as ne,useEffect as d}from"react";import{connect as re}from"react-redux";import{usePointCloudViews as oe}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as ie}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as le}from"../../store/annotation/map.js";import{LabelBeeContext as ce}from"../../store/ctx.js";import{PointCloud2DRectOperation as ue,ImgUtils as ae}from"@labelbee/lb-annotation";var se=Object.defineProperty,de=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,J=(u,i,l)=>i in u?se(u,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[i]=l,m=(u,i)=>{for(var l in i||(i={}))pe.call(i,l)&&J(u,l,i[l]);if(F)for(var l of F(i))me.call(i,l)&&J(u,l,i[l]);return u},R=(u,i)=>de(u,fe(i)),T=(u,i,l)=>new Promise((a,f)=>{var v=s=>{try{_(l.next(s))}catch(p){f(p)}},h=s=>{try{_(l.throw(s))}catch(p){f(p)}},_=s=>s.done?a(s.value):Promise.resolve(s.value).then(v,h);_((l=l.apply(u,i)).next())});const ve=u=>{var i,l;const{mappingData:a,size:f,config:v,checkMode:h,afterImgOnLoad:_,shouldExcludePointCloudBoxListUpdate:s}=u,p=(i=a==null?void 0:a.url)!=null?i:"",D=(l=a==null?void 0:a.fallbackUrl)!=null?l:"",{pointCloudBoxList:x,setPointCloudResult:C,defaultAttribute:y,rectList:O,addRectIn2DView:$,updateRectIn2DView:E,removeRectIn2DView:q}=ee(ie),{update2DViewRect:G,remove2DViewRect:H}=oe(),L=N.useRef(null),r=z(null),j=P(G),b=P(H),w=z(null),[K,B]=te(!0),V=ne(()=>O==null?void 0:O.filter(e=>e.imageName===(a==null?void 0:a.path)),[a==null?void 0:a.path,O]),I=Y(a==null?void 0:a.path),U=e=>{const{boxID:o}=e;if(!s&&o){const t=j==null?void 0:j(e);w.current=t,C(t);return}E(e,!0)},A=e=>{I.current&&$(R(m({},e),{imageName:I.current}))},k=e=>{if(e.length===0)return;if(!s){const t=e.find(n=>n.boxID);if(t){const n=b==null?void 0:b(t);w.current=n,C(n),g();return}}const o=e.find(t=>t.extId);if(o){const{imageName:t,extId:n}=o,c=b==null?void 0:b({boxID:n,imageName:t});w.current=c,C(c)}q(e)},Q=P(()=>{let e=[];return x.forEach(o=>{const{rects:t=[],id:n,attribute:c,trackID:S}=o,M=t.find(X=>X.imageName===I.current),W=n+"_"+I.current;M&&(e=[...e,R(m({},M),{boxID:n,id:W,attribute:c,order:S})])}),e}),g=P(()=>{var e,o,t;const n=s?[]:Q(),c=(e=r.current)==null?void 0:e.selectedRectID;(o=r.current)==null||o.setResult([...n,...V]),c&&((t=r.current)==null||t.setSelectedRectID(c))});return d(()=>{if(L.current){const e=new ue({container:L.current,size:f,config:R(m({},v),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:h});return r.current=e,r.current.init(),r.current.on("updateDragResult",U),r.current.on("afterAddingDrawingRect",A),r.current.on("deleteSelectedRects",k),()=>{var o,t,n,c;(o=r.current)==null||o.unbind("updateDragResult",U),(t=r.current)==null||t.unbind("afterAddingDrawingRect",A),(n=r.current)==null||n.unbind("deleteSelectedRects",k),(c=r.current)==null||c.destroy()}}},[]),d(()=>{const e=t=>T(void 0,null,function*(){try{return yield ae.load(t)}catch(n){return console.error("Error loading image:",n),null}}),o=()=>T(void 0,null,function*(){var t;B(!0);let n=yield e(p);!n&&D&&(n=yield e(D)),n&&((t=r.current)==null||t.setImgNode(n),_(n)),B(!1)});r.current&&(p||D)&&o()},[p,D]),d(()=>{var e;(e=r.current)==null||e.setSize(f)},[f]),d(()=>{x!==w.current&&g()},[x]),d(()=>{var e,o,t;const n=V.find(c=>c.id===r.current.selectedRectID);(o=(e=r.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,y),n&&E(R(m({},(t=r.current)==null?void 0:t.selectedRect),{attribute:y})),g()},[y]),d(()=>{g()},[V]),d(()=>{g()},[s]),d(()=>{var e,o,t,n;const c=(o=(e=r.current)==null?void 0:e.config)!=null?o:{},S=R(m({},c),{attributeList:(t=v.attributeList)!=null?t:[]});(n=r.current)==null||n.setConfig(JSON.stringify(S))},[v.attributeList]),N.createElement(Z,{spinning:K},N.createElement("div",{ref:L,style:m({position:"relative"},f)}))};var _e=re(le,null,null,{context:ce})(ve);export{_e as default};
@@ -1 +1 @@
1
- import{getClassName as U}from"../../utils/dom.js";import l,{useRef as j,useState as A,useContext as F,useMemo as M,useCallback as T,useEffect as q}from"react";import w from"../AnnotationView/index.js";import G from"../../hooks/useSize.js";import{useSingleBox as J}from"./hooks/useSingleBox.js";import{useHighlight as K}from"./hooks/useHighlight.js";import Q from"./components/HighlightVisible/index.js";import{PointCloudContext as W}from"./PointCloudContext.js";import X from"./hooks/useDataLinkSwitch.js";import Y from"../pointCloud2DRectOperationView/index.js";var Z=(o,r,e)=>new Promise((s,c)=>{var f=t=>{try{i(e.next(t))}catch(n){c(n)}},u=t=>{try{i(e.throw(t))}catch(n){c(n)}},i=t=>t.done?s(t.value):Promise.resolve(t.value).then(f,u);i((e=e.apply(o,r)).next())});const $=({view2dData:o,setSelectedID:r,currentData:e,showEnlarge:s,checkMode:c=!1,measureVisible:f})=>{var u,i;const t=j(null),n=j(),{selectedBox:d}=J(),g=G(t),{url:k,fallbackUrl:x,calib:b,path:y}=o,{toggle2dVisible:_,isHighlightVisible:v}=K({currentData:e}),[z,C]=A(!1),{cuboidBoxIn2DView:p,cacheImageNodeSize:B}=F(W),I=!o,O=M(()=>({zIndex:s?-1:101,is2DView:!p,imageName:o.path}),[s,p,o.path]),{rendered:R,isLinking:E}=X(O),L=m=>{h(),B({path:y,imgNode:m})},h=T(()=>{var m,S;const V=(m=n.current)==null?void 0:m.toolInstance;if(r(""),!d||!V)return;const a=o.annotations.find(N=>N.annotation.id===d.info.id);let P="";a&&((S=a==null?void 0:a.annotation.pointList)==null?void 0:S.length)>0&&(V.focusPositionByPointList(a==null?void 0:a.annotation.pointList),P=d.info.id,r(P))},[d,n.current,o.annotations]);q(()=>{h()},[h]);const H=()=>Z(void 0,null,function*(){C(!0),yield _(k,x!=null?x:"",b),C(!1)});return l.createElement("div",{className:U("point-cloud-2d-image"),ref:t},p?l.createElement(w,{src:(u=o==null?void 0:o.url)!=null?u:"",fallbackSrc:(i=o==null?void 0:o.fallbackUrl)!=null?i:"",annotations:o.annotations,size:g,ref:n,globalStyle:{display:I?"none":"block"},afterImgOnLoad:L,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:f}):l.createElement(l.Fragment,null,l.createElement(Y,{shouldExcludePointCloudBoxListUpdate:!E,mappingData:o,size:g,checkMode:c,afterImgOnLoad:L}),R),b&&l.createElement(Q,{visible:v(k),onClick:H,loading:z,style:{position:"absolute",right:16,top:16,zIndex:s?-1:101}}))};export{$ as default};
1
+ import{getClassName as U}from"../../utils/dom.js";import l,{useRef as j,useState as A,useContext as F,useMemo as T,useCallback as q,useEffect as w}from"react";import G from"../AnnotationView/index.js";import J from"../../hooks/useSize.js";import{useSingleBox as K}from"./hooks/useSingleBox.js";import{useHighlight as M}from"./hooks/useHighlight.js";import Q from"./components/HighlightVisible/index.js";import{PointCloudContext as W}from"./PointCloudContext.js";import X from"./hooks/useDataLinkSwitch.js";import Y from"../pointCloud2DRectOperationView/index.js";var Z=(t,c,e)=>new Promise((s,a)=>{var f=o=>{try{i(e.next(o))}catch(n){a(n)}},u=o=>{try{i(e.throw(o))}catch(n){a(n)}},i=o=>o.done?s(o.value):Promise.resolve(o.value).then(f,u);i((e=e.apply(t,c)).next())});const $=({view2dData:t,setSelectedID:c,currentData:e,showEnlarge:s,checkMode:a=!1,measureVisible:f})=>{var u,i;const o=j(null),n=j(),{selectedBox:d}=K(),g=J(o),{url:x,fallbackUrl:b,calib:k,path:y}=t,{toggle2dVisible:_,isHighlightVisible:v}=M({currentData:e}),[z,C]=A(!1),{cuboidBoxIn2DView:p,cacheImageNodeSize:B}=F(W),I=!t,O=T(()=>({zIndex:s?-1:101,is2DView:!p,imageName:t.path}),[s,p,t.path]),{rendered:R,isLinking:E}=X(O),L=m=>{h(),B({path:y,imgNode:m})},h=q(()=>{var m,S;const V=(m=n.current)==null?void 0:m.toolInstance;if(c(""),!d||!V)return;const r=t.annotations.find(N=>N.annotation.id===d.info.id);let P="";r&&((S=r==null?void 0:r.annotation.pointList)==null?void 0:S.length)>0&&(V.focusPositionByPointList(r==null?void 0:r.annotation.pointList),P=d.info.id,c(P))},[d,n.current,t.annotations]);w(()=>{h()},[h]);const H=()=>Z(void 0,null,function*(){C(!0),yield _(x,b!=null?b:"",k),C(!1)});return l.createElement("div",{className:U("point-cloud-2d-image"),ref:o},p?l.createElement(G,{src:(u=t==null?void 0:t.url)!=null?u:"",fallbackSrc:(i=t==null?void 0:t.fallbackUrl)!=null?i:"",annotations:t.annotations,size:g,ref:n,globalStyle:{display:I?"none":"block"},afterImgOnLoad:L,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:f}):l.createElement(l.Fragment,null,l.createElement(Y,{shouldExcludePointCloudBoxListUpdate:!E,mappingData:t,size:g,checkMode:a,afterImgOnLoad:L}),!a&&R),k&&l.createElement(Q,{visible:v(x),onClick:H,loading:z,style:{position:"absolute",right:16,top:16,zIndex:s?-1:101}}))};export{$ as default};
@@ -1 +1 @@
1
- import{EPointCloudPattern as J}from"@labelbee/lb-utils";import ht,{useState as o,useRef as Jt,useMemo as vt,useCallback as K,useEffect as Q}from"react";import{ActionsHistory as It,EToolName as U,uuid as Kt}from"@labelbee/lb-annotation";import{useDispatch as Qt}from"../../store/ctx.js";import{ChangeSave as Ut}from"../../store/annotation/actionCreators.js";import Wt from"../../store/annotatedBox/index.js";import Pt from"lodash";var Xt=Object.defineProperty,Yt=Object.defineProperties,$t=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,bt=(l,e,a)=>e in l?Xt(l,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[e]=a,N=(l,e)=>{for(var a in e||(e={}))te.call(e,a)&&bt(l,a,e[a]);if(yt)for(var a of yt(e))ee.call(e,a)&&bt(l,a,e[a]);return l},St=(l,e)=>Yt(l,$t(e)),ne=(l,e,a)=>new Promise((L,R)=>{var A=f=>{try{b(a.next(f))}catch(S){R(S)}},j=f=>{try{b(a.throw(f))}catch(S){R(S)}},b=f=>f.done?L(f.value):Promise.resolve(f.value).then(A,j);b((a=a.apply(l,e)).next())});const Ct=l=>Pt.pick(l,["id","attribute","width","height","x","y","imageName"]),wt=ht.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new It,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:U.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:J.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:l=>{},imageSizes:{},cacheImageNodeSize:()=>{},unlinkImageItems:[],addRectFromPointCloudBoxByImageName:l=>!1,removeRectBySpecifyId:(l,e,a)=>!1,removeRectByPointCloudBoxId:l=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{}}),ie=({children:l})=>{const[e,a]=o([]),[L,R]=o([]),[A,j]=o([]),[b,f]=o([]),[S,Lt]=o([]),[I,F]=o([]),[_,k]=o([]),[W,Dt]=o(!0),[X,xt]=o(2),[Y,Rt]=o(!0),[$,At]=o(1),[m,tt]=o(),[et,nt]=o(),[it,ot]=o(),[u,st]=o(),[rt,_t]=o(""),[z,Vt]=o(U.Rect),Bt=Jt(new It).current,[g,E]=o([]),[lt,Ot]=o(""),[G,Ht]=o(J.Detection),[D,at]=o(void 0),[M,Nt]=o([]),[T,jt]=o([]),h=Wt(),[ct,Ft]=o({}),kt=Qt(),zt=s=>{const{imgNode:r,path:i}=s;i&&r&&Ft(p=>St(N({},p),{[i]:{width:r.width,height:r.height}}))},dt=vt(()=>I.length===1?I[0]:"",[I]),V=K((s,r,i="extId")=>{const p=i||"id",d=new Set(r);return f(v=>{let C=!1;const w=v.filter(O=>{const Z=O[p],H=d.has(Z)?O.imageName!==s:!0;return H||(C=!0),H});return C?w:v}),!0},[]),ut=K(s=>{const r=e.map(i=>i.id);return V(s,r,"extId")},[e,V]),pt=K(s=>{if(!s)return!1;const r=e.filter(i=>Array.isArray(i.rects)).map(i=>{const{id:p,attribute:d,trackID:v}=i,C=i.rects.find(w=>w.imageName===s);if(C){const w=Pt.pick(C,["width","height","x","y","imageName"]);return St(N({},w),{id:Kt(),attribute:d,order:v,extId:p,lineDash:[]})}return null}).filter(i=>i!==null);return r.length?(f(i=>{const p=new Set(i.filter(v=>s===v.imageName).map(v=>v.extId)),d=r.filter(v=>p.has(v.extId)===!1);return d.length?[...i,...d]:i}),!0):!1},[e]),B=vt(()=>{const s=e.find(t=>t.id===dt),r=t=>{const n=e.concat(t);return a(n),n},i=t=>{const n=L.concat(t);return R(n),n},p=t=>{Dt(t!==!1)},d=t=>{t===void 0&&F([]),typeof t=="string"&&F([t]),Array.isArray(t)&&F(Array.from(new Set(t)))},v=t=>{I.includes(t)?d(I.filter(n=>n!==t)):d([...I,t])},C=t=>{const n=Ct(t);f(c=>[...c,n])},w=(t,n=!1)=>{const c=Ct(t);f(y=>y.map(P=>P.id===t.id?n?N(N({},P),c):c:P))},O=t=>{f(n=>n.filter(c=>!t.find(y=>y.id===c.id)))},Z=t=>{_.includes(t)?k([]):k([t])},H=()=>{if(z===U.Rect){const t=e.map(n=>n.id);d(t),m==null||m.pointCloud2dOperation.setSelectedIDs(t)}},Gt=t=>{d(e.filter(n=>n.attribute===t).map(n=>n.id))},q=e.filter(t=>!g.includes(t.attribute)),ft=L.filter(t=>!g.includes(t.attribute)),mt=S.filter(t=>t.attribute&&!g.includes(t.attribute)),Mt=t=>{if(g.includes(t))E(g.filter(n=>n!==t));else{const n=g.concat(t);E(n)}},Tt=(()=>{const t=q.map(c=>c.id),n=new Set(t);return b.filter(c=>c.extId&&n.has(c.extId)).map(c=>c.imageName)})(),Zt=(t=q,n=A,c=ft,y=mt,P=M)=>{var x;u==null||u.clearAllBox(),u==null||u.clearAllSphere(),m==null||m.updatePolygonList(t,n),m==null||m.updatePointList(c),m==null||m.updateLineList(y),u==null||u.generateBoxes(t),u==null||u.generateSpheres(c),(x=D==null?void 0:D.store)==null||x.updateCurrentSegment(P),gt(t)},qt=()=>{tt(void 0),nt(void 0),ot(void 0),st(void 0)},gt=(t,n)=>ne(void 0,null,function*(){var c;if(!u)return;const y=u.pointCloudObject;if(!!y)try{const P=yield u.getHighlightIndexByMappingImgList({mappingImgList:n!=null?n:T,points:y.geometry.attributes.position.array}),x=yield u==null?void 0:u.highlightOriginPointCloud(t,P);return x&&((c=m==null?void 0:m.pointCloudInstance)==null||c.updateColor(x)),x}catch(P){console.error(P)}});return{selectedID:dt,pointCloudBoxList:e,pointCloudSphereList:L,displayPointCloudList:q,displaySphereList:ft,displayLineList:mt,selectedIDs:I,setPointCloudResult:a,setSelectedIDs:d,addPointCloudBox:r,addPointCloudSphere:i,setPointCloudSphereList:R,valid:W,selectedPointCloudBox:s,setPointCloudValid:p,addSelectedID:v,addHighlightID:Z,selectedAllBoxes:H,topViewInstance:m,setTopViewInstance:tt,sideViewInstance:et,setSideViewInstance:nt,backViewInstance:it,setBackViewInstance:ot,mainViewInstance:u,setMainViewInstance:st,polygonList:A,setPolygonList:j,rectList:b,setRectList:f,addRectIn2DView:C,removeRectIn2DView:O,updateRectIn2DView:w,lineList:S,setLineList:Lt,zoom:$,setZoom:At,history:Bt,toggleAttributesVisible:Mt,hideAttributes:g,setHideAttributes:E,reRender:Zt,attrPanelLayout:lt,setAttrPanelLayout:Ot,syncAllViewPointCloudColor:gt,defaultAttribute:rt,setDefaultAttribute:_t,pointCloudPattern:z,setPointCloudPattern:Vt,selectSpecAttr:Gt,globalPattern:G,setGlobalPattern:t=>{G!==t&&(kt(Ut),Ht(t),t===J.Detection&&at(void 0))},ptSegmentInstance:D,setPtSegmentInstance:at,segmentation:M,setSegmentation:Nt,clearAllDetectionInstance:qt,highlight2DDataList:T,setHighlight2DDataList:jt,cuboidBoxIn2DView:Y,setCuboidBoxIn2DView:Rt,imageSizes:ct,cacheImageNodeSize:zt,highlightIDs:_,setHighlightIDs:k,unlinkImageItems:Tt,removeRectByPointCloudBoxId:ut,removeRectBySpecifyId:V,addRectFromPointCloudBoxByImageName:pt,rectRotateSensitivity:X,setRectRotateSensitivity:xt}},[W,I,e,L,A,S,b,m,et,it,u,$,g,lt,rt,z,G,D,M,T,Y,ct,_,ut,V,pt,X]);Q(()=>{var s,r,i;(s=h==null?void 0:h.setPointCloudBoxList)==null||s.call(h,e),(r=h==null?void 0:h.setHighlightIDs)==null||r.call(h,_),(i=h==null?void 0:h.setSelectedIDs)==null||i.call(h,I)},[e,I,_]),Q(()=>{var s;(s=h==null?void 0:h.setPtCtx)==null||s.call(h,B)},[B]);const Et=()=>{const s=e.filter(d=>g.includes(d.attribute)),{setSelectedIDs:r,reRender:i}=B,p=s.map(d=>d.id);p.length>0&&r(I.filter(d=>!p.includes(d))),i()};return Q(()=>{var s,r,i,p;Et(),(r=(s=m==null?void 0:m.toolInstance)==null?void 0:s.setHiddenAttributes)==null||r.call(s,g),(p=(i=D==null?void 0:D.store)==null?void 0:i.setHiddenAttributes)==null||p.call(i,g)},[g]),ht.createElement(wt.Provider,{value:B},l)};export{wt as PointCloudContext,ie as PointCloudProvider};
1
+ import{EPointCloudPattern as q}from"@labelbee/lb-utils";import Pt,{useState as r,useRef as Kt,useMemo as H,useCallback as J,useEffect as K}from"react";import{ActionsHistory as yt,EToolName as Q,uuid as Qt}from"@labelbee/lb-annotation";import{useDispatch as Ut}from"../../store/ctx.js";import{ChangeSave as Xt}from"../../store/annotation/actionCreators.js";import Yt from"../../store/annotatedBox/index.js";import wt from"lodash";import{addMapIndirectWeakSetItem as bt}from"./utils/map.js";var $t=Object.defineProperty,te=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,Ct=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,St=(a,n,c)=>n in a?$t(a,n,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[n]=c,M=(a,n)=>{for(var c in n||(n={}))ne.call(n,c)&&St(a,c,n[c]);if(Ct)for(var c of Ct(n))ie.call(n,c)&&St(a,c,n[c]);return a},Lt=(a,n)=>te(a,ee(n)),oe=(a,n,c)=>new Promise((L,R)=>{var A=m=>{try{P(c.next(m))}catch(b){R(b)}},j=m=>{try{P(c.throw(m))}catch(b){R(b)}},P=m=>m.done?L(m.value):Promise.resolve(m.value).then(A,j);P((c=c.apply(a,n)).next())});const Dt=a=>wt.pick(a,["id","attribute","width","height","x","y","imageName"]),xt=Pt.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new yt,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:Q.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:q.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:a=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:a=>!1,removeRectBySpecifyId:(a,n,c)=>!1,removeRectByPointCloudBoxId:a=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map}),se=({children:a})=>{const[n,c]=r([]),[L,R]=r([]),[A,j]=r([]),[P,m]=r([]),[b,Rt]=r([]),[I,k]=r([]),[_,F]=r([]),[U,At]=r(!0),[X,_t]=r(2),[Y,Bt]=r(!0),[$,Vt]=r(1),[f,tt]=r(),[et,nt]=r(),[it,ot]=r(),[u,st]=r(),[rt,Nt]=r(""),[z,Ot]=r(Q.Rect),Ht=Kt(new yt).current,[g,E]=r([]),[lt,Mt]=r(""),[G,jt]=r(q.Detection),[D,at]=r(void 0),[T,kt]=r([]),[Z,Ft]=r([]),h=Yt(),[ct,zt]=r({}),Et=Ut(),Gt=i=>{const{imgNode:o,path:e}=i;e&&o&&zt(d=>Lt(M({},d),{[e]:{width:o.width,height:o.height}}))},dt=H(()=>I.length===1?I[0]:"",[I]),B=J((i,o,e="extId")=>{const d=e||"id",l=new Set(o);return m(p=>{let C=!1;const S=p.filter(N=>{const W=N[d],O=l.has(W)?N.imageName!==i:!0;return O||(C=!0),O});return C?S:p}),!0},[]),ut=J(i=>{const o=n.map(e=>e.id);return B(i,o,"extId")},[n,B]),pt=J(i=>{if(!i)return!1;const o=n.filter(e=>Array.isArray(e.rects)).map(e=>{const{id:d,attribute:l,trackID:p}=e,C=e.rects.find(S=>S.imageName===i);if(C){const S=wt.pick(C,["width","height","x","y","imageName"]);return Lt(M({},S),{id:Qt(),attribute:l,order:p,extId:d,lineDash:[]})}return null}).filter(e=>e!==null);return o.length?(m(e=>{const d=new Set(e.filter(p=>i===p.imageName).map(p=>p.extId)),l=o.filter(p=>d.has(p.extId)===!1);return l.length?[...e,...l]:e}),!0):!1},[n]),mt=H(()=>n.filter(o=>Array.isArray(o.rects)&&o.rects.length>0).reduce((o,e)=>{var d;return(d=e.rects)==null||d.forEach(l=>{const{imageName:p}=l;if(!p){console.warn("Missing image name"),console.trace(l,e);return}bt(o,p,e.id,e)}),o},new Map),[n]),ft=H(()=>P.filter(i=>i.extId!==void 0&&i.id!==void 0).reduce((i,o)=>{const e=o.imageName;return e?(bt(i,e,o.extId,o),i):(console.warn("missing image name"),console.log(o,P),i)},new Map),[P]),V=H(()=>{const i=n.find(t=>t.id===dt),o=t=>{const s=n.concat(t);return c(s),s},e=t=>{const s=L.concat(t);return R(s),s},d=t=>{At(t!==!1)},l=t=>{t===void 0&&k([]),typeof t=="string"&&k([t]),Array.isArray(t)&&k(Array.from(new Set(t)))},p=t=>{I.includes(t)?l(I.filter(s=>s!==t)):l([...I,t])},C=t=>{const s=Dt(t);m(v=>[...v,s])},S=(t,s=!1)=>{const v=Dt(t);m(w=>w.map(y=>y.id===t.id?s?M(M({},y),v):v:y))},N=t=>{m(s=>s.filter(v=>!t.find(w=>w.id===v.id)))},W=t=>{_.includes(t)?F([]):F([t])},O=()=>{if(z===Q.Rect){const t=n.map(s=>s.id);l(t),f==null||f.pointCloud2dOperation.setSelectedIDs(t)}},Zt=t=>{l(n.filter(s=>s.attribute===t).map(s=>s.id))},gt=n.filter(t=>!g.includes(t.attribute)),ht=L.filter(t=>!g.includes(t.attribute)),vt=b.filter(t=>t.attribute&&!g.includes(t.attribute)),Wt=t=>{if(g.includes(t))E(g.filter(s=>s!==t));else{const s=g.concat(t);E(s)}},qt=(t=gt,s=A,v=ht,w=vt,y=T)=>{var x;u==null||u.clearAllBox(),u==null||u.clearAllSphere(),f==null||f.updatePolygonList(t,s),f==null||f.updatePointList(v),f==null||f.updateLineList(w),u==null||u.generateBoxes(t),u==null||u.generateSpheres(v),(x=D==null?void 0:D.store)==null||x.updateCurrentSegment(y),It(t)},Jt=()=>{tt(void 0),nt(void 0),ot(void 0),st(void 0)},It=(t,s)=>oe(void 0,null,function*(){var v;if(!u)return;const w=u.pointCloudObject;if(!!w)try{const y=yield u.getHighlightIndexByMappingImgList({mappingImgList:s!=null?s:Z,points:w.geometry.attributes.position.array}),x=yield u==null?void 0:u.highlightOriginPointCloud(t,y);return x&&((v=f==null?void 0:f.pointCloudInstance)==null||v.updateColor(x)),x}catch(y){console.error(y)}});return{selectedID:dt,pointCloudBoxList:n,pointCloudSphereList:L,displayPointCloudList:gt,displaySphereList:ht,displayLineList:vt,selectedIDs:I,setPointCloudResult:c,setSelectedIDs:l,addPointCloudBox:o,addPointCloudSphere:e,setPointCloudSphereList:R,valid:U,selectedPointCloudBox:i,setPointCloudValid:d,addSelectedID:p,addHighlightID:W,selectedAllBoxes:O,topViewInstance:f,setTopViewInstance:tt,sideViewInstance:et,setSideViewInstance:nt,backViewInstance:it,setBackViewInstance:ot,mainViewInstance:u,setMainViewInstance:st,polygonList:A,setPolygonList:j,rectList:P,setRectList:m,addRectIn2DView:C,removeRectIn2DView:N,updateRectIn2DView:S,lineList:b,setLineList:Rt,zoom:$,setZoom:Vt,history:Ht,toggleAttributesVisible:Wt,hideAttributes:g,setHideAttributes:E,reRender:qt,attrPanelLayout:lt,setAttrPanelLayout:Mt,syncAllViewPointCloudColor:It,defaultAttribute:rt,setDefaultAttribute:Nt,pointCloudPattern:z,setPointCloudPattern:Ot,selectSpecAttr:Zt,globalPattern:G,setGlobalPattern:t=>{G!==t&&(Et(Xt),jt(t),t===q.Detection&&at(void 0))},ptSegmentInstance:D,setPtSegmentInstance:at,segmentation:T,setSegmentation:kt,clearAllDetectionInstance:Jt,highlight2DDataList:Z,setHighlight2DDataList:Ft,cuboidBoxIn2DView:Y,setCuboidBoxIn2DView:Bt,imageSizes:ct,cacheImageNodeSize:Gt,highlightIDs:_,setHighlightIDs:F,removeRectByPointCloudBoxId:ut,removeRectBySpecifyId:B,addRectFromPointCloudBoxByImageName:pt,rectRotateSensitivity:X,setRectRotateSensitivity:_t,imageNamePointCloudBoxMap:mt,linkageImageNameRectMap:ft}},[U,I,n,L,A,b,P,f,et,it,u,$,g,lt,rt,z,G,D,T,Z,Y,ct,_,ut,B,pt,X,mt,ft]);K(()=>{var i,o,e;(i=h==null?void 0:h.setPointCloudBoxList)==null||i.call(h,n),(o=h==null?void 0:h.setHighlightIDs)==null||o.call(h,_),(e=h==null?void 0:h.setSelectedIDs)==null||e.call(h,I)},[n,I,_]),K(()=>{var i;(i=h==null?void 0:h.setPtCtx)==null||i.call(h,V)},[V]);const Tt=()=>{const i=n.filter(l=>g.includes(l.attribute)),{setSelectedIDs:o,reRender:e}=V,d=i.map(l=>l.id);d.length>0&&o(I.filter(l=>!d.includes(l))),e()};return K(()=>{var i,o,e,d;Tt(),(o=(i=f==null?void 0:f.toolInstance)==null?void 0:i.setHiddenAttributes)==null||o.call(i,g),(d=(e=D==null?void 0:D.store)==null?void 0:e.setHiddenAttributes)==null||d.call(e,g)},[g]),Pt.createElement(xt.Provider,{value:V},a)};export{xt as PointCloudContext,se as PointCloudProvider};
@@ -1 +1 @@
1
- import{PointCloudContext as te}from"./PointCloudContext.js";import{useRotate as oe}from"./hooks/useRotate.js";import{useRotateEdge as re}from"./hooks/useRotateEdge.js";import{useBoxes as ne}from"./hooks/useBoxes.js";import{useSingleBox as se}from"./hooks/useSingleBox.js";import{useSphere as ie}from"./hooks/useSphere.js";import{useContext as ae,useEffect as c}from"react";import{EPointCloudName as ue,CommonToolUtils as le,AttributeUtils as de,EToolName as P,cTool as ce}from"@labelbee/lb-annotation";import{message as h}from"antd";import{connect as pe}from"react-redux";import{a2MapStateToProps as me}from"../../store/annotation/map.js";import{useStatus as ve}from"./hooks/useStatus.js";import{usePointCloudViews as be}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as Pe,useDispatch as ye}from"../../store/ctx.js";import{useHistory as fe}from"./hooks/useHistory.js";import{useAttribute as we}from"./hooks/useAttribute.js";import{useConfig as Ce}from"./hooks/useConfig.js";import{usePolygon as ge}from"./hooks/usePolygon.js";import{useLine as he}from"./hooks/useLine.js";import{useTranslation as Se}from"react-i18next";import{PreDataProcess as ke}from"../../store/annotation/actionCreators.js";var xe=Object.defineProperty,_e=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,I=(l,r,u)=>r in l?xe(l,r,{enumerable:!0,configurable:!0,writable:!0,value:u}):l[r]=u,y=(l,r)=>{for(var u in r||(r={}))Le.call(r,u)&&I(l,u,r[u]);if(E)for(var u of E(r))Be.call(r,u)&&I(l,u,r[u]);return l},f=(l,r)=>_e(l,Ve(r));const{EPolygonPattern:Oe}=ce,je=({currentData:l,config:r,checkMode:u,configString:D,imgIndex:S,toolInstanceRef:i})=>{const t=ae(te),{changeSelectedBoxValid:T,selectNextBox:N,selectPrevBox:H,updateSelectedBox:k,deleteSelectedPointCloudBoxAndPolygon:K}=se(),{selectedSphere:w,updatePointCloudSphere:U}=ie(),{clearAllResult:C,updatePointCloudPattern:R}=ve(),{copySelectedBoxes:z,pasteSelectedBoxes:F,copiedBoxes:q}=ne({config:r}),{updateRotate:x}=oe({currentData:l}),{updateRotateEdge:G}=re({currentData:l}),{updatePointCloudData:v,topViewSelectedChanged:_}=be(),{redo:V,undo:L,pushHistoryWithList:M,pushHistoryUnderUpdatePolygon:W,pushHistoryUnderUpdateLine:Y}=fe(),$=ye(),{syncThreeViewsAttribute:B}=we(),{syncAllViewsConfig:J,reRenderTopViewRange:Q}=Ce(),{selectedPolygon:O}=ge(),{selectedLine:j}=he(),{t:g}=Se(),b=e=>{var o;const{topViewInstance:n}=t;!n||(o=n.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(e)},X=(e,o)=>{var n,a;const{topViewInstance:d,mainViewInstance:s}=t;if(!d)return;const{pointCloud2dOperation:p}=d;switch(e){case"q":{x(t.rectRotateSensitivity);break}case"e":x(-Number(t.rectRotateSensitivity));break;case"g":G(-90);break;case"u":{const m=p.pattern===Oe.Normal?P.Rect:P.Polygon;R(m);const ee={[P.Polygon]:g("PolygonPattern"),[P.Rect]:g("RectPattern")};h.success(g("ChangePatternMsg",{pattern:ee[m]})),p.clearActiveStatus(),p.clearDrawingStatus()}break;case"+":s==null||s.updatePointSize({zoomIn:!0});break;case"-":s==null||s.updatePointSize({zoomIn:!1});break;case"v":t.setPointCloudValid(!t.valid);break;case"tab":if(o.shiftKey){H();break}N(),o.preventDefault();break;case"f":T();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":K();break;default:{if(((n=r.attributeList)==null?void 0:n.length)>0){const m=de.getAttributeByKeycode(o.keyCode,r.attributeList);m!==void 0&&((a=i.current)==null||a.setDefaultAttribute(m))}return}}},Z=(e,o)=>{switch(e){case"c":z();break;case"v":F();break;case"a":o.preventDefault(),t.selectedAllBoxes();break;case"z":{o.shiftKey?V():L();break}}},A=e=>{if(!le.hotkeyFilter(e)||u===!0)return;const o=e.key.toLocaleLowerCase();if(e.ctrlKey){Z(o,e);return}X(o,e)};return c(()=>{const{topViewInstance:e}=t;if(!!e)return window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A)}},[t,q,r,t.pointCloudBoxList,t.polygonList]),c(()=>{J(r)},[D]),c(()=>{(r==null?void 0:r.radius)&&Q(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{v==null||v()},[S,t.mainViewInstance]),c(()=>{t.setHideAttributes([])},[S]),c(()=>{i.current.setDefaultAttribute=e=>{var o,n,a,d;B(e);const s=t.selectedPointCloudBox;if(s){s.attribute=e;const p=$(ke({tool:ue.PointCloud,dataList:[s],stepConfig:r,action:"viewUpdateBox"}));s.valid=p[0].valid;const m=k(s);(a=(n=(o=t==null?void 0:t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:n.setPolygonValidAndRender)==null||a.call(n,s.id,!0,s.valid),t.mainViewInstance&&_({newSelectedBox:s,newPointCloudList:m})}if(O&&W(f(y({},O),{attribute:e})),j&&Y(f(y({},j),{attribute:e})),w){const p=U(f(y({},w),{attribute:e}));t.mainViewInstance&&((d=t.mainViewInstance)==null||d.generateSpheres(p),_({newSelectedSphere:w,newSphereList:p}))}},i.current.setSubAttribute=(e,o)=>{var n;const a=t.selectedPointCloudBox;if(a){const d=(n=a==null?void 0:a.subAttribute)!=null?n:{};a.subAttribute=f(y({},d),{[e]:o}),k(a)}},i.current.clearResult=()=>{C==null||C()},i.current.redo=()=>{V()},i.current.undo=()=>{L()},i.current.setValid=e=>{i.current.valid=e,setTimeout(()=>{t.setPointCloudValid(e),e===!1&&C()})},i.current.setForbidOperation=e=>{var o,n;(n=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||n.setForbidOperation(e),e===!0&&t.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=e=>{var o,n;(n=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||n.setShowDefaultCursor(e)},i.current.asyncData=e=>{setTimeout(()=>{v==null||v(e)})}},[t.pointCloudBoxList,t.pointCloudSphereList,t.selectedID,t.valid,t.polygonList,t.lineList,t.mainViewInstance,t.ptSegmentInstance]),c(()=>{i.current.updateSegmentTool=e=>{var o;(o=t.ptSegmentInstance)==null||o.emit(e)},i.current.segmentInstance=t.ptSegmentInstance},[t.ptSegmentInstance]),c(()=>{i.current.history={pushHistory:e=>{M({pointCloudBoxList:e})},initRecord:()=>{}}},[]),c(()=>{var e;const o=(e=t.topViewInstance)==null?void 0:e.toolInstance;if(!o||u)return;const n=s=>{B(s)},a=s=>{h.error(s)},d=s=>{h.info(s)};return o.on("syncAttribute",n),o.on("messageError",a),o.on("messageInfo",d),()=>{o.unbind("syncAttribute",n),o.unbind("messageError",a),o.unbind("messageInfo",d)}},[t.topViewInstance]),null};var Ae=pe(me,null,null,{context:Pe})(je);export{Ae as default};
1
+ import{PointCloudContext as oe}from"./PointCloudContext.js";import{useRotate as re}from"./hooks/useRotate.js";import{useRotateEdge as se}from"./hooks/useRotateEdge.js";import{useBoxes as ne}from"./hooks/useBoxes.js";import{useSingleBox as ie}from"./hooks/useSingleBox.js";import{useSphere as ae}from"./hooks/useSphere.js";import{useContext as ue,useEffect as c}from"react";import{EPointCloudName as le,CommonToolUtils as de,AttributeUtils as ce,EToolName as P,cTool as pe}from"@labelbee/lb-annotation";import{message as g}from"antd";import{connect as me}from"react-redux";import{a2MapStateToProps as ve}from"../../store/annotation/map.js";import{useStatus as be}from"./hooks/useStatus.js";import{usePointCloudViews as Pe}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as fe,useDispatch as ye}from"../../store/ctx.js";import{useHistory as we}from"./hooks/useHistory.js";import{useAttribute as Ce}from"./hooks/useAttribute.js";import{useConfig as he}from"./hooks/useConfig.js";import{usePolygon as ge}from"./hooks/usePolygon.js";import{useLine as Se}from"./hooks/useLine.js";import{useTranslation as ke}from"react-i18next";import{PreDataProcess as xe}from"../../store/annotation/actionCreators.js";import{useLatest as _e}from"ahooks";var Le=Object.defineProperty,Ve=Object.defineProperties,Be=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,I=(u,r,l)=>r in u?Le(u,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[r]=l,f=(u,r)=>{for(var l in r||(r={}))Oe.call(r,l)&&I(u,l,r[l]);if(E)for(var l of E(r))je.call(r,l)&&I(u,l,r[l]);return u},y=(u,r)=>Ve(u,Be(r));const{EPolygonPattern:Ae}=pe,Ee=({currentData:u,config:r,checkMode:l,configString:D,imgIndex:S,toolInstanceRef:i})=>{const t=ue(oe),{changeSelectedBoxValid:T,selectNextBox:N,selectPrevBox:H,updateSelectedBox:k,deleteSelectedPointCloudBoxAndPolygon:K}=ie(),{selectedSphere:w,updatePointCloudSphere:R}=ae(),{clearAllResult:C,updatePointCloudPattern:U}=be(),{copySelectedBoxes:z,pasteSelectedBoxes:F,copiedBoxes:q}=ne({config:r}),{updateRotate:x}=re({currentData:u}),{updateRotateEdge:G}=se({currentData:u}),{updatePointCloudData:v,topViewSelectedChanged:_}=Pe(),{redo:L,undo:V,pushHistoryWithList:M,pushHistoryUnderUpdatePolygon:W,pushHistoryUnderUpdateLine:Y}=we(),$=ye(),{syncThreeViewsAttribute:B}=Ce(),{syncAllViewsConfig:J,reRenderTopViewRange:Q}=he(),{selectedPolygon:O}=ge(),{selectedLine:j}=Se(),{t:h}=ke(),X=_e(u),b=e=>{var o;const{topViewInstance:s}=t;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(e)},Z=(e,o)=>{var s,a;const{topViewInstance:d,mainViewInstance:n}=t;if(!d)return;const{pointCloud2dOperation:p}=d;switch(e){case"q":{x(t.rectRotateSensitivity);break}case"e":x(-Number(t.rectRotateSensitivity));break;case"g":G(-90);break;case"u":{const m=p.pattern===Ae.Normal?P.Rect:P.Polygon;U(m);const te={[P.Polygon]:h("PolygonPattern"),[P.Rect]:h("RectPattern")};g.success(h("ChangePatternMsg",{pattern:te[m]})),p.clearActiveStatus(),p.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":t.setPointCloudValid(!t.valid);break;case"tab":if(o.shiftKey){H();break}N(),o.preventDefault();break;case"f":T();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":K(X.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const m=ce.getAttributeByKeycode(o.keyCode,r.attributeList);m!==void 0&&((a=i.current)==null||a.setDefaultAttribute(m))}return}}},ee=(e,o)=>{switch(e){case"c":z();break;case"v":F();break;case"a":o.preventDefault(),t.selectedAllBoxes();break;case"z":{o.shiftKey?L():V();break}}},A=e=>{if(!de.hotkeyFilter(e)||l===!0)return;const o=e.key.toLocaleLowerCase();if(e.ctrlKey){ee(o,e);return}Z(o,e)};return c(()=>{const{topViewInstance:e}=t;if(!!e)return window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A)}},[t,q,r,t.pointCloudBoxList,t.polygonList]),c(()=>{J(r)},[D]),c(()=>{(r==null?void 0:r.radius)&&Q(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{v==null||v()},[S,t.mainViewInstance]),c(()=>{t.setHideAttributes([])},[S]),c(()=>{i.current.setDefaultAttribute=e=>{var o,s,a,d;B(e);const n=t.selectedPointCloudBox;if(n){n.attribute=e;const p=$(xe({tool:le.PointCloud,dataList:[n],stepConfig:r,action:"viewUpdateBox"}));n.valid=p[0].valid;const m=k(n);(a=(s=(o=t==null?void 0:t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:s.setPolygonValidAndRender)==null||a.call(s,n.id,!0,n.valid),t.mainViewInstance&&_({newSelectedBox:n,newPointCloudList:m})}if(O&&W(y(f({},O),{attribute:e})),j&&Y(y(f({},j),{attribute:e})),w){const p=R(y(f({},w),{attribute:e}));t.mainViewInstance&&((d=t.mainViewInstance)==null||d.generateSpheres(p),_({newSelectedSphere:w,newSphereList:p}))}},i.current.setSubAttribute=(e,o)=>{var s;const a=t.selectedPointCloudBox;if(a){const d=(s=a==null?void 0:a.subAttribute)!=null?s:{};a.subAttribute=y(f({},d),{[e]:o}),k(a)}},i.current.clearResult=()=>{C==null||C()},i.current.redo=()=>{L()},i.current.undo=()=>{V()},i.current.setValid=e=>{i.current.valid=e,setTimeout(()=>{t.setPointCloudValid(e),e===!1&&C()})},i.current.setForbidOperation=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&t.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)},i.current.asyncData=e=>{setTimeout(()=>{v==null||v(e)})}},[t.pointCloudBoxList,t.pointCloudSphereList,t.selectedID,t.valid,t.polygonList,t.lineList,t.mainViewInstance,t.ptSegmentInstance]),c(()=>{i.current.updateSegmentTool=e=>{var o;(o=t.ptSegmentInstance)==null||o.emit(e)},i.current.segmentInstance=t.ptSegmentInstance},[t.ptSegmentInstance]),c(()=>{i.current.history={pushHistory:e=>{M({pointCloudBoxList:e})},initRecord:()=>{}}},[]),c(()=>{var e;const o=(e=t.topViewInstance)==null?void 0:e.toolInstance;if(!o||l)return;const s=n=>{B(n)},a=n=>{g.error(n)},d=n=>{g.info(n)};return o.on("syncAttribute",s),o.on("messageError",a),o.on("messageInfo",d),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",a),o.unbind("messageInfo",d)}},[t.topViewInstance]),null};var Ie=me(ve,null,null,{context:fe})(Ee);export{Ie as default};
@@ -1 +1 @@
1
- import c,{useState as C,useRef as v,useContext as y,useCallback as m,useMemo as N,useEffect as R}from"react";import{useLatest as d}from"ahooks";import{PointCloudContext as S}from"../PointCloudContext.js";import b from"../../../assets/annotation/icon_link.svg.js";import z from"../../../assets/annotation/icon_unlink.svg.js";const g={width:16,height:16},D=e=>{e.imageName||console.warn("missing imageName");const[n,f]=C(!0),s=v(e.imageName);s.current=e.imageName;const{unlinkImageItems:l,addRectFromPointCloudBoxByImageName:w,removeRectByPointCloudBoxId:h}=y(S),I=d(w),k=d(h),i=m(t=>{const o=s.current;if(!o){console.warn("invalid image name");return}f(t),t?k.current(o):I.current(o)},[]),u=m(()=>{i(!n)},[i,n]),x=N(()=>{var t;if(!e.is2DView)return null;const r={zIndex:(t=e.zIndex)!=null?t:999,position:"absolute",top:16,right:16+28+12,background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,cursor:"pointer"};return c.createElement("div",{style:r,onClick:u},n&&c.createElement("img",{src:b,style:g}),!n&&c.createElement("img",{src:z,style:g}))},[n,e.is2DView,e.zIndex,u]),a=m(()=>{if(!e.is2DView)return;const t=s.current;if(!t){console.warn("invalid image name");return}const r=new Set(l).has(t)===!1;i(r)},[e.is2DView,l,i]);return R(()=>{a()},[a]),{rendered:x,isLinking:n,swapSwitch:i,syncIsLinking:a}};export{D as default};
1
+ import u,{useState as V,useContext as j,useMemo as C,useCallback as d,useEffect as N}from"react";import{useLatest as s}from"ahooks";import{PointCloudContext as p}from"../PointCloudContext.js";import z from"../../../assets/annotation/icon_link.svg.js";import L from"../../../assets/annotation/icon_unlink.svg.js";import{EventBusEvent as v}from"../../../views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js";import{EventBus as x}from"@labelbee/lb-annotation";const k={width:16,height:16},F=e=>{e.imageName||console.warn("missing imageName");const[a,B]=V(!0),g=s(e.imageName),{addRectFromPointCloudBoxByImageName:b,removeRectByPointCloudBoxId:y,imageNamePointCloudBoxMap:o,linkageImageNameRectMap:f}=j(p),c=C(()=>e.imageName?o.has(e.imageName):(console.error("Missing image name"),!1),[e.imageName,o]),S=s(c),R=s(b),_=s(y),i=d(n=>{if(!S.current)return;const t=g.current;if(!t){console.warn("invalid image name");return}B(n),n?_.current(t):R.current(t)},[]),E=d(()=>{i(!a)},[i,a]),P=C(()=>{var n;if(!e.is2DView||!c)return null;const r={zIndex:(n=e.zIndex)!=null?n:999,position:"absolute",top:16,right:16+28+12,background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28};return u.createElement("div",{style:r},a&&u.createElement("img",{src:z,style:k}),!a&&u.createElement("img",{src:L,style:k}))},[a,e.is2DView,e.zIndex,E,c]),m=d(()=>{var n,t,r,h;if(!e.is2DView)return;const l=g.current;if(!l){console.warn("invalid image name");return}const D=new Set([...(t=(n=o.get(l))==null?void 0:n.keys())!=null?t:[]]),w=[...(h=(r=f.get(l))==null?void 0:r.keys())!=null?h:[]];let I=!0;w.length&&(I=Boolean(w.find(M=>D.has(M)))===!1),i(I)},[e.is2DView,f,o,i]);return N(()=>{m()},[m]),N(()=>{const n=t=>{i(t)};return x.on(v.switchConnect,n),()=>x.unbind(v.switchConnect,n)},[i]),{rendered:P,isLinking:a,swapSwitch:i,syncIsLinking:m}};export{F as default};
@@ -1 +1 @@
1
- import{useContext as G,useMemo as h,useCallback as u}from"react";import f from"lodash";import{PointCloudContext as J}from"../PointCloudContext.js";import{EToolName as D,cAnnotation as Q}from"@labelbee/lb-annotation";import{useHistory as U}from"./useHistory.js";import{usePolygon as X}from"./usePolygon.js";var Y=Object.defineProperty,Z=Object.defineProperties,$=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable,S=(i,e,l)=>e in i?Y(i,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[e]=l,ne=(i,e)=>{for(var l in e||(e={}))ee.call(e,l)&&S(i,l,e[l]);if(L)for(var l of L(e))oe.call(e,l)&&S(i,l,e[l]);return i},te=(i,e)=>Z(i,$(e));const{ESortDirection:y}=Q,ie=i=>{const{pointCloudBoxList:e,setPointCloudResult:l,topViewInstance:d,backViewInstance:g,sideViewInstance:C,selectedIDs:P,selectedID:m,mainViewInstance:c,setSelectedIDs:j,syncAllViewPointCloudColor:I,polygonList:R,pointCloudPattern:B}=G(J),{selectedPolygon:a,updateSelectedPolygon:A,updatePolygonValidByID:E,deletePolygon:N}=X(),{pushHistoryWithList:_}=U(),r=h(()=>{const o=e.findIndex(t=>t.id===m);if(o>-1)return{info:e[o],index:o}},[m,e]),O=u(o=>{var t;if(r==null?void 0:r.info){(t=i==null?void 0:i.generateRects)==null||t.call(i,o),e.splice(r.index,1,f.merge(r.info,o));const n=f.cloneDeep(e);return l(n),_({pointCloudBoxList:n}),n}return e},[m,e]),H=u((o,t)=>{const n=e.findIndex(s=>s.id===t);if(n>-1){e.splice(n,1,f.merge(e[n],o));const s=f.cloneDeep(e);return l(s),s}return e},[e]),v=u(o=>{d==null||d.pointCloud2dOperation.setPolygonValidAndRender(o,!0),C==null||C.pointCloud2dOperation.setPolygonValidAndRender(o,!0),g==null||g.pointCloud2dOperation.setPolygonValidAndRender(o,!0)},[d,C,g]),T=u(()=>{if(r==null?void 0:r.info){const{id:o,valid:t=!0}=r.info,n=O({valid:!t});I(n),v(o)}a&&(A(te(ne({},a),{valid:!a.valid})),d==null||d.pointCloud2dOperation.setPolygonValidAndRender(a.id,!0))},[v,r,a]),k=u(o=>{const t=e.find(n=>n.id===o);if(t){const{id:n,valid:s=!0}=t,x=H({valid:!s},n);return v(n),x}E(o)},[v,e,R]),b=u((o=y.ascend,t=!1)=>{if(!d||P.length>1)return;if(B!==D.Rect&&B!==D.Polygon){t&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:o!==y.ascend}));return}const{pointCloud2dOperation:n}=d,s=n.switchToNextPolygon(o);s&&j(s)},[d,B,d==null?void 0:d.toolInstance]),K=(o=!1)=>{b(y.descend,o)},M=(o=!1)=>{b(y.ascend,o)},V=o=>{const t=e.filter(n=>n.id!==o);l(t),c==null||c.removeObjectByName(o,"box"),c==null||c.render(),I(t)},W=()=>{r&&(V(r.info.id),d==null||d.pointCloud2dOperation.deletePolygon(r.info.id)),a&&(N(a.id),d==null||d.pointCloud2dOperation.deletePolygon(a.id))},q=h(()=>e.filter(o=>P.includes(o.id)),[P,e]),z=u(o=>{var t;const n=f.cloneDeep(e);let s=!1;for(const x of o){const w=n.findIndex(p=>p.id===x.id);if(w>-1){const p=f.merge(n[w],x);(t=i==null?void 0:i.generateRects)==null||t.call(i,p),n.splice(w,1,p),c==null||c.generateBox(p),s=!0}}if(s)return l(n),_({pointCloudBoxList:n}),c==null||c.render(),n},[P,e]),F=u(o=>e.find(t=>t.id===o),[e]);return{selectedBox:r,updateSelectedBox:O,changeSelectedBoxValid:T,changeValidByID:k,selectNextBox:M,selectPrevBox:K,deletePointCloudBox:V,selectedBoxes:q,updateSelectedBoxes:z,getPointCloudByID:F,deleteSelectedPointCloudBoxAndPolygon:W}};export{ie as useSingleBox};
1
+ import{useContext as oe,useMemo as A,useCallback as c}from"react";import m from"lodash";import{PointCloudContext as te}from"../PointCloudContext.js";import{EToolName as M,cAnnotation as ne}from"@labelbee/lb-annotation";import{useHistory as ie}from"./useHistory.js";import{usePolygon as le}from"./usePolygon.js";var de=Object.defineProperty,re=Object.defineProperties,se=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,ae=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,T=(i,o,l)=>o in i?de(i,o,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[o]=l,ue=(i,o)=>{for(var l in o||(o={}))ae.call(o,l)&&T(i,l,o[l]);if(H)for(var l of H(o))ce.call(o,l)&&T(i,l,o[l]);return i},fe=(i,o)=>re(i,se(o));const{ESortDirection:B}=ne,pe=i=>{const{pointCloudBoxList:o,setPointCloudResult:l,topViewInstance:r,backViewInstance:_,sideViewInstance:h,selectedIDs:y,selectedID:O,mainViewInstance:u,setSelectedIDs:k,syncAllViewPointCloudColor:b,polygonList:K,pointCloudPattern:V,rectList:D,removeRectIn2DView:S,addRectIn2DView:L}=oe(te),{selectedPolygon:f,updateSelectedPolygon:W,updatePolygonValidByID:q,deletePolygon:z}=le(),{pushHistoryWithList:E}=ie(),s=A(()=>{const e=o.findIndex(n=>n.id===O);if(e>-1)return{info:o[e],index:e}},[O,o]),R=c(e=>{var n;if(s==null?void 0:s.info){(n=i==null?void 0:i.generateRects)==null||n.call(i,e),o.splice(s.index,1,m.merge(s.info,e));const t=m.cloneDeep(o);return l(t),E({pointCloudBoxList:t}),t}return o},[O,o]),F=c((e,n)=>{const t=o.findIndex(d=>d.id===n);if(t>-1){o.splice(t,1,m.merge(o[t],e));const d=m.cloneDeep(o);return l(d),d}return o},[o]),I=c(e=>{r==null||r.pointCloud2dOperation.setPolygonValidAndRender(e,!0),h==null||h.pointCloud2dOperation.setPolygonValidAndRender(e,!0),_==null||_.pointCloud2dOperation.setPolygonValidAndRender(e,!0)},[r,h,_]),G=c(()=>{if(s==null?void 0:s.info){const{id:e,valid:n=!0}=s.info,t=R({valid:!n});b(t),I(e)}f&&(W(fe(ue({},f),{valid:!f.valid})),r==null||r.pointCloud2dOperation.setPolygonValidAndRender(f.id,!0))},[I,s,f]),J=c(e=>{const n=o.find(t=>t.id===e);if(n){const{id:t,valid:d=!0}=n,x=F({valid:!d},t);return I(t),x}q(e)},[I,o,K]),N=c((e=B.ascend,n=!1)=>{if(!r||y.length>1)return;if(V!==M.Rect&&V!==M.Polygon){n&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:e!==B.ascend}));return}const{pointCloud2dOperation:t}=r,d=t.switchToNextPolygon(e);d&&k(d)},[r,V,r==null?void 0:r.toolInstance]),Q=(e=!1)=>{N(B.descend,e)},U=(e=!1)=>{N(B.ascend,e)},j=e=>{const n=o.filter(t=>t.id!==e);l(n),u==null||u.removeObjectByName(e,"box"),u==null||u.render(),b(n)},X=c((e,n)=>{var t,d;const x=new Set((d=(t=n.mappingImgList)==null?void 0:t.map(a=>a.path))!=null?d:[]),v=new Map;e.forEach(a=>{const C=a.id;(a.rects||[]).forEach(w=>{const{imageName:P}=w;if(x.has(P)){let g=v.get(P);g||(g=new Set,v.set(P,g)),g.add(C)}})});const p=D.filter(a=>{var C;const w=a.extId,P=a.imageName;if(P!==void 0&&w!==void 0){const g=v.get(P);return(C=g==null?void 0:g.has(w))!=null?C:!1}return!1});S(p),p.forEach(a=>{L(a)})},[D,S,L]),Y=e=>{s&&(j(s.info.id),r==null||r.pointCloud2dOperation.deletePolygon(s.info.id),X([s.info],e)),f&&(z(f.id),r==null||r.pointCloud2dOperation.deletePolygon(f.id))},Z=A(()=>o.filter(e=>y.includes(e.id)),[y,o]),$=c(e=>{var n;const t=m.cloneDeep(o);let d=!1;for(const x of e){const v=t.findIndex(p=>p.id===x.id);if(v>-1){const p=m.merge(t[v],x);(n=i==null?void 0:i.generateRects)==null||n.call(i,p),t.splice(v,1,p),u==null||u.generateBox(p),d=!0}}if(d)return l(t),E({pointCloudBoxList:t}),u==null||u.render(),t},[y,o]),ee=c(e=>o.find(n=>n.id===e),[o]);return{selectedBox:s,updateSelectedBox:R,changeSelectedBoxValid:G,changeValidByID:J,selectNextBox:U,selectPrevBox:Q,deletePointCloudBox:j,selectedBoxes:Z,updateSelectedBoxes:$,getPointCloudByID:ee,deleteSelectedPointCloudBoxAndPolygon:Y}};export{pe as useSingleBox};
@@ -0,0 +1 @@
1
+ const s=(n,r,d,a)=>{let e=n.get(r);e||(e=new Map,n.set(r,e));let t=e.get(d);return t||(t=new WeakSet,e.set(d,t)),t.add(a),n};export{s as addMapIndirectWeakSetItem};
package/es/index.js CHANGED
@@ -1 +1 @@
1
- export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as l}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import r,{useState as c,useImperativeHandle as m}from"react";import{I18nextProvider as u}from"react-i18next";import{Provider as f}from"react-redux";import x from"./App.js";import w from"./configureStore.js";import{PageBackward as P,PageForward as v,PageJump as T}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as b}from"./components/pointCloudView/PointCloudContext.js";import{LabelBeeContext as j}from"./store/ctx.js";export{default as PredictTracking}from"./components/predictTracking/predictTrackingIcon/index.js";export{default as LLMToolView}from"./components/LLMToolView/index.js";export{default as SwitchCuboidBoxIn2DView}from"./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js";export{default as MeasureCanvas}from"./components/measureCanvas/index.js";export{default as AnnotatedBox}from"./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js";export{default as RectRotateSensitivitySlider}from"./views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js";export{FindTrackIDIndexInCheckMode as FindTrackIDIndex}from"./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js";export{WrapAudioPlayer as AudioPlayer}from"./components/audioPlayer/index.js";export{generatePointCloudBoxRects}from"./utils/index.js";export{default as SubAttributeList}from"./components/subAttributeList/index.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var g=Object.defineProperty,_=Object.defineProperties,C=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,d=(o,e,t)=>e in o?g(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,S=(o,e)=>{for(var t in e||(e={}))I.call(e,t)&&d(o,t,e[t]);if(s)for(var t of s(e))V.call(e,t)&&d(o,t,e[t]);return o},A=(o,e)=>_(o,C(e));const n=w(),y=(o,e)=>{const[t,p]=c();return m(e,()=>({toolInstance:t,annotationEngine:n.getState().annotation.annotationEngine,pageBackwardActions:()=>n.dispatch(P()),pageForwardActions:()=>n.dispatch(v()),pageJump:a=>{const i=~~a-1;n.dispatch(T(i))},hello:()=>alert("hello labelBee!!!")}),[t]),r.createElement(f,{store:n,context:j},r.createElement(u,{i18n:l},r.createElement(b,null,r.createElement(x,A(S({},o),{setToolInstance:a=>{var i;p(a),(i=o.onLoad)==null||i.call(o,{toolInstance:a})}})))))};var L=r.forwardRef(y);export{L as default,n as store};
1
+ export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as l}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import r,{useState as c,useImperativeHandle as m}from"react";import{I18nextProvider as u}from"react-i18next";import{Provider as f}from"react-redux";import x from"./App.js";import w from"./configureStore.js";import{PageBackward as P,PageForward as v,PageJump as j}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as T}from"./components/pointCloudView/PointCloudContext.js";import{LabelBeeContext as b}from"./store/ctx.js";export{default as PredictTracking}from"./components/predictTracking/predictTrackingIcon/index.js";export{default as LLMToolView}from"./components/LLMToolView/index.js";export{default as SwitchCuboidBoxIn2DView}from"./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js";export{default as BatchSwitchConnectIn2DView}from"./views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js";export{default as MeasureCanvas}from"./components/measureCanvas/index.js";export{default as AnnotatedBox}from"./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js";export{default as RectRotateSensitivitySlider}from"./views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js";export{FindTrackIDIndexInCheckMode as FindTrackIDIndex}from"./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js";export{WrapAudioPlayer as AudioPlayer}from"./components/audioPlayer/index.js";export{generatePointCloudBoxRects}from"./utils/index.js";export{default as SubAttributeList}from"./components/subAttributeList/index.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var g=Object.defineProperty,V=Object.defineProperties,C=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,d=(o,e,t)=>e in o?g(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,_=(o,e)=>{for(var t in e||(e={}))I.call(e,t)&&d(o,t,e[t]);if(s)for(var t of s(e))S.call(e,t)&&d(o,t,e[t]);return o},A=(o,e)=>V(o,C(e));const n=w(),h=(o,e)=>{const[t,p]=c();return m(e,()=>({toolInstance:t,annotationEngine:n.getState().annotation.annotationEngine,pageBackwardActions:()=>n.dispatch(P()),pageForwardActions:()=>n.dispatch(v()),pageJump:a=>{const i=~~a-1;n.dispatch(j(i))},hello:()=>alert("hello labelBee!!!")}),[t]),r.createElement(f,{store:n,context:b},r.createElement(u,{i18n:l},r.createElement(T,null,r.createElement(x,A(_({},o),{setToolInstance:a=>{var i;p(a),(i=o.onLoad)==null||i.call(o,{toolInstance:a})}})))))};var y=r.forwardRef(h);export{y as default,n as store};
@@ -0,0 +1 @@
1
+ import n,{useContext as f,useCallback as r}from"react";import{Popconfirm as a,Button as m}from"antd";import{useTranslation as u}from"react-i18next";import{PointCloudContext as x}from"../../../../components/pointCloudView/PointCloudContext.js";import{EventBus as p}from"@labelbee/lb-annotation";var c;(function(i){i.switchConnect="batch:switch-connect"})(c||(c={}));const d=()=>{const{cuboidBoxIn2DView:i}=f(x),{t}=u(),e=r((o,C)=>{p.emit(c.switchConnect,C)},[]),l=r(o=>{e(o,!0)},[e]),s=r(o=>{e(o,!1)},[e]);return i?null:n.createElement("div",{style:{margin:"0 10px"}},t("2DImageBatch")," \xA0",n.createElement(a,{title:t("ConfirmToBatchConnect"),onConfirm:l,okText:t("Confirm"),cancelText:t("Cancel")},n.createElement(m,{size:"small"},t("Connect"))),"\xA0",n.createElement(a,{title:t("ConfirmToBatchDisconnect"),onConfirm:s,okText:t("Confirm"),cancelText:t("Cancel")},n.createElement(m,{size:"small"},t("Disconnect"))))};export{c as EventBusEvent,d as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.46",
3
+ "version": "1.23.0-alpha.48",
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.27.0-alpha.23",
46
+ "@labelbee/lb-annotation": "1.27.0-alpha.24",
47
47
  "@labelbee/lb-utils": "1.19.0-alpha.16",
48
48
  "@labelbee/wavesurfer": "1.0.0",
49
49
  "@types/react-dom": "^18.2.7",