@labelbee/lb-components 1.24.0-alpha.20 → 1.24.0-alpha.22

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 (26) hide show
  1. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  2. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  3. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  4. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  5. package/dist/components/pointCloudView/index.js +1 -1
  6. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +2 -0
  7. package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -0
  8. package/dist/types/components/pointCloudView/index.d.ts +2 -0
  9. package/dist/types/views/MainView/index.d.ts +2 -0
  10. package/dist/types/views/MainView/sidebar/GeneralOperation/ActionsConfirm.d.ts +3 -0
  11. package/dist/types/views/MainView/sidebar/GeneralOperation/index.d.ts +9 -0
  12. package/dist/types/views/MainView/sidebar/index.d.ts +2 -0
  13. package/dist/views/MainView/index.js +1 -1
  14. package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
  15. package/dist/views/MainView/sidebar/GeneralOperation/index.js +1 -1
  16. package/dist/views/MainView/sidebar/index.js +1 -1
  17. package/es/components/pointCloud2DRectOperationView/index.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/usePointCloudViews.js +1 -1
  21. package/es/components/pointCloudView/index.js +1 -1
  22. package/es/views/MainView/index.js +1 -1
  23. package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
  24. package/es/views/MainView/sidebar/GeneralOperation/index.js +1 -1
  25. package/es/views/MainView/sidebar/index.js +1 -1
  26. 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"),lbUtils=require("@labelbee/lb-utils"),util=require("./util.js"),useUpdateRectList=require("./useUpdateRectList.js"),_=require("lodash"),useToolStyle=require("../../hooks/useToolStyle.js"),index=require("../../store/toolConfig/index.js");function _interopDefaultLegacy(c){return c&&typeof c=="object"&&"default"in c?c:{default:c}}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=(c,l,s)=>l in c?__defProp(c,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):c[l]=s,__spreadValues=(c,l)=>{for(var s in l||(l={}))__hasOwnProp.call(l,s)&&__defNormalProp(c,s,l[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(l))__propIsEnum.call(l,s)&&__defNormalProp(c,s,l[s]);return c},__spreadProps=(c,l)=>__defProps(c,__getOwnPropDescs(l)),__async=(c,l,s)=>new Promise((f,p)=>{var I=a=>{try{D(s.next(a))}catch(R){p(R)}},S=a=>{try{D(s.throw(a))}catch(R){p(R)}},D=a=>a.done?f(a.value):Promise.resolve(a.value).then(I,S);D((s=s.apply(c,l)).next())});const PointCloud2DRectOperationView=c=>{var l,s;const{mappingData:f,size:p,config:I,checkMode:S,afterImgOnLoad:D,shouldExcludePointCloudBoxListUpdate:a}=c,{selectBoxVisibleSwitch:R}=index(),L=(l=f==null?void 0:f.url)!=null?l:"",b=(s=f==null?void 0:f.fallbackUrl)!=null?s:"",{pointCloudBoxList:E,setPointCloudResult:O,defaultAttribute:V,rectList:q,addRectIn2DView:W,updateRectIn2DView:X,removeRectIn2DView:Y,updateRectListByReducer:ee,selectedIDs:v,setSelectedIDs:j,selectedID:C}=React.useContext(PointCloudContext.PointCloudContext),{value:U}=useToolStyle.useToolStyleContext(),te=ahooks.useLatest(v),{update2DViewRect:re,remove2DViewRect:ne}=usePointCloudViews.usePointCloudViews(),k=React__default.default.useRef(null),n=React.useRef(null),A=ahooks.useMemoizedFn(re),w=ahooks.useMemoizedFn(ne),x=React.useRef(null),[oe,F]=React.useState(!0),[T,H]=React.useState(""),[ue,B]=React.useState(!1),[ie,y]=React.useState(!0),g=React.useMemo(()=>q==null?void 0:q.filter(e=>e.imageName===(f==null?void 0:f.path)),[f==null?void 0:f.path,q]),Z=React.useRef(g),P=ahooks.useLatest(f==null?void 0:f.path),N=React.useCallback(e=>__async(void 0,null,function*(){try{const o=te.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(o.length){const r=new Set(o),u=t.filter(i=>r.has(i.id)).map(i=>i.id);j(u)}return t}catch(o){}}),[j]),J=e=>{const{boxID:o}=e;if(y(!1),!a&&o){N(()=>{const t=A==null?void 0:A(e);return t?(x.current=t,O(t),t):null});return}X(e,!0)},$=e=>{P.current&&W(__spreadProps(__spreadValues({},e),{imageName:P.current}))},G=e=>{if(e.length===0)return;if(!a){const t=e.find(r=>r.boxID);if(t){N(()=>{const r=w==null?void 0:w(t);return r?(x.current=r,O(r),m(),r):null});return}}const o=e.find(t=>t.extId);o&&N(()=>{const{imageName:t,extId:r}=o,u=w==null?void 0:w({boxID:r,imageName:t});return u?(x.current=u,O(u),u):null}),Y(e)},ce=ahooks.useMemoizedFn(()=>{let e=[];return E.forEach(o=>{const{rects:t=[],id:r,attribute:u,trackID:i}=o,d=t.find(z=>z.imageName===P.current),h=r+"_"+P.current;d&&(e=[...e,__spreadProps(__spreadValues({},d),{boxID:r,id:h,attribute:u,order:i})])}),e}),m=useUpdateRectList.useUpdateRectList(()=>{var e,o,t,r,u;const i=a?[]:ce(),d=(e=n.current)==null?void 0:e.selectedRectID,h=v.slice(0),z=R?util.selectSpecifiedRectsFromTopViewSelectedIds(h,i,g):[...i,...g];let Q=[];!R&&(v==null?void 0:v.length)&&(Q=i.filter(M=>d?v.includes(M.boxID)&&!d.includes(M.boxID):v.includes(M.boxID))),(o=n.current)==null||o.setHighLightRectList(Q),(t=n.current)==null||t.setResult(z),T?((r=n.current)==null||r.setSelectedRectID(T),H("")):ue&&d&&((u=n.current)==null||u.setSelectedRectID(d),B(!1))}),K=({targetId:e,id:o})=>{y(!1),j(e),H(o)};return React.useEffect(()=>{if(k.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:k.current,size:p,config:__spreadProps(__spreadValues({},I),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:S});return n.current=e,n.current.init(),n.current.on("updateDragResult",J),n.current.on("afterAddingDrawingRect",$),n.current.on("deleteSelectedRects",G),n.current.on("onRightClick",K),()=>{var o,t,r,u,i;(o=n.current)==null||o.unbind("updateDragResult",J),(t=n.current)==null||t.unbind("afterAddingDrawingRect",$),(r=n.current)==null||r.unbind("deleteSelectedRects",G),(u=n.current)==null||u.unbind("onRightClick",K),(i=n.current)==null||i.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;F(!0);let r=yield e(L);!r&&b&&(r=yield e(b)),r&&((t=n.current)==null||t.setImgNode(r),D(r)),F(!1)});n.current&&(L||b)&&o()},[L,b]),React.useEffect(()=>{var e;(e=n.current)==null||e.setSize(p)},[p]),React.useEffect(()=>{E!==x.current&&m()},[E]),React.useEffect(()=>{var e,o;const t=g.find(r=>r.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,V),t&&ee(r=>{var u;const i=[];let d=null;return r.forEach(h=>{h.id!==n.current.selectedRectID?i.push(h):d=h}),t.extId===void 0&&(d=(u=n.current)==null?void 0:u.selectedRect),[...i,__spreadProps(__spreadValues({},d||{}),{attribute:V})]}),B(!0),m()},[V]),React.useEffect(()=>{const e=Z.current;___default.default.isEqual(e,g)||(B(!0),m(),Z.current=g)},[g]),React.useEffect(()=>{m()},[a]),React.useEffect(()=>{var e,o,t,r;const u=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},i=__spreadProps(__spreadValues({},u),{attributeList:(t=I.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(i))},[I.attributeList]),React.useEffect(()=>{var e;(e=n.current)==null||e.setEnableAddRect(v.length===0),m()},[v]),ahooks.useDebounceEffect(()=>{if(!C||!ie){y(!0),a&&(n.current.setHoverRectID(""),n.current.render());return}const{rectList:e,size:o,zoom:t,imgNode:r}=n.current,u=e.find(d=>d.boxID===C||d.extId===C),i=lbUtils.ImgPosUtils.getBasicRecPos(r,u,o,.5);if(!i){y(!0);return}a&&n.current.setHoverRectID(u.id),n.current.setCurrentPos(i.currentPos),n.current.setZoom(i.innerZoom),n.current.renderBasicCanvas(),n.current.render()},[C],{wait:200}),React.useEffect(()=>{const{hiddenText:e}=U||{};if(e===void 0)return;const o=n.current;if(!o)return;const t=__spreadValues(__spreadValues({},o.style),U);o.setStyle(t)},[U]),React.useEffect(()=>{m()},[R]),React__default.default.createElement(es.Spin,{spinning:oe},React__default.default.createElement("div",{ref:k,style:__spreadValues({position:"relative"},p)}))};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"),lbUtils=require("@labelbee/lb-utils"),util=require("./util.js"),useUpdateRectList=require("./useUpdateRectList.js"),_=require("lodash"),useToolStyle=require("../../hooks/useToolStyle.js"),index=require("../../store/toolConfig/index.js");function _interopDefaultLegacy(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}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=(s,c,l)=>c in s?__defProp(s,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):s[c]=l,__spreadValues=(s,c)=>{for(var l in c||(c={}))__hasOwnProp.call(c,l)&&__defNormalProp(s,l,c[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(c))__propIsEnum.call(c,l)&&__defNormalProp(s,l,c[l]);return s},__spreadProps=(s,c)=>__defProps(s,__getOwnPropDescs(c)),__async=(s,c,l)=>new Promise((f,p)=>{var h=a=>{try{D(l.next(a))}catch(R){p(R)}},S=a=>{try{D(l.throw(a))}catch(R){p(R)}},D=a=>a.done?f(a.value):Promise.resolve(a.value).then(h,S);D((l=l.apply(s,c)).next())});const PointCloud2DRectOperationView=s=>{var c,l;const{mappingData:f,size:p,config:h,checkMode:S,afterImgOnLoad:D,shouldExcludePointCloudBoxListUpdate:a}=s,{selectBoxVisibleSwitch:R}=index(),L=(c=f==null?void 0:f.url)!=null?c:"",b=(l=f==null?void 0:f.fallbackUrl)!=null?l:"",{pointCloudBoxList:E,setPointCloudResult:O,defaultAttribute:q,rectList:V,addRectIn2DView:W,updateRectIn2DView:X,removeRectIn2DView:Y,updateRectListByReducer:ee,selectedIDs:v,setSelectedIDs:j,selectedID:C}=React.useContext(PointCloudContext.PointCloudContext),{value:U}=useToolStyle.useToolStyleContext(),te=ahooks.useLatest(v),{update2DViewRect:re,remove2DViewRect:ne}=usePointCloudViews.usePointCloudViews(),k=React__default.default.useRef(null),n=React.useRef(null),M=ahooks.useMemoizedFn(re),y=ahooks.useMemoizedFn(ne),x=React.useRef(null),[oe,F]=React.useState(!0),[T,H]=React.useState(""),[ue,B]=React.useState(!1),[ie,w]=React.useState(!0),g=React.useMemo(()=>V==null?void 0:V.filter(e=>e.imageName===(f==null?void 0:f.path)),[f==null?void 0:f.path,V]),Z=React.useRef(g),P=ahooks.useLatest(f==null?void 0:f.path),N=React.useCallback(e=>__async(void 0,null,function*(){try{const o=te.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(o.length){const r=new Set(o),u=t.filter(i=>r.has(i.id)).map(i=>i.id);j(u)}return t}catch(o){}}),[j]),J=e=>{const{boxID:o}=e;if(w(!1),!a&&o){N(()=>{const t=M==null?void 0:M(e);return t?(x.current=t,O(t),t):null});return}X(e,!0)},$=e=>{P.current&&W(__spreadProps(__spreadValues({},e),{imageName:P.current}))},G=e=>{if(e.length===0)return;if(!a){const t=e.find(r=>r.boxID);if(t){N(()=>{const r=y==null?void 0:y(t);return r?(x.current=r,O(r),m(),r):null});return}}const o=e.find(t=>t.extId);o&&N(()=>{const{imageName:t,extId:r}=o,u=y==null?void 0:y({boxID:r,imageName:t});return u?(x.current=u,O(u),u):null}),Y(e)},se=ahooks.useMemoizedFn(()=>{let e=[];return E.forEach(o=>{const{rects:t=[],id:r,attribute:u,trackID:i}=o,d=t.find(A=>A.imageName===P.current),I=r+"_"+P.current;d&&(e=[...e,__spreadProps(__spreadValues({},d),{boxID:r,id:I,attribute:u,order:i})])}),e}),m=useUpdateRectList.useUpdateRectList(()=>{var e,o,t,r,u;const i=a?[]:se(),d=(e=n.current)==null?void 0:e.selectedRectID,I=v.slice(0),A=R?util.selectSpecifiedRectsFromTopViewSelectedIds(I,i,g):[...i,...g];let Q=[];!R&&(v==null?void 0:v.length)&&(Q=i.filter(z=>d?v.includes(z.boxID)&&!d.includes(z.boxID):v.includes(z.boxID))),(o=n.current)==null||o.setHighLightRectList(Q),(t=n.current)==null||t.setResult(A),T?((r=n.current)==null||r.setSelectedRectID(T),H("")):ue&&d&&((u=n.current)==null||u.setSelectedRectID(d),B(!1))}),K=({targetId:e,id:o})=>{w(!1),requestAnimationFrame(()=>{ce(e),H(o)})},ce=e=>{(Array.isArray(v)?v:[]).includes(e)||j(e)};return React.useEffect(()=>{if(k.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:k.current,size:p,config:__spreadProps(__spreadValues({},h),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:S});return n.current=e,n.current.init(),n.current.on("updateDragResult",J),n.current.on("afterAddingDrawingRect",$),n.current.on("deleteSelectedRects",G),n.current.on("onRightClick",K),()=>{var o,t,r,u,i;(o=n.current)==null||o.unbind("updateDragResult",J),(t=n.current)==null||t.unbind("afterAddingDrawingRect",$),(r=n.current)==null||r.unbind("deleteSelectedRects",G),(u=n.current)==null||u.unbind("onRightClick",K),(i=n.current)==null||i.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;F(!0);let r=yield e(L);!r&&b&&(r=yield e(b)),r&&((t=n.current)==null||t.setImgNode(r),D(r)),F(!1)});n.current&&(L||b)&&o()},[L,b]),React.useEffect(()=>{var e;(e=n.current)==null||e.setSize(p)},[p]),React.useEffect(()=>{E!==x.current&&m()},[E]),React.useEffect(()=>{var e,o;const t=g.find(r=>r.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,q),t&&ee(r=>{var u;const i=[];let d=null;return r.forEach(I=>{I.id!==n.current.selectedRectID?i.push(I):d=I}),t.extId===void 0&&(d=(u=n.current)==null?void 0:u.selectedRect),[...i,__spreadProps(__spreadValues({},d||{}),{attribute:q})]}),B(!0),m()},[q]),React.useEffect(()=>{const e=Z.current;___default.default.isEqual(e,g)||(B(!0),m(),Z.current=g)},[g]),React.useEffect(()=>{m()},[a]),React.useEffect(()=>{var e,o,t,r;const u=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},i=__spreadProps(__spreadValues({},u),{attributeList:(t=h.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(i))},[h.attributeList]),React.useEffect(()=>{var e;(e=n.current)==null||e.setEnableAddRect(v.length===0),m()},[v]),ahooks.useDebounceEffect(()=>{if(!C||!ie){w(!0),a&&(n.current.setHoverRectID(""),n.current.render());return}const{rectList:e,size:o,zoom:t,imgNode:r}=n.current,u=e.find(d=>d.boxID===C||d.extId===C),i=lbUtils.ImgPosUtils.getBasicRecPos(r,u,o,.5);if(!i){w(!0);return}a&&n.current.setHoverRectID(u.id),n.current.setCurrentPos(i.currentPos),n.current.setZoom(i.innerZoom),n.current.renderBasicCanvas(),n.current.render()},[C],{wait:200}),React.useEffect(()=>{const{hiddenText:e}=U||{};if(e===void 0)return;const o=n.current;if(!o)return;const t=__spreadValues(__spreadValues({},o.style),U);o.setStyle(t)},[U]),React.useEffect(()=>{m()},[R]),React__default.default.createElement(es.Spin,{spinning:oe},React__default.default.createElement("div",{ref:k,style:__spreadValues({position:"relative"},p)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),ToolPointCloudBoxRenderHelper=require("../../utils/ToolPointCloudBoxRenderHelper.js"),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"),useTimeoutFunc=require("./hooks/useTimeoutFunc.js"),useWindowKeydownListener=require("./hooks/useWindowKeydownListener.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}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=(r,s,d)=>s in r?__defProp(r,s,{enumerable:!0,configurable:!0,writable:!0,value:d}):r[s]=d,__spreadValues=(r,s)=>{for(var d in s||(s={}))__hasOwnProp.call(s,d)&&__defNormalProp(r,d,s[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(s))__propIsEnum.call(s,d)&&__defNormalProp(r,d,s[d]);return r},__spreadProps=(r,s)=>__defProps(r,__getOwnPropDescs(s)),__async=(r,s,d)=>new Promise((x,D)=>{var A=u=>{try{S(d.next(u))}catch(R){D(R)}},E=u=>{try{S(d.throw(u))}catch(R){D(R)}},S=u=>u.done?x(u.value):Promise.resolve(u.value).then(A,E);S((d=d.apply(r,s)).next())});const pickRectObject=r=>___default.default.pick(r,["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:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:r=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:r=>!1,removeRectBySpecifyId:(r,s,d)=>!1,removeRectByPointCloudBoxId:r=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:useWindowKeydownListener.getEmptyUseWindowKeydownListener(),isLargeStatus:!1,setIsLargeStatus:()=>{}}),PointCloudProvider=({children:r})=>{const[s,d]=React.useState([]),[x,D]=React.useState([]),[A,E]=React.useState([]),[S,u]=React.useState([]),[R,Le]=React.useState([]),[v,K]=React.useState([]),[B,O]=React.useState([]),[U,De]=React.useState(!0),[Z,Ae]=React.useState(2),[J,Be]=React.useState(!0),[Q,_e]=React.useState(1),[f,X]=React.useState(),[Y,$]=React.useState(),[ee,te]=React.useState(),[g,oe]=React.useState(),[ne,Ve]=React.useState(""),[j,Ne]=React.useState(lbAnnotation.EToolName.Rect),F=React.useRef(new lbAnnotation.ActionsHistory).current,[p,q]=React.useState([]),[ie,He]=React.useState(""),[T,Me]=React.useState(lbUtils.EPointCloudPattern.Detection),[L,se]=React.useState(void 0),[z,ke]=React.useState([]),[W,Ee]=React.useState([]),[re,Oe]=React.useState(!1),[ae,le]=React.useState(!1),h=index(),[de,je]=React.useState({}),Fe=ctx.useDispatch(),qe=o=>{const{imgNode:n,path:t}=o;t&&n&&je(l=>__spreadProps(__spreadValues({},l),{[t]:{width:n.width,height:n.height}}))},ce=React.useMemo(()=>v.length===1?v[0]:"",[v]),ue=useWindowKeydownListener.default(),N=React.useCallback((o,n,t="extId")=>{const l=t||"id",a=new Set(n);return u(c=>{let I=!1;const P=c.filter(M=>{const G=M[l],k=a.has(G)?M.imageName!==o:!0;return k||(I=!0),k});return I?P:c}),!0},[]),ge=React.useCallback(o=>{const n=s.map(t=>t.id);return N(o,n,"extId")},[s,N]),fe=React.useCallback(o=>{if(!o)return!1;const n=s.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:l,attribute:a,trackID:c}=t,I=t.rects.find(P=>P.imageName===o);if(I){const P=___default.default.pick(I,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},P),{id:lbAnnotation.uuid(),attribute:a,order:c,extId:l,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(u(t=>{const l=new Set(t.filter(c=>o===c.imageName).map(c=>c.extId)),a=n.filter(c=>l.has(c.extId)===!1);return a.length?[...t,...a]:t}),!0):!1},[s]),pe=React.useMemo(()=>s.filter(n=>Array.isArray(n.rects)&&n.rects.length>0).reduce((n,t)=>{var l;return(l=t.rects)==null||l.forEach(a=>{const{imageName:c}=a;if(!c){console.warn("Missing image name"),console.trace(a,t);return}map.addMapIndirectWeakSetItem(n,c,t.id,t)}),n},new Map),[s]),he=React.useCallback(o=>{u(n=>o(n,pickRectObject))},[pickRectObject]),me=React.useMemo(()=>S.filter(o=>o.extId!==void 0&&o.id!==void 0).reduce((o,n)=>{const t=n.imageName;return t?(map.addMapIndirectWeakSetItem(o,t,n.extId,n),o):(console.warn("missing image name"),console.log(n,S),o)},new Map),[S]),{fn:Te}=useTimeoutFunc.default(o=>{K(n=>{const t=o,l=new Set(t);let a=!1;const c=n.filter(I=>{const P=l.has(I);return P||(a=!0),P});return a?c:n})},200),ve=React.useCallback(o=>{const n=o.map(t=>t.id);d(o),Te(n)},[]),H=React.useMemo(()=>{const o=s.find(e=>e.id===ce),n=e=>{const i=s.concat(e);return ve(i),i},t=e=>{const i=x.concat(e);return D(i),i},l=e=>{De(e!==!1)},a=e=>{let i=[];e===void 0||e===""?i=[]:typeof e=="string"?i=[e]:Array.isArray(e)&&(i=e.length>1?Array.from(new Set(e)):e),K(i)},c=e=>{v.includes(e)?a(v.filter(i=>i!==e)):a([...v,e])},I=e=>{const i=pickRectObject(e);u(m=>[...m,i])},P=(e,i=!1)=>{const m=pickRectObject(e);u(C=>C.map(w=>w.id===e.id?i?__spreadValues(__spreadValues({},w),m):m:w))},M=e=>{u(i=>i.filter(m=>!e.find(C=>C.id===m.id)))},G=e=>{B.includes(e)?O([]):O([e])},k=()=>{if(j===lbAnnotation.EToolName.Rect){const e=s.map(i=>i.id);a(e),f==null||f.pointCloud2dOperation.setSelectedIDs(e)}},We=e=>{a(s.filter(i=>i.attribute===e).map(i=>i.id))},Pe=s.filter(e=>!p.includes(e.attribute)),Se=x.filter(e=>!p.includes(e.attribute)),Ie=R.filter(e=>e.attribute&&!p.includes(e.attribute)),Ge=e=>{if(p.includes(e))q(p.filter(i=>i!==e));else{const i=p.concat(e);q(i)}},Ke=(e=Pe,i=A,m=Se,C=Ie,w=z)=>{var V;g==null||g.clearAllBox(),g==null||g.clearAllSphere(),f==null||f.updatePolygonList(e,i),f==null||f.updatePointList(m),f==null||f.updateLineList(C),g==null||g.generateBoxes(e),g==null||g.generateSpheres(m),(V=L==null?void 0:L.store)==null||V.updateCurrentSegment(w),Ce(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,e)},Ue=()=>{X(void 0),$(void 0),te(void 0),oe(void 0)},Ce=(e,i,m)=>__async(void 0,null,function*(){var C,w,V;if(!g)return;const we=g.pointCloudObject;if(!we)return;let ye=[],be=[];try{if(i&&F.record.length){const{record:y,recordIndex:b}=F;let Re=b;b>0&&(e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleToggleValid||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleRotate||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single&&i.length===((C=y[b])==null?void 0:C.pointCloudBoxList.length))&&(Re=b-1);let Ze=(w=y[Re])==null?void 0:w.pointCloudBoxList;const xe=ToolPointCloudBoxRenderHelper.calcResetAreasAndBoxIds(e,i,Ze);ye=xe.modifiedBoxIds,be=xe.resetAreas}}catch(y){console.error("call calcResetAreasAndBoxIds error",y)}try{const y=yield g.getHighlightIndexByMappingImgList({mappingImgList:m!=null?m:W,points:we.geometry.attributes.position.array}),b=yield g==null?void 0:g.highlightOriginPointCloud(i,y,{modifiedBoxIds:ye,resetAreas:be});return b&&((V=f==null?void 0:f.pointCloudInstance)==null||V.updateColor(b)),b}catch(y){console.error("call highlightOriginPointCloud error",y)}});return{selectedID:ce,pointCloudBoxList:s,pointCloudSphereList:x,displayPointCloudList:Pe,displaySphereList:Se,displayLineList:Ie,selectedIDs:v,setPointCloudResult:ve,setSelectedIDs:a,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:D,valid:U,selectedPointCloudBox:o,setPointCloudValid:l,addSelectedID:c,addHighlightID:G,selectedAllBoxes:k,topViewInstance:f,setTopViewInstance:X,sideViewInstance:Y,setSideViewInstance:$,backViewInstance:ee,setBackViewInstance:te,mainViewInstance:g,setMainViewInstance:oe,polygonList:A,setPolygonList:E,rectList:S,setRectList:u,addRectIn2DView:I,removeRectIn2DView:M,updateRectIn2DView:P,lineList:R,setLineList:Le,zoom:Q,setZoom:_e,history:F,toggleAttributesVisible:Ge,hideAttributes:p,setHideAttributes:q,reRender:Ke,attrPanelLayout:ie,setAttrPanelLayout:He,syncAllViewPointCloudColor:Ce,defaultAttribute:ne,setDefaultAttribute:Ve,pointCloudPattern:j,setPointCloudPattern:Ne,selectSpecAttr:We,globalPattern:T,setGlobalPattern:e=>{T!==e&&(Fe(actionCreators.ChangeSave),Me(e),e===lbUtils.EPointCloudPattern.Detection&&se(void 0))},ptSegmentInstance:L,setPtSegmentInstance:se,segmentation:z,setSegmentation:ke,clearAllDetectionInstance:Ue,highlight2DDataList:W,setHighlight2DDataList:Ee,highlight2DLoading:re,setHighlight2DLoading:Oe,cuboidBoxIn2DView:J,setCuboidBoxIn2DView:Be,imageSizes:de,cacheImageNodeSize:qe,highlightIDs:B,setHighlightIDs:O,removeRectByPointCloudBoxId:ge,removeRectBySpecifyId:N,addRectFromPointCloudBoxByImageName:fe,rectRotateSensitivity:Z,setRectRotateSensitivity:Ae,imageNamePointCloudBoxMap:pe,linkageImageNameRectMap:me,updateRectListByReducer:he,windowKeydownListenerHook:ue,isLargeStatus:ae,setIsLargeStatus:le}},[U,v,s,x,A,R,S,f,Y,ee,g,Q,p,ie,ne,j,T,L,z,W,re,J,de,B,ge,N,fe,Z,pe,me,he,ue,ae,le]);React.useEffect(()=>{var o,n,t;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,s),(n=h==null?void 0:h.setHighlightIDs)==null||n.call(h,B),(t=h==null?void 0:h.setSelectedIDs)==null||t.call(h,v)},[s,v,B]),React.useEffect(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,H)},[H]);const ze=()=>{const o=s.filter(a=>p.includes(a.attribute)),{setSelectedIDs:n,reRender:t}=H,l=o.map(a=>a.id);l.length>0&&n(v.filter(a=>!l.includes(a))),t()};return React.useEffect(()=>{var o,n,t,l;ze(),(n=(o=f==null?void 0:f.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,p),(l=(t=L==null?void 0:L.store)==null?void 0:t.setHiddenAttributes)==null||l.call(t,p)},[p]),React__default.default.createElement(PointCloudContext.Provider,{value:H},r)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),ToolPointCloudBoxRenderHelper=require("../../utils/ToolPointCloudBoxRenderHelper.js"),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"),useTimeoutFunc=require("./hooks/useTimeoutFunc.js"),useWindowKeydownListener=require("./hooks/useWindowKeydownListener.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}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=(r,s,c)=>s in r?__defProp(r,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):r[s]=c,__spreadValues=(r,s)=>{for(var c in s||(s={}))__hasOwnProp.call(s,c)&&__defNormalProp(r,c,s[c]);if(__getOwnPropSymbols)for(var c of __getOwnPropSymbols(s))__propIsEnum.call(s,c)&&__defNormalProp(r,c,s[c]);return r},__spreadProps=(r,s)=>__defProps(r,__getOwnPropDescs(s)),__async=(r,s,c)=>new Promise((x,B)=>{var D=u=>{try{P(c.next(u))}catch(R){B(R)}},E=u=>{try{P(c.throw(u))}catch(R){B(R)}},P=u=>u.done?x(u.value):Promise.resolve(u.value).then(D,E);P((c=c.apply(r,s)).next())});const pickRectObject=r=>___default.default.pick(r,["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,visibleBatchSetValid:!1,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setBatchSetValidModal:()=>{},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:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:r=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:r=>!1,removeRectBySpecifyId:(r,s,c)=>!1,removeRectByPointCloudBoxId:r=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:useWindowKeydownListener.getEmptyUseWindowKeydownListener(),isLargeStatus:!1,setIsLargeStatus:()=>{}}),PointCloudProvider=({children:r})=>{const[s,c]=React.useState([]),[x,B]=React.useState([]),[D,E]=React.useState([]),[P,u]=React.useState([]),[R,Be]=React.useState([]),[v,K]=React.useState([]),[A,O]=React.useState([]),[U,De]=React.useState(!0),[Z,Ae]=React.useState(2),[J,_e]=React.useState(!0),[Q,Ve]=React.useState(1),[f,X]=React.useState(),[Y,$]=React.useState(),[ee,te]=React.useState(),[g,oe]=React.useState(),[ne,Ne]=React.useState(""),[j,He]=React.useState(lbAnnotation.EToolName.Rect),F=React.useRef(new lbAnnotation.ActionsHistory).current,[h,q]=React.useState([]),[ie,Me]=React.useState(""),[T,ke]=React.useState(lbUtils.EPointCloudPattern.Detection),[L,se]=React.useState(void 0),[z,Ee]=React.useState([]),[W,Oe]=React.useState([]),[re,je]=React.useState(!1),[ae,le]=React.useState(!1),p=index(),[de,Fe]=React.useState(!1),[ce,qe]=React.useState({}),Te=ctx.useDispatch(),ze=o=>{const{imgNode:n,path:t}=o;t&&n&&qe(l=>__spreadProps(__spreadValues({},l),{[t]:{width:n.width,height:n.height}}))},ue=React.useMemo(()=>v.length===1?v[0]:"",[v]),ge=useWindowKeydownListener.default(),N=React.useCallback((o,n,t="extId")=>{const l=t||"id",d=new Set(n);return u(a=>{let I=!1;const S=a.filter(M=>{const G=M[l],k=d.has(G)?M.imageName!==o:!0;return k||(I=!0),k});return I?S:a}),!0},[]),fe=React.useCallback(o=>{const n=s.map(t=>t.id);return N(o,n,"extId")},[s,N]),he=React.useCallback(o=>{if(!o)return!1;const n=s.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:l,attribute:d,trackID:a}=t,I=t.rects.find(S=>S.imageName===o);if(I){const S=___default.default.pick(I,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},S),{id:lbAnnotation.uuid(),attribute:d,order:a,extId:l,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(u(t=>{const l=new Set(t.filter(a=>o===a.imageName).map(a=>a.extId)),d=n.filter(a=>l.has(a.extId)===!1);return d.length?[...t,...d]:t}),!0):!1},[s]),pe=React.useMemo(()=>s.filter(n=>Array.isArray(n.rects)&&n.rects.length>0).reduce((n,t)=>{var l;return(l=t.rects)==null||l.forEach(d=>{const{imageName:a}=d;if(!a){console.warn("Missing image name"),console.trace(d,t);return}map.addMapIndirectWeakSetItem(n,a,t.id,t)}),n},new Map),[s]),me=React.useCallback(o=>{u(n=>o(n,pickRectObject))},[pickRectObject]),ve=React.useMemo(()=>P.filter(o=>o.extId!==void 0&&o.id!==void 0).reduce((o,n)=>{const t=n.imageName;return t?(map.addMapIndirectWeakSetItem(o,t,n.extId,n),o):(console.warn("missing image name"),console.log(n,P),o)},new Map),[P]),{fn:We}=useTimeoutFunc.default(o=>{K(n=>{const t=o,l=new Set(t);let d=!1;const a=n.filter(I=>{const S=l.has(I);return S||(d=!0),S});return d?a:n})},200),Se=React.useCallback(o=>{const n=o.map(t=>t.id);c(o),We(n)},[]),H=React.useMemo(()=>{const o=s.find(e=>e.id===ue),n=e=>{const i=s.concat(e);return Se(i),i},t=e=>{const i=x.concat(e);return B(i),i},l=e=>{De(e!==!1)},d=e=>{Fe(e)},a=e=>{let i=[];e===void 0||e===""?i=[]:typeof e=="string"?i=[e]:Array.isArray(e)&&(i=e.length>1?Array.from(new Set(e)):e),K(i)},I=e=>{v.includes(e)?a(v.filter(i=>i!==e)):a([...v,e])},S=e=>{const i=pickRectObject(e);u(m=>[...m,i])},M=(e,i=!1)=>{const m=pickRectObject(e);u(C=>C.map(w=>w.id===e.id?i?__spreadValues(__spreadValues({},w),m):m:w))},G=e=>{u(i=>i.filter(m=>!e.find(C=>C.id===m.id)))},k=e=>{A.includes(e)?O([]):O([e])},Ke=()=>{if(j===lbAnnotation.EToolName.Rect){const e=s.map(i=>i.id);a(e),f==null||f.pointCloud2dOperation.setSelectedIDs(e)}},Ue=e=>{a(s.filter(i=>i.attribute===e).map(i=>i.id))},Pe=s.filter(e=>!h.includes(e.attribute)),Ie=x.filter(e=>!h.includes(e.attribute)),Ce=R.filter(e=>e.attribute&&!h.includes(e.attribute)),Ze=e=>{if(h.includes(e))q(h.filter(i=>i!==e));else{const i=h.concat(e);q(i)}},Je=(e=Pe,i=D,m=Ie,C=Ce,w=z)=>{var V;g==null||g.clearAllBox(),g==null||g.clearAllSphere(),f==null||f.updatePolygonList(e,i),f==null||f.updatePointList(m),f==null||f.updateLineList(C),g==null||g.generateBoxes(e),g==null||g.generateSpheres(m),(V=L==null?void 0:L.store)==null||V.updateCurrentSegment(w),we(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,e)},Qe=()=>{X(void 0),$(void 0),te(void 0),oe(void 0)},we=(e,i,m)=>__async(void 0,null,function*(){var C,w,V;if(!g)return;const be=g.pointCloudObject;if(!be)return;let ye=[],Re=[];try{if(i&&F.record.length){const{record:b,recordIndex:y}=F;let xe=y;y>0&&(e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleToggleValid||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleRotate||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single&&i.length===((C=b[y])==null?void 0:C.pointCloudBoxList.length))&&(xe=y-1);let Xe=(w=b[xe])==null?void 0:w.pointCloudBoxList;const Le=ToolPointCloudBoxRenderHelper.calcResetAreasAndBoxIds(e,i,Xe);ye=Le.modifiedBoxIds,Re=Le.resetAreas}}catch(b){console.error("call calcResetAreasAndBoxIds error",b)}try{const b=yield g.getHighlightIndexByMappingImgList({mappingImgList:m!=null?m:W,points:be.geometry.attributes.position.array}),y=yield g==null?void 0:g.highlightOriginPointCloud(i,b,{modifiedBoxIds:ye,resetAreas:Re});return y&&((V=f==null?void 0:f.pointCloudInstance)==null||V.updateColor(y)),y}catch(b){console.error("call highlightOriginPointCloud error",b)}});return{selectedID:ue,pointCloudBoxList:s,pointCloudSphereList:x,displayPointCloudList:Pe,displaySphereList:Ie,displayLineList:Ce,selectedIDs:v,setPointCloudResult:Se,setSelectedIDs:a,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:B,valid:U,visibleBatchSetValid:de,selectedPointCloudBox:o,setPointCloudValid:l,setBatchSetValidModal:d,addSelectedID:I,addHighlightID:k,selectedAllBoxes:Ke,topViewInstance:f,setTopViewInstance:X,sideViewInstance:Y,setSideViewInstance:$,backViewInstance:ee,setBackViewInstance:te,mainViewInstance:g,setMainViewInstance:oe,polygonList:D,setPolygonList:E,rectList:P,setRectList:u,addRectIn2DView:S,removeRectIn2DView:G,updateRectIn2DView:M,lineList:R,setLineList:Be,zoom:Q,setZoom:Ve,history:F,toggleAttributesVisible:Ze,hideAttributes:h,setHideAttributes:q,reRender:Je,attrPanelLayout:ie,setAttrPanelLayout:Me,syncAllViewPointCloudColor:we,defaultAttribute:ne,setDefaultAttribute:Ne,pointCloudPattern:j,setPointCloudPattern:He,selectSpecAttr:Ue,globalPattern:T,setGlobalPattern:e=>{T!==e&&(Te(actionCreators.ChangeSave),ke(e),e===lbUtils.EPointCloudPattern.Detection&&se(void 0))},ptSegmentInstance:L,setPtSegmentInstance:se,segmentation:z,setSegmentation:Ee,clearAllDetectionInstance:Qe,highlight2DDataList:W,setHighlight2DDataList:Oe,highlight2DLoading:re,setHighlight2DLoading:je,cuboidBoxIn2DView:J,setCuboidBoxIn2DView:_e,imageSizes:ce,cacheImageNodeSize:ze,highlightIDs:A,setHighlightIDs:O,removeRectByPointCloudBoxId:fe,removeRectBySpecifyId:N,addRectFromPointCloudBoxByImageName:he,rectRotateSensitivity:Z,setRectRotateSensitivity:Ae,imageNamePointCloudBoxMap:pe,linkageImageNameRectMap:ve,updateRectListByReducer:me,windowKeydownListenerHook:ge,isLargeStatus:ae,setIsLargeStatus:le}},[U,de,v,s,x,D,R,P,f,Y,ee,g,Q,h,ie,ne,j,T,L,z,W,re,J,ce,A,fe,N,he,Z,pe,ve,me,ge,ae,le]);React.useEffect(()=>{var o,n,t;(o=p==null?void 0:p.setPointCloudBoxList)==null||o.call(p,s),(n=p==null?void 0:p.setHighlightIDs)==null||n.call(p,A),(t=p==null?void 0:p.setSelectedIDs)==null||t.call(p,v)},[s,v,A]),React.useEffect(()=>{var o;(o=p==null?void 0:p.setPtCtx)==null||o.call(p,H)},[H]);const Ge=()=>{const o=s.filter(d=>h.includes(d.attribute)),{setSelectedIDs:n,reRender:t}=H,l=o.map(d=>d.id);l.length>0&&n(v.filter(d=>!l.includes(d))),t()};return React.useEffect(()=>{var o,n,t,l;Ge(),(n=(o=f==null?void 0:f.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,h),(l=(t=L==null?void 0:L.store)==null?void 0:t.setHiddenAttributes)==null||l.call(t,h)},[h]),React__default.default.createElement(PointCloudContext.Provider,{value:H},r)};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"),useUpdatePointCloudColor=require("./hooks/useUpdatePointCloudColor.js"),reactI18next=require("react-i18next"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(a,r,i)=>r in a?__defProp(a,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[r]=i,__spreadValues=(a,r)=>{for(var i in r||(r={}))__hasOwnProp.call(r,i)&&__defNormalProp(a,i,r[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(r))__propIsEnum.call(r,i)&&__defNormalProp(a,i,r[i]);return a},__spreadProps=(a,r)=>__defProps(a,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:a,config:r,checkMode:i,configString:x,imgIndex:b,toolInstanceRef:u,setResourceLoading:y})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:k,selectNextBox:V,selectPrevBox:_,updateSelectedBox:E,deleteSelectedPointCloudBoxAndPolygon:I}=useSingleBox.useSingleBox(),{selectedSphere:v,updatePointCloudSphere:q}=useSphere.useSphere(),{clearAllResult:P,updatePointCloudPattern:B}=useStatus.useStatus(),{copySelectedBoxes:L,pasteSelectedBoxes:O,copiedBoxes:W}=useBoxes.useBoxes({config:r,currentData:a}),{updateRotate:C}=useRotate.useRotate({currentData:a}),{updateRotateEdge:j}=useRotateEdge.useRotateEdge({currentData:a}),{updatePointCloudData:d,topViewSelectedChanged:T}=usePointCloudViews.usePointCloudViews({setResourceLoading:y}),{redo:f,undo:g,pushHistoryWithList:A,pushHistoryUnderUpdatePolygon:D,pushHistoryUnderUpdateLine:H}=useHistory.useHistory(),{syncThreeViewsAttribute:m}=useAttribute.useAttribute(),{syncAllViewsConfig:N,reRenderTopViewRange:R}=useConfig.useConfig(),{selectedPolygon:h}=usePolygon.usePolygon(),{selectedLine:S}=useLine.useLine(),{t:w}=reactI18next.useTranslation(),{updatePointCloudColor:K}=useUpdatePointCloudColor.useUpdatePointCloudColor(y,r),U=ahooks.useLatest(a),p=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},z=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{C(e.rectRotateSensitivity);break}case"e":C(-Number(e.rectRotateSensitivity));break;case"g":j(-90);break;case"u":{const c=l.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;B(c);const M={[lbAnnotation.EToolName.Polygon]:w("PolygonPattern"),[lbAnnotation.EToolName.Rect]:w("RectPattern")};antd.message.success(w("ChangePatternMsg",{pattern:M[c]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){_();break}V(),o.preventDefault();break;case"f":k();break;case"arrowup":p({y:-1});break;case"arrowdown":p({y:1});break;case"arrowleft":p({x:-1});break;case"arrowright":p({x:1});break;case"delete":I(U.current);break}},F=(t,o)=>{switch(t){case"c":L();break;case"v":O();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?f():g();break}}},G=ahooks.useLatest(t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||i===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){F(o,t);return}z(o,t)});return React.useEffect(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>G.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),React.useEffect(()=>{N(r)},[x]),React.useEffect(()=>{(r==null?void 0:r.radius)&&R(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{d==null||d()},[b,e.mainViewInstance]),React.useEffect(()=>{e.setHideAttributes([])},[b]),React.useEffect(()=>{u.current.setDefaultAttribute=t=>{var o;if(m(t),K(t),h&&D(__spreadProps(__spreadValues({},h),{attribute:t})),S&&H(__spreadProps(__spreadValues({},S),{attribute:t})),v){const s=q(__spreadProps(__spreadValues({},v),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),T({newSelectedSphere:v,newSphereList:s}))}},u.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=__spreadProps(__spreadValues({},l),{[t]:o}),E(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},u.current.clearResult=()=>{P==null||P()},u.current.redo=()=>{f()},u.current.undo=()=>{g()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&P()})},u.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{d==null||d(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),React.useEffect(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),React.useEffect(()=>{u.current.history={pushHistory:t=>{A({pointCloudBoxList:t})},initRecord:()=>{}}},[]),React.useEffect(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||i)return;const s=c=>{m(c)},n=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.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"),useUpdatePointCloudColor=require("./hooks/useUpdatePointCloudColor.js"),reactI18next=require("react-i18next"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(a,s,i)=>s in a?__defProp(a,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[s]=i,__spreadValues=(a,s)=>{for(var i in s||(s={}))__hasOwnProp.call(s,i)&&__defNormalProp(a,i,s[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(s))__propIsEnum.call(s,i)&&__defNormalProp(a,i,s[i]);return a},__spreadProps=(a,s)=>__defProps(a,__getOwnPropDescs(s));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:a,config:s,checkMode:i,configString:x,imgIndex:w,toolInstanceRef:u,setResourceLoading:y,isBatchSetValid:k})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:V,selectNextBox:_,selectPrevBox:E,updateSelectedBox:B,deleteSelectedPointCloudBoxAndPolygon:I}=useSingleBox.useSingleBox(),{selectedSphere:v,updatePointCloudSphere:q}=useSphere.useSphere(),{clearAllResult:P,updatePointCloudPattern:L}=useStatus.useStatus(),{copySelectedBoxes:O,pasteSelectedBoxes:j,copiedBoxes:Y}=useBoxes.useBoxes({config:s,currentData:a}),{updateRotate:C}=useRotate.useRotate({currentData:a}),{updateRotateEdge:A}=useRotateEdge.useRotateEdge({currentData:a}),{updatePointCloudData:d,topViewSelectedChanged:T}=usePointCloudViews.usePointCloudViews({setResourceLoading:y}),{redo:f,undo:g,pushHistoryWithList:D,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:N}=useHistory.useHistory(),{syncThreeViewsAttribute:h}=useAttribute.useAttribute(),{syncAllViewsConfig:R,reRenderTopViewRange:K}=useConfig.useConfig(),{selectedPolygon:m}=usePolygon.usePolygon(),{selectedLine:S}=useLine.useLine(),{t:b}=reactI18next.useTranslation(),{updatePointCloudColor:U}=useUpdatePointCloudColor.useUpdatePointCloudColor(y,s),z=ahooks.useLatest(a),p=t=>{var o;const{topViewInstance:r}=e;!r||(o=r.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},F=(t,o)=>{const{topViewInstance:r,mainViewInstance:n}=e;if(!r)return;const{pointCloud2dOperation:l}=r;switch(t){case"q":{C(e.rectRotateSensitivity);break}case"e":C(-Number(e.rectRotateSensitivity));break;case"g":A(-90);break;case"u":{const c=l.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;L(c);const W={[lbAnnotation.EToolName.Polygon]:b("PolygonPattern"),[lbAnnotation.EToolName.Rect]:b("RectPattern")};antd.message.success(b("ChangePatternMsg",{pattern:W[c]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":k?(antd.Modal.destroyAll(),e.setBatchSetValidModal(!e.visibleBatchSetValid)):e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){E();break}_(),o.preventDefault();break;case"f":V();break;case"arrowup":p({y:-1});break;case"arrowdown":p({y:1});break;case"arrowleft":p({x:-1});break;case"arrowright":p({x:1});break;case"delete":I(z.current);break}},M=(t,o)=>{switch(t){case"c":O();break;case"v":j();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?f():g();break}}},G=ahooks.useLatest(t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||i===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){M(o,t);return}F(o,t)});return React.useEffect(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>G.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),React.useEffect(()=>{R(s)},[x]),React.useEffect(()=>{(s==null?void 0:s.radius)&&K(s==null?void 0:s.radius)},[s==null?void 0:s.radius]),React.useEffect(()=>{d==null||d()},[w,e.mainViewInstance]),React.useEffect(()=>{e.setHideAttributes([])},[w]),React.useEffect(()=>{u.current.setDefaultAttribute=t=>{var o;if(h(t),U(t),m&&H(__spreadProps(__spreadValues({},m),{attribute:t})),S&&N(__spreadProps(__spreadValues({},S),{attribute:t})),v){const r=q(__spreadProps(__spreadValues({},v),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(r),T({newSelectedSphere:v,newSphereList:r}))}},u.current.setSubAttribute=(t,o)=>{var r;const n=e.selectedPointCloudBox;if(n){const l=(r=n==null?void 0:n.subAttribute)!=null?r:{};n.subAttribute=__spreadProps(__spreadValues({},l),{[t]:o}),B(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},u.current.clearResult=()=>{P==null||P()},u.current.redo=()=>{f()},u.current.undo=()=>{g()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&P()})},u.current.setForbidOperation=t=>{var o,r;(r=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||r.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,r;(r=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||r.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{d==null||d(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),React.useEffect(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),React.useEffect(()=>{u.current.history={pushHistory:t=>{D({pointCloudBoxList:t})},initRecord:()=>{}}},[]),React.useEffect(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||i)return;const r=c=>{h(c)},n=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};return o.on("syncAttribute",r),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",r),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),_=require("lodash"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.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=(o,n,t)=>n in o?__defProp(o,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[n]=t,__spreadValues=(o,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(o,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(o,t,n[t]);return o},__spreadProps=(o,n)=>__defProps(o,__getOwnPropDescs(n)),__async=(o,n,t)=>new Promise((a,p)=>{var e=d=>{try{c(t.next(d))}catch(x){p(x)}},P=d=>{try{c(t.throw(d))}catch(x){p(x)}},c=d=>d.done?a(d.value):Promise.resolve(d.value).then(e,P);c((t=t.apply(o,n)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(o,n,t,a,p)=>{const{x:e,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,n),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:e,y:P,z:c},id:o.id},x=a?__spreadValues(__spreadValues({},a),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return p&&Object.assign(x,p),x},topViewPolygon2PointCloud=(o,n,t,a,p,e)=>{let P=o.pointList.map(w=>lbUtils.PointCloudUtils.transferCanvas2World(w,n)),c=0,d=1,x={};if(t){const w=t.getSensesPointZAxisInPolygon(P,void 0,e);e&&w.fittedCoordinates.length>0&&(P=w.fittedCoordinates),c=(w.maxZ+w.minZ)/2,d=w.maxZ-w.minZ,x={count:w.zCount}}const[f,v,R]=P,I=lbAnnotation.MathUtils.getLineCenterPoint([f,R]),S=lbAnnotation.MathUtils.getLineLength(f,v),V=lbAnnotation.MathUtils.getLineLength(v,R),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(o.pointList);a&&(c=a.center.z,d=a.depth);const T={center:{x:I.x,y:I.y,z:c},width:e?V+INTELLIGENT_FIT_MARGIN:V,height:e?S+INTELLIGENT_FIT_MARGIN:S,depth:d,rotation:k,id:o.id},A=__spreadValues(a?__spreadValues(__spreadValues({},a),T):__spreadProps(__spreadValues({},T),{attribute:"",valid:!0}),x);p&&Object.assign(A,p);const O=P.map(w=>lbUtils.PointCloudUtils.transferWorld2Canvas(w,n));return{boxParams:A,newPointList:O}},sideViewPoint2PointCloud=(o,n,t)=>{const a={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x-a.x,y:t.center.y,z:t.center.z-a.y}})},sideViewPolygon2PointCloud=(o,n,t,a)=>{const[p,e,P]=o.pointList,[c,d,x]=n.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),v=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),I={x:{x:f.x-v.x,y:f.y-v.y}.x,y:0,z:f.y-v.y},S=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,d),k=S-V,T=lbAnnotation.MathUtils.getLineLength(e,P),A=lbAnnotation.MathUtils.getLineLength(d,x),O=T-A,{newBoxParams:w}=a.getNewBoxBySideUpdate(I,O,k,t);return w},backViewPoint2PointCloud=(o,n,t)=>{const a={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x,y:t.center.y-a.x,z:t.center.z-a.y}})},backViewPolygon2PointCloud=(o,n,t,a)=>{const[p,e,P]=o.pointList,[c,d,x]=n.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),v=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),I={x:{x:f.x-v.x,y:f.y-v.y}.x,y:0,z:f.y-v.y},S=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,d),k=S-V,T=lbAnnotation.MathUtils.getLineLength(e,P),A=lbAnnotation.MathUtils.getLineLength(d,x),O=T-A;let{newBoxParams:w}=a.getNewBoxByBackUpdate(I,O,k,t);return w},syncSideViewByPoint=(o,n,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(d);const{point2d:x,zoom:f}=c.getSphereSidePoint2DCoordinate(o);c.camera.zoom=f,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(f),P.setResult([__spreadProps(__spreadValues(__spreadValues({},n),x),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(n.id)},synchronizeSideView=(o,n,t,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxSidePolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncBackViewByPoint=(o,n,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(d);const{point2d:x,zoom:f}=c.getSphereBackPoint2DCoordinate(o);c.camera.zoom=f,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(f),P.setResult([__spreadProps(__spreadValues(__spreadValues({},n),x),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(n.id)},synchronizeBackView=(o,n,t,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxBackPolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncTopViewByPoint=(o,n,t,a)=>{if(!t||!a)return;a.generateSphere(o),a.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:p,pointCloudInstance:e}=t,{point2d:P}=e.getSphereTopPoint2DCoordinate(o),c=[...p.pointList].map(d=>d.id===n.id?__spreadProps(__spreadValues(__spreadValues({},n),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):d);p.setResult(c),p.setSelectedID(n.id)},synchronizeTopView=(o,n,t,a)=>{var p,e;if(!t||!a)return;a.generateBox(o),a.setHighlightColor(o.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=t,{polygon2d:d}=c.getBoxTopPolygon2DCoordinate(o),x=[...P.polygonList],f=x.find(v=>v.id===n.id);f?(f.pointList=d,f.valid=(p=o.valid)!=null?p:!0):x.push({id:n.id,pointList:d,textAttribute:"",isRect:!0,valid:(e=o.valid)!=null?e:!0}),P.setResultAndSelectedID(x,n.id)},usePointCloudViews=o=>{const n=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:a,backViewInstance:p,mainViewInstance:e,addPointCloudBox:P,addPointCloudSphere:c,setSelectedIDs:d,selectedIDs:x,pointCloudBoxList:f,pointCloudSphereList:v,hideAttributes:R,setHighlight2DDataList:I,cuboidBoxIn2DView:S,imageSizes:V,history:k,linkageImageNameRectMap:T}=n,{addHistory:A,initHistory:O,pushHistoryUnderUpdatePolygon:w}=useHistory.useHistory(),{selectedPolygon:ot}=usePolygon.usePolygon(),{getPointCloudSphereByID:nt,updatePointCloudSphere:X,selectedSphere:F}=useSphere.useSphere(),{currentData:E,config:y}=ctx.useSelector(s=>{const{stepList:i,step:u,imgList:l,imgIndex:g}=s.annotation;return{currentData:l[g],config:index.jsonParser(StepUtils.getCurrentStepInfo(u,i).config)}}),M=ctx.useDispatch(),it=ahooks.useLatest(S),st=ahooks.useLatest(T),rt=React.useCallback((s,i)=>{const u=st.current,l=i.id;return s.filter(r=>{if(!r)return!1;const h=u.get(r.imageName);return h===void 0?!0:Boolean(h.get(l))})},[]),Z=s=>{const{enableAutoMap2DRect:i=!1}=y;if(!it.current||i){const{mappingImgList:u=[]}=E;index.generatePointCloudBoxRects({pointCloudBox:s,mappingImgList:u,imageSizes:V},{prepareRectsFn:rt})}},{selectedBox:U,updateSelectedBox:lt,updateSelectedBoxes:G,getPointCloudByID:at}=useSingleBox.useSingleBox({generateRects:Z}),Y=U==null?void 0:U.info;if(!t||!a||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:J}=t,dt=s=>{e==null||e.generateSphere(s),e==null||e.controls.update(),e==null||e.render()},ut=({newPoint:s,size:i,zoom:u,trackConfigurable:l})=>{var g;const r={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};l===!0&&Object.assign(r,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const h=topViewPoint2PointCloud(s,i,J,void 0,r);d(s.id);const C=c(h);H(PointCloudView.Top,s,h,u,C,y),A({newSphereParams:h})},ct=({polygon:s,size:i,imgList:u,trackConfigurable:l,zoom:g,intelligentFit:r})=>{var h,C,b;const D={attribute:(h=t.toolInstance.defaultAttribute)!=null?h:""};l===!0&&Object.assign(D,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:f,extraSphereList:v})}),t==null||t.toolInstance;const L=__spreadValues({},s);let{boxParams:B,newPointList:m}=topViewPolygon2PointCloud(L,i,J,void 0,D,r);B=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[B],stepConfig:y,action:"viewUpdateBox"}))[0],r&&(m==null?void 0:m.length)&&(L.pointList=m);const N=R.includes(L.attribute);Z(B);const z=P(B),Q=(C=n==null?void 0:n.polygonList)!=null?C:[];B.subAttribute=lbAnnotation.TagUtils.getDefaultResultByConfig((y==null?void 0:y.secondaryAttributeConfigurable)?(b=y==null?void 0:y.inputList)!=null?b:[]:[]),t==null||t.updatePolygonList(z!=null?z:[],Q),N?d([]):(d(B.id),r&&synchronizeTopView(B,L,t,e)),A({newBoxParams:B})},pt=s=>{const{boxID:i,imageName:u,width:l,height:g,x:r,y:h}=s,C=f.find(m=>m.id===i);if(!(C==null?void 0:C.rects)||!C.rects.find(m=>m.imageName===u))return;const D=C.rects.map(m=>m.imageName===u?__spreadProps(__spreadValues({},m),{width:l,height:g,x:r,y:h}):m),L=__spreadProps(__spreadValues({},C),{rects:D}),B=f.map(m=>m.id===i?L:m);return t==null||t.updatePolygonList(B!=null?B:[]),B},gt=s=>{const{boxID:i,imageName:u}=s,l=f.find(C=>C.id===i);if(!(l==null?void 0:l.rects))return;const g=l.rects.filter(C=>C.imageName!==u),r=__spreadProps(__spreadValues({},l),{rects:g}),h=f.map(C=>C.id===i?r:C);return t==null||t.updatePolygonList(h!=null?h:[]),h},Pt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:u,newSphereList:l})=>{var g;const r=t==null?void 0:t.toolInstance;if(!(x.length===0||!r)){if(s||(U==null?void 0:U.info)){const h=s!=null?s:U==null?void 0:U.info;(g=r==null?void 0:r.selection)==null||g.setSelectedIDs(x[0]);const C=r.selectedPolygon;if(x.length===1&&h){q({omitView:PointCloudView.Top,polygon:C,boxParams:h,newPointCloudBoxList:i});return}}if((u||F)&&x.length===1){const h=u!=null?u:F;r.setSelectedID(x[0]);const C=r.selectedPoint;h&&H(PointCloudView.Top,C,h,void 0,l,y)}}},K=(s,i,u,l=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{if(Y){let g,r;switch(u){case PointCloudView.Back:g=backViewPolygon2PointCloud;break;case PointCloudView.Side:g=sideViewPolygon2PointCloud;break;default:g=sideViewPolygon2PointCloud;break}if(r=g(s,i,Y,a.pointCloudInstance),e){const{count:L}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:L})}const C=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:y,action:"viewUpdateBox"}))[0],b=r.valid!==C.valid;r=C;const D=lt(r);return r=D.find(L=>L.id===r.id),q({omitView:b?void 0:u,polygon:s,boxParams:r,newPointCloudBoxList:D},l),D}},$=(s,i,u)=>{if(F){let l,g;switch(u){case PointCloudView.Back:l=backViewPoint2PointCloud;break;case PointCloudView.Side:l=sideViewPoint2PointCloud;break;default:l=sideViewPoint2PointCloud;break}g=l(s,i,F);const r=X(g);return H(u,s,g,void 0,r,y),r}},Ct=(s,i)=>{$(s,i,PointCloudView.Side)},ft=(s,i)=>{$(s,i,PointCloudView.Back)},ht=(s,i)=>{K(s,i,PointCloudView.Side,ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)},xt=(s,i)=>{K(s,i,PointCloudView.Back,ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)},vt=(s,i)=>{const u=nt(s.id),l=topViewPoint2PointCloud(s,i,J,u),g=X(l);H(PointCloudView.Top,s,l,void 0,g,y)},Lt=(s,i)=>{if(ot){const l=__spreadValues({},s[0].newPolygon);l.pointList=l.pointList.map(g=>lbUtils.PointCloudUtils.transferCanvas2World(g,i)),w(l);return}let u=s.map(({newPolygon:l})=>{const g=at(l.id),{boxParams:r}=topViewPolygon2PointCloud(l,i,t.pointCloudInstance,g);return r});if(u=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:u,stepConfig:y,action:"viewUpdateBox"})),u.length===1){const{newPolygon:l}=s[0],g=G(u);q({polygon:l,boxParams:u[0],newPointCloudBoxList:g},ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)}else{const l=G(u);l&&n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiMove,l)}},yt=s=>{var i,u,l,g,r;if(U){const h=Number(s.widthDefault),C=Number(s.depthDefault),b=Number(s.heightDefault),D=U==null?void 0:U.info.trackID,B=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(W=>(W==null?void 0:W.trackID)===D),m={width:(l=(u=t==null?void 0:t.toolInstance)==null?void 0:u.basicImgInfo)==null?void 0:l.width,height:(r=(g=t==null?void 0:t.toolInstance)==null?void 0:g.basicImgInfo)==null?void 0:r.height},j=B.pointList.map(W=>lbUtils.PointCloudUtils.transferCanvas2World(W,m)),N=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(j,b,h),z=N[0],Q=N[2],tt=lbAnnotation.MathUtils.getLineCenterPoint([z,Q]),mt=U.info.center.z-U.info.depth/2,et=__spreadProps(__spreadValues({},U.info),{center:{x:tt.x,y:tt.y,z:mt+C/2},width:h,height:b,depth:C,valid:!0}),Bt=G([et]);q({omitView:PointCloudView["3D"],polygon:B,boxParams:et,newPointCloudBoxList:Bt})}},H=(s,i,u,l,g,r)=>__async(void 0,null,function*(){const h=E==null?void 0:E.url,C={[PointCloudView.Side]:()=>{syncSideViewByPoint(u,i,a,h,r)},[PointCloudView.Back]:()=>{p&&syncBackViewByPoint(u,i,p,h,r)},[PointCloudView.Top]:()=>{syncTopViewByPoint(u,i,t,e)}};Object.keys(C).forEach(b=>{b!==s&&C[b]()}),l&&(e==null||e.updateCameraZoom(l)),dt(u)}),q=(s,i=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{const{omitView:u,polygon:l,boxParams:g,zoom:r,newPointCloudBoxList:h}=s,C=E==null?void 0:E.url;h&&n.syncAllViewPointCloudColor(i,h);const b={[PointCloudView.Side]:()=>{synchronizeSideView(g,l,a,C)},[PointCloudView.Back]:()=>{p&&synchronizeBackView(g,l,p,C)},[PointCloudView.Top]:()=>{synchronizeTopView(g,l,t,e)}};Object.keys(b).forEach(D=>{D!==u&&b[D]()}),r&&(e==null||e.updateCameraZoom(r))};return{topViewAddSphere:ut,topViewAddBox:ct,topViewSelectedChanged:Pt,topViewUpdatePoint:vt,sideViewUpdatePoint:Ct,backViewUpdatePoint:ft,topViewUpdateBox:Lt,sideViewUpdateBox:ht,backViewUpdateBox:xt,syncPointCloudViews:q,syncPointCloudPoint:H,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),e==null||e.generateBoxes(s)},initPointCloud3d:s=>{if(!e)return;const i=lbUtils.PointCloudUtils.getDefaultOrthographicParams(s);e.initOrthographicCamera(i),e.initRenderer(),e.render()},updatePointCloudData:(...s)=>__async(void 0,[...s],function*(i=E){var u,l,g,r,h,C,b,D;if(!(i==null?void 0:i.url)||!e)return;I([]),actionCreators.SetAnnotationLoading(M,!0),actionCreators.SetLoadPCDFileLoading(M,!0),(u=o==null?void 0:o.setResourceLoading)==null||u.call(o,!0),yield e.loadPCDFile(i.url,(l=y==null?void 0:y.radius)!=null?l:DEFAULT_RADIUS),e==null||e.clearAllBox(),e==null||e.clearAllSphere();let L=[],B=[],m=[],j=[];e.updateTopCamera();const N=(r=(g=index.jsonParser(i.result))==null?void 0:g.valid)!=null?r:!0;if(n.setPointCloudValid(N),(h=n.sideViewInstance)==null||h.clearAllData(),(C=n.backViewInstance)==null||C.clearAllData(),i.result){if(L=lbUtils.PointCloudUtils.getBoxParamsFromResultList(i.result),(L==null?void 0:L.length)>0&&i.isPreResult&&(y==null?void 0:y.lowerLimitPointsNumInBox)>0){L=yield e==null?void 0:e.filterPreResult(i.url,y,L);const z=index.jsonParser(i.result);z[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=L,i.result=JSON.stringify(z),n.setPointCloudResult(L)}m=lbUtils.PointCloudUtils.getPolygonListFromResultList(i.result),B=lbUtils.PointCloudUtils.getLineListFromResultList(i.result),j=lbUtils.PointCloudUtils.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(b=y==null?void 0:y.radius)!=null?b:DEFAULT_RADIUS}),e==null||e.generateBoxes(L),e==null||e.generateSpheres(j),yield n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,L,[])}O({pointCloudBoxList:L,polygonList:m,lineList:B,pointCloudSphereList:j}),actionCreators.SetAnnotationLoading(M,!1),actionCreators.SetLoadPCDFileLoading(M,!1),(D=o==null?void 0:o.setResourceLoading)==null||D.call(o,!1)}),updateViewsByDefaultSize:yt,generateRects:Z,update2DViewRect:pt,remove2DViewRect:gt}},useSyncRectPositionDimensionToPointCloudList=()=>{const{pointCloudBoxList:o,rectList:n,setPointCloudResult:t}=React.useContext(PointCloudContext.PointCloudContext),a=ahooks.useLatest(o),p=ahooks.useLatest(n);return{syncToPointCloudBoxList:React.useCallback(()=>{const P=a.current,c=p.current;if(c.length===0)return null;const d=new Map,x=new Set;if(c.filter(f=>f.extId!==void 0).forEach(f=>{const v=f.extId,R=f.imageName,I=_.pick(f,["x","y","width","height"]);let S=d.get(v);S||(S=new Map,d.set(v,S)),S.set(R,I),x.add(v)}),d.size){const f=P.map(v=>{var R;const I=v.id;if(x.has(I)){const S=__spreadValues({},v);return(R=S.rects)==null||R.forEach(V=>{var k;const T=V.imageName;Object.assign(V,(k=d.get(I))==null?void 0:k.get(T))}),S}return v});return t(f),f}return null},[])}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews,exports.useSyncRectPositionDimensionToPointCloudList=useSyncRectPositionDimensionToPointCloudList;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),_=require("lodash"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.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=(o,n,t)=>n in o?__defProp(o,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[n]=t,__spreadValues=(o,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(o,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(o,t,n[t]);return o},__spreadProps=(o,n)=>__defProps(o,__getOwnPropDescs(n)),__async=(o,n,t)=>new Promise((a,p)=>{var e=d=>{try{c(t.next(d))}catch(x){p(x)}},P=d=>{try{c(t.throw(d))}catch(x){p(x)}},c=d=>d.done?a(d.value):Promise.resolve(d.value).then(e,P);c((t=t.apply(o,n)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(o,n,t,a,p)=>{const{x:e,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,n),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:e,y:P,z:c},id:o.id},x=a?__spreadValues(__spreadValues({},a),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return p&&Object.assign(x,p),x},topViewPolygon2PointCloud=(o,n,t,a,p,e)=>{let P=o.pointList.map(w=>lbUtils.PointCloudUtils.transferCanvas2World(w,n)),c=0,d=1,x={};if(t){const w=t.getSensesPointZAxisInPolygon(P,void 0,e);e&&w.fittedCoordinates.length>0&&(P=w.fittedCoordinates),c=(w.maxZ+w.minZ)/2,d=w.maxZ-w.minZ,x={count:w.zCount}}const[f,v,R]=P,I=lbAnnotation.MathUtils.getLineCenterPoint([f,R]),S=lbAnnotation.MathUtils.getLineLength(f,v),V=lbAnnotation.MathUtils.getLineLength(v,R),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(o.pointList);a&&(c=a.center.z,d=a.depth);const T={center:{x:I.x,y:I.y,z:c},width:e?V+INTELLIGENT_FIT_MARGIN:V,height:e?S+INTELLIGENT_FIT_MARGIN:S,depth:d,rotation:k,id:o.id},A=__spreadValues(a?__spreadValues(__spreadValues({},a),T):__spreadProps(__spreadValues({},T),{attribute:"",valid:!0}),x);p&&Object.assign(A,p);const O=P.map(w=>lbUtils.PointCloudUtils.transferWorld2Canvas(w,n));return{boxParams:A,newPointList:O}},sideViewPoint2PointCloud=(o,n,t)=>{const a={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x-a.x,y:t.center.y,z:t.center.z-a.y}})},sideViewPolygon2PointCloud=(o,n,t,a)=>{const[p,e,P]=o.pointList,[c,d,x]=n.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),v=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),I={x:{x:f.x-v.x,y:f.y-v.y}.x,y:0,z:f.y-v.y},S=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,d),k=S-V,T=lbAnnotation.MathUtils.getLineLength(e,P),A=lbAnnotation.MathUtils.getLineLength(d,x),O=T-A,{newBoxParams:w}=a.getNewBoxBySideUpdate(I,O,k,t);return w},backViewPoint2PointCloud=(o,n,t)=>{const a={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x,y:t.center.y-a.x,z:t.center.z-a.y}})},backViewPolygon2PointCloud=(o,n,t,a)=>{const[p,e,P]=o.pointList,[c,d,x]=n.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),v=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),I={x:{x:f.x-v.x,y:f.y-v.y}.x,y:0,z:f.y-v.y},S=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,d),k=S-V,T=lbAnnotation.MathUtils.getLineLength(e,P),A=lbAnnotation.MathUtils.getLineLength(d,x),O=T-A;let{newBoxParams:w}=a.getNewBoxByBackUpdate(I,O,k,t);return w},syncSideViewByPoint=(o,n,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(d);const{point2d:x,zoom:f}=c.getSphereSidePoint2DCoordinate(o);c.camera.zoom=f,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(f),P.setResult([__spreadProps(__spreadValues(__spreadValues({},n),x),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(n.id)},synchronizeSideView=(o,n,t,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxSidePolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncBackViewByPoint=(o,n,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(d);const{point2d:x,zoom:f}=c.getSphereBackPoint2DCoordinate(o);c.camera.zoom=f,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(f),P.setResult([__spreadProps(__spreadValues(__spreadValues({},n),x),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(n.id)},synchronizeBackView=(o,n,t,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxBackPolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncTopViewByPoint=(o,n,t,a)=>{if(!t||!a)return;a.generateSphere(o),a.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:p,pointCloudInstance:e}=t,{point2d:P}=e.getSphereTopPoint2DCoordinate(o),c=[...p.pointList].map(d=>d.id===n.id?__spreadProps(__spreadValues(__spreadValues({},n),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):d);p.setResult(c),p.setSelectedID(n.id)},synchronizeTopView=(o,n,t,a)=>{var p,e;if(!t||!a)return;a.generateBox(o),a.setHighlightColor(o.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=t,{polygon2d:d}=c.getBoxTopPolygon2DCoordinate(o),x=[...P.polygonList],f=x.find(v=>v.id===n.id);f?(f.pointList=d,f.valid=(p=o.valid)!=null?p:!0):x.push({id:n.id,pointList:d,textAttribute:"",isRect:!0,valid:(e=o.valid)!=null?e:!0}),P.setResultAndSelectedID(x,n.id)},usePointCloudViews=o=>{const n=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:a,backViewInstance:p,mainViewInstance:e,addPointCloudBox:P,addPointCloudSphere:c,setSelectedIDs:d,selectedIDs:x,pointCloudBoxList:f,pointCloudSphereList:v,hideAttributes:R,setHighlight2DDataList:I,cuboidBoxIn2DView:S,imageSizes:V,history:k,linkageImageNameRectMap:T}=n,{addHistory:A,initHistory:O,pushHistoryUnderUpdatePolygon:w}=useHistory.useHistory(),{selectedPolygon:ot}=usePolygon.usePolygon(),{getPointCloudSphereByID:nt,updatePointCloudSphere:X,selectedSphere:F}=useSphere.useSphere(),{currentData:E,config:y}=ctx.useSelector(s=>{const{stepList:i,step:u,imgList:l,imgIndex:g}=s.annotation;return{currentData:l[g],config:index.jsonParser(StepUtils.getCurrentStepInfo(u,i).config)}}),M=ctx.useDispatch(),it=ahooks.useLatest(S),st=ahooks.useLatest(T),rt=React.useCallback((s,i)=>{const u=st.current,l=i.id;return s.filter(r=>{if(!r)return!1;const h=u.get(r.imageName);return h===void 0?!0:Boolean(h.get(l))})},[]),Z=s=>{const{enableAutoMap2DRect:i=!1}=y;if(!it.current||i){const{mappingImgList:u=[]}=E;index.generatePointCloudBoxRects({pointCloudBox:s,mappingImgList:u,imageSizes:V},{prepareRectsFn:rt})}},{selectedBox:U,updateSelectedBox:lt,updateSelectedBoxes:G,getPointCloudByID:at}=useSingleBox.useSingleBox({generateRects:Z}),Y=U==null?void 0:U.info;if(!t||!a||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:J}=t,dt=s=>{e==null||e.generateSphere(s),e==null||e.controls.update(),e==null||e.render()},ut=({newPoint:s,size:i,zoom:u,trackConfigurable:l})=>{var g;const r={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};l===!0&&Object.assign(r,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const h=topViewPoint2PointCloud(s,i,J,void 0,r);d(s.id);const C=c(h);H(PointCloudView.Top,s,h,u,C,y),A({newSphereParams:h})},ct=({polygon:s,size:i,imgList:u,trackConfigurable:l,zoom:g,intelligentFit:r})=>{var h,C,b;const D={attribute:(h=t.toolInstance.defaultAttribute)!=null?h:""};l===!0&&Object.assign(D,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:f,extraSphereList:v})}),t==null||t.toolInstance;const L=__spreadValues({},s);let{boxParams:B,newPointList:m}=topViewPolygon2PointCloud(L,i,J,void 0,D,r);B=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[B],stepConfig:y,action:"viewUpdateBox"}))[0],r&&(m==null?void 0:m.length)&&(L.pointList=m);const N=R.includes(L.attribute);Z(B);const z=P(B),Q=(C=n==null?void 0:n.polygonList)!=null?C:[];B.subAttribute=lbAnnotation.TagUtils.getDefaultResultByConfig((y==null?void 0:y.secondaryAttributeConfigurable)?(b=y==null?void 0:y.inputList)!=null?b:[]:[]),t==null||t.updatePolygonList(z!=null?z:[],Q,!1),N?d([]):(d(B.id),r&&synchronizeTopView(B,L,t,e)),A({newBoxParams:B})},pt=s=>{const{boxID:i,imageName:u,width:l,height:g,x:r,y:h}=s,C=f.find(m=>m.id===i);if(!(C==null?void 0:C.rects)||!C.rects.find(m=>m.imageName===u))return;const D=C.rects.map(m=>m.imageName===u?__spreadProps(__spreadValues({},m),{width:l,height:g,x:r,y:h}):m),L=__spreadProps(__spreadValues({},C),{rects:D}),B=f.map(m=>m.id===i?L:m);return t==null||t.updatePolygonList(B!=null?B:[]),B},gt=s=>{const{boxID:i,imageName:u}=s,l=f.find(C=>C.id===i);if(!(l==null?void 0:l.rects))return;const g=l.rects.filter(C=>C.imageName!==u),r=__spreadProps(__spreadValues({},l),{rects:g}),h=f.map(C=>C.id===i?r:C);return t==null||t.updatePolygonList(h!=null?h:[]),h},Pt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:u,newSphereList:l})=>{var g;const r=t==null?void 0:t.toolInstance;if(!(x.length===0||!r)){if(s||(U==null?void 0:U.info)){const h=s!=null?s:U==null?void 0:U.info;(g=r==null?void 0:r.selection)==null||g.setSelectedIDs(x[0]);const C=r.selectedPolygon;if(x.length===1&&h){q({omitView:PointCloudView.Top,polygon:C,boxParams:h,newPointCloudBoxList:i});return}}if((u||F)&&x.length===1){const h=u!=null?u:F;r.setSelectedID(x[0]);const C=r.selectedPoint;h&&H(PointCloudView.Top,C,h,void 0,l,y)}}},K=(s,i,u,l=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{if(Y){let g,r;switch(u){case PointCloudView.Back:g=backViewPolygon2PointCloud;break;case PointCloudView.Side:g=sideViewPolygon2PointCloud;break;default:g=sideViewPolygon2PointCloud;break}if(r=g(s,i,Y,a.pointCloudInstance),e){const{count:L}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:L})}const C=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:y,action:"viewUpdateBox"}))[0],b=r.valid!==C.valid;r=C;const D=lt(r);return r=D.find(L=>L.id===r.id),q({omitView:b?void 0:u,polygon:s,boxParams:r,newPointCloudBoxList:D},l),D}},$=(s,i,u)=>{if(F){let l,g;switch(u){case PointCloudView.Back:l=backViewPoint2PointCloud;break;case PointCloudView.Side:l=sideViewPoint2PointCloud;break;default:l=sideViewPoint2PointCloud;break}g=l(s,i,F);const r=X(g);return H(u,s,g,void 0,r,y),r}},Ct=(s,i)=>{$(s,i,PointCloudView.Side)},ft=(s,i)=>{$(s,i,PointCloudView.Back)},ht=(s,i)=>{K(s,i,PointCloudView.Side,ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)},xt=(s,i)=>{K(s,i,PointCloudView.Back,ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)},vt=(s,i)=>{const u=nt(s.id),l=topViewPoint2PointCloud(s,i,J,u),g=X(l);H(PointCloudView.Top,s,l,void 0,g,y)},Lt=(s,i)=>{if(ot){const l=__spreadValues({},s[0].newPolygon);l.pointList=l.pointList.map(g=>lbUtils.PointCloudUtils.transferCanvas2World(g,i)),w(l);return}let u=s.map(({newPolygon:l})=>{const g=at(l.id),{boxParams:r}=topViewPolygon2PointCloud(l,i,t.pointCloudInstance,g);return r});if(u=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:u,stepConfig:y,action:"viewUpdateBox"})),u.length===1){const{newPolygon:l}=s[0],g=G(u);q({polygon:l,boxParams:u[0],newPointCloudBoxList:g},ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)}else{const l=G(u);l&&n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiMove,l)}},yt=s=>{var i,u,l,g,r;if(U){const h=Number(s.widthDefault),C=Number(s.depthDefault),b=Number(s.heightDefault),D=U==null?void 0:U.info.trackID,B=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(W=>(W==null?void 0:W.trackID)===D),m={width:(l=(u=t==null?void 0:t.toolInstance)==null?void 0:u.basicImgInfo)==null?void 0:l.width,height:(r=(g=t==null?void 0:t.toolInstance)==null?void 0:g.basicImgInfo)==null?void 0:r.height},j=B.pointList.map(W=>lbUtils.PointCloudUtils.transferCanvas2World(W,m)),N=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(j,b,h),z=N[0],Q=N[2],tt=lbAnnotation.MathUtils.getLineCenterPoint([z,Q]),mt=U.info.center.z-U.info.depth/2,et=__spreadProps(__spreadValues({},U.info),{center:{x:tt.x,y:tt.y,z:mt+C/2},width:h,height:b,depth:C,valid:!0}),Bt=G([et]);q({omitView:PointCloudView["3D"],polygon:B,boxParams:et,newPointCloudBoxList:Bt})}},H=(s,i,u,l,g,r)=>__async(void 0,null,function*(){const h=E==null?void 0:E.url,C={[PointCloudView.Side]:()=>{syncSideViewByPoint(u,i,a,h,r)},[PointCloudView.Back]:()=>{p&&syncBackViewByPoint(u,i,p,h,r)},[PointCloudView.Top]:()=>{syncTopViewByPoint(u,i,t,e)}};Object.keys(C).forEach(b=>{b!==s&&C[b]()}),l&&(e==null||e.updateCameraZoom(l)),dt(u)}),q=(s,i=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{const{omitView:u,polygon:l,boxParams:g,zoom:r,newPointCloudBoxList:h}=s,C=E==null?void 0:E.url;h&&n.syncAllViewPointCloudColor(i,h);const b={[PointCloudView.Side]:()=>{synchronizeSideView(g,l,a,C)},[PointCloudView.Back]:()=>{p&&synchronizeBackView(g,l,p,C)},[PointCloudView.Top]:()=>{synchronizeTopView(g,l,t,e)}};Object.keys(b).forEach(D=>{D!==u&&b[D]()}),r&&(e==null||e.updateCameraZoom(r))};return{topViewAddSphere:ut,topViewAddBox:ct,topViewSelectedChanged:Pt,topViewUpdatePoint:vt,sideViewUpdatePoint:Ct,backViewUpdatePoint:ft,topViewUpdateBox:Lt,sideViewUpdateBox:ht,backViewUpdateBox:xt,syncPointCloudViews:q,syncPointCloudPoint:H,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),e==null||e.generateBoxes(s)},initPointCloud3d:s=>{if(!e)return;const i=lbUtils.PointCloudUtils.getDefaultOrthographicParams(s);e.initOrthographicCamera(i),e.initRenderer(),e.render()},updatePointCloudData:(...s)=>__async(void 0,[...s],function*(i=E){var u,l,g,r,h,C,b,D;if(!(i==null?void 0:i.url)||!e)return;I([]),actionCreators.SetAnnotationLoading(M,!0),actionCreators.SetLoadPCDFileLoading(M,!0),(u=o==null?void 0:o.setResourceLoading)==null||u.call(o,!0),yield e.loadPCDFile(i.url,(l=y==null?void 0:y.radius)!=null?l:DEFAULT_RADIUS),e==null||e.clearAllBox(),e==null||e.clearAllSphere();let L=[],B=[],m=[],j=[];e.updateTopCamera();const N=(r=(g=index.jsonParser(i.result))==null?void 0:g.valid)!=null?r:!0;if(n.setPointCloudValid(N),(h=n.sideViewInstance)==null||h.clearAllData(),(C=n.backViewInstance)==null||C.clearAllData(),i.result){if(L=lbUtils.PointCloudUtils.getBoxParamsFromResultList(i.result),(L==null?void 0:L.length)>0&&i.isPreResult&&(y==null?void 0:y.lowerLimitPointsNumInBox)>0){L=yield e==null?void 0:e.filterPreResult(i.url,y,L);const z=index.jsonParser(i.result);z[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=L,i.result=JSON.stringify(z),n.setPointCloudResult(L)}m=lbUtils.PointCloudUtils.getPolygonListFromResultList(i.result),B=lbUtils.PointCloudUtils.getLineListFromResultList(i.result),j=lbUtils.PointCloudUtils.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(b=y==null?void 0:y.radius)!=null?b:DEFAULT_RADIUS}),e==null||e.generateBoxes(L),e==null||e.generateSpheres(j),yield n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,L,[])}O({pointCloudBoxList:L,polygonList:m,lineList:B,pointCloudSphereList:j}),actionCreators.SetAnnotationLoading(M,!1),actionCreators.SetLoadPCDFileLoading(M,!1),(D=o==null?void 0:o.setResourceLoading)==null||D.call(o,!1)}),updateViewsByDefaultSize:yt,generateRects:Z,update2DViewRect:pt,remove2DViewRect:gt}},useSyncRectPositionDimensionToPointCloudList=()=>{const{pointCloudBoxList:o,rectList:n,setPointCloudResult:t}=React.useContext(PointCloudContext.PointCloudContext),a=ahooks.useLatest(o),p=ahooks.useLatest(n);return{syncToPointCloudBoxList:React.useCallback(()=>{const P=a.current,c=p.current;if(c.length===0)return null;const d=new Map,x=new Set;if(c.filter(f=>f.extId!==void 0).forEach(f=>{const v=f.extId,R=f.imageName,I=_.pick(f,["x","y","width","height"]);let S=d.get(v);S||(S=new Map,d.set(v,S)),S.set(R,I),x.add(v)}),d.size){const f=P.map(v=>{var R;const I=v.id;if(x.has(I)){const S=__spreadValues({},v);return(R=S.rects)==null||R.forEach(V=>{var k;const T=V.imageName;Object.assign(V,(k=d.get(I))==null?void 0:k.get(T))}),S}return v});return t(f),f}return null},[])}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews,exports.useSyncRectPositionDimensionToPointCloudList=useSyncRectPositionDimensionToPointCloudList;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),PointCloudSegment2DView=require("./PointCloudSegment2DView.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js"),actionCreators=require("../../store/annotation/actionCreators.js"),DynamicResizer=require("../DynamicResizer/DynamicResizer.js");function _interopDefaultLegacy(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=i=>{const{currentData:s,imgList:h,drawLayerSlot:f,checkMode:l,intelligentFit:x,imgIndex:S,config:b,measureVisible:q,setResourceLoading:v,stepInfo:t}=i,e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:g,setGlobalPattern:w,selectedIDs:p,isLargeStatus:u,setIsLargeStatus:j}=e,D=ctx.useDispatch(),C=React.useRef(null),P=React.useRef(null),[V,N]=React.useState(0),[a,L]=React.useState(!1),y=(p==null?void 0:p.length)>0&&a,R=index.jsonParser(s.result),{toolInstanceRef:r,clearToolInstance:I}=annotation.useCustomToolInstance({basicInfo:R});if(React.useEffect(()=>{r.current.setPointCloudGlobalPattern=n=>{n!==g&&(w(n),e.clearAllDetectionInstance(),I())}},[g]),React.useEffect(()=>{var n;if(actionCreators.SetLoadPCDFileLoading(D,!0),s){const{boxParamsList:o,polygonList:d,lineList:c,sphereParamsList:m,segmentation:A,rectList:_}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((n=s==null?void 0:s.result)!=null?n:"");e.setPointCloudResult(o),e.setPolygonList(d),e.setLineList(c),e.setPointCloudSphereList(m),e.setRectList(_),e.setSegmentation(A)}},[S]),React.useEffect(()=>{var n;if(C.current){const o=((n=C.current)==null?void 0:n.offsetHeight)-233;N(o)}},[P.current]),React.useEffect(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var n,o,d,c,m;return{resultPolygon:(n=e.polygonList)!=null?n:[],resultLine:(o=e.lineList)!=null?o:[],resultPoint:(d=e.pointCloudSphereList)!=null?d:[],resultRect:(c=e.rectList)!=null?c:[],segmentation:(m=e.segmentation)!=null?m:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),h.length===0)return null;if(g===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:l,toolInstanceRef:r}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout")},React__default.default.createElement(PointCloudSegment,{checkMode:l}),React__default.default.createElement(PointCloudSegment2DView,null)),React__default.default.createElement(PointCloudSegmentStatus,{config:b}),f==null?void 0:f({direct:!0}));let E=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:l}),React__default.default.createElement(PointCloudSideView,{checkMode:l}));return a&&(E=React__default.default.createElement(index$2,{selectAndEnlarge:y,checkMode:l})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:l,toolInstanceRef:r,setResourceLoading:v}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content"),ref:P},React__default.default.createElement(DynamicResizer,{direction:"horizontal",localKey:"leftAllViewid:"+(t==null?void 0:t.id)+"taskID:"+(t==null?void 0:t.taskID)+"step:"+(t==null?void 0:t.step)+"type:"+(t==null?void 0:t.type),defaultWidth:360,minLeftWidth:244,minRightWidth:"50%",disabled:u},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container",u?"left-large":"left-noLarge")},React__default.default.createElement(PointCloud3DView,{setResourceLoading:v}),E),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:a}),ref:C},React__default.default.createElement(DynamicResizer,{localKey:"rightAllViewid:"+(t==null?void 0:t.id)+"taskID:"+(t==null?void 0:t.taskID)+"step:"+(t==null?void 0:t.step)+"type:"+(t==null?void 0:t.type),defaultHeight:300,minTopHeight:V,minBottomHeight:160,disabled:u},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:f,checkMode:l,intelligentFit:x,setIsEnlargeTopView:L,onExitZoom:()=>{j(!1),L(!1)},isEnlargeTopView:a}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container",u?"right-bottom-large":"right-bottom-noLarge")]:!a,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:a})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:a,thumbnailWidth:a?300:455,checkMode:l,measureVisible:q})))))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),PointCloudSegment2DView=require("./PointCloudSegment2DView.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js"),actionCreators=require("../../store/annotation/actionCreators.js"),DynamicResizer=require("../DynamicResizer/DynamicResizer.js");function _interopDefaultLegacy(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=i=>{const{currentData:s,imgList:S,drawLayerSlot:f,checkMode:n,intelligentFit:b,imgIndex:x,config:V,measureVisible:q,setResourceLoading:p,stepInfo:t,setBatchSetValid:g}=i,e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:v,setGlobalPattern:w,selectedIDs:P,isLargeStatus:u,setIsLargeStatus:j}=e,D=ctx.useDispatch(),C=React.useRef(null),L=React.useRef(null),[N,y]=React.useState(0),[a,h]=React.useState(!1),R=(P==null?void 0:P.length)>0&&a,I=index.jsonParser(s.result),{toolInstanceRef:r,clearToolInstance:A}=annotation.useCustomToolInstance({basicInfo:I});if(React.useEffect(()=>{r.current.setPointCloudGlobalPattern=l=>{l!==v&&(w(l),e.clearAllDetectionInstance(),A())}},[v]),React.useEffect(()=>{var l;if(actionCreators.SetLoadPCDFileLoading(D,!0),s){const{boxParamsList:o,polygonList:d,lineList:c,sphereParamsList:m,segmentation:B,rectList:_}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((l=s==null?void 0:s.result)!=null?l:"");e.setPointCloudResult(o),e.setPolygonList(d),e.setLineList(c),e.setPointCloudSphereList(m),e.setRectList(_),e.setSegmentation(B)}},[x]),React.useEffect(()=>{var l;if(C.current){const o=((l=C.current)==null?void 0:l.offsetHeight)-233;y(o)}},[L.current]),React.useEffect(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var l,o,d,c,m;return{resultPolygon:(l=e.polygonList)!=null?l:[],resultLine:(o=e.lineList)!=null?o:[],resultPoint:(d=e.pointCloudSphereList)!=null?d:[],resultRect:(c=e.rectList)!=null?c:[],segmentation:(m=e.segmentation)!=null?m:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),S.length===0)return null;if(v===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:n,toolInstanceRef:r}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout")},React__default.default.createElement(PointCloudSegment,{checkMode:n}),React__default.default.createElement(PointCloudSegment2DView,null)),React__default.default.createElement(PointCloudSegmentStatus,{config:V}),f==null?void 0:f({direct:!0}));let E=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:n}),React__default.default.createElement(PointCloudSideView,{checkMode:n}));return a&&(E=React__default.default.createElement(index$2,{selectAndEnlarge:R,checkMode:n})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:n,toolInstanceRef:r,setResourceLoading:p,isBatchSetValid:!!g}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:l=>l.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content"),ref:L},React__default.default.createElement(DynamicResizer,{direction:"horizontal",localKey:"leftAllViewid:"+(t==null?void 0:t.id)+"taskID:"+(t==null?void 0:t.taskID)+"step:"+(t==null?void 0:t.step)+"type:"+(t==null?void 0:t.type),defaultWidth:360,minLeftWidth:244,minRightWidth:"50%",disabled:u},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container",u?"left-large":"left-noLarge")},React__default.default.createElement(PointCloud3DView,{setResourceLoading:p}),E),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:a}),ref:C},React__default.default.createElement(DynamicResizer,{localKey:"rightAllViewid:"+(t==null?void 0:t.id)+"taskID:"+(t==null?void 0:t.taskID)+"step:"+(t==null?void 0:t.step)+"type:"+(t==null?void 0:t.type),defaultHeight:300,minTopHeight:N,minBottomHeight:160,disabled:u},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:f,checkMode:n,intelligentFit:b,setIsEnlargeTopView:h,onExitZoom:()=>{j(!1),h(!1)},isEnlargeTopView:a}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container",u?"right-bottom-large":"right-bottom-noLarge")]:!a,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:a})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:a,thumbnailWidth:a?300:455,checkMode:n,measureVisible:q})))))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))),e.visibleBatchSetValid&&(g==null?void 0:g({valid:e.valid,isModal:!0,visibleModal:e.visibleBatchSetValid,onClose:()=>e.setBatchSetValidModal(!1),singleSetQuestionImg:()=>e.setPointCloudValid(!e.valid)})))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
@@ -40,10 +40,12 @@ export interface IPointCloudContext extends IPointCloudContextInstances, IPointC
40
40
  selectedIDs: string[];
41
41
  setSelectedIDs: (ids?: string[] | string) => void;
42
42
  valid: boolean;
43
+ visibleBatchSetValid: boolean;
43
44
  setPointCloudResult: (resultList: IPointCloudBoxList) => void;
44
45
  setPointCloudSphereList: (sphereList: IPointCloudSphereList) => void;
45
46
  selectedPointCloudBox?: IPointCloudBox;
46
47
  setPointCloudValid: (valid?: boolean) => void;
48
+ setBatchSetValidModal: (visible: boolean) => void;
47
49
  addSelectedID: (selectedID: string) => void;
48
50
  addHighlightID: (highlightID: number) => void;
49
51
  selectedAllBoxes: () => void;
@@ -5,6 +5,7 @@ interface IProps extends IA2MapStateProps {
5
5
  checkMode?: boolean;
6
6
  toolInstanceRef: React.MutableRefObject<ICustomToolInstance>;
7
7
  setResourceLoading?: (loading: boolean) => void;
8
+ isBatchSetValid?: boolean;
8
9
  }
9
10
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
10
11
  children?: React.ReactNode;
@@ -7,12 +7,14 @@
7
7
  import React from 'react';
8
8
  import { DrawLayerSlot } from '@/types/main';
9
9
  import { IA2MapStateProps } from '@/store/annotation/map';
10
+ import { IBatchSetValid } from '@/views/MainView/sidebar/GeneralOperation';
10
11
  interface IProps extends IA2MapStateProps {
11
12
  drawLayerSlot?: DrawLayerSlot;
12
13
  checkMode?: boolean;
13
14
  intelligentFit?: boolean;
14
15
  measureVisible?: boolean;
15
16
  setResourceLoading?: (loading: boolean) => void;
17
+ setBatchSetValid?: (values: IBatchSetValid) => void;
16
18
  }
17
19
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
18
20
  children?: React.ReactNode;
@@ -1,9 +1,11 @@
1
1
  import { AppProps } from '@/App';
2
2
  import React from 'react';
3
+ import { IBatchSetValid } from './sidebar/GeneralOperation';
3
4
  interface IProps {
4
5
  path: string;
5
6
  loading: boolean;
6
7
  measureVisible?: boolean;
8
+ setBatchSetValid?: (values: IBatchSetValid) => void;
7
9
  }
8
10
  declare const _default: import("react-redux").ConnectedComponent<React.FC<AppProps & IProps>, import("react-redux").Omit<AppProps & IProps & {
9
11
  children?: React.ReactNode;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { IBatchSetValid } from '../GeneralOperation';
2
3
  export interface IOperationConfig {
3
4
  name: string;
4
5
  key: string;
@@ -11,5 +12,7 @@ export interface IOperationConfig {
11
12
  }
12
13
  declare const ActionsConfirm: React.FC<{
13
14
  allOperation: IOperationConfig[];
15
+ setBatchSetValid?: (values: IBatchSetValid) => void;
16
+ valid?: boolean;
14
17
  }>;
15
18
  export default ActionsConfirm;
@@ -3,6 +3,14 @@ import { ConnectedComponent } from 'react-redux';
3
3
  import { ToolInstance } from '@/store/annotation/types';
4
4
  import { IStepInfo } from '@/types/step';
5
5
  import { AnnotationFileList } from '@/types/data';
6
+ export interface IBatchSetValid {
7
+ isHover?: boolean;
8
+ valid?: boolean;
9
+ isModal?: boolean;
10
+ visibleModal?: boolean;
11
+ onClose?: () => void;
12
+ singleSetQuestionImg?: () => void;
13
+ }
6
14
  interface IProps {
7
15
  toolInstance: ToolInstance;
8
16
  stepInfo: IStepInfo;
@@ -10,6 +18,7 @@ interface IProps {
10
18
  imgIndex: number;
11
19
  stepList: IStepInfo[];
12
20
  hideValidity?: boolean;
21
+ setBatchSetValid?: (values: IBatchSetValid) => void;
13
22
  }
14
23
  export declare const PointCloudOperation: ConnectedComponent<React.FC<IProps>, Omit<IProps & {
15
24
  children?: React.ReactNode;
@@ -1,6 +1,7 @@
1
1
  import { EToolName } from '@/data/enums/ToolType';
2
2
  import { Sider } from '@/types/main';
3
3
  import React from 'react';
4
+ import { IBatchSetValid } from './GeneralOperation';
4
5
  interface IProps {
5
6
  toolName?: EToolName;
6
7
  sider?: Sider;
@@ -8,6 +9,7 @@ interface IProps {
8
9
  setSiderWidth?: (width: number | undefined) => void;
9
10
  propsSiderWidth?: number | undefined;
10
11
  checkMode?: boolean;
12
+ setBatchSetValid?: (values: IBatchSetValid) => void;
11
13
  }
12
14
  export declare const sidebarCls: string;
13
15
  declare const Sidebar: React.FC<IProps>;
@@ -1 +1 @@
1
- "use strict";var index$8=require("../../components/customResizeHook/index.js"),index$6=require("../../constant/index.js"),antd=require("antd"),es=require("antd/es"),React=require("react"),index$c=require("./annotationOperation/index.js"),index$b=require("./annotationTips/index.js"),index$5=require("./sidebar/index.js"),index$d=require("./toolFooter/index.js"),index$a=require("./toolHeader/index.js"),reducer=require("../../store/annotation/reducer.js"),index$7=require("../../components/videoAnnotate/index.js"),reactRedux=require("react-redux"),ToolUtils=require("../../utils/ToolUtils.js"),index$e=require("../../components/pointCloudView/index.js"),dom=require("../../utils/dom.js"),index$9=require("../../utils/index.js"),index$4=require("../../components/predictTracking/previewResult/index.js"),ctx=require("../../store/ctx.js"),ToolType=require("../../data/enums/ToolType.js"),index$1=require("./LLMLayout/index.js"),index$2=require("./NLPLayout/index.js"),index$3=require("../../components/audioAnnotate/index.js"),icons=require("@ant-design/icons"),reactI18next=require("react-i18next"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("./LLMMultiWheelLayout/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e};const{Sider,Content}=es.Layout,layoutCls=`${index$6.prefix}-layout`,ImageAnnotate=e=>{var t;return React__default.default.createElement(React__default.default.Fragment,null,e.showTips===!0&&React__default.default.createElement(index$b,{path:e.path,tips:e.tips}),React__default.default.createElement(index$c,__spreadValues({},e)),React__default.default.createElement(index$d.default,{style:(t=e.style)==null?void 0:t.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},PointCloudAnnotate=e=>{var t;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$e,{drawLayerSlot:e.drawLayerSlot,checkMode:e.checkMode,intelligentFit:e.intelligentFit,measureVisible:e.measureVisible,setResourceLoading:e.setResourceLoading}),React__default.default.createElement(index$d.default,{style:(t=e.style)==null?void 0:t.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},AnnotatedArea=e=>{var t;const{stepList:a,step:l}=e,r=(t=reducer.getStepConfig(a,l))==null?void 0:t.tool,i=ToolUtils.isPointCloudTool(r),n=ToolUtils.isVideoTool(r);return i?React__default.default.createElement(PointCloudAnnotate,__spreadValues({},e)):n?React__default.default.createElement(index$7,{drawLayerSlot:e.drawLayerSlot,footer:e.footer,annotationBefore:e==null?void 0:e.annotationBefore}):React__default.default.createElement(ImageAnnotate,__spreadValues({},e))},ViewportProviderLayout=e=>{var t,a,l;const{t:r}=reactI18next.useTranslation(),{stepList:i,step:n}=e,o=(t=reducer.getStepConfig(i,n))==null?void 0:t.tool,d=![ToolType.EToolName.LLM,ToolType.EToolName.NLP,ToolType.EToolName.LLMMultiWheel].includes(o),c=![ToolType.EToolName.LLM,ToolType.EToolName.NLP,ToolType.EToolName.LLMMultiWheel].includes(o),s=[lbAnnotation.EPointCloudName.PointCloud].includes(o);return React__default.default.createElement(index$8.ViewportProvider,null,React__default.default.createElement(antd.Spin,{spinning:e.loading,indicator:React__default.default.createElement(icons.LoadingOutlined,null),tip:React__default.default.createElement("span",{style:{marginTop:200}},r("LoadingTips")),delay:500},React__default.default.createElement(es.Layout,{className:index$9.classnames([layoutCls,e.className]),style:(a=e.style)==null?void 0:a.layout},React__default.default.createElement("header",{className:`${layoutCls}__header`,style:(l=e.style)==null?void 0:l.header},React__default.default.createElement(index$a,{header:e==null?void 0:e.header,headerName:e.headerName,goBack:e.goBack,exportData:e.exportData,hasLangNode:d,hasHeaderOption:c,hasPredictTrackingIcon:s})),e.children)))},MainView=e=>{var t,a,l,r,i,n,o;const[d,c]=React.useState(void 0),s=(a=(t=e.style)==null?void 0:t.sider)==null?void 0:a.width,{stepList:m,step:f}=e,u=(l=reducer.getStepConfig(m,f))==null?void 0:l.tool,v=ToolType.EToolName.LLM===u,L=ToolType.EToolName.NLP===u,E=ToolType.EToolName.LLMMultiWheel===u,x=ToolUtils.isAudioTool(u);return E?React__default.default.createElement(ViewportProviderLayout,__spreadValues({},e),React__default.default.createElement(index.default,__spreadValues({},e))):v?React__default.default.createElement(ViewportProviderLayout,__spreadValues({},e),React__default.default.createElement(index$1,__spreadValues({},e))):L?React__default.default.createElement(ViewportProviderLayout,__spreadValues({},e),React__default.default.createElement(index$2,__spreadValues({},e))):x?React__default.default.createElement(ViewportProviderLayout,__spreadValues({},e),React__default.default.createElement(index$3,__spreadValues({},e))):React__default.default.createElement(ViewportProviderLayout,__spreadValues({},e),React__default.default.createElement(es.Layout,{className:dom.getClassName("layout","container")},e==null?void 0:e.leftSider,React__default.default.createElement(Content,{className:`${layoutCls}__content`},React__default.default.createElement(AnnotatedArea,__spreadValues({},e)),React__default.default.createElement(index$4,null)),React__default.default.createElement(Sider,{className:`${layoutCls}__side`,width:(r=d!=null?d:s)!=null?r:240,style:(i=e.style)==null?void 0:i.sider},React__default.default.createElement(index$5.default,{sider:e==null?void 0:e.sider,enableColorPicker:e==null?void 0:e.enableColorPicker,setSiderWidth:c,propsSiderWidth:(o=(n=e.style)==null?void 0:n.sider)==null?void 0:o.width}))))},mapStateToProps=({annotation:e})=>{var t,a,l;const{imgList:r,loading:i}=e,n=(t=r[e.imgIndex])!=null?t:{};return{path:(l=(a=n==null?void 0:n.path)!=null?a:n==null?void 0:n.url)!=null?l:"",loading:i}};var MainView$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(MainView);module.exports=MainView$1;
1
+ "use strict";var index$8=require("../../components/customResizeHook/index.js"),index$6=require("../../constant/index.js"),antd=require("antd"),es=require("antd/es"),React=require("react"),index$c=require("./annotationOperation/index.js"),index$b=require("./annotationTips/index.js"),index$5=require("./sidebar/index.js"),index$d=require("./toolFooter/index.js"),index$a=require("./toolHeader/index.js"),reducer=require("../../store/annotation/reducer.js"),index$7=require("../../components/videoAnnotate/index.js"),reactRedux=require("react-redux"),ToolUtils=require("../../utils/ToolUtils.js"),index$e=require("../../components/pointCloudView/index.js"),dom=require("../../utils/dom.js"),index$9=require("../../utils/index.js"),index$4=require("../../components/predictTracking/previewResult/index.js"),ctx=require("../../store/ctx.js"),ToolType=require("../../data/enums/ToolType.js"),index$1=require("./LLMLayout/index.js"),index$2=require("./NLPLayout/index.js"),index$3=require("../../components/audioAnnotate/index.js"),icons=require("@ant-design/icons"),reactI18next=require("react-i18next"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("./LLMMultiWheelLayout/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e};const{Sider,Content}=es.Layout,layoutCls=`${index$6.prefix}-layout`,ImageAnnotate=e=>{var t;return React__default.default.createElement(React__default.default.Fragment,null,e.showTips===!0&&React__default.default.createElement(index$b,{path:e.path,tips:e.tips}),React__default.default.createElement(index$c,__spreadValues({},e)),React__default.default.createElement(index$d.default,{style:(t=e.style)==null?void 0:t.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},PointCloudAnnotate=e=>{var t;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$e,{drawLayerSlot:e.drawLayerSlot,checkMode:e.checkMode,intelligentFit:e.intelligentFit,measureVisible:e.measureVisible,setResourceLoading:e.setResourceLoading,setBatchSetValid:e==null?void 0:e.setBatchSetValid}),React__default.default.createElement(index$d.default,{style:(t=e.style)==null?void 0:t.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},AnnotatedArea=e=>{var t;const{stepList:a,step:n}=e,i=(t=reducer.getStepConfig(a,n))==null?void 0:t.tool,r=ToolUtils.isPointCloudTool(i),l=ToolUtils.isVideoTool(i);return r?React__default.default.createElement(PointCloudAnnotate,__spreadValues({},e)):l?React__default.default.createElement(index$7,{drawLayerSlot:e.drawLayerSlot,footer:e.footer,annotationBefore:e==null?void 0:e.annotationBefore}):React__default.default.createElement(ImageAnnotate,__spreadValues({},e))},ViewportProviderLayout=e=>{var t,a,n;const{t:i}=reactI18next.useTranslation(),{stepList:r,step:l}=e,o=(t=reducer.getStepConfig(r,l))==null?void 0:t.tool,d=![ToolType.EToolName.LLM,ToolType.EToolName.NLP,ToolType.EToolName.LLMMultiWheel].includes(o),c=![ToolType.EToolName.LLM,ToolType.EToolName.NLP,ToolType.EToolName.LLMMultiWheel].includes(o),s=[lbAnnotation.EPointCloudName.PointCloud].includes(o);return React__default.default.createElement(index$8.ViewportProvider,null,React__default.default.createElement(antd.Spin,{spinning:e.loading,indicator:React__default.default.createElement(icons.LoadingOutlined,null),tip:React__default.default.createElement("span",{style:{marginTop:200}},i("LoadingTips")),delay:500},React__default.default.createElement(es.Layout,{className:index$9.classnames([layoutCls,e.className]),style:(a=e.style)==null?void 0:a.layout},React__default.default.createElement("header",{className:`${layoutCls}__header`,style:(n=e.style)==null?void 0:n.header},React__default.default.createElement(index$a,{header:e==null?void 0:e.header,headerName:e.headerName,goBack:e.goBack,exportData:e.exportData,hasLangNode:d,hasHeaderOption:c,hasPredictTrackingIcon:s})),e.children)))},MainView=e=>{var t,a,n,i,r,l,o;const[d,c]=React.useState(void 0),s=(a=(t=e.style)==null?void 0:t.sider)==null?void 0:a.width,{stepList:m,step:f}=e,u=(n=reducer.getStepConfig(m,f))==null?void 0:n.tool,v=ToolType.EToolName.LLM===u,L=ToolType.EToolName.NLP===u,E=ToolType.EToolName.LLMMultiWheel===u,x=ToolUtils.isAudioTool(u);return E?React__default.default.createElement(ViewportProviderLayout,__spreadValues({},e),React__default.default.createElement(index.default,__spreadValues({},e))):v?React__default.default.createElement(ViewportProviderLayout,__spreadValues({},e),React__default.default.createElement(index$1,__spreadValues({},e))):L?React__default.default.createElement(ViewportProviderLayout,__spreadValues({},e),React__default.default.createElement(index$2,__spreadValues({},e))):x?React__default.default.createElement(ViewportProviderLayout,__spreadValues({},e),React__default.default.createElement(index$3,__spreadValues({},e))):React__default.default.createElement(ViewportProviderLayout,__spreadValues({},e),React__default.default.createElement(es.Layout,{className:dom.getClassName("layout","container")},e==null?void 0:e.leftSider,React__default.default.createElement(Content,{className:`${layoutCls}__content`},React__default.default.createElement(AnnotatedArea,__spreadValues({},e)),React__default.default.createElement(index$4,null)),React__default.default.createElement(Sider,{className:`${layoutCls}__side`,width:(i=d!=null?d:s)!=null?i:240,style:(r=e.style)==null?void 0:r.sider},React__default.default.createElement(index$5.default,{sider:e==null?void 0:e.sider,enableColorPicker:e==null?void 0:e.enableColorPicker,setSiderWidth:c,propsSiderWidth:(o=(l=e.style)==null?void 0:l.sider)==null?void 0:o.width,setBatchSetValid:e.setBatchSetValid}))))},mapStateToProps=({annotation:e})=>{var t,a,n;const{imgList:i,loading:r}=e,l=(t=i[e.imgIndex])!=null?t:{};return{path:(n=(a=l==null?void 0:l.path)!=null?a:l==null?void 0:l.url)!=null?n:"",loading:r}};var MainView$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(MainView);module.exports=MainView$1;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),antd=require("antd"),reactI18next=require("react-i18next"),index=require("../../../../constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const forbidStyle={color:"#CCCCCC"},PopconfirmTitle=({info:e})=>{const{t}=reactI18next.useTranslation();return e.key.startsWith("sure")?React__default.default.createElement("div",{key:e.key},`${t("ConfirmTo")}${e.name.slice(0)}\uFF1F`,(e==null?void 0:e.content)?e.content:""):React__default.default.createElement("span",null,e.name)},ActionIcon=({icon:e})=>typeof e=="string"?React__default.default.createElement("img",{width:23,height:25,src:e}):e,ShowIcon=({isHover:e,info:t})=>{const a=!!t.forbidOperation,l=t.key===e&&!a;let n={color:l?"#666fff":""};return a&&(n=forbidStyle),React__default.default.createElement("div",{style:{cursor:a?"not-allowed":"default"},onClick:()=>{var c;return(t==null?void 0:t.forbidConfirm)&&!a&&((c=t==null?void 0:t.onClick)==null?void 0:c.call(t))}},React__default.default.createElement("div",{className:"icon"},React__default.default.createElement(ActionIcon,{icon:l?t.hoverSvg:t.imgSvg})),React__default.default.createElement("div",{className:"toolName",style:n},t.name))},ActionsConfirm=({allOperation:e})=>{const t=React.useRef(null),[a,l]=React.useState(null),{t:n}=reactI18next.useTranslation(),c=Math.floor(24/e.length);return React__default.default.createElement("div",{className:"generalOperation",ref:t},e.map((r,u)=>React__default.default.createElement(antd.Col,{span:c,key:u,className:"generalOperation-col"},React__default.default.createElement("div",{key:r.key,className:"item",onMouseEnter:()=>{l(r.key)},onMouseLeave:()=>{l(null)}},r.forbidConfirm?React__default.default.createElement(ShowIcon,{info:r,isHover:a}):React__default.default.createElement(antd.Popconfirm,{title:React__default.default.createElement(PopconfirmTitle,{info:r}),placement:"topRight",okText:n("Confirm"),cancelText:n("Cancel"),getPopupContainer:()=>{var o;return(o=t.current)!=null?o:document.body},onConfirm:r.onClick,overlayClassName:`${index.prefix}-pop-confirm`},React__default.default.createElement("div",null,React__default.default.createElement(ShowIcon,{info:r,isHover:a})))))))};module.exports=ActionsConfirm;
1
+ "use strict";var React=require("react"),antd=require("antd"),reactI18next=require("react-i18next"),index=require("../../../../constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const forbidStyle={color:"#CCCCCC"},PopconfirmTitle=({info:e})=>{const{t}=reactI18next.useTranslation();return e.key.startsWith("sure")?React__default.default.createElement("div",{key:e.key},`${t("ConfirmTo")}${e.name.slice(0)}\uFF1F`,(e==null?void 0:e.content)?e.content:""):React__default.default.createElement("span",null,e.name)},ActionIcon=({icon:e})=>typeof e=="string"?React__default.default.createElement("img",{width:23,height:25,src:e}):e,ShowIcon=({isHover:e,info:t})=>{const l=!!t.forbidOperation,a=t.key===e&&!l;let n={color:a?"#666fff":""};return l&&(n=forbidStyle),React__default.default.createElement("div",{style:{cursor:l?"not-allowed":"default"},onClick:()=>{var c;return(t==null?void 0:t.forbidConfirm)&&!l&&((c=t==null?void 0:t.onClick)==null?void 0:c.call(t))}},React__default.default.createElement("div",{className:"icon"},React__default.default.createElement(ActionIcon,{icon:a?t.hoverSvg:t.imgSvg})),React__default.default.createElement("div",{className:"toolName",style:n},t.name))},ActionsConfirm=({allOperation:e,setBatchSetValid:t,valid:l})=>{const a=React.useRef(null),[n,c]=React.useState(null),{t:u}=reactI18next.useTranslation(),s=Math.floor(24/e.length),i=r=>r.forbidConfirm?React__default.default.createElement(ShowIcon,{info:r,isHover:n}):t&&r.key==="setValidity"?t({valid:l,isHover:!!n,singleSetQuestionImg:r.onClick}):React__default.default.createElement(antd.Popconfirm,{title:React__default.default.createElement(PopconfirmTitle,{info:r}),placement:"topRight",okText:u("Confirm"),cancelText:u("Cancel"),getPopupContainer:()=>{var o;return(o=a.current)!=null?o:document.body},onConfirm:r.onClick,overlayClassName:`${index.prefix}-pop-confirm`},React__default.default.createElement("div",null,React__default.default.createElement(ShowIcon,{info:r,isHover:n})));return React__default.default.createElement("div",{className:"generalOperation",ref:a},e.map((r,o)=>React__default.default.createElement(antd.Col,{span:s,key:o,className:"generalOperation-col"},React__default.default.createElement("div",{key:r.key,className:"item",onMouseEnter:()=>{c(r.key)},onMouseLeave:()=>{c(null)}},i(r)))))};module.exports=ActionsConfirm;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),reactRedux=require("react-redux"),StepUtils=require("../../../../utils/StepUtils.js"),index=require("../../../../utils/index.js"),ActionsConfirm=require("./ActionsConfirm.js"),useOperationList=require("./useOperationList.js"),ctx=require("../../../../store/ctx.js"),unitAttribute=require("../../../../assets/annotation/pointCloudTool/unitAttribute.svg.js"),unitAttributeForbid=require("../../../../assets/annotation/pointCloudTool/unitAttributeForbid.svg.js"),unitAttributeHover=require("../../../../assets/annotation/pointCloudTool/unitAttributeHover.svg.js"),reactI18next=require("react-i18next"),index$1=require("../../../../components/pointCloudView/components/UnifyParamsModal/index.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reducer=require("../../../../store/annotation/reducer.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const mapStateToProps=t=>{var e,n;const o=StepUtils.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(n=t.annotation)==null?void 0:n.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:o,imgList:t.annotation.imgList,imgIndex:t.annotation.imgIndex,stepList:t.annotation.stepList}},GeneralOperation=({toolInstance:t,stepInfo:e,hideValidity:n})=>{const o=useOperationList(t),r=index.jsonParser(e==null?void 0:e.config),i=[o.empty];return(e==null?void 0:e.dataSourceStep)===0&&!n&&i.push(o.setValidity),(r==null?void 0:r.copyBackwardResult)&&i.push(o.copyPrevious),React__default.default.createElement(ActionsConfirm,{allOperation:i})},PointCloudOperation=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(({toolInstance:t,stepInfo:e,imgList:n,stepList:o,imgIndex:r})=>{const{t:i}=reactI18next.useTranslation(),{selectedBox:u}=useSingleBox.useSingleBox(),l=useOperationList(t),[v,c]=React.useState(!1),[f,m]=React.useState([]),{isPointCloudDetectionPattern:g,isPointCloudSegmentationPattern:x}=useStatus.useStatus(),d=index.jsonParser(e.config);let s=[l.copyPrevious,l.empty,l.setValidity];if(g&&d.trackConfigurable===!0){const a=!u,y={name:i("UnifyParams"),key:"UnifyParams",imgSvg:a?unitAttributeForbid:unitAttribute,hoverSvg:unitAttributeHover,onClick:()=>{m(reducer.composeResultByToolInstance({toolInstance:t,imgList:n,imgIndex:r,stepList:o})),c(!0)},forbidConfirm:!0,forbidOperation:a};s.unshift(y)}const C=React.useCallback(()=>{c(!1)},[]),p=u==null?void 0:u.info;return x&&(s=s.filter(a=>!["setValidity","copyPrevious"].includes(a.key))),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ActionsConfirm,{allOperation:s}),React__default.default.createElement(index$1,{id:p==null?void 0:p.trackID,visible:v,onCancel:C,config:d,imgList:f}))});var GeneralOperation$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(GeneralOperation);exports.PointCloudOperation=PointCloudOperation,exports.default=GeneralOperation$1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),reactRedux=require("react-redux"),StepUtils=require("../../../../utils/StepUtils.js"),index=require("../../../../utils/index.js"),ActionsConfirm=require("./ActionsConfirm.js"),useOperationList=require("./useOperationList.js"),ctx=require("../../../../store/ctx.js"),unitAttribute=require("../../../../assets/annotation/pointCloudTool/unitAttribute.svg.js"),unitAttributeForbid=require("../../../../assets/annotation/pointCloudTool/unitAttributeForbid.svg.js"),unitAttributeHover=require("../../../../assets/annotation/pointCloudTool/unitAttributeHover.svg.js"),reactI18next=require("react-i18next"),index$1=require("../../../../components/pointCloudView/components/UnifyParamsModal/index.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reducer=require("../../../../store/annotation/reducer.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const mapStateToProps=t=>{var e,n;const o=StepUtils.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(n=t.annotation)==null?void 0:n.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:o,imgList:t.annotation.imgList,imgIndex:t.annotation.imgIndex,stepList:t.annotation.stepList}},GeneralOperation=({toolInstance:t,stepInfo:e,hideValidity:n})=>{const o=useOperationList(t),r=index.jsonParser(e==null?void 0:e.config),i=[o.empty];return(e==null?void 0:e.dataSourceStep)===0&&!n&&i.push(o.setValidity),(r==null?void 0:r.copyBackwardResult)&&i.push(o.copyPrevious),React__default.default.createElement(ActionsConfirm,{allOperation:i})},PointCloudOperation=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(({toolInstance:t,stepInfo:e,imgList:n,stepList:o,imgIndex:r,setBatchSetValid:i})=>{const{t:v}=reactI18next.useTranslation(),{selectedBox:u}=useSingleBox.useSingleBox(),l=useOperationList(t),[f,c]=React.useState(!1),[m,g]=React.useState([]),{isPointCloudDetectionPattern:x,isPointCloudSegmentationPattern:C}=useStatus.useStatus(),d=index.jsonParser(e.config);let a=[l.copyPrevious,l.empty,l.setValidity];if(x&&d.trackConfigurable===!0){const s=!u,S={name:v("UnifyParams"),key:"UnifyParams",imgSvg:s?unitAttributeForbid:unitAttribute,hoverSvg:unitAttributeHover,onClick:()=>{g(reducer.composeResultByToolInstance({toolInstance:t,imgList:n,imgIndex:r,stepList:o})),c(!0)},forbidConfirm:!0,forbidOperation:s};a.unshift(S)}const y=React.useCallback(()=>{c(!1)},[]),p=u==null?void 0:u.info;return C&&(a=a.filter(s=>!["setValidity","copyPrevious"].includes(s.key))),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ActionsConfirm,{allOperation:a,setBatchSetValid:i,valid:t==null?void 0:t.valid}),React__default.default.createElement(index$1,{id:p==null?void 0:p.trackID,visible:f,onCancel:y,config:d,imgList:m}))});var GeneralOperation$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(GeneralOperation);exports.PointCloudOperation=PointCloudOperation,exports.default=GeneralOperation$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index=require("../../../constant/index.js"),ToolType=require("../../../data/enums/ToolType.js"),StepUtils=require("../../../utils/StepUtils.js"),es=require("antd/es"),React=require("react"),reactI18next=require("react-i18next"),index$9=require("./AnnotationText/index.js"),index$2=require("./ClearIcon/index.js"),index$7=require("./GeneralOperation/index.js"),index$3=require("./ImgAttributeInfo/index.js"),index$8=require("./SwitchAttributeList/index.js"),index$1=require("./TagSidebar/index.js"),index$4=require("./TextToolSidebar/index.js"),index$6=require("./PointCloudToolSidebar/index.js"),index$f=require("./ToolStyle/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index$a=require("./ScribbleSidebar/index.js"),ToolIcons=require("./ToolIcons.js"),ctx=require("../../../store/ctx.js"),antd=require("antd"),index$5=require("../../../utils/index.js"),icon_menu_fold=require("../../../assets/annotation/common/icon_menu_fold.svg.js"),index$c=require("../../../components/LLMToolView/sidebar/index.js"),index$d=require("../../../components/LLMMultiWheelView/sidebar/index.js"),index$e=require("./NLPSidebar/index.js"),index$b=require("../../../components/videoAnnotate/videoClipTool/components/annotatedList/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const{EVideoToolName,EPointCloudName}=lbAnnotation.cTool,{Panel}=es.Collapse,sidebarCls=`${index.prefix}-sidebar`,Sidebar=({sider:t,enableColorPicker:N,setSiderWidth:u,propsSiderWidth:j,checkMode:o})=>{const s=ctx.useSelector(a=>StepUtils.getCurrentStepInfo(a.annotation.step,a.annotation.stepList)),[i,$]=React.useState(!0),e=s==null?void 0:s.tool,{t:c}=reactI18next.useTranslation();if(!e)return null;const S=a=>{const r=React__default.default.createElement(index$f,null);return React__default.default.createElement(Panel,{header:c("Style"),className:"panel",key:a},r)},f=React__default.default.createElement(ToolIcons.ToolIcons,{toolName:e,onChange:()=>{}}),l=React__default.default.createElement(index$8,null),m=React__default.default.createElement(index$9,null),x=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},S("1")),p=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},React__default.default.createElement(Panel,{header:React__default.default.createElement("div",null,c("Adjust"),React__default.default.createElement(index$2,null)),className:"panel",key:"imgAttribute"},React__default.default.createElement(index$3,null))),n=React__default.default.createElement(index$7.default,null),g=React__default.default.createElement(index$1.default,null),_=a=>React__default.default.createElement(index$4.default,{disabled:a}),E=React__default.default.createElement(index$a,{onChange:(a,r)=>{}}),v=React__default.default.createElement(index$b,null),b=React__default.default.createElement(index$c.default,{checkMode:o}),q=React__default.default.createElement(index$d,{checkMode:o}),T=React__default.default.createElement(index$e.default,{checkMode:o}),d=React__default.default.createElement("div",{className:`${sidebarCls}__horizontal`}),y=React__default.default.createElement(index$6.default,{enableColorPicker:N}),C=React__default.default.createElement(index$7.PointCloudOperation,null);if(t)return typeof t=="function"?React__default.default.createElement("div",{className:`${sidebarCls}`},t({toolIcon:f,attributeList:l,annotationText:m,toolStyle:x,imageAttributeInfo:p,operation:n,tagToolSideBar:g,textToolSideBar:_,horizontal:d,pointCloudToolSidebar:y,pointCloudOperation:C,scribbleSidebar:E,LLMSidebar:b,LLMMultiWheelSidebar:q,videoClipSidebar:v,NLPSidebar:T})):t;if([ToolType.EToolName.Rect,ToolType.EToolName.Point,ToolType.EToolName.Line,ToolType.EToolName.Rect,ToolType.EToolName.Polygon,ToolType.EToolName.Cuboid].includes(e))return React__default.default.createElement("div",{className:`${sidebarCls}`},f,d,l,m,d,React__default.default.createElement("div",{className:`${sidebarCls}__content`},x,p),n);if(e===ToolType.EToolName.Tag)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$1.default,null));if(e===EVideoToolName.VideoClipTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},v,l),n);if(e===EVideoToolName.VideoTagTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$1.default,null)),n);if(e===EVideoToolName.VideoTextTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$4.default,null));if(e===ToolType.EToolName.Text)return React__default.default.createElement("div",{className:`${sidebarCls}`},"s",React__default.default.createElement(index$4.default,null));if(e===EPointCloudName.PointCloud){const a=()=>{$(!i),u&&u(i?48:void 0)},r=React__default.default.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},React__default.default.createElement("span",{onClick:()=>a()},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:icon_menu_fold})));return i?React__default.default.createElement(antd.Tabs,{type:"card",activeKey:"1",className:index$5.classnames({[`${sidebarCls}`]:!0,[`${sidebarCls}__pointCloud`]:!0}),tabBarExtraContent:{left:React__default.default.createElement("span",{onClick:()=>a(),style:{padding:"0px 4px"}},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:icon_menu_fold}))}},React__default.default.createElement(antd.Tabs.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$6.default,null)),React__default.default.createElement(index$7.PointCloudOperation,null))):r}return e===ToolType.EToolName.ScribbleTool?React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},E,l),n):e===ToolType.EToolName.LLM?b:e===ToolType.EToolName.NLP?T:null};exports.default=Sidebar,exports.sidebarCls=sidebarCls;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index=require("../../../constant/index.js"),ToolType=require("../../../data/enums/ToolType.js"),StepUtils=require("../../../utils/StepUtils.js"),es=require("antd/es"),React=require("react"),reactI18next=require("react-i18next"),index$9=require("./AnnotationText/index.js"),index$2=require("./ClearIcon/index.js"),index$7=require("./GeneralOperation/index.js"),index$3=require("./ImgAttributeInfo/index.js"),index$8=require("./SwitchAttributeList/index.js"),index$1=require("./TagSidebar/index.js"),index$4=require("./TextToolSidebar/index.js"),index$6=require("./PointCloudToolSidebar/index.js"),index$f=require("./ToolStyle/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index$a=require("./ScribbleSidebar/index.js"),ToolIcons=require("./ToolIcons.js"),ctx=require("../../../store/ctx.js"),antd=require("antd"),index$5=require("../../../utils/index.js"),icon_menu_fold=require("../../../assets/annotation/common/icon_menu_fold.svg.js"),index$c=require("../../../components/LLMToolView/sidebar/index.js"),index$d=require("../../../components/LLMMultiWheelView/sidebar/index.js"),index$e=require("./NLPSidebar/index.js"),index$b=require("../../../components/videoAnnotate/videoClipTool/components/annotatedList/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const{EVideoToolName,EPointCloudName}=lbAnnotation.cTool,{Panel}=es.Collapse,sidebarCls=`${index.prefix}-sidebar`,Sidebar=({sider:t,enableColorPicker:N,setSiderWidth:u,propsSiderWidth:h,checkMode:o,setBatchSetValid:$})=>{const s=ctx.useSelector(a=>StepUtils.getCurrentStepInfo(a.annotation.step,a.annotation.stepList)),[i,S]=React.useState(!0),e=s==null?void 0:s.tool,{t:c}=reactI18next.useTranslation();if(!e)return null;const g=a=>{const r=React__default.default.createElement(index$f,null);return React__default.default.createElement(Panel,{header:c("Style"),className:"panel",key:a},r)},f=React__default.default.createElement(ToolIcons.ToolIcons,{toolName:e,onChange:()=>{}}),l=React__default.default.createElement(index$8,null),m=React__default.default.createElement(index$9,null),x=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},g("1")),p=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},React__default.default.createElement(Panel,{header:React__default.default.createElement("div",null,c("Adjust"),React__default.default.createElement(index$2,null)),className:"panel",key:"imgAttribute"},React__default.default.createElement(index$3,null))),n=React__default.default.createElement(index$7.default,null),_=React__default.default.createElement(index$1.default,null),q=a=>React__default.default.createElement(index$4.default,{disabled:a}),E=React__default.default.createElement(index$a,{onChange:(a,r)=>{}}),v=React__default.default.createElement(index$b,null),b=React__default.default.createElement(index$c.default,{checkMode:o}),y=React__default.default.createElement(index$d,{checkMode:o}),T=React__default.default.createElement(index$e.default,{checkMode:o}),d=React__default.default.createElement("div",{className:`${sidebarCls}__horizontal`}),C=React__default.default.createElement(index$6.default,{enableColorPicker:N}),j=React__default.default.createElement(index$7.PointCloudOperation,{setBatchSetValid:$});if(t)return typeof t=="function"?React__default.default.createElement("div",{className:`${sidebarCls}`},t({toolIcon:f,attributeList:l,annotationText:m,toolStyle:x,imageAttributeInfo:p,operation:n,tagToolSideBar:_,textToolSideBar:q,horizontal:d,pointCloudToolSidebar:C,pointCloudOperation:j,scribbleSidebar:E,LLMSidebar:b,LLMMultiWheelSidebar:y,videoClipSidebar:v,NLPSidebar:T})):t;if([ToolType.EToolName.Rect,ToolType.EToolName.Point,ToolType.EToolName.Line,ToolType.EToolName.Rect,ToolType.EToolName.Polygon,ToolType.EToolName.Cuboid].includes(e))return React__default.default.createElement("div",{className:`${sidebarCls}`},f,d,l,m,d,React__default.default.createElement("div",{className:`${sidebarCls}__content`},x,p),n);if(e===ToolType.EToolName.Tag)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$1.default,null));if(e===EVideoToolName.VideoClipTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},v,l),n);if(e===EVideoToolName.VideoTagTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$1.default,null)),n);if(e===EVideoToolName.VideoTextTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$4.default,null));if(e===ToolType.EToolName.Text)return React__default.default.createElement("div",{className:`${sidebarCls}`},"s",React__default.default.createElement(index$4.default,null));if(e===EPointCloudName.PointCloud){const a=()=>{S(!i),u&&u(i?48:void 0)},r=React__default.default.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},React__default.default.createElement("span",{onClick:()=>a()},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:icon_menu_fold})));return i?React__default.default.createElement(antd.Tabs,{type:"card",activeKey:"1",className:index$5.classnames({[`${sidebarCls}`]:!0,[`${sidebarCls}__pointCloud`]:!0}),tabBarExtraContent:{left:React__default.default.createElement("span",{onClick:()=>a(),style:{padding:"0px 4px"}},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:icon_menu_fold}))}},React__default.default.createElement(antd.Tabs.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$6.default,null)),React__default.default.createElement(index$7.PointCloudOperation,null))):r}return e===ToolType.EToolName.ScribbleTool?React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},E,l),n):e===ToolType.EToolName.LLM?b:e===ToolType.EToolName.NLP?T:null};exports.default=Sidebar,exports.sidebarCls=sidebarCls;
@@ -1 +1 @@
1
- import{useLatest as oe,useMemoizedFn as Z,useDebounceEffect as Ie}from"ahooks";import{Spin as he}from"antd/es";import q,{useContext as De,useRef as J,useState as O,useMemo as _e,useCallback as be,useEffect as p}from"react";import{connect as Ce}from"react-redux";import{usePointCloudViews as we}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as xe}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as ye}from"../../store/annotation/map.js";import{LabelBeeContext as Pe}from"../../store/ctx.js";import{PointCloud2DRectOperation as Se,ImgUtils as Le}from"@labelbee/lb-annotation";import{ImgPosUtils as Oe}from"@labelbee/lb-utils";import{selectSpecifiedRectsFromTopViewSelectedIds as Ve}from"./util.js";import{useUpdateRectList as Ee}from"./useUpdateRectList.js";import je from"lodash";import{useToolStyleContext as Be}from"../../hooks/useToolStyle.js";import Ne from"../../store/toolConfig/index.js";var ke=Object.defineProperty,Ue=Object.defineProperties,ze=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,le=(a,c,s)=>c in a?ke(a,c,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[c]=s,v=(a,c)=>{for(var s in c||(c={}))Ae.call(c,s)&&le(a,s,c[s]);if(ie)for(var s of ie(c))Me.call(c,s)&&le(a,s,c[s]);return a},C=(a,c)=>Ue(a,ze(c)),$=(a,c,s)=>new Promise((f,g)=>{var _=u=>{try{b(s.next(u))}catch(R){g(R)}},V=u=>{try{b(s.throw(u))}catch(R){g(R)}},b=u=>u.done?f(u.value):Promise.resolve(u.value).then(_,V);b((s=s.apply(a,c)).next())});const Te=a=>{var c,s;const{mappingData:f,size:g,config:_,checkMode:V,afterImgOnLoad:b,shouldExcludePointCloudBoxListUpdate:u}=a,{selectBoxVisibleSwitch:R}=Ne(),E=(c=f==null?void 0:f.url)!=null?c:"",w=(s=f==null?void 0:f.fallbackUrl)!=null?s:"",{pointCloudBoxList:j,setPointCloudResult:B,defaultAttribute:N,rectList:k,addRectIn2DView:ce,updateRectIn2DView:se,removeRectIn2DView:ue,updateRectListByReducer:de,selectedIDs:m,setSelectedIDs:U,selectedID:x}=De(xe),{value:z}=Be(),ae=oe(m),{update2DViewRect:fe,remove2DViewRect:pe}=we(),A=q.useRef(null),n=J(null),G=Z(fe),y=Z(pe),P=J(null),[me,K]=O(!0),[Q,W]=O(""),[ve,M]=O(!1),[ge,S]=O(!0),I=_e(()=>k==null?void 0:k.filter(e=>e.imageName===(f==null?void 0:f.path)),[f==null?void 0:f.path,k]),X=J(I),L=oe(f==null?void 0:f.path),T=be(e=>$(void 0,null,function*(){try{const o=ae.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(o.length){const r=new Set(o),i=t.filter(l=>r.has(l.id)).map(l=>l.id);U(i)}return t}catch(o){}}),[U]),Y=e=>{const{boxID:o}=e;if(S(!1),!u&&o){T(()=>{const t=G==null?void 0:G(e);return t?(P.current=t,B(t),t):null});return}se(e,!0)},ee=e=>{L.current&&ce(C(v({},e),{imageName:L.current}))},te=e=>{if(e.length===0)return;if(!u){const t=e.find(r=>r.boxID);if(t){T(()=>{const r=y==null?void 0:y(t);return r?(P.current=r,B(r),h(),r):null});return}}const o=e.find(t=>t.extId);o&&T(()=>{const{imageName:t,extId:r}=o,i=y==null?void 0:y({boxID:r,imageName:t});return i?(P.current=i,B(i),i):null}),ue(e)},Re=Z(()=>{let e=[];return j.forEach(o=>{const{rects:t=[],id:r,attribute:i,trackID:l}=o,d=t.find(F=>F.imageName===L.current),D=r+"_"+L.current;d&&(e=[...e,C(v({},d),{boxID:r,id:D,attribute:i,order:l})])}),e}),h=Ee(()=>{var e,o,t,r,i;const l=u?[]:Re(),d=(e=n.current)==null?void 0:e.selectedRectID,D=m.slice(0),F=R?Ve(D,l,I):[...l,...I];let ne=[];!R&&(m==null?void 0:m.length)&&(ne=l.filter(H=>d?m.includes(H.boxID)&&!d.includes(H.boxID):m.includes(H.boxID))),(o=n.current)==null||o.setHighLightRectList(ne),(t=n.current)==null||t.setResult(F),Q?((r=n.current)==null||r.setSelectedRectID(Q),W("")):ve&&d&&((i=n.current)==null||i.setSelectedRectID(d),M(!1))}),re=({targetId:e,id:o})=>{S(!1),U(e),W(o)};return p(()=>{if(A.current){const e=new Se({container:A.current,size:g,config:C(v({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:V});return n.current=e,n.current.init(),n.current.on("updateDragResult",Y),n.current.on("afterAddingDrawingRect",ee),n.current.on("deleteSelectedRects",te),n.current.on("onRightClick",re),()=>{var o,t,r,i,l;(o=n.current)==null||o.unbind("updateDragResult",Y),(t=n.current)==null||t.unbind("afterAddingDrawingRect",ee),(r=n.current)==null||r.unbind("deleteSelectedRects",te),(i=n.current)==null||i.unbind("onRightClick",re),(l=n.current)==null||l.destroy()}}},[]),p(()=>{const e=t=>$(void 0,null,function*(){try{return yield Le.load(t)}catch(r){return console.error("Error loading image:",r),null}}),o=()=>$(void 0,null,function*(){var t;K(!0);let r=yield e(E);!r&&w&&(r=yield e(w)),r&&((t=n.current)==null||t.setImgNode(r),b(r)),K(!1)});n.current&&(E||w)&&o()},[E,w]),p(()=>{var e;(e=n.current)==null||e.setSize(g)},[g]),p(()=>{j!==P.current&&h()},[j]),p(()=>{var e,o;const t=I.find(r=>r.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,N),t&&de(r=>{var i;const l=[];let d=null;return r.forEach(D=>{D.id!==n.current.selectedRectID?l.push(D):d=D}),t.extId===void 0&&(d=(i=n.current)==null?void 0:i.selectedRect),[...l,C(v({},d||{}),{attribute:N})]}),M(!0),h()},[N]),p(()=>{const e=X.current;je.isEqual(e,I)||(M(!0),h(),X.current=I)},[I]),p(()=>{h()},[u]),p(()=>{var e,o,t,r;const i=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},l=C(v({},i),{attributeList:(t=_.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(l))},[_.attributeList]),p(()=>{var e;(e=n.current)==null||e.setEnableAddRect(m.length===0),h()},[m]),Ie(()=>{if(!x||!ge){S(!0),u&&(n.current.setHoverRectID(""),n.current.render());return}const{rectList:e,size:o,zoom:t,imgNode:r}=n.current,i=e.find(d=>d.boxID===x||d.extId===x),l=Oe.getBasicRecPos(r,i,o,.5);if(!l){S(!0);return}u&&n.current.setHoverRectID(i.id),n.current.setCurrentPos(l.currentPos),n.current.setZoom(l.innerZoom),n.current.renderBasicCanvas(),n.current.render()},[x],{wait:200}),p(()=>{const{hiddenText:e}=z||{};if(e===void 0)return;const o=n.current;if(!o)return;const t=v(v({},o.style),z);o.setStyle(t)},[z]),p(()=>{h()},[R]),q.createElement(he,{spinning:me},q.createElement("div",{ref:A,style:v({position:"relative"},g)}))};var Fe=Ce(ye,null,null,{context:Pe})(Te);export{Fe as default};
1
+ import{useLatest as oe,useMemoizedFn as q,useDebounceEffect as he}from"ahooks";import{Spin as De}from"antd/es";import Z,{useContext as _e,useRef as J,useState as O,useMemo as be,useCallback as Ce,useEffect as p}from"react";import{connect as we}from"react-redux";import{usePointCloudViews as ye}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as xe}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as Pe}from"../../store/annotation/map.js";import{LabelBeeContext as Se}from"../../store/ctx.js";import{PointCloud2DRectOperation as Le,ImgUtils as Oe}from"@labelbee/lb-annotation";import{ImgPosUtils as Ve}from"@labelbee/lb-utils";import{selectSpecifiedRectsFromTopViewSelectedIds as Ee}from"./util.js";import{useUpdateRectList as je}from"./useUpdateRectList.js";import Be from"lodash";import{useToolStyleContext as Ne}from"../../hooks/useToolStyle.js";import ke from"../../store/toolConfig/index.js";var Ue=Object.defineProperty,Ae=Object.defineProperties,ze=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,Te=Object.prototype.propertyIsEnumerable,ce=(a,l,s)=>l in a?Ue(a,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[l]=s,v=(a,l)=>{for(var s in l||(l={}))Me.call(l,s)&&ce(a,s,l[s]);if(ie)for(var s of ie(l))Te.call(l,s)&&ce(a,s,l[s]);return a},C=(a,l)=>Ae(a,ze(l)),$=(a,l,s)=>new Promise((f,g)=>{var _=u=>{try{b(s.next(u))}catch(R){g(R)}},V=u=>{try{b(s.throw(u))}catch(R){g(R)}},b=u=>u.done?f(u.value):Promise.resolve(u.value).then(_,V);b((s=s.apply(a,l)).next())});const Fe=a=>{var l,s;const{mappingData:f,size:g,config:_,checkMode:V,afterImgOnLoad:b,shouldExcludePointCloudBoxListUpdate:u}=a,{selectBoxVisibleSwitch:R}=ke(),E=(l=f==null?void 0:f.url)!=null?l:"",w=(s=f==null?void 0:f.fallbackUrl)!=null?s:"",{pointCloudBoxList:j,setPointCloudResult:B,defaultAttribute:N,rectList:k,addRectIn2DView:le,updateRectIn2DView:se,removeRectIn2DView:ue,updateRectListByReducer:de,selectedIDs:m,setSelectedIDs:U,selectedID:y}=_e(xe),{value:A}=Ne(),ae=oe(m),{update2DViewRect:fe,remove2DViewRect:pe}=ye(),z=Z.useRef(null),n=J(null),G=q(fe),x=q(pe),P=J(null),[me,K]=O(!0),[Q,W]=O(""),[ve,M]=O(!1),[ge,S]=O(!0),I=be(()=>k==null?void 0:k.filter(e=>e.imageName===(f==null?void 0:f.path)),[f==null?void 0:f.path,k]),X=J(I),L=oe(f==null?void 0:f.path),T=Ce(e=>$(void 0,null,function*(){try{const o=ae.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(o.length){const r=new Set(o),i=t.filter(c=>r.has(c.id)).map(c=>c.id);U(i)}return t}catch(o){}}),[U]),Y=e=>{const{boxID:o}=e;if(S(!1),!u&&o){T(()=>{const t=G==null?void 0:G(e);return t?(P.current=t,B(t),t):null});return}se(e,!0)},ee=e=>{L.current&&le(C(v({},e),{imageName:L.current}))},te=e=>{if(e.length===0)return;if(!u){const t=e.find(r=>r.boxID);if(t){T(()=>{const r=x==null?void 0:x(t);return r?(P.current=r,B(r),h(),r):null});return}}const o=e.find(t=>t.extId);o&&T(()=>{const{imageName:t,extId:r}=o,i=x==null?void 0:x({boxID:r,imageName:t});return i?(P.current=i,B(i),i):null}),ue(e)},Re=q(()=>{let e=[];return j.forEach(o=>{const{rects:t=[],id:r,attribute:i,trackID:c}=o,d=t.find(F=>F.imageName===L.current),D=r+"_"+L.current;d&&(e=[...e,C(v({},d),{boxID:r,id:D,attribute:i,order:c})])}),e}),h=je(()=>{var e,o,t,r,i;const c=u?[]:Re(),d=(e=n.current)==null?void 0:e.selectedRectID,D=m.slice(0),F=R?Ee(D,c,I):[...c,...I];let ne=[];!R&&(m==null?void 0:m.length)&&(ne=c.filter(H=>d?m.includes(H.boxID)&&!d.includes(H.boxID):m.includes(H.boxID))),(o=n.current)==null||o.setHighLightRectList(ne),(t=n.current)==null||t.setResult(F),Q?((r=n.current)==null||r.setSelectedRectID(Q),W("")):ve&&d&&((i=n.current)==null||i.setSelectedRectID(d),M(!1))}),re=({targetId:e,id:o})=>{S(!1),requestAnimationFrame(()=>{Ie(e),W(o)})},Ie=e=>{(Array.isArray(m)?m:[]).includes(e)||U(e)};return p(()=>{if(z.current){const e=new Le({container:z.current,size:g,config:C(v({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:V});return n.current=e,n.current.init(),n.current.on("updateDragResult",Y),n.current.on("afterAddingDrawingRect",ee),n.current.on("deleteSelectedRects",te),n.current.on("onRightClick",re),()=>{var o,t,r,i,c;(o=n.current)==null||o.unbind("updateDragResult",Y),(t=n.current)==null||t.unbind("afterAddingDrawingRect",ee),(r=n.current)==null||r.unbind("deleteSelectedRects",te),(i=n.current)==null||i.unbind("onRightClick",re),(c=n.current)==null||c.destroy()}}},[]),p(()=>{const e=t=>$(void 0,null,function*(){try{return yield Oe.load(t)}catch(r){return console.error("Error loading image:",r),null}}),o=()=>$(void 0,null,function*(){var t;K(!0);let r=yield e(E);!r&&w&&(r=yield e(w)),r&&((t=n.current)==null||t.setImgNode(r),b(r)),K(!1)});n.current&&(E||w)&&o()},[E,w]),p(()=>{var e;(e=n.current)==null||e.setSize(g)},[g]),p(()=>{j!==P.current&&h()},[j]),p(()=>{var e,o;const t=I.find(r=>r.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,N),t&&de(r=>{var i;const c=[];let d=null;return r.forEach(D=>{D.id!==n.current.selectedRectID?c.push(D):d=D}),t.extId===void 0&&(d=(i=n.current)==null?void 0:i.selectedRect),[...c,C(v({},d||{}),{attribute:N})]}),M(!0),h()},[N]),p(()=>{const e=X.current;Be.isEqual(e,I)||(M(!0),h(),X.current=I)},[I]),p(()=>{h()},[u]),p(()=>{var e,o,t,r;const i=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},c=C(v({},i),{attributeList:(t=_.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(c))},[_.attributeList]),p(()=>{var e;(e=n.current)==null||e.setEnableAddRect(m.length===0),h()},[m]),he(()=>{if(!y||!ge){S(!0),u&&(n.current.setHoverRectID(""),n.current.render());return}const{rectList:e,size:o,zoom:t,imgNode:r}=n.current,i=e.find(d=>d.boxID===y||d.extId===y),c=Ve.getBasicRecPos(r,i,o,.5);if(!c){S(!0);return}u&&n.current.setHoverRectID(i.id),n.current.setCurrentPos(c.currentPos),n.current.setZoom(c.innerZoom),n.current.renderBasicCanvas(),n.current.render()},[y],{wait:200}),p(()=>{const{hiddenText:e}=A||{};if(e===void 0)return;const o=n.current;if(!o)return;const t=v(v({},o.style),A);o.setStyle(t)},[A]),p(()=>{h()},[R]),Z.createElement(De,{spinning:me},Z.createElement("div",{ref:z,style:v({position:"relative"},g)}))};var He=we(Pe,null,null,{context:Se})(Fe);export{He as default};
@@ -1 +1 @@
1
- import{EPointCloudPattern as X}from"@labelbee/lb-utils";import Oe,{useState as r,useRef as ut,useMemo as k,useCallback as N,useEffect as Y}from"react";import{EPointCloudBoxRenderTrigger as F,calcResetAreasAndBoxIds as gt}from"../../utils/ToolPointCloudBoxRenderHelper.js";import{ActionsHistory as Me,EToolName as $,uuid as ft}from"@labelbee/lb-annotation";import{useDispatch as pt}from"../../store/ctx.js";import{ChangeSave as mt}from"../../store/annotation/actionCreators.js";import ht from"../../store/annotatedBox/index.js";import je from"lodash";import{addMapIndirectWeakSetItem as ke}from"./utils/map.js";import It from"./hooks/useTimeoutFunc.js";import vt,{getEmptyUseWindowKeydownListener as Pt}from"./hooks/useWindowKeydownListener.js";var wt=Object.defineProperty,yt=Object.defineProperties,St=Object.getOwnPropertyDescriptors,Fe=Object.getOwnPropertySymbols,Lt=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,Ee=(d,s,c)=>s in d?wt(d,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[s]=c,E=(d,s)=>{for(var c in s||(s={}))Lt.call(s,c)&&Ee(d,c,s[c]);if(Fe)for(var c of Fe(s))Ct.call(s,c)&&Ee(d,c,s[c]);return d},ze=(d,s)=>yt(d,St(s)),Rt=(d,s,c)=>new Promise((x,A)=>{var B=g=>{try{w(c.next(g))}catch(b){A(b)}},G=g=>{try{w(c.throw(g))}catch(b){A(b)}},w=g=>g.done?x(g.value):Promise.resolve(g.value).then(B,G);w((c=c.apply(d,s)).next())});const z=d=>je.pick(d,["id","attribute","width","height","x","y","imageName"]),Ge=Oe.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 Me,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:$.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:X.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:d=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:d=>!1,removeRectBySpecifyId:(d,s,c)=>!1,removeRectByPointCloudBoxId:d=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:Pt(),isLargeStatus:!1,setIsLargeStatus:()=>{}}),bt=({children:d})=>{const[s,c]=r([]),[x,A]=r([]),[B,G]=r([]),[w,g]=r([]),[b,Ke]=r([]),[v,ee]=r([]),[_,K]=r([]),[te,Te]=r(!0),[oe,We]=r(2),[ne,Ze]=r(!0),[ie,Ue]=r(1),[p,se]=r(),[re,le]=r(),[ae,de]=r(),[f,ce]=r(),[ue,qe]=r(""),[T,Je]=r($.Rect),W=ut(new Me).current,[m,Z]=r([]),[ge,Qe]=r(""),[U,Xe]=r(X.Detection),[D,fe]=r(void 0),[q,Ye]=r([]),[J,$e]=r([]),[pe,et]=r(!1),[me,he]=r(!1),h=ht(),[Ie,tt]=r({}),ot=pt(),nt=o=>{const{imgNode:n,path:t}=o;t&&n&&tt(a=>ze(E({},a),{[t]:{width:n.width,height:n.height}}))},ve=k(()=>v.length===1?v[0]:"",[v]),Pe=vt(),H=N((o,n,t="extId")=>{const a=t||"id",l=new Set(n);return g(u=>{let y=!1;const P=u.filter(M=>{const Q=M[a],j=l.has(Q)?M.imageName!==o:!0;return j||(y=!0),j});return y?P:u}),!0},[]),we=N(o=>{const n=s.map(t=>t.id);return H(o,n,"extId")},[s,H]),ye=N(o=>{if(!o)return!1;const n=s.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:a,attribute:l,trackID:u}=t,y=t.rects.find(P=>P.imageName===o);if(y){const P=je.pick(y,["width","height","x","y","imageName"]);return ze(E({},P),{id:ft(),attribute:l,order:u,extId:a,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(g(t=>{const a=new Set(t.filter(u=>o===u.imageName).map(u=>u.extId)),l=n.filter(u=>a.has(u.extId)===!1);return l.length?[...t,...l]:t}),!0):!1},[s]),Se=k(()=>s.filter(n=>Array.isArray(n.rects)&&n.rects.length>0).reduce((n,t)=>{var a;return(a=t.rects)==null||a.forEach(l=>{const{imageName:u}=l;if(!u){console.warn("Missing image name"),console.trace(l,t);return}ke(n,u,t.id,t)}),n},new Map),[s]),Le=N(o=>{g(n=>o(n,z))},[z]),Ce=k(()=>w.filter(o=>o.extId!==void 0&&o.id!==void 0).reduce((o,n)=>{const t=n.imageName;return t?(ke(o,t,n.extId,n),o):(console.warn("missing image name"),console.log(n,w),o)},new Map),[w]),{fn:it}=It(o=>{ee(n=>{const t=o,a=new Set(t);let l=!1;const u=n.filter(y=>{const P=a.has(y);return P||(l=!0),P});return l?u:n})},200),Re=N(o=>{const n=o.map(t=>t.id);c(o),it(n)},[]),O=k(()=>{const o=s.find(e=>e.id===ve),n=e=>{const i=s.concat(e);return Re(i),i},t=e=>{const i=x.concat(e);return A(i),i},a=e=>{Te(e!==!1)},l=e=>{let i=[];e===void 0||e===""?i=[]:typeof e=="string"?i=[e]:Array.isArray(e)&&(i=e.length>1?Array.from(new Set(e)):e),ee(i)},u=e=>{v.includes(e)?l(v.filter(i=>i!==e)):l([...v,e])},y=e=>{const i=z(e);g(I=>[...I,i])},P=(e,i=!1)=>{const I=z(e);g(S=>S.map(L=>L.id===e.id?i?E(E({},L),I):I:L))},M=e=>{g(i=>i.filter(I=>!e.find(S=>S.id===I.id)))},Q=e=>{_.includes(e)?K([]):K([e])},j=()=>{if(T===$.Rect){const e=s.map(i=>i.id);l(e),p==null||p.pointCloud2dOperation.setSelectedIDs(e)}},rt=e=>{l(s.filter(i=>i.attribute===e).map(i=>i.id))},be=s.filter(e=>!m.includes(e.attribute)),xe=x.filter(e=>!m.includes(e.attribute)),De=b.filter(e=>e.attribute&&!m.includes(e.attribute)),lt=e=>{if(m.includes(e))Z(m.filter(i=>i!==e));else{const i=m.concat(e);Z(i)}},at=(e=be,i=B,I=xe,S=De,L=q)=>{var V;f==null||f.clearAllBox(),f==null||f.clearAllSphere(),p==null||p.updatePolygonList(e,i),p==null||p.updatePointList(I),p==null||p.updateLineList(S),f==null||f.generateBoxes(e),f==null||f.generateSpheres(I),(V=D==null?void 0:D.store)==null||V.updateCurrentSegment(L),Ae(F.Default,e)},dt=()=>{se(void 0),le(void 0),de(void 0),ce(void 0)},Ae=(e,i,I)=>Rt(void 0,null,function*(){var S,L,V;if(!f)return;const Be=f.pointCloudObject;if(!Be)return;let _e=[],Ve=[];try{if(i&&W.record.length){const{record:C,recordIndex:R}=W;let Ne=R;R>0&&(e===F.SingleToggleValid||e===F.SingleRotate||e===F.Single&&i.length===((S=C[R])==null?void 0:S.pointCloudBoxList.length))&&(Ne=R-1);let ct=(L=C[Ne])==null?void 0:L.pointCloudBoxList;const He=gt(e,i,ct);_e=He.modifiedBoxIds,Ve=He.resetAreas}}catch(C){console.error("call calcResetAreasAndBoxIds error",C)}try{const C=yield f.getHighlightIndexByMappingImgList({mappingImgList:I!=null?I:J,points:Be.geometry.attributes.position.array}),R=yield f==null?void 0:f.highlightOriginPointCloud(i,C,{modifiedBoxIds:_e,resetAreas:Ve});return R&&((V=p==null?void 0:p.pointCloudInstance)==null||V.updateColor(R)),R}catch(C){console.error("call highlightOriginPointCloud error",C)}});return{selectedID:ve,pointCloudBoxList:s,pointCloudSphereList:x,displayPointCloudList:be,displaySphereList:xe,displayLineList:De,selectedIDs:v,setPointCloudResult:Re,setSelectedIDs:l,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:A,valid:te,selectedPointCloudBox:o,setPointCloudValid:a,addSelectedID:u,addHighlightID:Q,selectedAllBoxes:j,topViewInstance:p,setTopViewInstance:se,sideViewInstance:re,setSideViewInstance:le,backViewInstance:ae,setBackViewInstance:de,mainViewInstance:f,setMainViewInstance:ce,polygonList:B,setPolygonList:G,rectList:w,setRectList:g,addRectIn2DView:y,removeRectIn2DView:M,updateRectIn2DView:P,lineList:b,setLineList:Ke,zoom:ie,setZoom:Ue,history:W,toggleAttributesVisible:lt,hideAttributes:m,setHideAttributes:Z,reRender:at,attrPanelLayout:ge,setAttrPanelLayout:Qe,syncAllViewPointCloudColor:Ae,defaultAttribute:ue,setDefaultAttribute:qe,pointCloudPattern:T,setPointCloudPattern:Je,selectSpecAttr:rt,globalPattern:U,setGlobalPattern:e=>{U!==e&&(ot(mt),Xe(e),e===X.Detection&&fe(void 0))},ptSegmentInstance:D,setPtSegmentInstance:fe,segmentation:q,setSegmentation:Ye,clearAllDetectionInstance:dt,highlight2DDataList:J,setHighlight2DDataList:$e,highlight2DLoading:pe,setHighlight2DLoading:et,cuboidBoxIn2DView:ne,setCuboidBoxIn2DView:Ze,imageSizes:Ie,cacheImageNodeSize:nt,highlightIDs:_,setHighlightIDs:K,removeRectByPointCloudBoxId:we,removeRectBySpecifyId:H,addRectFromPointCloudBoxByImageName:ye,rectRotateSensitivity:oe,setRectRotateSensitivity:We,imageNamePointCloudBoxMap:Se,linkageImageNameRectMap:Ce,updateRectListByReducer:Le,windowKeydownListenerHook:Pe,isLargeStatus:me,setIsLargeStatus:he}},[te,v,s,x,B,b,w,p,re,ae,f,ie,m,ge,ue,T,U,D,q,J,pe,ne,Ie,_,we,H,ye,oe,Se,Ce,Le,Pe,me,he]);Y(()=>{var o,n,t;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,s),(n=h==null?void 0:h.setHighlightIDs)==null||n.call(h,_),(t=h==null?void 0:h.setSelectedIDs)==null||t.call(h,v)},[s,v,_]),Y(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,O)},[O]);const st=()=>{const o=s.filter(l=>m.includes(l.attribute)),{setSelectedIDs:n,reRender:t}=O,a=o.map(l=>l.id);a.length>0&&n(v.filter(l=>!a.includes(l))),t()};return Y(()=>{var o,n,t,a;st(),(n=(o=p==null?void 0:p.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,m),(a=(t=D==null?void 0:D.store)==null?void 0:t.setHiddenAttributes)==null||a.call(t,m)},[m]),Oe.createElement(Ge.Provider,{value:O},d)};export{Ge as PointCloudContext,bt as PointCloudProvider};
1
+ import{EPointCloudPattern as X}from"@labelbee/lb-utils";import Me,{useState as r,useRef as pt,useMemo as k,useCallback as N,useEffect as Y}from"react";import{EPointCloudBoxRenderTrigger as F,calcResetAreasAndBoxIds as mt}from"../../utils/ToolPointCloudBoxRenderHelper.js";import{ActionsHistory as je,EToolName as $,uuid as ht}from"@labelbee/lb-annotation";import{useDispatch as It}from"../../store/ctx.js";import{ChangeSave as vt}from"../../store/annotation/actionCreators.js";import Pt from"../../store/annotatedBox/index.js";import ke from"lodash";import{addMapIndirectWeakSetItem as Fe}from"./utils/map.js";import wt from"./hooks/useTimeoutFunc.js";import St,{getEmptyUseWindowKeydownListener as yt}from"./hooks/useWindowKeydownListener.js";var Lt=Object.defineProperty,bt=Object.defineProperties,Ct=Object.getOwnPropertyDescriptors,Ee=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable,ze=(c,s,u)=>s in c?Lt(c,s,{enumerable:!0,configurable:!0,writable:!0,value:u}):c[s]=u,E=(c,s)=>{for(var u in s||(s={}))Rt.call(s,u)&&ze(c,u,s[u]);if(Ee)for(var u of Ee(s))xt.call(s,u)&&ze(c,u,s[u]);return c},Ge=(c,s)=>bt(c,Ct(s)),Dt=(c,s,u)=>new Promise((x,B)=>{var A=g=>{try{w(u.next(g))}catch(R){B(R)}},G=g=>{try{w(u.throw(g))}catch(R){B(R)}},w=g=>g.done?x(g.value):Promise.resolve(g.value).then(A,G);w((u=u.apply(c,s)).next())});const z=c=>ke.pick(c,["id","attribute","width","height","x","y","imageName"]),Ke=Me.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,visibleBatchSetValid:!1,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setBatchSetValidModal:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new je,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:$.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:X.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:c=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:c=>!1,removeRectBySpecifyId:(c,s,u)=>!1,removeRectByPointCloudBoxId:c=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:yt(),isLargeStatus:!1,setIsLargeStatus:()=>{}}),Bt=({children:c})=>{const[s,u]=r([]),[x,B]=r([]),[A,G]=r([]),[w,g]=r([]),[R,Te]=r([]),[v,ee]=r([]),[V,K]=r([]),[te,We]=r(!0),[oe,Ze]=r(2),[ne,Ue]=r(!0),[ie,qe]=r(1),[p,se]=r(),[re,le]=r(),[ae,de]=r(),[f,ce]=r(),[ue,Je]=r(""),[T,Qe]=r($.Rect),W=pt(new je).current,[m,Z]=r([]),[ge,Xe]=r(""),[U,Ye]=r(X.Detection),[D,fe]=r(void 0),[q,$e]=r([]),[J,et]=r([]),[pe,tt]=r(!1),[me,he]=r(!1),h=Pt(),[Ie,ot]=r(!1),[ve,nt]=r({}),it=It(),st=o=>{const{imgNode:n,path:t}=o;t&&n&&nt(a=>Ge(E({},a),{[t]:{width:n.width,height:n.height}}))},Pe=k(()=>v.length===1?v[0]:"",[v]),we=St(),H=N((o,n,t="extId")=>{const a=t||"id",d=new Set(n);return g(l=>{let S=!1;const P=l.filter(M=>{const Q=M[a],j=d.has(Q)?M.imageName!==o:!0;return j||(S=!0),j});return S?P:l}),!0},[]),Se=N(o=>{const n=s.map(t=>t.id);return H(o,n,"extId")},[s,H]),ye=N(o=>{if(!o)return!1;const n=s.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:a,attribute:d,trackID:l}=t,S=t.rects.find(P=>P.imageName===o);if(S){const P=ke.pick(S,["width","height","x","y","imageName"]);return Ge(E({},P),{id:ht(),attribute:d,order:l,extId:a,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(g(t=>{const a=new Set(t.filter(l=>o===l.imageName).map(l=>l.extId)),d=n.filter(l=>a.has(l.extId)===!1);return d.length?[...t,...d]:t}),!0):!1},[s]),Le=k(()=>s.filter(n=>Array.isArray(n.rects)&&n.rects.length>0).reduce((n,t)=>{var a;return(a=t.rects)==null||a.forEach(d=>{const{imageName:l}=d;if(!l){console.warn("Missing image name"),console.trace(d,t);return}Fe(n,l,t.id,t)}),n},new Map),[s]),be=N(o=>{g(n=>o(n,z))},[z]),Ce=k(()=>w.filter(o=>o.extId!==void 0&&o.id!==void 0).reduce((o,n)=>{const t=n.imageName;return t?(Fe(o,t,n.extId,n),o):(console.warn("missing image name"),console.log(n,w),o)},new Map),[w]),{fn:rt}=wt(o=>{ee(n=>{const t=o,a=new Set(t);let d=!1;const l=n.filter(S=>{const P=a.has(S);return P||(d=!0),P});return d?l:n})},200),Re=N(o=>{const n=o.map(t=>t.id);u(o),rt(n)},[]),O=k(()=>{const o=s.find(e=>e.id===Pe),n=e=>{const i=s.concat(e);return Re(i),i},t=e=>{const i=x.concat(e);return B(i),i},a=e=>{We(e!==!1)},d=e=>{ot(e)},l=e=>{let i=[];e===void 0||e===""?i=[]:typeof e=="string"?i=[e]:Array.isArray(e)&&(i=e.length>1?Array.from(new Set(e)):e),ee(i)},S=e=>{v.includes(e)?l(v.filter(i=>i!==e)):l([...v,e])},P=e=>{const i=z(e);g(I=>[...I,i])},M=(e,i=!1)=>{const I=z(e);g(y=>y.map(L=>L.id===e.id?i?E(E({},L),I):I:L))},Q=e=>{g(i=>i.filter(I=>!e.find(y=>y.id===I.id)))},j=e=>{V.includes(e)?K([]):K([e])},at=()=>{if(T===$.Rect){const e=s.map(i=>i.id);l(e),p==null||p.pointCloud2dOperation.setSelectedIDs(e)}},dt=e=>{l(s.filter(i=>i.attribute===e).map(i=>i.id))},xe=s.filter(e=>!m.includes(e.attribute)),De=x.filter(e=>!m.includes(e.attribute)),Be=R.filter(e=>e.attribute&&!m.includes(e.attribute)),ct=e=>{if(m.includes(e))Z(m.filter(i=>i!==e));else{const i=m.concat(e);Z(i)}},ut=(e=xe,i=A,I=De,y=Be,L=q)=>{var _;f==null||f.clearAllBox(),f==null||f.clearAllSphere(),p==null||p.updatePolygonList(e,i),p==null||p.updatePointList(I),p==null||p.updateLineList(y),f==null||f.generateBoxes(e),f==null||f.generateSpheres(I),(_=D==null?void 0:D.store)==null||_.updateCurrentSegment(L),Ae(F.Default,e)},gt=()=>{se(void 0),le(void 0),de(void 0),ce(void 0)},Ae=(e,i,I)=>Dt(void 0,null,function*(){var y,L,_;if(!f)return;const Ve=f.pointCloudObject;if(!Ve)return;let _e=[],Ne=[];try{if(i&&W.record.length){const{record:b,recordIndex:C}=W;let He=C;C>0&&(e===F.SingleToggleValid||e===F.SingleRotate||e===F.Single&&i.length===((y=b[C])==null?void 0:y.pointCloudBoxList.length))&&(He=C-1);let ft=(L=b[He])==null?void 0:L.pointCloudBoxList;const Oe=mt(e,i,ft);_e=Oe.modifiedBoxIds,Ne=Oe.resetAreas}}catch(b){console.error("call calcResetAreasAndBoxIds error",b)}try{const b=yield f.getHighlightIndexByMappingImgList({mappingImgList:I!=null?I:J,points:Ve.geometry.attributes.position.array}),C=yield f==null?void 0:f.highlightOriginPointCloud(i,b,{modifiedBoxIds:_e,resetAreas:Ne});return C&&((_=p==null?void 0:p.pointCloudInstance)==null||_.updateColor(C)),C}catch(b){console.error("call highlightOriginPointCloud error",b)}});return{selectedID:Pe,pointCloudBoxList:s,pointCloudSphereList:x,displayPointCloudList:xe,displaySphereList:De,displayLineList:Be,selectedIDs:v,setPointCloudResult:Re,setSelectedIDs:l,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:B,valid:te,visibleBatchSetValid:Ie,selectedPointCloudBox:o,setPointCloudValid:a,setBatchSetValidModal:d,addSelectedID:S,addHighlightID:j,selectedAllBoxes:at,topViewInstance:p,setTopViewInstance:se,sideViewInstance:re,setSideViewInstance:le,backViewInstance:ae,setBackViewInstance:de,mainViewInstance:f,setMainViewInstance:ce,polygonList:A,setPolygonList:G,rectList:w,setRectList:g,addRectIn2DView:P,removeRectIn2DView:Q,updateRectIn2DView:M,lineList:R,setLineList:Te,zoom:ie,setZoom:qe,history:W,toggleAttributesVisible:ct,hideAttributes:m,setHideAttributes:Z,reRender:ut,attrPanelLayout:ge,setAttrPanelLayout:Xe,syncAllViewPointCloudColor:Ae,defaultAttribute:ue,setDefaultAttribute:Je,pointCloudPattern:T,setPointCloudPattern:Qe,selectSpecAttr:dt,globalPattern:U,setGlobalPattern:e=>{U!==e&&(it(vt),Ye(e),e===X.Detection&&fe(void 0))},ptSegmentInstance:D,setPtSegmentInstance:fe,segmentation:q,setSegmentation:$e,clearAllDetectionInstance:gt,highlight2DDataList:J,setHighlight2DDataList:et,highlight2DLoading:pe,setHighlight2DLoading:tt,cuboidBoxIn2DView:ne,setCuboidBoxIn2DView:Ue,imageSizes:ve,cacheImageNodeSize:st,highlightIDs:V,setHighlightIDs:K,removeRectByPointCloudBoxId:Se,removeRectBySpecifyId:H,addRectFromPointCloudBoxByImageName:ye,rectRotateSensitivity:oe,setRectRotateSensitivity:Ze,imageNamePointCloudBoxMap:Le,linkageImageNameRectMap:Ce,updateRectListByReducer:be,windowKeydownListenerHook:we,isLargeStatus:me,setIsLargeStatus:he}},[te,Ie,v,s,x,A,R,w,p,re,ae,f,ie,m,ge,ue,T,U,D,q,J,pe,ne,ve,V,Se,H,ye,oe,Le,Ce,be,we,me,he]);Y(()=>{var o,n,t;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,s),(n=h==null?void 0:h.setHighlightIDs)==null||n.call(h,V),(t=h==null?void 0:h.setSelectedIDs)==null||t.call(h,v)},[s,v,V]),Y(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,O)},[O]);const lt=()=>{const o=s.filter(d=>m.includes(d.attribute)),{setSelectedIDs:n,reRender:t}=O,a=o.map(d=>d.id);a.length>0&&n(v.filter(d=>!a.includes(d))),t()};return Y(()=>{var o,n,t,a;lt(),(n=(o=p==null?void 0:p.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,m),(a=(t=D==null?void 0:D.store)==null?void 0:t.setHiddenAttributes)==null||a.call(t,m)},[m]),Me.createElement(Ke.Provider,{value:O},c)};export{Ke as PointCloudContext,Bt 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 se}from"./hooks/useBoxes.js";import{useSingleBox as ne}from"./hooks/useSingleBox.js";import{useSphere as ie}from"./hooks/useSphere.js";import{useContext as ae,useEffect as c}from"react";import{CommonToolUtils as ue,EToolName as P,cTool as le}from"@labelbee/lb-annotation";import{message as C}from"antd";import{connect as ce}from"react-redux";import{a2MapStateToProps as de}from"../../store/annotation/map.js";import{useStatus as pe}from"./hooks/useStatus.js";import{usePointCloudViews as me}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as Pe}from"../../store/ctx.js";import{useHistory as fe}from"./hooks/useHistory.js";import{useAttribute as we}from"./hooks/useAttribute.js";import{useConfig as be}from"./hooks/useConfig.js";import{usePolygon as ye}from"./hooks/usePolygon.js";import{useLine as ve}from"./hooks/useLine.js";import{useUpdatePointCloudColor as Ce}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as he}from"react-i18next";import{useLatest as B}from"ahooks";var ge=Object.defineProperty,Se=Object.defineProperties,ke=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,j=(i,r,a)=>r in i?ge(i,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[r]=a,f=(i,r)=>{for(var a in r||(r={}))xe.call(r,a)&&j(i,a,r[a]);if(O)for(var a of O(r))Ve.call(r,a)&&j(i,a,r[a]);return i},w=(i,r)=>Se(i,ke(r));const{EPolygonPattern:_e}=le,Ie=({currentData:i,config:r,checkMode:a,configString:L,imgIndex:h,toolInstanceRef:u,setResourceLoading:g})=>{const e=ae(te),{changeSelectedBoxValid:E,selectNextBox:A,selectPrevBox:T,updateSelectedBox:D,deleteSelectedPointCloudBoxAndPolygon:H}=ne(),{selectedSphere:b,updatePointCloudSphere:K}=ie(),{clearAllResult:y,updatePointCloudPattern:N}=pe(),{copySelectedBoxes:U,pasteSelectedBoxes:z,copiedBoxes:Oe}=se({config:r,currentData:i}),{updateRotate:S}=oe({currentData:i}),{updateRotateEdge:R}=re({currentData:i}),{updatePointCloudData:p,topViewSelectedChanged:F}=me({setResourceLoading:g}),{redo:k,undo:x,pushHistoryWithList:q,pushHistoryUnderUpdatePolygon:G,pushHistoryUnderUpdateLine:M}=fe(),{syncThreeViewsAttribute:V}=we(),{syncAllViewsConfig:W,reRenderTopViewRange:Y}=be(),{selectedPolygon:_}=ye(),{selectedLine:I}=ve(),{t:v}=he(),{updatePointCloudColor:$}=Ce(g,r),J=B(i),m=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Q=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{S(e.rectRotateSensitivity);break}case"e":S(-Number(e.rectRotateSensitivity));break;case"g":R(-90);break;case"u":{const d=l.pattern===_e.Normal?P.Rect:P.Polygon;N(d);const ee={[P.Polygon]:v("PolygonPattern"),[P.Rect]:v("RectPattern")};C.success(v("ChangePatternMsg",{pattern:ee[d]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){T();break}A(),o.preventDefault();break;case"f":E();break;case"arrowup":m({y:-1});break;case"arrowdown":m({y:1});break;case"arrowleft":m({x:-1});break;case"arrowright":m({x:1});break;case"delete":H(J.current);break}},X=(t,o)=>{switch(t){case"c":U();break;case"v":z();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?k():x();break}}},Z=B(t=>{if(!ue.hotkeyFilter(t)||a===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){X(o,t);return}Q(o,t)});return c(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>Z.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),c(()=>{W(r)},[L]),c(()=>{(r==null?void 0:r.radius)&&Y(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{p==null||p()},[h,e.mainViewInstance]),c(()=>{e.setHideAttributes([])},[h]),c(()=>{u.current.setDefaultAttribute=t=>{var o;if(V(t),$(t),_&&G(w(f({},_),{attribute:t})),I&&M(w(f({},I),{attribute:t})),b){const s=K(w(f({},b),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),F({newSelectedSphere:b,newSphereList:s}))}},u.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=w(f({},l),{[t]:o}),D(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},u.current.clearResult=()=>{y==null||y()},u.current.redo=()=>{k()},u.current.undo=()=>{x()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&y()})},u.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{p==null||p(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),c(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),c(()=>{u.current.history={pushHistory:t=>{q({pointCloudBoxList:t})},initRecord:()=>{}}},[]),c(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||a)return;const s=d=>{V(d)},n=d=>{C.error(d)},l=d=>{C.info(d)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var Be=ce(de,null,null,{context:Pe})(Ie);export{Be 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{CommonToolUtils as le,EToolName as f,cTool as ce}from"@labelbee/lb-annotation";import{Modal as de,message as h}from"antd";import{connect as pe}from"react-redux";import{a2MapStateToProps as me}from"../../store/annotation/map.js";import{useStatus as fe}from"./hooks/useStatus.js";import{usePointCloudViews as Pe}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as we}from"../../store/ctx.js";import{useHistory as be}from"./hooks/useHistory.js";import{useAttribute as ye}from"./hooks/useAttribute.js";import{useConfig as ve}from"./hooks/useConfig.js";import{usePolygon as he}from"./hooks/usePolygon.js";import{useLine as Ce}from"./hooks/useLine.js";import{useUpdatePointCloudColor as ge}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as Se}from"react-i18next";import{useLatest as I}from"ahooks";var ke=Object.defineProperty,xe=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,j=(i,r,a)=>r in i?ke(i,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[r]=a,P=(i,r)=>{for(var a in r||(r={}))_e.call(r,a)&&j(i,a,r[a]);if(O)for(var a of O(r))Be.call(r,a)&&j(i,a,r[a]);return i},w=(i,r)=>xe(i,Ve(r));const{EPolygonPattern:Ie}=ce,Oe=({currentData:i,config:r,checkMode:a,configString:L,imgIndex:C,toolInstanceRef:u,setResourceLoading:g,isBatchSetValid:A})=>{const e=ue(oe),{changeSelectedBoxValid:E,selectNextBox:T,selectPrevBox:D,updateSelectedBox:H,deleteSelectedPointCloudBoxAndPolygon:K}=ie(),{selectedSphere:b,updatePointCloudSphere:N}=ae(),{clearAllResult:y,updatePointCloudPattern:U}=fe(),{copySelectedBoxes:z,pasteSelectedBoxes:R,copiedBoxes:Le}=ne({config:r,currentData:i}),{updateRotate:S}=re({currentData:i}),{updateRotateEdge:F}=se({currentData:i}),{updatePointCloudData:p,topViewSelectedChanged:M}=Pe({setResourceLoading:g}),{redo:k,undo:x,pushHistoryWithList:q,pushHistoryUnderUpdatePolygon:G,pushHistoryUnderUpdateLine:W}=be(),{syncThreeViewsAttribute:V}=ye(),{syncAllViewsConfig:Y,reRenderTopViewRange:$}=ve(),{selectedPolygon:_}=he(),{selectedLine:B}=Ce(),{t:v}=Se(),{updatePointCloudColor:J}=ge(g,r),Q=I(i),m=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},X=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{S(e.rectRotateSensitivity);break}case"e":S(-Number(e.rectRotateSensitivity));break;case"g":F(-90);break;case"u":{const d=l.pattern===Ie.Normal?f.Rect:f.Polygon;U(d);const te={[f.Polygon]:v("PolygonPattern"),[f.Rect]:v("RectPattern")};h.success(v("ChangePatternMsg",{pattern:te[d]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":A?(de.destroyAll(),e.setBatchSetValidModal(!e.visibleBatchSetValid)):e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){D();break}T(),o.preventDefault();break;case"f":E();break;case"arrowup":m({y:-1});break;case"arrowdown":m({y:1});break;case"arrowleft":m({x:-1});break;case"arrowright":m({x:1});break;case"delete":K(Q.current);break}},Z=(t,o)=>{switch(t){case"c":z();break;case"v":R();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?k():x();break}}},ee=I(t=>{if(!le.hotkeyFilter(t)||a===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){Z(o,t);return}X(o,t)});return c(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>ee.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),c(()=>{Y(r)},[L]),c(()=>{(r==null?void 0:r.radius)&&$(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{p==null||p()},[C,e.mainViewInstance]),c(()=>{e.setHideAttributes([])},[C]),c(()=>{u.current.setDefaultAttribute=t=>{var o;if(V(t),J(t),_&&G(w(P({},_),{attribute:t})),B&&W(w(P({},B),{attribute:t})),b){const s=N(w(P({},b),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),M({newSelectedSphere:b,newSphereList:s}))}},u.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=w(P({},l),{[t]:o}),H(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},u.current.clearResult=()=>{y==null||y()},u.current.redo=()=>{k()},u.current.undo=()=>{x()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&y()})},u.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{p==null||p(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),c(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),c(()=>{u.current.history={pushHistory:t=>{q({pointCloudBoxList:t})},initRecord:()=>{}}},[]),c(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||a)return;const s=d=>{V(d)},n=d=>{h.error(d)},l=d=>{h.info(d)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var je=pe(me,null,null,{context:we})(Oe);export{je as default};
@@ -1 +1 @@
1
- import{EPointCloudName as st,TagUtils as oo,MathUtils as w,getCuboidFromPointCloudBox as eo}from"@labelbee/lb-annotation";import{EPerspectiveView as X,PointCloudUtils as O,POINT_CLOUD_DEFAULT_STEP as no,DEFAULT_SPHERE_PARAMS as io}from"@labelbee/lb-utils";import{useContext as mt,useCallback as ht}from"react";import{PointCloudContext as xt}from"../PointCloudContext.js";import{useSingleBox as so}from"./useSingleBox.js";import{useSphere as ro}from"./useSphere.js";import{pick as lo}from"lodash";import{useSelector as ao,useDispatch as co}from"../../../store/ctx.js";import uo from"../../../utils/StepUtils.js";import{EPointCloudBoxRenderTrigger as F}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{jsonParser as rt,generatePointCloudBoxRects as po}from"../../../utils/index.js";import{PreDataProcess as lt,SetAnnotationLoading as Lt,SetLoadPCDFileLoading as vt}from"../../../store/annotation/actionCreators.js";import{useHistory as go}from"./useHistory.js";import{usePolygon as fo}from"./usePolygon.js";import{useLatest as K}from"ahooks";var Co=Object.defineProperty,Po=Object.defineProperties,mo=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,ho=Object.prototype.hasOwnProperty,xo=Object.prototype.propertyIsEnumerable,Bt=(e,n,t)=>n in e?Co(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,x=(e,n)=>{for(var t in n||(n={}))ho.call(n,t)&&Bt(e,t,n[t]);if(yt)for(var t of yt(n))xo.call(n,t)&&Bt(e,t,n[t]);return e},A=(e,n)=>Po(e,mo(n)),bt=(e,n,t)=>new Promise((d,p)=>{var o=a=>{try{u(t.next(a))}catch(h){p(h)}},f=a=>{try{u(t.throw(a))}catch(h){p(h)}},u=a=>a.done?d(a.value):Promise.resolve(a.value).then(o,f);u((t=t.apply(e,n)).next())});const $=5,tt=90,It=.01,b={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},dt=(e,n,t,d,p)=>{const{x:o,y:f}=O.transferCanvas2World(e,n),{defaultZ:u}=io,a={center:{x:o,y:f,z:u},id:e.id},h=d?x(x({},d),a):A(x({},a),{attribute:"",valid:!0});return p&&Object.assign(h,p),h},at=(e,n,t,d,p,o)=>{let f=e.pointList.map(D=>O.transferCanvas2World(D,n)),u=0,a=1,h={};if(t){const D=t.getSensesPointZAxisInPolygon(f,void 0,o);o&&D.fittedCoordinates.length>0&&(f=D.fittedCoordinates),u=(D.maxZ+D.minZ)/2,a=D.maxZ-D.minZ,h={count:D.zCount}}const[P,L,T]=f,V=w.getLineCenterPoint([P,T]),R=w.getLineLength(P,L),U=w.getLineLength(L,T),N=w.getRadiusFromQuadrangle(e.pointList);d&&(u=d.center.z,a=d.depth);const z={center:{x:V.x,y:V.y,z:u},width:o?U+It:U,height:o?R+It:R,depth:a,rotation:N,id:e.id},j=x(d?x(x({},d),z):A(x({},z),{attribute:"",valid:!0}),h);p&&Object.assign(j,p);const E=f.map(D=>O.transferWorld2Canvas(D,n));return{boxParams:j,newPointList:E}},wt=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(x({},t),{center:{x:t.center.x-d.x,y:t.center.y,z:t.center.z-d.y}})},Dt=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),L=w.getLineCenterPoint([u,h]),V={x:{x:P.x-L.x,y:P.y-L.y}.x,y:0,z:P.y-L.y},R=w.getLineLength(p,o),U=w.getLineLength(u,a),N=R-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),E=z-j,{newBoxParams:D}=d.getNewBoxBySideUpdate(V,E,N,t);return D},Lo=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(x({},t),{center:{x:t.center.x,y:t.center.y-d.x,z:t.center.z-d.y}})},vo=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),L=w.getLineCenterPoint([u,h]),V={x:{x:P.x-L.x,y:P.y-L.y}.x,y:0,z:P.y-L.y},R=w.getLineLength(p,o),U=w.getLineLength(u,a),N=R-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),E=z-j;let{newBoxParams:D}=d.getNewBoxByBackUpdate(V,E,N,t);return D},St=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:tt);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Left);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(x(x({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Rt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{width:$,depth:$});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Left);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxSidePolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},_t=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:tt);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Back);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(x(x({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Vt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{height:$,depth:$});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Back);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxBackPolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},kt=(e,n,t,d)=>{if(!t||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,X.Top),d.render();const{toolInstance:p,pointCloudInstance:o}=t,{point2d:f}=o.getSphereTopPoint2DCoordinate(e),u=[...p.pointList].map(a=>a.id===n.id?A(x(x({},n),f),{valid:e.valid,textAttribute:"",attribute:e.attribute}):a);p.setResult(u),p.setSelectedID(n.id)},ct=(e,n,t,d)=>{var p,o;if(!t||!d)return;d.generateBox(e),d.setHighlightColor(e.id),d.render();const{pointCloud2dOperation:f,pointCloudInstance:u}=t,{polygon2d:a}=u.getBoxTopPolygon2DCoordinate(e),h=[...f.polygonList],P=h.find(L=>L.id===n.id);P?(P.pointList=a,P.valid=(p=e.valid)!=null?p:!0):h.push({id:n.id,pointList:a,textAttribute:"",isRect:!0,valid:(o=e.valid)!=null?o:!0}),f.setResultAndSelectedID(h,n.id)},yo=e=>{const n=mt(xt),{topViewInstance:t,sideViewInstance:d,backViewInstance:p,mainViewInstance:o,addPointCloudBox:f,addPointCloudSphere:u,setSelectedIDs:a,selectedIDs:h,pointCloudBoxList:P,pointCloudSphereList:L,hideAttributes:T,setHighlight2DDataList:V,cuboidBoxIn2DView:R,imageSizes:U,history:N,linkageImageNameRectMap:z}=n,{addHistory:j,initHistory:E,pushHistoryUnderUpdatePolygon:D}=go(),{selectedPolygon:Ot}=fo(),{getPointCloudSphereByID:At,updatePointCloudSphere:ut,selectedSphere:Y}=ro(),{currentData:W,config:y}=ao(s=>{const{stepList:i,step:c,imgList:l,imgIndex:g}=s.annotation;return{currentData:l[g],config:rt(uo.getCurrentStepInfo(c,i).config)}}),M=co(),Tt=K(R),Ut=K(z),zt=ht((s,i)=>{const c=Ut.current,l=i.id;return s.filter(r=>{if(!r)return!1;const m=c.get(r.imageName);return m===void 0?!0:Boolean(m.get(l))})},[]),ot=s=>{const{enableAutoMap2DRect:i=!1}=y;if(!Tt.current||i){const{mappingImgList:c=[]}=W;po({pointCloudBox:s,mappingImgList:c,imageSizes:U},{prepareRectsFn:zt})}},{selectedBox:k,updateSelectedBox:Nt,updateSelectedBoxes:et,getPointCloudByID:jt}=so({generateRects:ot}),pt=k==null?void 0:k.info;if(!t||!d||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:nt}=t,Et=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},Mt=({newPoint:s,size:i,zoom:c,trackConfigurable:l})=>{var g;const r={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};l===!0&&Object.assign(r,{trackID:O.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:L})});const m=dt(s,i,nt,void 0,r);a(s.id);const C=u(m);J(b.Top,s,m,c,C,y),j({newSphereParams:m})},Ht=({polygon:s,size:i,imgList:c,trackConfigurable:l,zoom:g,intelligentFit:r})=>{var m,C,S;const _={attribute:(m=t.toolInstance.defaultAttribute)!=null?m:""};l===!0&&Object.assign(_,{trackID:O.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:L})}),t==null||t.toolInstance;const v=x({},s);let{boxParams:I,newPointList:B}=at(v,i,nt,void 0,_,r);I=M(lt({tool:st.PointCloud,dataList:[I],stepConfig:y,action:"viewUpdateBox"}))[0],r&&(B==null?void 0:B.length)&&(v.pointList=B);const G=T.includes(v.attribute);ot(I);const H=f(I),it=(C=n==null?void 0:n.polygonList)!=null?C:[];I.subAttribute=oo.getDefaultResultByConfig((y==null?void 0:y.secondaryAttributeConfigurable)?(S=y==null?void 0:y.inputList)!=null?S:[]:[]),t==null||t.updatePolygonList(H!=null?H:[],it),G?a([]):(a(I.id),r&&ct(I,v,t,o)),j({newBoxParams:I})},Ft=s=>{const{boxID:i,imageName:c,width:l,height:g,x:r,y:m}=s,C=P.find(B=>B.id===i);if(!(C==null?void 0:C.rects)||!C.rects.find(B=>B.imageName===c))return;const _=C.rects.map(B=>B.imageName===c?A(x({},B),{width:l,height:g,x:r,y:m}):B),v=A(x({},C),{rects:_}),I=P.map(B=>B.id===i?v:B);return t==null||t.updatePolygonList(I!=null?I:[]),I},Wt=s=>{const{boxID:i,imageName:c}=s,l=P.find(C=>C.id===i);if(!(l==null?void 0:l.rects))return;const g=l.rects.filter(C=>C.imageName!==c),r=A(x({},l),{rects:g}),m=P.map(C=>C.id===i?r:C);return t==null||t.updatePolygonList(m!=null?m:[]),m},Zt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:c,newSphereList:l})=>{var g;const r=t==null?void 0:t.toolInstance;if(!(h.length===0||!r)){if(s||(k==null?void 0:k.info)){const m=s!=null?s:k==null?void 0:k.info;(g=r==null?void 0:r.selection)==null||g.setSelectedIDs(h[0]);const C=r.selectedPolygon;if(h.length===1&&m){Q({omitView:b.Top,polygon:C,boxParams:m,newPointCloudBoxList:i});return}}if((c||Y)&&h.length===1){const m=c!=null?c:Y;r.setSelectedID(h[0]);const C=r.selectedPoint;m&&J(b.Top,C,m,void 0,l,y)}}},gt=(s,i,c,l=F.Default)=>{if(pt){let g,r;switch(c){case b.Back:g=vo;break;case b.Side:g=Dt;break;default:g=Dt;break}if(r=g(s,i,pt,d.pointCloudInstance),o){const{count:v}=o.getSensesPointZAxisInPolygon(eo(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=A(x({},r),{count:v})}const C=M(lt({tool:st.PointCloud,dataList:[r],stepConfig:y,action:"viewUpdateBox"}))[0],S=r.valid!==C.valid;r=C;const _=Nt(r);return r=_.find(v=>v.id===r.id),Q({omitView:S?void 0:c,polygon:s,boxParams:r,newPointCloudBoxList:_},l),_}},ft=(s,i,c)=>{if(Y){let l,g;switch(c){case b.Back:l=Lo;break;case b.Side:l=wt;break;default:l=wt;break}g=l(s,i,Y);const r=ut(g);return J(c,s,g,void 0,r,y),r}},Gt=(s,i)=>{ft(s,i,b.Side)},Jt=(s,i)=>{ft(s,i,b.Back)},Qt=(s,i)=>{gt(s,i,b.Side,F.Single)},Xt=(s,i)=>{gt(s,i,b.Back,F.Single)},Yt=(s,i)=>{const c=At(s.id),l=dt(s,i,nt,c),g=ut(l);J(b.Top,s,l,void 0,g,y)},qt=(s,i)=>{if(Ot){const l=x({},s[0].newPolygon);l.pointList=l.pointList.map(g=>O.transferCanvas2World(g,i)),D(l);return}let c=s.map(({newPolygon:l})=>{const g=jt(l.id),{boxParams:r}=at(l,i,t.pointCloudInstance,g);return r});if(c=M(lt({tool:st.PointCloud,dataList:c,stepConfig:y,action:"viewUpdateBox"})),c.length===1){const{newPolygon:l}=s[0],g=et(c);Q({polygon:l,boxParams:c[0],newPointCloudBoxList:g},F.Single)}else{const l=et(c);l&&n.syncAllViewPointCloudColor(F.MultiMove,l)}},Kt=s=>{var i,c,l,g,r;if(k){const m=Number(s.widthDefault),C=Number(s.depthDefault),S=Number(s.heightDefault),_=k==null?void 0:k.info.trackID,I=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(q=>(q==null?void 0:q.trackID)===_),B={width:(l=(c=t==null?void 0:t.toolInstance)==null?void 0:c.basicImgInfo)==null?void 0:l.width,height:(r=(g=t==null?void 0:t.toolInstance)==null?void 0:g.basicImgInfo)==null?void 0:r.height},Z=I.pointList.map(q=>O.transferCanvas2World(q,B)),G=w.getModifiedRectangleCoordinates(Z,S,m),H=G[0],it=G[2],Ct=w.getLineCenterPoint([H,it]),$t=k.info.center.z-k.info.depth/2,Pt=A(x({},k.info),{center:{x:Ct.x,y:Ct.y,z:$t+C/2},width:m,height:S,depth:C,valid:!0}),to=et([Pt]);Q({omitView:b["3D"],polygon:I,boxParams:Pt,newPointCloudBoxList:to})}},J=(s,i,c,l,g,r)=>bt(void 0,null,function*(){const m=W==null?void 0:W.url,C={[b.Side]:()=>{St(c,i,d,m,r)},[b.Back]:()=>{p&&_t(c,i,p,m,r)},[b.Top]:()=>{kt(c,i,t,o)}};Object.keys(C).forEach(S=>{S!==s&&C[S]()}),l&&(o==null||o.updateCameraZoom(l)),Et(c)}),Q=(s,i=F.Default)=>{const{omitView:c,polygon:l,boxParams:g,zoom:r,newPointCloudBoxList:m}=s,C=W==null?void 0:W.url;m&&n.syncAllViewPointCloudColor(i,m);const S={[b.Side]:()=>{Rt(g,l,d,C)},[b.Back]:()=>{p&&Vt(g,l,p,C)},[b.Top]:()=>{ct(g,l,t,o)}};Object.keys(S).forEach(_=>{_!==c&&S[_]()}),r&&(o==null||o.updateCameraZoom(r))};return{topViewAddSphere:Mt,topViewAddBox:Ht,topViewSelectedChanged:Zt,topViewUpdatePoint:Yt,sideViewUpdatePoint:Gt,backViewUpdatePoint:Jt,topViewUpdateBox:qt,sideViewUpdateBox:Qt,backViewUpdateBox:Xt,syncPointCloudViews:Q,syncPointCloudPoint:J,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=O.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>bt(void 0,[...s],function*(i=W){var c,l,g,r,m,C,S,_;if(!(i==null?void 0:i.url)||!o)return;V([]),Lt(M,!0),vt(M,!0),(c=e==null?void 0:e.setResourceLoading)==null||c.call(e,!0),yield o.loadPCDFile(i.url,(l=y==null?void 0:y.radius)!=null?l:tt),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let v=[],I=[],B=[],Z=[];o.updateTopCamera();const G=(r=(g=rt(i.result))==null?void 0:g.valid)!=null?r:!0;if(n.setPointCloudValid(G),(m=n.sideViewInstance)==null||m.clearAllData(),(C=n.backViewInstance)==null||C.clearAllData(),i.result){if(v=O.getBoxParamsFromResultList(i.result),(v==null?void 0:v.length)>0&&i.isPreResult&&(y==null?void 0:y.lowerLimitPointsNumInBox)>0){v=yield o==null?void 0:o.filterPreResult(i.url,y,v);const H=rt(i.result);H[no].result=v,i.result=JSON.stringify(H),n.setPointCloudResult(v)}B=O.getPolygonListFromResultList(i.result),I=O.getLineListFromResultList(i.result),Z=O.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(S=y==null?void 0:y.radius)!=null?S:tt}),o==null||o.generateBoxes(v),o==null||o.generateSpheres(Z),yield n.syncAllViewPointCloudColor(F.Default,v,[])}E({pointCloudBoxList:v,polygonList:B,lineList:I,pointCloudSphereList:Z}),Lt(M,!1),vt(M,!1),(_=e==null?void 0:e.setResourceLoading)==null||_.call(e,!1)}),updateViewsByDefaultSize:Kt,generateRects:ot,update2DViewRect:Ft,remove2DViewRect:Wt}},Bo=()=>{const{pointCloudBoxList:e,rectList:n,setPointCloudResult:t}=mt(xt),d=K(e),p=K(n);return{syncToPointCloudBoxList:ht(()=>{const f=d.current,u=p.current;if(u.length===0)return null;const a=new Map,h=new Set;if(u.filter(P=>P.extId!==void 0).forEach(P=>{const L=P.extId,T=P.imageName,V=lo(P,["x","y","width","height"]);let R=a.get(L);R||(R=new Map,a.set(L,R)),R.set(T,V),h.add(L)}),a.size){const P=f.map(L=>{var T;const V=L.id;if(h.has(V)){const R=x({},L);return(T=R.rects)==null||T.forEach(U=>{var N;const z=U.imageName;Object.assign(U,(N=a.get(V))==null?void 0:N.get(z))}),R}return L});return t(P),P}return null},[])}};export{_t as syncBackViewByPoint,St as syncSideViewByPoint,kt as syncTopViewByPoint,Vt as synchronizeBackView,Rt as synchronizeSideView,ct as synchronizeTopView,dt as topViewPoint2PointCloud,at as topViewPolygon2PointCloud,yo as usePointCloudViews,Bo as useSyncRectPositionDimensionToPointCloudList};
1
+ import{EPointCloudName as st,TagUtils as oo,MathUtils as w,getCuboidFromPointCloudBox as eo}from"@labelbee/lb-annotation";import{EPerspectiveView as X,PointCloudUtils as O,POINT_CLOUD_DEFAULT_STEP as no,DEFAULT_SPHERE_PARAMS as io}from"@labelbee/lb-utils";import{useContext as mt,useCallback as ht}from"react";import{PointCloudContext as xt}from"../PointCloudContext.js";import{useSingleBox as so}from"./useSingleBox.js";import{useSphere as ro}from"./useSphere.js";import{pick as lo}from"lodash";import{useSelector as ao,useDispatch as co}from"../../../store/ctx.js";import uo from"../../../utils/StepUtils.js";import{EPointCloudBoxRenderTrigger as F}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{jsonParser as rt,generatePointCloudBoxRects as po}from"../../../utils/index.js";import{PreDataProcess as lt,SetAnnotationLoading as Lt,SetLoadPCDFileLoading as vt}from"../../../store/annotation/actionCreators.js";import{useHistory as go}from"./useHistory.js";import{usePolygon as fo}from"./usePolygon.js";import{useLatest as K}from"ahooks";var Co=Object.defineProperty,Po=Object.defineProperties,mo=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,ho=Object.prototype.hasOwnProperty,xo=Object.prototype.propertyIsEnumerable,Bt=(e,n,t)=>n in e?Co(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,x=(e,n)=>{for(var t in n||(n={}))ho.call(n,t)&&Bt(e,t,n[t]);if(yt)for(var t of yt(n))xo.call(n,t)&&Bt(e,t,n[t]);return e},A=(e,n)=>Po(e,mo(n)),bt=(e,n,t)=>new Promise((d,p)=>{var o=a=>{try{u(t.next(a))}catch(h){p(h)}},f=a=>{try{u(t.throw(a))}catch(h){p(h)}},u=a=>a.done?d(a.value):Promise.resolve(a.value).then(o,f);u((t=t.apply(e,n)).next())});const $=5,tt=90,It=.01,b={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},dt=(e,n,t,d,p)=>{const{x:o,y:f}=O.transferCanvas2World(e,n),{defaultZ:u}=io,a={center:{x:o,y:f,z:u},id:e.id},h=d?x(x({},d),a):A(x({},a),{attribute:"",valid:!0});return p&&Object.assign(h,p),h},at=(e,n,t,d,p,o)=>{let f=e.pointList.map(D=>O.transferCanvas2World(D,n)),u=0,a=1,h={};if(t){const D=t.getSensesPointZAxisInPolygon(f,void 0,o);o&&D.fittedCoordinates.length>0&&(f=D.fittedCoordinates),u=(D.maxZ+D.minZ)/2,a=D.maxZ-D.minZ,h={count:D.zCount}}const[P,L,T]=f,V=w.getLineCenterPoint([P,T]),R=w.getLineLength(P,L),U=w.getLineLength(L,T),N=w.getRadiusFromQuadrangle(e.pointList);d&&(u=d.center.z,a=d.depth);const z={center:{x:V.x,y:V.y,z:u},width:o?U+It:U,height:o?R+It:R,depth:a,rotation:N,id:e.id},j=x(d?x(x({},d),z):A(x({},z),{attribute:"",valid:!0}),h);p&&Object.assign(j,p);const E=f.map(D=>O.transferWorld2Canvas(D,n));return{boxParams:j,newPointList:E}},wt=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(x({},t),{center:{x:t.center.x-d.x,y:t.center.y,z:t.center.z-d.y}})},Dt=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),L=w.getLineCenterPoint([u,h]),V={x:{x:P.x-L.x,y:P.y-L.y}.x,y:0,z:P.y-L.y},R=w.getLineLength(p,o),U=w.getLineLength(u,a),N=R-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),E=z-j,{newBoxParams:D}=d.getNewBoxBySideUpdate(V,E,N,t);return D},Lo=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(x({},t),{center:{x:t.center.x,y:t.center.y-d.x,z:t.center.z-d.y}})},vo=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),L=w.getLineCenterPoint([u,h]),V={x:{x:P.x-L.x,y:P.y-L.y}.x,y:0,z:P.y-L.y},R=w.getLineLength(p,o),U=w.getLineLength(u,a),N=R-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),E=z-j;let{newBoxParams:D}=d.getNewBoxByBackUpdate(V,E,N,t);return D},St=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:tt);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Left);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(x(x({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Rt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{width:$,depth:$});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Left);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxSidePolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},_t=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:tt);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Back);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(x(x({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Vt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{height:$,depth:$});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Back);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxBackPolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},kt=(e,n,t,d)=>{if(!t||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,X.Top),d.render();const{toolInstance:p,pointCloudInstance:o}=t,{point2d:f}=o.getSphereTopPoint2DCoordinate(e),u=[...p.pointList].map(a=>a.id===n.id?A(x(x({},n),f),{valid:e.valid,textAttribute:"",attribute:e.attribute}):a);p.setResult(u),p.setSelectedID(n.id)},ct=(e,n,t,d)=>{var p,o;if(!t||!d)return;d.generateBox(e),d.setHighlightColor(e.id),d.render();const{pointCloud2dOperation:f,pointCloudInstance:u}=t,{polygon2d:a}=u.getBoxTopPolygon2DCoordinate(e),h=[...f.polygonList],P=h.find(L=>L.id===n.id);P?(P.pointList=a,P.valid=(p=e.valid)!=null?p:!0):h.push({id:n.id,pointList:a,textAttribute:"",isRect:!0,valid:(o=e.valid)!=null?o:!0}),f.setResultAndSelectedID(h,n.id)},yo=e=>{const n=mt(xt),{topViewInstance:t,sideViewInstance:d,backViewInstance:p,mainViewInstance:o,addPointCloudBox:f,addPointCloudSphere:u,setSelectedIDs:a,selectedIDs:h,pointCloudBoxList:P,pointCloudSphereList:L,hideAttributes:T,setHighlight2DDataList:V,cuboidBoxIn2DView:R,imageSizes:U,history:N,linkageImageNameRectMap:z}=n,{addHistory:j,initHistory:E,pushHistoryUnderUpdatePolygon:D}=go(),{selectedPolygon:Ot}=fo(),{getPointCloudSphereByID:At,updatePointCloudSphere:ut,selectedSphere:Y}=ro(),{currentData:W,config:y}=ao(s=>{const{stepList:i,step:c,imgList:l,imgIndex:g}=s.annotation;return{currentData:l[g],config:rt(uo.getCurrentStepInfo(c,i).config)}}),M=co(),Tt=K(R),Ut=K(z),zt=ht((s,i)=>{const c=Ut.current,l=i.id;return s.filter(r=>{if(!r)return!1;const m=c.get(r.imageName);return m===void 0?!0:Boolean(m.get(l))})},[]),ot=s=>{const{enableAutoMap2DRect:i=!1}=y;if(!Tt.current||i){const{mappingImgList:c=[]}=W;po({pointCloudBox:s,mappingImgList:c,imageSizes:U},{prepareRectsFn:zt})}},{selectedBox:k,updateSelectedBox:Nt,updateSelectedBoxes:et,getPointCloudByID:jt}=so({generateRects:ot}),pt=k==null?void 0:k.info;if(!t||!d||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:nt}=t,Et=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},Mt=({newPoint:s,size:i,zoom:c,trackConfigurable:l})=>{var g;const r={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};l===!0&&Object.assign(r,{trackID:O.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:L})});const m=dt(s,i,nt,void 0,r);a(s.id);const C=u(m);J(b.Top,s,m,c,C,y),j({newSphereParams:m})},Ht=({polygon:s,size:i,imgList:c,trackConfigurable:l,zoom:g,intelligentFit:r})=>{var m,C,S;const _={attribute:(m=t.toolInstance.defaultAttribute)!=null?m:""};l===!0&&Object.assign(_,{trackID:O.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:L})}),t==null||t.toolInstance;const v=x({},s);let{boxParams:I,newPointList:B}=at(v,i,nt,void 0,_,r);I=M(lt({tool:st.PointCloud,dataList:[I],stepConfig:y,action:"viewUpdateBox"}))[0],r&&(B==null?void 0:B.length)&&(v.pointList=B);const G=T.includes(v.attribute);ot(I);const H=f(I),it=(C=n==null?void 0:n.polygonList)!=null?C:[];I.subAttribute=oo.getDefaultResultByConfig((y==null?void 0:y.secondaryAttributeConfigurable)?(S=y==null?void 0:y.inputList)!=null?S:[]:[]),t==null||t.updatePolygonList(H!=null?H:[],it,!1),G?a([]):(a(I.id),r&&ct(I,v,t,o)),j({newBoxParams:I})},Ft=s=>{const{boxID:i,imageName:c,width:l,height:g,x:r,y:m}=s,C=P.find(B=>B.id===i);if(!(C==null?void 0:C.rects)||!C.rects.find(B=>B.imageName===c))return;const _=C.rects.map(B=>B.imageName===c?A(x({},B),{width:l,height:g,x:r,y:m}):B),v=A(x({},C),{rects:_}),I=P.map(B=>B.id===i?v:B);return t==null||t.updatePolygonList(I!=null?I:[]),I},Wt=s=>{const{boxID:i,imageName:c}=s,l=P.find(C=>C.id===i);if(!(l==null?void 0:l.rects))return;const g=l.rects.filter(C=>C.imageName!==c),r=A(x({},l),{rects:g}),m=P.map(C=>C.id===i?r:C);return t==null||t.updatePolygonList(m!=null?m:[]),m},Zt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:c,newSphereList:l})=>{var g;const r=t==null?void 0:t.toolInstance;if(!(h.length===0||!r)){if(s||(k==null?void 0:k.info)){const m=s!=null?s:k==null?void 0:k.info;(g=r==null?void 0:r.selection)==null||g.setSelectedIDs(h[0]);const C=r.selectedPolygon;if(h.length===1&&m){Q({omitView:b.Top,polygon:C,boxParams:m,newPointCloudBoxList:i});return}}if((c||Y)&&h.length===1){const m=c!=null?c:Y;r.setSelectedID(h[0]);const C=r.selectedPoint;m&&J(b.Top,C,m,void 0,l,y)}}},gt=(s,i,c,l=F.Default)=>{if(pt){let g,r;switch(c){case b.Back:g=vo;break;case b.Side:g=Dt;break;default:g=Dt;break}if(r=g(s,i,pt,d.pointCloudInstance),o){const{count:v}=o.getSensesPointZAxisInPolygon(eo(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=A(x({},r),{count:v})}const C=M(lt({tool:st.PointCloud,dataList:[r],stepConfig:y,action:"viewUpdateBox"}))[0],S=r.valid!==C.valid;r=C;const _=Nt(r);return r=_.find(v=>v.id===r.id),Q({omitView:S?void 0:c,polygon:s,boxParams:r,newPointCloudBoxList:_},l),_}},ft=(s,i,c)=>{if(Y){let l,g;switch(c){case b.Back:l=Lo;break;case b.Side:l=wt;break;default:l=wt;break}g=l(s,i,Y);const r=ut(g);return J(c,s,g,void 0,r,y),r}},Gt=(s,i)=>{ft(s,i,b.Side)},Jt=(s,i)=>{ft(s,i,b.Back)},Qt=(s,i)=>{gt(s,i,b.Side,F.Single)},Xt=(s,i)=>{gt(s,i,b.Back,F.Single)},Yt=(s,i)=>{const c=At(s.id),l=dt(s,i,nt,c),g=ut(l);J(b.Top,s,l,void 0,g,y)},qt=(s,i)=>{if(Ot){const l=x({},s[0].newPolygon);l.pointList=l.pointList.map(g=>O.transferCanvas2World(g,i)),D(l);return}let c=s.map(({newPolygon:l})=>{const g=jt(l.id),{boxParams:r}=at(l,i,t.pointCloudInstance,g);return r});if(c=M(lt({tool:st.PointCloud,dataList:c,stepConfig:y,action:"viewUpdateBox"})),c.length===1){const{newPolygon:l}=s[0],g=et(c);Q({polygon:l,boxParams:c[0],newPointCloudBoxList:g},F.Single)}else{const l=et(c);l&&n.syncAllViewPointCloudColor(F.MultiMove,l)}},Kt=s=>{var i,c,l,g,r;if(k){const m=Number(s.widthDefault),C=Number(s.depthDefault),S=Number(s.heightDefault),_=k==null?void 0:k.info.trackID,I=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(q=>(q==null?void 0:q.trackID)===_),B={width:(l=(c=t==null?void 0:t.toolInstance)==null?void 0:c.basicImgInfo)==null?void 0:l.width,height:(r=(g=t==null?void 0:t.toolInstance)==null?void 0:g.basicImgInfo)==null?void 0:r.height},Z=I.pointList.map(q=>O.transferCanvas2World(q,B)),G=w.getModifiedRectangleCoordinates(Z,S,m),H=G[0],it=G[2],Ct=w.getLineCenterPoint([H,it]),$t=k.info.center.z-k.info.depth/2,Pt=A(x({},k.info),{center:{x:Ct.x,y:Ct.y,z:$t+C/2},width:m,height:S,depth:C,valid:!0}),to=et([Pt]);Q({omitView:b["3D"],polygon:I,boxParams:Pt,newPointCloudBoxList:to})}},J=(s,i,c,l,g,r)=>bt(void 0,null,function*(){const m=W==null?void 0:W.url,C={[b.Side]:()=>{St(c,i,d,m,r)},[b.Back]:()=>{p&&_t(c,i,p,m,r)},[b.Top]:()=>{kt(c,i,t,o)}};Object.keys(C).forEach(S=>{S!==s&&C[S]()}),l&&(o==null||o.updateCameraZoom(l)),Et(c)}),Q=(s,i=F.Default)=>{const{omitView:c,polygon:l,boxParams:g,zoom:r,newPointCloudBoxList:m}=s,C=W==null?void 0:W.url;m&&n.syncAllViewPointCloudColor(i,m);const S={[b.Side]:()=>{Rt(g,l,d,C)},[b.Back]:()=>{p&&Vt(g,l,p,C)},[b.Top]:()=>{ct(g,l,t,o)}};Object.keys(S).forEach(_=>{_!==c&&S[_]()}),r&&(o==null||o.updateCameraZoom(r))};return{topViewAddSphere:Mt,topViewAddBox:Ht,topViewSelectedChanged:Zt,topViewUpdatePoint:Yt,sideViewUpdatePoint:Gt,backViewUpdatePoint:Jt,topViewUpdateBox:qt,sideViewUpdateBox:Qt,backViewUpdateBox:Xt,syncPointCloudViews:Q,syncPointCloudPoint:J,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=O.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>bt(void 0,[...s],function*(i=W){var c,l,g,r,m,C,S,_;if(!(i==null?void 0:i.url)||!o)return;V([]),Lt(M,!0),vt(M,!0),(c=e==null?void 0:e.setResourceLoading)==null||c.call(e,!0),yield o.loadPCDFile(i.url,(l=y==null?void 0:y.radius)!=null?l:tt),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let v=[],I=[],B=[],Z=[];o.updateTopCamera();const G=(r=(g=rt(i.result))==null?void 0:g.valid)!=null?r:!0;if(n.setPointCloudValid(G),(m=n.sideViewInstance)==null||m.clearAllData(),(C=n.backViewInstance)==null||C.clearAllData(),i.result){if(v=O.getBoxParamsFromResultList(i.result),(v==null?void 0:v.length)>0&&i.isPreResult&&(y==null?void 0:y.lowerLimitPointsNumInBox)>0){v=yield o==null?void 0:o.filterPreResult(i.url,y,v);const H=rt(i.result);H[no].result=v,i.result=JSON.stringify(H),n.setPointCloudResult(v)}B=O.getPolygonListFromResultList(i.result),I=O.getLineListFromResultList(i.result),Z=O.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(S=y==null?void 0:y.radius)!=null?S:tt}),o==null||o.generateBoxes(v),o==null||o.generateSpheres(Z),yield n.syncAllViewPointCloudColor(F.Default,v,[])}E({pointCloudBoxList:v,polygonList:B,lineList:I,pointCloudSphereList:Z}),Lt(M,!1),vt(M,!1),(_=e==null?void 0:e.setResourceLoading)==null||_.call(e,!1)}),updateViewsByDefaultSize:Kt,generateRects:ot,update2DViewRect:Ft,remove2DViewRect:Wt}},Bo=()=>{const{pointCloudBoxList:e,rectList:n,setPointCloudResult:t}=mt(xt),d=K(e),p=K(n);return{syncToPointCloudBoxList:ht(()=>{const f=d.current,u=p.current;if(u.length===0)return null;const a=new Map,h=new Set;if(u.filter(P=>P.extId!==void 0).forEach(P=>{const L=P.extId,T=P.imageName,V=lo(P,["x","y","width","height"]);let R=a.get(L);R||(R=new Map,a.set(L,R)),R.set(T,V),h.add(L)}),a.size){const P=f.map(L=>{var T;const V=L.id;if(h.has(V)){const R=x({},L);return(T=R.rects)==null||T.forEach(U=>{var N;const z=U.imageName;Object.assign(U,(N=a.get(V))==null?void 0:N.get(z))}),R}return L});return t(P),P}return null},[])}};export{_t as syncBackViewByPoint,St as syncSideViewByPoint,kt as syncTopViewByPoint,Vt as synchronizeBackView,Rt as synchronizeSideView,ct as synchronizeTopView,dt as topViewPoint2PointCloud,at as topViewPolygon2PointCloud,yo as usePointCloudViews,Bo as useSyncRectPositionDimensionToPointCloudList};
@@ -1 +1 @@
1
- import{getClassName as i}from"../../utils/dom.js";import t,{useContext as G,useRef as w,useState as b,useEffect as f}from"react";import K from"./PointCloud3DView.js";import O from"./PointCloudBackView.js";import Z from"./PointCloudTopView.js";import U from"./PointCloudSideView.js";import $ from"./PointCloud2DView.js";import q from"./PointCloudListener.js";import J from"./PointCloudSegmentListener.js";import Q from"./PointCloudSegment.js";import X from"./PointCloudSegmentStatus.js";import Y from"./PointCloudSegmentToolbar.js";import tt from"./PointCloudSegment2DView.js";import{connect as et}from"react-redux";import{LabelBeeContext as ot,useDispatch as nt}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as it,AnnotatedAttributesPanelFixedRight as lt}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as rt}from"./PointCloudContext.js";import{PointCloudUtils as st,EPointCloudPattern as at}from"@labelbee/lb-utils";import{useCustomToolInstance as mt}from"../../hooks/annotation.js";import{jsonParser as ut}from"../../utils/index.js";import{a2MapStateToProps as ct}from"../../store/annotation/map.js";import V from"classnames";import dt from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as pt}from"../../store/annotation/actionCreators.js";import j from"../DynamicResizer/DynamicResizer.js";const ft=x=>{const{currentData:m,imgList:D,drawLayerSlot:g,checkMode:l,intelligentFit:y,imgIndex:I,config:R,measureVisible:A,setResourceLoading:L,stepInfo:o}=x,e=G(rt),{globalPattern:C,setGlobalPattern:k,selectedIDs:E,isLargeStatus:u,setIsLargeStatus:T}=e,N=nt(),P=w(null),h=w(null),[_,B]=b(0),[r,v]=b(!1),F=(E==null?void 0:E.length)>0&&r,H=ut(m.result),{toolInstanceRef:a,clearToolInstance:M}=mt({basicInfo:H});if(f(()=>{a.current.setPointCloudGlobalPattern=n=>{n!==C&&(k(n),e.clearAllDetectionInstance(),M())}},[C]),f(()=>{var n;if(pt(N,!0),m){const{boxParamsList:s,polygonList:c,lineList:d,sphereParamsList:p,segmentation:z,rectList:W}=st.parsePointCloudCurrentResult((n=m==null?void 0:m.result)!=null?n:"");e.setPointCloudResult(s),e.setPolygonList(c),e.setLineList(d),e.setPointCloudSphereList(p),e.setRectList(W),e.setSegmentation(z)}},[I]),f(()=>{var n;if(P.current){const s=((n=P.current)==null?void 0:n.offsetHeight)-233;B(s)}},[h.current]),f(()=>{a.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],a.current.exportCustomData=()=>{var n,s,c,d,p;return{resultPolygon:(n=e.polygonList)!=null?n:[],resultLine:(s=e.lineList)!=null?s:[],resultPoint:(c=e.pointCloudSphereList)!=null?c:[],resultRect:(d=e.rectList)!=null?d:[],segmentation:(p=e.segmentation)!=null?p:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),D.length===0)return null;if(C===at.Segmentation)return t.createElement(t.Fragment,null,t.createElement(J,{checkMode:l,toolInstanceRef:a}),t.createElement(Y,null),t.createElement("div",{className:i("point-cloud-layout")},t.createElement(Q,{checkMode:l}),t.createElement(tt,null)),t.createElement(X,{config:R}),g==null?void 0:g({direct:!0}));let S=t.createElement("div",{className:i("point-cloud-container","left-bottom")},t.createElement(O,{checkMode:l}),t.createElement(U,{checkMode:l}));return r&&(S=t.createElement(dt,{selectAndEnlarge:F,checkMode:l})),t.createElement(t.Fragment,null,t.createElement(q,{checkMode:l,toolInstanceRef:a,setResourceLoading:L}),t.createElement("div",{className:i("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},t.createElement("div",{className:i("point-cloud-wrapper")},t.createElement(it,null),t.createElement("div",{className:i("point-cloud-content"),ref:h},t.createElement(j,{direction:"horizontal",localKey:"leftAllViewid:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type),defaultWidth:360,minLeftWidth:244,minRightWidth:"50%",disabled:u},t.createElement("div",{className:i("point-cloud-container",u?"left-large":"left-noLarge")},t.createElement(K,{setResourceLoading:L}),S),t.createElement("div",{className:V({[i("point-cloud-container","right")]:!0,[i("point-cloud-container","rightZoom")]:r}),ref:P},t.createElement(j,{localKey:"rightAllViewid:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type),defaultHeight:300,minTopHeight:_,minBottomHeight:160,disabled:u},t.createElement(Z,{drawLayerSlot:g,checkMode:l,intelligentFit:y,setIsEnlargeTopView:v,onExitZoom:()=>{T(!1),v(!1)},isEnlargeTopView:r}),t.createElement("div",{className:V({[i("point-cloud-container",u?"right-bottom-large":"right-bottom-noLarge")]:!r,[i("point-cloud-container","right-bottom-floatLeft")]:r})},t.createElement($,{isEnlargeTopView:r,thumbnailWidth:r?300:455,checkMode:l,measureVisible:A})))))),t.createElement(lt,null))))};var gt=et(ct,null,null,{context:ot})(ft);export{gt as default};
1
+ import{getClassName as i}from"../../utils/dom.js";import e,{useContext as K,useRef as b,useState as w,useEffect as f}from"react";import O from"./PointCloud3DView.js";import Z from"./PointCloudBackView.js";import Q from"./PointCloudTopView.js";import U from"./PointCloudSideView.js";import $ from"./PointCloud2DView.js";import q from"./PointCloudListener.js";import J from"./PointCloudSegmentListener.js";import X from"./PointCloudSegment.js";import Y from"./PointCloudSegmentStatus.js";import tt from"./PointCloudSegmentToolbar.js";import et from"./PointCloudSegment2DView.js";import{connect as ot}from"react-redux";import{LabelBeeContext as nt,useDispatch as it}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as lt,AnnotatedAttributesPanelFixedRight as rt}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as at}from"./PointCloudContext.js";import{PointCloudUtils as st,EPointCloudPattern as ut}from"@labelbee/lb-utils";import{useCustomToolInstance as mt}from"../../hooks/annotation.js";import{jsonParser as dt}from"../../utils/index.js";import{a2MapStateToProps as ct}from"../../store/annotation/map.js";import j from"classnames";import pt from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as ft}from"../../store/annotation/actionCreators.js";import x from"../DynamicResizer/DynamicResizer.js";const gt=D=>{const{currentData:u,imgList:y,drawLayerSlot:g,checkMode:l,intelligentFit:I,imgIndex:R,config:A,measureVisible:B,setResourceLoading:L,stepInfo:o,setBatchSetValid:C}=D,t=K(at),{globalPattern:P,setGlobalPattern:k,selectedIDs:h,isLargeStatus:m,setIsLargeStatus:T}=t,N=it(),v=b(null),S=b(null),[_,M]=w(0),[r,E]=w(!1),F=(h==null?void 0:h.length)>0&&r,H=dt(u.result),{toolInstanceRef:s,clearToolInstance:z}=mt({basicInfo:H});if(f(()=>{s.current.setPointCloudGlobalPattern=n=>{n!==P&&(k(n),t.clearAllDetectionInstance(),z())}},[P]),f(()=>{var n;if(ft(N,!0),u){const{boxParamsList:a,polygonList:d,lineList:c,sphereParamsList:p,segmentation:W,rectList:G}=st.parsePointCloudCurrentResult((n=u==null?void 0:u.result)!=null?n:"");t.setPointCloudResult(a),t.setPolygonList(d),t.setLineList(c),t.setPointCloudSphereList(p),t.setRectList(G),t.setSegmentation(W)}},[R]),f(()=>{var n;if(v.current){const a=((n=v.current)==null?void 0:n.offsetHeight)-233;M(a)}},[S.current]),f(()=>{s.current.exportData=()=>[t.pointCloudBoxList,{valid:t.valid}],s.current.exportCustomData=()=>{var n,a,d,c,p;return{resultPolygon:(n=t.polygonList)!=null?n:[],resultLine:(a=t.lineList)!=null?a:[],resultPoint:(d=t.pointCloudSphereList)!=null?d:[],resultRect:(c=t.rectList)!=null?c:[],segmentation:(p=t.segmentation)!=null?p:[]}}},[t.pointCloudBoxList,t.rectList,t.valid,t.polygonList,t.lineList,t.pointCloudSphereList,t.ptSegmentInstance,t.segmentation]),y.length===0)return null;if(P===ut.Segmentation)return e.createElement(e.Fragment,null,e.createElement(J,{checkMode:l,toolInstanceRef:s}),e.createElement(tt,null),e.createElement("div",{className:i("point-cloud-layout")},e.createElement(X,{checkMode:l}),e.createElement(et,null)),e.createElement(Y,{config:A}),g==null?void 0:g({direct:!0}));let V=e.createElement("div",{className:i("point-cloud-container","left-bottom")},e.createElement(Z,{checkMode:l}),e.createElement(U,{checkMode:l}));return r&&(V=e.createElement(pt,{selectAndEnlarge:F,checkMode:l})),e.createElement(e.Fragment,null,e.createElement(q,{checkMode:l,toolInstanceRef:s,setResourceLoading:L,isBatchSetValid:!!C}),e.createElement("div",{className:i("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},e.createElement("div",{className:i("point-cloud-wrapper")},e.createElement(lt,null),e.createElement("div",{className:i("point-cloud-content"),ref:S},e.createElement(x,{direction:"horizontal",localKey:"leftAllViewid:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type),defaultWidth:360,minLeftWidth:244,minRightWidth:"50%",disabled:m},e.createElement("div",{className:i("point-cloud-container",m?"left-large":"left-noLarge")},e.createElement(O,{setResourceLoading:L}),V),e.createElement("div",{className:j({[i("point-cloud-container","right")]:!0,[i("point-cloud-container","rightZoom")]:r}),ref:v},e.createElement(x,{localKey:"rightAllViewid:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type),defaultHeight:300,minTopHeight:_,minBottomHeight:160,disabled:m},e.createElement(Q,{drawLayerSlot:g,checkMode:l,intelligentFit:I,setIsEnlargeTopView:E,onExitZoom:()=>{T(!1),E(!1)},isEnlargeTopView:r}),e.createElement("div",{className:j({[i("point-cloud-container",m?"right-bottom-large":"right-bottom-noLarge")]:!r,[i("point-cloud-container","right-bottom-floatLeft")]:r})},e.createElement($,{isEnlargeTopView:r,thumbnailWidth:r?300:455,checkMode:l,measureVisible:B})))))),e.createElement(rt,null))),t.visibleBatchSetValid&&(C==null?void 0:C({valid:t.valid,isModal:!0,visibleModal:t.visibleBatchSetValid,onClose:()=>t.setBatchSetValidModal(!1),singleSetQuestionImg:()=>t.setPointCloudValid(!t.valid)})))};var Ct=ot(ct,null,null,{context:nt})(gt);export{Ct as default};
@@ -1 +1 @@
1
- import{ViewportProvider as b}from"../../components/customResizeHook/index.js";import{prefix as C}from"../../constant/index.js";import{Spin as A}from"antd";import{Layout as E}from"antd/es";import t,{useState as O}from"react";import V from"./annotationOperation/index.js";import W from"./annotationTips/index.js";import k from"./sidebar/index.js";import g from"./toolFooter/index.js";import F from"./toolHeader/index.js";import{getStepConfig as _}from"../../store/annotation/reducer.js";import I from"../../components/videoAnnotate/index.js";import{connect as R}from"react-redux";import h from"../../utils/ToolUtils.js";import B from"../../components/pointCloudView/index.js";import{getClassName as $}from"../../utils/dom.js";import{classnames as H}from"../../utils/index.js";import D from"../../components/predictTracking/previewResult/index.js";import{LabelBeeContext as U}from"../../store/ctx.js";import{EToolName as m}from"../../data/enums/ToolType.js";import z from"./LLMLayout/index.js";import q from"./NLPLayout/index.js";import G from"../../components/audioAnnotate/index.js";import{LoadingOutlined as J}from"@ant-design/icons";import{useTranslation as K}from"react-i18next";import{EPointCloudName as Q}from"@labelbee/lb-annotation";import X from"./LLMMultiWheelLayout/index.js";var Y=Object.defineProperty,T=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,P=(e,o,n)=>o in e?Y(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,l=(e,o)=>{for(var n in o||(o={}))Z.call(o,n)&&P(e,n,o[n]);if(T)for(var n of T(o))p.call(o,n)&&P(e,n,o[n]);return e};const{Sider:ee,Content:te}=E,L=`${C}-layout`,oe=e=>{var o;return t.createElement(t.Fragment,null,e.showTips===!0&&t.createElement(W,{path:e.path,tips:e.tips}),t.createElement(V,l({},e)),t.createElement(g,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},ne=e=>{var o;return t.createElement(t.Fragment,null,t.createElement(B,{drawLayerSlot:e.drawLayerSlot,checkMode:e.checkMode,intelligentFit:e.intelligentFit,measureVisible:e.measureVisible,setResourceLoading:e.setResourceLoading}),t.createElement(g,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},le=e=>{var o;const{stepList:n,step:r}=e,a=(o=_(n,r))==null?void 0:o.tool,d=h.isPointCloudTool(a),i=h.isVideoTool(a);return d?t.createElement(ne,l({},e)):i?t.createElement(I,{drawLayerSlot:e.drawLayerSlot,footer:e.footer,annotationBefore:e==null?void 0:e.annotationBefore}):t.createElement(oe,l({},e))},s=e=>{var o,n,r;const{t:a}=K(),{stepList:d,step:i}=e,c=(o=_(d,i))==null?void 0:o.tool,u=![m.LLM,m.NLP,m.LLMMultiWheel].includes(c),v=![m.LLM,m.NLP,m.LLMMultiWheel].includes(c),y=[Q.PointCloud].includes(c);return t.createElement(b,null,t.createElement(A,{spinning:e.loading,indicator:t.createElement(J,null),tip:t.createElement("span",{style:{marginTop:200}},a("LoadingTips")),delay:500},t.createElement(E,{className:H([L,e.className]),style:(n=e.style)==null?void 0:n.layout},t.createElement("header",{className:`${L}__header`,style:(r=e.style)==null?void 0:r.header},t.createElement(F,{header:e==null?void 0:e.header,headerName:e.headerName,goBack:e.goBack,exportData:e.exportData,hasLangNode:u,hasHeaderOption:v,hasPredictTrackingIcon:y})),e.children)))},ie=e=>{var o,n,r,a,d,i,c;const[u,v]=O(void 0),y=(n=(o=e.style)==null?void 0:o.sider)==null?void 0:n.width,{stepList:x,step:j}=e,f=(r=_(x,j))==null?void 0:r.tool,M=m.LLM===f,N=m.NLP===f,w=m.LLMMultiWheel===f,S=h.isAudioTool(f);return w?t.createElement(s,l({},e),t.createElement(X,l({},e))):M?t.createElement(s,l({},e),t.createElement(z,l({},e))):N?t.createElement(s,l({},e),t.createElement(q,l({},e))):S?t.createElement(s,l({},e),t.createElement(G,l({},e))):t.createElement(s,l({},e),t.createElement(E,{className:$("layout","container")},e==null?void 0:e.leftSider,t.createElement(te,{className:`${L}__content`},t.createElement(le,l({},e)),t.createElement(D,null)),t.createElement(ee,{className:`${L}__side`,width:(a=u!=null?u:y)!=null?a:240,style:(d=e.style)==null?void 0:d.sider},t.createElement(k,{sider:e==null?void 0:e.sider,enableColorPicker:e==null?void 0:e.enableColorPicker,setSiderWidth:v,propsSiderWidth:(c=(i=e.style)==null?void 0:i.sider)==null?void 0:c.width}))))},re=({annotation:e})=>{var o,n,r;const{imgList:a,loading:d}=e,i=(o=a[e.imgIndex])!=null?o:{};return{path:(r=(n=i==null?void 0:i.path)!=null?n:i==null?void 0:i.url)!=null?r:"",loading:d}};var ae=R(re,null,null,{context:U})(ie);export{ae as default};
1
+ import{ViewportProvider as V}from"../../components/customResizeHook/index.js";import{prefix as b}from"../../constant/index.js";import{Spin as C}from"antd";import{Layout as y}from"antd/es";import t,{useState as A}from"react";import O from"./annotationOperation/index.js";import W from"./annotationTips/index.js";import B from"./sidebar/index.js";import g from"./toolFooter/index.js";import k from"./toolHeader/index.js";import{getStepConfig as E}from"../../store/annotation/reducer.js";import F from"../../components/videoAnnotate/index.js";import{connect as I}from"react-redux";import _ from"../../utils/ToolUtils.js";import R from"../../components/pointCloudView/index.js";import{getClassName as $}from"../../utils/dom.js";import{classnames as H}from"../../utils/index.js";import D from"../../components/predictTracking/previewResult/index.js";import{LabelBeeContext as U}from"../../store/ctx.js";import{EToolName as d}from"../../data/enums/ToolType.js";import z from"./LLMLayout/index.js";import q from"./NLPLayout/index.js";import G from"../../components/audioAnnotate/index.js";import{LoadingOutlined as J}from"@ant-design/icons";import{useTranslation as K}from"react-i18next";import{EPointCloudName as Q}from"@labelbee/lb-annotation";import X from"./LLMMultiWheelLayout/index.js";var Y=Object.defineProperty,T=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,P=(e,o,n)=>o in e?Y(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,l=(e,o)=>{for(var n in o||(o={}))Z.call(o,n)&&P(e,n,o[n]);if(T)for(var n of T(o))p.call(o,n)&&P(e,n,o[n]);return e};const{Sider:ee,Content:te}=y,L=`${b}-layout`,oe=e=>{var o;return t.createElement(t.Fragment,null,e.showTips===!0&&t.createElement(W,{path:e.path,tips:e.tips}),t.createElement(O,l({},e)),t.createElement(g,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},ne=e=>{var o;return t.createElement(t.Fragment,null,t.createElement(R,{drawLayerSlot:e.drawLayerSlot,checkMode:e.checkMode,intelligentFit:e.intelligentFit,measureVisible:e.measureVisible,setResourceLoading:e.setResourceLoading,setBatchSetValid:e==null?void 0:e.setBatchSetValid}),t.createElement(g,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},le=e=>{var o;const{stepList:n,step:a}=e,r=(o=E(n,a))==null?void 0:o.tool,m=_.isPointCloudTool(r),i=_.isVideoTool(r);return m?t.createElement(ne,l({},e)):i?t.createElement(F,{drawLayerSlot:e.drawLayerSlot,footer:e.footer,annotationBefore:e==null?void 0:e.annotationBefore}):t.createElement(oe,l({},e))},s=e=>{var o,n,a;const{t:r}=K(),{stepList:m,step:i}=e,c=(o=E(m,i))==null?void 0:o.tool,u=![d.LLM,d.NLP,d.LLMMultiWheel].includes(c),v=![d.LLM,d.NLP,d.LLMMultiWheel].includes(c),h=[Q.PointCloud].includes(c);return t.createElement(V,null,t.createElement(C,{spinning:e.loading,indicator:t.createElement(J,null),tip:t.createElement("span",{style:{marginTop:200}},r("LoadingTips")),delay:500},t.createElement(y,{className:H([L,e.className]),style:(n=e.style)==null?void 0:n.layout},t.createElement("header",{className:`${L}__header`,style:(a=e.style)==null?void 0:a.header},t.createElement(k,{header:e==null?void 0:e.header,headerName:e.headerName,goBack:e.goBack,exportData:e.exportData,hasLangNode:u,hasHeaderOption:v,hasPredictTrackingIcon:h})),e.children)))},ie=e=>{var o,n,a,r,m,i,c;const[u,v]=A(void 0),h=(n=(o=e.style)==null?void 0:o.sider)==null?void 0:n.width,{stepList:x,step:j}=e,f=(a=E(x,j))==null?void 0:a.tool,M=d.LLM===f,N=d.NLP===f,w=d.LLMMultiWheel===f,S=_.isAudioTool(f);return w?t.createElement(s,l({},e),t.createElement(X,l({},e))):M?t.createElement(s,l({},e),t.createElement(z,l({},e))):N?t.createElement(s,l({},e),t.createElement(q,l({},e))):S?t.createElement(s,l({},e),t.createElement(G,l({},e))):t.createElement(s,l({},e),t.createElement(y,{className:$("layout","container")},e==null?void 0:e.leftSider,t.createElement(te,{className:`${L}__content`},t.createElement(le,l({},e)),t.createElement(D,null)),t.createElement(ee,{className:`${L}__side`,width:(r=u!=null?u:h)!=null?r:240,style:(m=e.style)==null?void 0:m.sider},t.createElement(B,{sider:e==null?void 0:e.sider,enableColorPicker:e==null?void 0:e.enableColorPicker,setSiderWidth:v,propsSiderWidth:(c=(i=e.style)==null?void 0:i.sider)==null?void 0:c.width,setBatchSetValid:e.setBatchSetValid}))))},ae=({annotation:e})=>{var o,n,a;const{imgList:r,loading:m}=e,i=(o=r[e.imgIndex])!=null?o:{};return{path:(a=(n=i==null?void 0:i.path)!=null?n:i==null?void 0:i.url)!=null?a:"",loading:m}};var re=I(ae,null,null,{context:U})(ie);export{re as default};
@@ -1 +1 @@
1
- import r,{useRef as d,useState as v}from"react";import{Col as p,Popconfirm as C}from"antd";import{useTranslation as m}from"react-i18next";import{prefix as E}from"../../../../constant/index.js";const y={color:"#CCCCCC"},g=({info:e})=>{const{t}=m();return e.key.startsWith("sure")?r.createElement("div",{key:e.key},`${t("ConfirmTo")}${e.name.slice(0)}\uFF1F`,(e==null?void 0:e.content)?e.content:""):r.createElement("span",null,e.name)},k=({icon:e})=>typeof e=="string"?r.createElement("img",{width:23,height:25,src:e}):e,i=({isHover:e,info:t})=>{const n=!!t.forbidOperation,o=t.key===e&&!n;let a={color:o?"#666fff":""};return n&&(a=y),r.createElement("div",{style:{cursor:n?"not-allowed":"default"},onClick:()=>{var c;return(t==null?void 0:t.forbidConfirm)&&!n&&((c=t==null?void 0:t.onClick)==null?void 0:c.call(t))}},r.createElement("div",{className:"icon"},r.createElement(k,{icon:o?t.hoverSvg:t.imgSvg})),r.createElement("div",{className:"toolName",style:a},t.name))},f=({allOperation:e})=>{const t=d(null),[n,o]=v(null),{t:a}=m(),c=Math.floor(24/e.length);return r.createElement("div",{className:"generalOperation",ref:t},e.map((l,u)=>r.createElement(p,{span:c,key:u,className:"generalOperation-col"},r.createElement("div",{key:l.key,className:"item",onMouseEnter:()=>{o(l.key)},onMouseLeave:()=>{o(null)}},l.forbidConfirm?r.createElement(i,{info:l,isHover:n}):r.createElement(C,{title:r.createElement(g,{info:l}),placement:"topRight",okText:a("Confirm"),cancelText:a("Cancel"),getPopupContainer:()=>{var s;return(s=t.current)!=null?s:document.body},onConfirm:l.onClick,overlayClassName:`${E}-pop-confirm`},r.createElement("div",null,r.createElement(i,{info:l,isHover:n})))))))};export{f as default};
1
+ import r,{useRef as p,useState as C}from"react";import{Col as y,Popconfirm as E}from"antd";import{useTranslation as i}from"react-i18next";import{prefix as g}from"../../../../constant/index.js";const k={color:"#CCCCCC"},f=({info:e})=>{const{t}=i();return e.key.startsWith("sure")?r.createElement("div",{key:e.key},`${t("ConfirmTo")}${e.name.slice(0)}\uFF1F`,(e==null?void 0:e.content)?e.content:""):r.createElement("span",null,e.name)},h=({icon:e})=>typeof e=="string"?r.createElement("img",{width:23,height:25,src:e}):e,u=({isHover:e,info:t})=>{const l=!!t.forbidOperation,a=t.key===e&&!l;let o={color:a?"#666fff":""};return l&&(o=k),r.createElement("div",{style:{cursor:l?"not-allowed":"default"},onClick:()=>{var c;return(t==null?void 0:t.forbidConfirm)&&!l&&((c=t==null?void 0:t.onClick)==null?void 0:c.call(t))}},r.createElement("div",{className:"icon"},r.createElement(h,{icon:a?t.hoverSvg:t.imgSvg})),r.createElement("div",{className:"toolName",style:o},t.name))},x=({allOperation:e,setBatchSetValid:t,valid:l})=>{const a=p(null),[o,c]=C(null),{t:m}=i(),d=Math.floor(24/e.length),v=n=>n.forbidConfirm?r.createElement(u,{info:n,isHover:o}):t&&n.key==="setValidity"?t({valid:l,isHover:!!o,singleSetQuestionImg:n.onClick}):r.createElement(E,{title:r.createElement(f,{info:n}),placement:"topRight",okText:m("Confirm"),cancelText:m("Cancel"),getPopupContainer:()=>{var s;return(s=a.current)!=null?s:document.body},onConfirm:n.onClick,overlayClassName:`${g}-pop-confirm`},r.createElement("div",null,r.createElement(u,{info:n,isHover:o})));return r.createElement("div",{className:"generalOperation",ref:a},e.map((n,s)=>r.createElement(y,{span:d,key:s,className:"generalOperation-col"},r.createElement("div",{key:n.key,className:"item",onMouseEnter:()=>{c(n.key)},onMouseLeave:()=>{c(null)}},v(n)))))};export{x as default};
@@ -1 +1 @@
1
- import s,{useState as d,useCallback as B}from"react";import{connect as g}from"react-redux";import I from"../../../../utils/StepUtils.js";import{jsonParser as v}from"../../../../utils/index.js";import C from"./ActionsConfirm.js";import y from"./useOperationList.js";import{LabelBeeContext as S}from"../../../../store/ctx.js";import U from"../../../../assets/annotation/pointCloudTool/unitAttribute.svg.js";import w from"../../../../assets/annotation/pointCloudTool/unitAttributeForbid.svg.js";import T from"../../../../assets/annotation/pointCloudTool/unitAttributeHover.svg.js";import{useTranslation as V}from"react-i18next";import A from"../../../../components/pointCloudView/components/UnifyParamsModal/index.js";import{useSingleBox as E}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{composeResultByToolInstance as M}from"../../../../store/annotation/reducer.js";import{useStatus as _}from"../../../../components/pointCloudView/hooks/useStatus.js";const x=o=>{var t,i;const n=I.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(i=o.annotation)==null?void 0:i.stepList);return{toolInstance:o.annotation.toolInstance,stepInfo:n,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:o.annotation.stepList}},R=({toolInstance:o,stepInfo:t,hideValidity:i})=>{const n=y(o),r=v(t==null?void 0:t.config),e=[n.empty];return(t==null?void 0:t.dataSourceStep)===0&&!i&&e.push(n.setValidity),(r==null?void 0:r.copyBackwardResult)&&e.push(n.copyPrevious),s.createElement(C,{allOperation:e})},$=g(x,null,null,{context:S})(({toolInstance:o,stepInfo:t,imgList:i,stepList:n,imgIndex:r})=>{const{t:e}=V(),{selectedBox:m}=E(),u=y(o),[P,c]=d(!1),[j,L]=d([]),{isPointCloudDetectionPattern:b,isPointCloudSegmentationPattern:k}=_(),p=v(t.config);let a=[u.copyPrevious,u.empty,u.setValidity];if(b&&p.trackConfigurable===!0){const l=!m,O={name:e("UnifyParams"),key:"UnifyParams",imgSvg:l?w:U,hoverSvg:T,onClick:()=>{L(M({toolInstance:o,imgList:i,imgIndex:r,stepList:n})),c(!0)},forbidConfirm:!0,forbidOperation:l};a.unshift(O)}const h=B(()=>{c(!1)},[]),f=m==null?void 0:m.info;return k&&(a=a.filter(l=>!["setValidity","copyPrevious"].includes(l.key))),s.createElement(s.Fragment,null,s.createElement(C,{allOperation:a}),s.createElement(A,{id:f==null?void 0:f.trackID,visible:P,onCancel:h,config:p,imgList:j}))});var D=g(x,null,null,{context:S})(R);export{$ as PointCloudOperation,D as default};
1
+ import s,{useState as f,useCallback as U}from"react";import{connect as g}from"react-redux";import w from"../../../../utils/StepUtils.js";import{jsonParser as v}from"../../../../utils/index.js";import C from"./ActionsConfirm.js";import y from"./useOperationList.js";import{LabelBeeContext as S}from"../../../../store/ctx.js";import T from"../../../../assets/annotation/pointCloudTool/unitAttribute.svg.js";import V from"../../../../assets/annotation/pointCloudTool/unitAttributeForbid.svg.js";import A from"../../../../assets/annotation/pointCloudTool/unitAttributeHover.svg.js";import{useTranslation as I}from"react-i18next";import E from"../../../../components/pointCloudView/components/UnifyParamsModal/index.js";import{useSingleBox as M}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{composeResultByToolInstance as _}from"../../../../store/annotation/reducer.js";import{useStatus as R}from"../../../../components/pointCloudView/hooks/useStatus.js";const x=o=>{var t,i;const n=w.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(i=o.annotation)==null?void 0:i.stepList);return{toolInstance:o.annotation.toolInstance,stepInfo:n,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:o.annotation.stepList}},$=({toolInstance:o,stepInfo:t,hideValidity:i})=>{const n=y(o),r=v(t==null?void 0:t.config),e=[n.empty];return(t==null?void 0:t.dataSourceStep)===0&&!i&&e.push(n.setValidity),(r==null?void 0:r.copyBackwardResult)&&e.push(n.copyPrevious),s.createElement(C,{allOperation:e})},D=g(x,null,null,{context:S})(({toolInstance:o,stepInfo:t,imgList:i,stepList:n,imgIndex:r,setBatchSetValid:e})=>{const{t:P}=I(),{selectedBox:m}=M(),u=y(o),[j,c]=f(!1),[L,b]=f([]),{isPointCloudDetectionPattern:k,isPointCloudSegmentationPattern:h}=R(),p=v(t.config);let a=[u.copyPrevious,u.empty,u.setValidity];if(k&&p.trackConfigurable===!0){const l=!m,B={name:P("UnifyParams"),key:"UnifyParams",imgSvg:l?V:T,hoverSvg:A,onClick:()=>{b(_({toolInstance:o,imgList:i,imgIndex:r,stepList:n})),c(!0)},forbidConfirm:!0,forbidOperation:l};a.unshift(B)}const O=U(()=>{c(!1)},[]),d=m==null?void 0:m.info;return h&&(a=a.filter(l=>!["setValidity","copyPrevious"].includes(l.key))),s.createElement(s.Fragment,null,s.createElement(C,{allOperation:a,setBatchSetValid:e,valid:o==null?void 0:o.valid}),s.createElement(E,{id:d==null?void 0:d.trackID,visible:j,onCancel:O,config:p,imgList:L}))});var F=g(x,null,null,{context:S})($);export{D as PointCloudOperation,F as default};
@@ -1 +1 @@
1
- import{prefix as R}from"../../../constant/index.js";import{EToolName as n}from"../../../data/enums/ToolType.js";import W from"../../../utils/StepUtils.js";import{Collapse as u}from"antd/es";import e,{useState as z}from"react";import{useTranslation as D}from"react-i18next";import G from"./AnnotationText/index.js";import U from"./ClearIcon/index.js";import q,{PointCloudOperation as y}from"./GeneralOperation/index.js";import H from"./ImgAttributeInfo/index.js";import J from"./SwitchAttributeList/index.js";import p,{expandIconFuc as _}from"./TagSidebar/index.js";import f from"./TextToolSidebar/index.js";import $ from"./PointCloudToolSidebar/index.js";import Q from"./ToolStyle/index.js";import{cTool as X}from"@labelbee/lb-annotation";import Y from"./ScribbleSidebar/index.js";import{ToolIcons as Z}from"./ToolIcons.js";import{useSelector as ee}from"../../../store/ctx.js";import{Tabs as I}from"antd";import{classnames as te}from"../../../utils/index.js";import P from"../../../assets/annotation/common/icon_menu_fold.svg.js";import oe from"../../../components/LLMToolView/sidebar/index.js";import ne from"../../../components/LLMMultiWheelView/sidebar/index.js";import re from"./NLPSidebar/index.js";import ie from"../../../components/videoAnnotate/videoClipTool/components/annotatedList/index.js";const{EVideoToolName:E,EPointCloudName:le}=X,{Panel:A}=u,t=`${R}-sidebar`,ae=({sider:l,enableColorPicker:w,setSiderWidth:b,propsSiderWidth:se,checkMode:c})=>{const x=ee(r=>W.getCurrentStepInfo(r.annotation.step,r.annotation.stepList)),[m,M]=z(!0),o=x==null?void 0:x.tool,{t:S}=D();if(!o)return null;const V=r=>{const s=e.createElement(Q,null);return e.createElement(A,{header:S("Style"),className:"panel",key:r},s)},T=e.createElement(Z,{toolName:o,onChange:()=>{}}),a=e.createElement(J,null),g=e.createElement(G,null),N=e.createElement(u,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:_},V("1")),h=e.createElement(u,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:_},e.createElement(A,{header:e.createElement("div",null,S("Adjust"),e.createElement(U,null)),className:"panel",key:"imgAttribute"},e.createElement(H,null))),i=e.createElement(q,null),B=e.createElement(p,null),O=r=>e.createElement(f,{disabled:r}),L=e.createElement(Y,{onChange:(r,s)=>{}}),v=e.createElement(ie,null),C=e.createElement(oe,{checkMode:c}),k=e.createElement(ne,{checkMode:c}),j=e.createElement(re,{checkMode:c}),d=e.createElement("div",{className:`${t}__horizontal`}),F=e.createElement($,{enableColorPicker:w}),K=e.createElement(y,null);if(l)return typeof l=="function"?e.createElement("div",{className:`${t}`},l({toolIcon:T,attributeList:a,annotationText:g,toolStyle:N,imageAttributeInfo:h,operation:i,tagToolSideBar:B,textToolSideBar:O,horizontal:d,pointCloudToolSidebar:F,pointCloudOperation:K,scribbleSidebar:L,LLMSidebar:C,LLMMultiWheelSidebar:k,videoClipSidebar:v,NLPSidebar:j})):l;if([n.Rect,n.Point,n.Line,n.Rect,n.Polygon,n.Cuboid].includes(o))return e.createElement("div",{className:`${t}`},T,d,a,g,d,e.createElement("div",{className:`${t}__content`},N,h),i);if(o===n.Tag)return e.createElement("div",{className:`${t}`},e.createElement(p,null));if(o===E.VideoClipTool)return e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},v,a),i);if(o===E.VideoTagTool)return e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},e.createElement(p,null)),i);if(o===E.VideoTextTool)return e.createElement("div",{className:`${t}`},e.createElement(f,null));if(o===n.Text)return e.createElement("div",{className:`${t}`},"s",e.createElement(f,null));if(o===le.PointCloud){const r=()=>{M(!m),b&&b(m?48:void 0)},s=e.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},e.createElement("span",{onClick:()=>r()},e.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:P})));return m?e.createElement(I,{type:"card",activeKey:"1",className:te({[`${t}`]:!0,[`${t}__pointCloud`]:!0}),tabBarExtraContent:{left:e.createElement("span",{onClick:()=>r(),style:{padding:"0px 4px"}},e.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:P}))}},e.createElement(I.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},e.createElement("div",{className:`${t}__content`},e.createElement($,null)),e.createElement(y,null))):s}return o===n.ScribbleTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},L,a),i):o===n.LLM?C:o===n.NLP?j:null};export{ae as default,t as sidebarCls};
1
+ import{prefix as W}from"../../../constant/index.js";import{EToolName as n}from"../../../data/enums/ToolType.js";import z from"../../../utils/StepUtils.js";import{Collapse as u}from"antd/es";import e,{useState as D}from"react";import{useTranslation as G}from"react-i18next";import U from"./AnnotationText/index.js";import q from"./ClearIcon/index.js";import H,{PointCloudOperation as y}from"./GeneralOperation/index.js";import J from"./ImgAttributeInfo/index.js";import Q from"./SwitchAttributeList/index.js";import p,{expandIconFuc as _}from"./TagSidebar/index.js";import f from"./TextToolSidebar/index.js";import $ from"./PointCloudToolSidebar/index.js";import X from"./ToolStyle/index.js";import{cTool as Y}from"@labelbee/lb-annotation";import Z from"./ScribbleSidebar/index.js";import{ToolIcons as ee}from"./ToolIcons.js";import{useSelector as te}from"../../../store/ctx.js";import{Tabs as I}from"antd";import{classnames as oe}from"../../../utils/index.js";import P from"../../../assets/annotation/common/icon_menu_fold.svg.js";import ne from"../../../components/LLMToolView/sidebar/index.js";import re from"../../../components/LLMMultiWheelView/sidebar/index.js";import ie from"./NLPSidebar/index.js";import le from"../../../components/videoAnnotate/videoClipTool/components/annotatedList/index.js";const{EVideoToolName:E,EPointCloudName:ae}=Y,{Panel:A}=u,t=`${W}-sidebar`,se=({sider:l,enableColorPicker:w,setSiderWidth:b,propsSiderWidth:ce,checkMode:c,setBatchSetValid:M})=>{const x=te(r=>z.getCurrentStepInfo(r.annotation.step,r.annotation.stepList)),[m,V]=D(!0),o=x==null?void 0:x.tool,{t:S}=G();if(!o)return null;const B=r=>{const s=e.createElement(X,null);return e.createElement(A,{header:S("Style"),className:"panel",key:r},s)},T=e.createElement(ee,{toolName:o,onChange:()=>{}}),a=e.createElement(Q,null),g=e.createElement(U,null),N=e.createElement(u,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:_},B("1")),h=e.createElement(u,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:_},e.createElement(A,{header:e.createElement("div",null,S("Adjust"),e.createElement(q,null)),className:"panel",key:"imgAttribute"},e.createElement(J,null))),i=e.createElement(H,null),O=e.createElement(p,null),k=r=>e.createElement(f,{disabled:r}),L=e.createElement(Z,{onChange:(r,s)=>{}}),v=e.createElement(le,null),C=e.createElement(ne,{checkMode:c}),F=e.createElement(re,{checkMode:c}),j=e.createElement(ie,{checkMode:c}),d=e.createElement("div",{className:`${t}__horizontal`}),K=e.createElement($,{enableColorPicker:w}),R=e.createElement(y,{setBatchSetValid:M});if(l)return typeof l=="function"?e.createElement("div",{className:`${t}`},l({toolIcon:T,attributeList:a,annotationText:g,toolStyle:N,imageAttributeInfo:h,operation:i,tagToolSideBar:O,textToolSideBar:k,horizontal:d,pointCloudToolSidebar:K,pointCloudOperation:R,scribbleSidebar:L,LLMSidebar:C,LLMMultiWheelSidebar:F,videoClipSidebar:v,NLPSidebar:j})):l;if([n.Rect,n.Point,n.Line,n.Rect,n.Polygon,n.Cuboid].includes(o))return e.createElement("div",{className:`${t}`},T,d,a,g,d,e.createElement("div",{className:`${t}__content`},N,h),i);if(o===n.Tag)return e.createElement("div",{className:`${t}`},e.createElement(p,null));if(o===E.VideoClipTool)return e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},v,a),i);if(o===E.VideoTagTool)return e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},e.createElement(p,null)),i);if(o===E.VideoTextTool)return e.createElement("div",{className:`${t}`},e.createElement(f,null));if(o===n.Text)return e.createElement("div",{className:`${t}`},"s",e.createElement(f,null));if(o===ae.PointCloud){const r=()=>{V(!m),b&&b(m?48:void 0)},s=e.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},e.createElement("span",{onClick:()=>r()},e.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:P})));return m?e.createElement(I,{type:"card",activeKey:"1",className:oe({[`${t}`]:!0,[`${t}__pointCloud`]:!0}),tabBarExtraContent:{left:e.createElement("span",{onClick:()=>r(),style:{padding:"0px 4px"}},e.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:P}))}},e.createElement(I.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},e.createElement("div",{className:`${t}__content`},e.createElement($,null)),e.createElement(y,null))):s}return o===n.ScribbleTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},L,a),i):o===n.LLM?C:o===n.NLP?j:null};export{se as default,t as sidebarCls};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.24.0-alpha.20",
3
+ "version": "1.24.0-alpha.22",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.28.0-alpha.9",
46
+ "@labelbee/lb-annotation": "1.28.0-alpha.11",
47
47
  "@labelbee/lb-utils": "1.20.0-alpha.1",
48
48
  "@labelbee/wavesurfer": "1.1.0",
49
49
  "@types/react-dom": "18.3.1",