@labelbee/lb-components 1.23.0-alpha.86 → 1.23.0-alpha.88
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.
- package/dist/_virtual/2DViewWorker.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/views/MainView/toolHeader/index.js +1 -1
- package/es/_virtual/2DViewWorker.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/views/MainView/toolHeader/index.js +1 -1
- package/package.json +3 -3
|
@@ -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,i,d)=>i in r?__defProp(r,i,{enumerable:!0,configurable:!0,writable:!0,value:d}):r[i]=d,__spreadValues=(r,i)=>{for(var d in i||(i={}))__hasOwnProp.call(i,d)&&__defNormalProp(r,d,i[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(i))__propIsEnum.call(i,d)&&__defNormalProp(r,d,i[d]);return r},__spreadProps=(r,i)=>__defProps(r,__getOwnPropDescs(i)),__async=(r,i,d)=>new Promise((x,D)=>{var A=u=>{try{I(d.next(u))}catch(R){D(R)}},O=u=>{try{I(d.throw(u))}catch(R){D(R)}},I=u=>u.done?x(u.value):Promise.resolve(u.value).then(A,O);I((d=d.apply(r,i)).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,i,d)=>!1,removeRectByPointCloudBoxId:r=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:useWindowKeydownListener.getEmptyUseWindowKeydownListener()}),PointCloudProvider=({children:r})=>{const[i,d]=React.useState([]),[x,D]=React.useState([]),[A,O]=React.useState([]),[I,u]=React.useState([]),[R,Re]=React.useState([]),[v,N]=React.useState([]),[B,j]=React.useState([]),[U,xe]=React.useState(!0),[Z,Le]=React.useState(2),[J,De]=React.useState(!0),[Q,Ae]=React.useState(1),[f,X]=React.useState(),[Y,$]=React.useState(),[ee,te]=React.useState(),[g,oe]=React.useState(),[ne,Be]=React.useState(""),[F,_e]=React.useState(lbAnnotation.EToolName.Rect),q=React.useRef(new lbAnnotation.ActionsHistory).current,[p,T]=React.useState([]),[ie,Ve]=React.useState(""),[z,Ne]=React.useState(lbUtils.EPointCloudPattern.Detection),[L,se]=React.useState(void 0),[W,He]=React.useState([]),[G,Me]=React.useState([]),[re,ke]=React.useState(!1),h=index(),[le,Ee]=React.useState({}),Oe=ctx.useDispatch(),je=o=>{const{imgNode:n,path:t}=o;t&&n&&Ee(a=>__spreadProps(__spreadValues({},a),{[t]:{width:n.width,height:n.height}}))},ae=React.useMemo(()=>v.length===1?v[0]:"",[v]),de=useWindowKeydownListener.default(),H=React.useCallback((o,n,t="extId")=>{const a=t||"id",l=new Set(n);return u(c=>{let S=!1;const P=c.filter(k=>{const K=k[a],E=l.has(K)?k.imageName!==o:!0;return E||(S=!0),E});return S?P:c}),!0},[]),ce=React.useCallback(o=>{const n=i.map(t=>t.id);return H(o,n,"extId")},[i,H]),ue=React.useCallback(o=>{if(!o)return!1;const n=i.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:a,attribute:l,trackID:c}=t,S=t.rects.find(P=>P.imageName===o);if(S){const P=___default.default.pick(S,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},P),{id:lbAnnotation.uuid(),attribute:l,order:c,extId:a})}return null}).filter(t=>t!==null);return n.length?(u(t=>{const a=new Set(t.filter(c=>o===c.imageName).map(c=>c.extId)),l=n.filter(c=>a.has(c.extId)===!1);return l.length?[...t,...l]:t}),!0):!1},[i]),ge=React.useMemo(()=>i.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:c}=l;if(!c){console.warn("Missing image name"),console.trace(l,t);return}map.addMapIndirectWeakSetItem(n,c,t.id,t)}),n},new Map),[i]),fe=React.useCallback(o=>{u(n=>o(n,pickRectObject))},[pickRectObject]),pe=React.useMemo(()=>I.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,I),o)},new Map),[I]),{fn:Fe}=useTimeoutFunc.default(o=>{N(n=>{const t=o,a=new Set(t);let l=!1;const c=n.filter(S=>{const P=a.has(S);return P||(l=!0),P});return l?c:n})},200),he=React.useCallback(o=>{const n=o.map(t=>t.id);d(o),Fe(n)},[]),M=React.useMemo(()=>{const o=i.find(e=>e.id===ae),n=e=>{const s=i.concat(e);return he(s),s},t=e=>{const s=x.concat(e);return D(s),s},a=e=>{xe(e!==!1)},l=e=>{e===void 0&&N([]),typeof e=="string"&&N([e]),Array.isArray(e)&&N(Array.from(new Set(e)))},c=e=>{v.includes(e)?l(v.filter(s=>s!==e)):l([...v,e])},S=e=>{const s=pickRectObject(e);u(m=>[...m,s])},P=(e,s=!1)=>{const m=pickRectObject(e);u(C=>C.map(w=>w.id===e.id?s?__spreadValues(__spreadValues({},w),m):m:w))},k=e=>{u(s=>s.filter(m=>!e.find(C=>C.id===m.id)))},K=e=>{B.includes(e)?j([]):j([e])},E=()=>{if(F===lbAnnotation.EToolName.Rect){const e=i.map(s=>s.id);l(e),f==null||f.pointCloud2dOperation.setSelectedIDs(e)}},Te=e=>{l(i.filter(s=>s.attribute===e).map(s=>s.id))},me=i.filter(e=>!p.includes(e.attribute)),ve=x.filter(e=>!p.includes(e.attribute)),Pe=R.filter(e=>e.attribute&&!p.includes(e.attribute)),ze=e=>{if(p.includes(e))T(p.filter(s=>s!==e));else{const s=p.concat(e);T(s)}},We=(e=me,s=A,m=ve,C=Pe,w=W)=>{var V;g==null||g.clearAllBox(),g==null||g.clearAllSphere(),f==null||f.updatePolygonList(e,s),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),Ie(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,e)},Ge=()=>{X(void 0),$(void 0),te(void 0),oe(void 0)},Ie=(e,s,m)=>__async(void 0,null,function*(){var C,w,V;if(!g)return;const Se=g.pointCloudObject;if(!Se)return;let Ce=[],we=[];try{if(s&&q.record.length){const{record:y,recordIndex:b}=q;let ye=b;b>0&&(e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleToggleValid||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleRotate||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single&&s.length===((C=y[b])==null?void 0:C.pointCloudBoxList.length))&&(ye=b-1);let Ke=(w=y[ye])==null?void 0:w.pointCloudBoxList;const be=ToolPointCloudBoxRenderHelper.calcResetAreasAndBoxIds(e,s,Ke);Ce=be.modifiedBoxIds,we=be.resetAreas}}catch(y){console.error("call calcResetAreasAndBoxIds error",y)}try{const y=yield g.getHighlightIndexByMappingImgList({mappingImgList:m!=null?m:G,points:Se.geometry.attributes.position.array}),b=yield g==null?void 0:g.highlightOriginPointCloud(s,y,{modifiedBoxIds:Ce,resetAreas:we});return b&&((V=f==null?void 0:f.pointCloudInstance)==null||V.updateColor(b)),b}catch(y){console.error("call highlightOriginPointCloud error",y)}});return{selectedID:ae,pointCloudBoxList:i,pointCloudSphereList:x,displayPointCloudList:me,displaySphereList:ve,displayLineList:Pe,selectedIDs:v,setPointCloudResult:he,setSelectedIDs:l,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:D,valid:U,selectedPointCloudBox:o,setPointCloudValid:a,addSelectedID:c,addHighlightID:K,selectedAllBoxes:E,topViewInstance:f,setTopViewInstance:X,sideViewInstance:Y,setSideViewInstance:$,backViewInstance:ee,setBackViewInstance:te,mainViewInstance:g,setMainViewInstance:oe,polygonList:A,setPolygonList:O,rectList:I,setRectList:u,addRectIn2DView:S,removeRectIn2DView:k,updateRectIn2DView:P,lineList:R,setLineList:Re,zoom:Q,setZoom:Ae,history:q,toggleAttributesVisible:ze,hideAttributes:p,setHideAttributes:T,reRender:We,attrPanelLayout:ie,setAttrPanelLayout:Ve,syncAllViewPointCloudColor:Ie,defaultAttribute:ne,setDefaultAttribute:Be,pointCloudPattern:F,setPointCloudPattern:_e,selectSpecAttr:Te,globalPattern:z,setGlobalPattern:e=>{z!==e&&(Oe(actionCreators.ChangeSave),Ne(e),e===lbUtils.EPointCloudPattern.Detection&&se(void 0))},ptSegmentInstance:L,setPtSegmentInstance:se,segmentation:W,setSegmentation:He,clearAllDetectionInstance:Ge,highlight2DDataList:G,setHighlight2DDataList:Me,highlight2DLoading:re,setHighlight2DLoading:ke,cuboidBoxIn2DView:J,setCuboidBoxIn2DView:De,imageSizes:le,cacheImageNodeSize:je,highlightIDs:B,setHighlightIDs:j,removeRectByPointCloudBoxId:ce,removeRectBySpecifyId:H,addRectFromPointCloudBoxByImageName:ue,rectRotateSensitivity:Z,setRectRotateSensitivity:Le,imageNamePointCloudBoxMap:ge,linkageImageNameRectMap:pe,updateRectListByReducer:fe,windowKeydownListenerHook:de}},[U,v,i,x,A,R,I,f,Y,ee,g,Q,p,ie,ne,F,z,L,W,G,re,J,le,B,ce,H,ue,Z,ge,pe,fe,de]);React.useEffect(()=>{var o,n,t;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,i),(n=h==null?void 0:h.setHighlightIDs)==null||n.call(h,B),(t=h==null?void 0:h.setSelectedIDs)==null||t.call(h,v)},[i,v,B]),React.useEffect(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,M)},[M]);const qe=()=>{const o=i.filter(l=>p.includes(l.attribute)),{setSelectedIDs:n,reRender:t}=M,a=o.map(l=>l.id);a.length>0&&n(v.filter(l=>!a.includes(l))),t()};return React.useEffect(()=>{var o,n,t,a;qe(),(n=(o=f==null?void 0:f.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,p),(a=(t=L==null?void 0:L.store)==null?void 0:t.setHiddenAttributes)==null||a.call(t,p)},[p]),React__default.default.createElement(PointCloudContext.Provider,{value:M},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,i,d)=>i in r?__defProp(r,i,{enumerable:!0,configurable:!0,writable:!0,value:d}):r[i]=d,__spreadValues=(r,i)=>{for(var d in i||(i={}))__hasOwnProp.call(i,d)&&__defNormalProp(r,d,i[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(i))__propIsEnum.call(i,d)&&__defNormalProp(r,d,i[d]);return r},__spreadProps=(r,i)=>__defProps(r,__getOwnPropDescs(i)),__async=(r,i,d)=>new Promise((x,D)=>{var A=u=>{try{I(d.next(u))}catch(R){D(R)}},O=u=>{try{I(d.throw(u))}catch(R){D(R)}},I=u=>u.done?x(u.value):Promise.resolve(u.value).then(A,O);I((d=d.apply(r,i)).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,i,d)=>!1,removeRectByPointCloudBoxId:r=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:useWindowKeydownListener.getEmptyUseWindowKeydownListener()}),PointCloudProvider=({children:r})=>{const[i,d]=React.useState([]),[x,D]=React.useState([]),[A,O]=React.useState([]),[I,u]=React.useState([]),[R,Re]=React.useState([]),[v,N]=React.useState([]),[B,j]=React.useState([]),[U,xe]=React.useState(!0),[Z,Le]=React.useState(2),[J,De]=React.useState(!0),[Q,Ae]=React.useState(1),[f,X]=React.useState(),[Y,$]=React.useState(),[ee,te]=React.useState(),[g,oe]=React.useState(),[ne,Be]=React.useState(""),[F,_e]=React.useState(lbAnnotation.EToolName.Rect),q=React.useRef(new lbAnnotation.ActionsHistory).current,[p,T]=React.useState([]),[ie,Ve]=React.useState(""),[z,Ne]=React.useState(lbUtils.EPointCloudPattern.Detection),[L,se]=React.useState(void 0),[W,He]=React.useState([]),[G,Me]=React.useState([]),[re,ke]=React.useState(!1),h=index(),[le,Ee]=React.useState({}),Oe=ctx.useDispatch(),je=o=>{const{imgNode:n,path:t}=o;t&&n&&Ee(a=>__spreadProps(__spreadValues({},a),{[t]:{width:n.width,height:n.height}}))},ae=React.useMemo(()=>v.length===1?v[0]:"",[v]),de=useWindowKeydownListener.default(),H=React.useCallback((o,n,t="extId")=>{const a=t||"id",l=new Set(n);return u(c=>{let S=!1;const P=c.filter(k=>{const K=k[a],E=l.has(K)?k.imageName!==o:!0;return E||(S=!0),E});return S?P:c}),!0},[]),ce=React.useCallback(o=>{const n=i.map(t=>t.id);return H(o,n,"extId")},[i,H]),ue=React.useCallback(o=>{if(!o)return!1;const n=i.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:a,attribute:l,trackID:c}=t,S=t.rects.find(P=>P.imageName===o);if(S){const P=___default.default.pick(S,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},P),{id:lbAnnotation.uuid(),attribute:l,order:c,extId:a,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(u(t=>{const a=new Set(t.filter(c=>o===c.imageName).map(c=>c.extId)),l=n.filter(c=>a.has(c.extId)===!1);return l.length?[...t,...l]:t}),!0):!1},[i]),ge=React.useMemo(()=>i.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:c}=l;if(!c){console.warn("Missing image name"),console.trace(l,t);return}map.addMapIndirectWeakSetItem(n,c,t.id,t)}),n},new Map),[i]),fe=React.useCallback(o=>{u(n=>o(n,pickRectObject))},[pickRectObject]),pe=React.useMemo(()=>I.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,I),o)},new Map),[I]),{fn:Fe}=useTimeoutFunc.default(o=>{N(n=>{const t=o,a=new Set(t);let l=!1;const c=n.filter(S=>{const P=a.has(S);return P||(l=!0),P});return l?c:n})},200),he=React.useCallback(o=>{const n=o.map(t=>t.id);d(o),Fe(n)},[]),M=React.useMemo(()=>{const o=i.find(e=>e.id===ae),n=e=>{const s=i.concat(e);return he(s),s},t=e=>{const s=x.concat(e);return D(s),s},a=e=>{xe(e!==!1)},l=e=>{e===void 0&&N([]),typeof e=="string"&&N([e]),Array.isArray(e)&&N(Array.from(new Set(e)))},c=e=>{v.includes(e)?l(v.filter(s=>s!==e)):l([...v,e])},S=e=>{const s=pickRectObject(e);u(m=>[...m,s])},P=(e,s=!1)=>{const m=pickRectObject(e);u(C=>C.map(w=>w.id===e.id?s?__spreadValues(__spreadValues({},w),m):m:w))},k=e=>{u(s=>s.filter(m=>!e.find(C=>C.id===m.id)))},K=e=>{B.includes(e)?j([]):j([e])},E=()=>{if(F===lbAnnotation.EToolName.Rect){const e=i.map(s=>s.id);l(e),f==null||f.pointCloud2dOperation.setSelectedIDs(e)}},Te=e=>{l(i.filter(s=>s.attribute===e).map(s=>s.id))},me=i.filter(e=>!p.includes(e.attribute)),ve=x.filter(e=>!p.includes(e.attribute)),Pe=R.filter(e=>e.attribute&&!p.includes(e.attribute)),ze=e=>{if(p.includes(e))T(p.filter(s=>s!==e));else{const s=p.concat(e);T(s)}},We=(e=me,s=A,m=ve,C=Pe,w=W)=>{var V;g==null||g.clearAllBox(),g==null||g.clearAllSphere(),f==null||f.updatePolygonList(e,s),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),Ie(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,e)},Ge=()=>{X(void 0),$(void 0),te(void 0),oe(void 0)},Ie=(e,s,m)=>__async(void 0,null,function*(){var C,w,V;if(!g)return;const Se=g.pointCloudObject;if(!Se)return;let Ce=[],we=[];try{if(s&&q.record.length){const{record:y,recordIndex:b}=q;let ye=b;b>0&&(e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleToggleValid||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleRotate||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single&&s.length===((C=y[b])==null?void 0:C.pointCloudBoxList.length))&&(ye=b-1);let Ke=(w=y[ye])==null?void 0:w.pointCloudBoxList;const be=ToolPointCloudBoxRenderHelper.calcResetAreasAndBoxIds(e,s,Ke);Ce=be.modifiedBoxIds,we=be.resetAreas}}catch(y){console.error("call calcResetAreasAndBoxIds error",y)}try{const y=yield g.getHighlightIndexByMappingImgList({mappingImgList:m!=null?m:G,points:Se.geometry.attributes.position.array}),b=yield g==null?void 0:g.highlightOriginPointCloud(s,y,{modifiedBoxIds:Ce,resetAreas:we});return b&&((V=f==null?void 0:f.pointCloudInstance)==null||V.updateColor(b)),b}catch(y){console.error("call highlightOriginPointCloud error",y)}});return{selectedID:ae,pointCloudBoxList:i,pointCloudSphereList:x,displayPointCloudList:me,displaySphereList:ve,displayLineList:Pe,selectedIDs:v,setPointCloudResult:he,setSelectedIDs:l,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:D,valid:U,selectedPointCloudBox:o,setPointCloudValid:a,addSelectedID:c,addHighlightID:K,selectedAllBoxes:E,topViewInstance:f,setTopViewInstance:X,sideViewInstance:Y,setSideViewInstance:$,backViewInstance:ee,setBackViewInstance:te,mainViewInstance:g,setMainViewInstance:oe,polygonList:A,setPolygonList:O,rectList:I,setRectList:u,addRectIn2DView:S,removeRectIn2DView:k,updateRectIn2DView:P,lineList:R,setLineList:Re,zoom:Q,setZoom:Ae,history:q,toggleAttributesVisible:ze,hideAttributes:p,setHideAttributes:T,reRender:We,attrPanelLayout:ie,setAttrPanelLayout:Ve,syncAllViewPointCloudColor:Ie,defaultAttribute:ne,setDefaultAttribute:Be,pointCloudPattern:F,setPointCloudPattern:_e,selectSpecAttr:Te,globalPattern:z,setGlobalPattern:e=>{z!==e&&(Oe(actionCreators.ChangeSave),Ne(e),e===lbUtils.EPointCloudPattern.Detection&&se(void 0))},ptSegmentInstance:L,setPtSegmentInstance:se,segmentation:W,setSegmentation:He,clearAllDetectionInstance:Ge,highlight2DDataList:G,setHighlight2DDataList:Me,highlight2DLoading:re,setHighlight2DLoading:ke,cuboidBoxIn2DView:J,setCuboidBoxIn2DView:De,imageSizes:le,cacheImageNodeSize:je,highlightIDs:B,setHighlightIDs:j,removeRectByPointCloudBoxId:ce,removeRectBySpecifyId:H,addRectFromPointCloudBoxByImageName:ue,rectRotateSensitivity:Z,setRectRotateSensitivity:Le,imageNamePointCloudBoxMap:ge,linkageImageNameRectMap:pe,updateRectListByReducer:fe,windowKeydownListenerHook:de}},[U,v,i,x,A,R,I,f,Y,ee,g,Q,p,ie,ne,F,z,L,W,G,re,J,le,B,ce,H,ue,Z,ge,pe,fe,de]);React.useEffect(()=>{var o,n,t;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,i),(n=h==null?void 0:h.setHighlightIDs)==null||n.call(h,B),(t=h==null?void 0:h.setSelectedIDs)==null||t.call(h,v)},[i,v,B]),React.useEffect(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,M)},[M]);const qe=()=>{const o=i.filter(l=>p.includes(l.attribute)),{setSelectedIDs:n,reRender:t}=M,a=o.map(l=>l.id);a.length>0&&n(v.filter(l=>!a.includes(l))),t()};return React.useEffect(()=>{var o,n,t,a;qe(),(n=(o=f==null?void 0:f.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,p),(a=(t=L==null?void 0:L.store)==null?void 0:t.setHiddenAttributes)==null||a.call(t,p)},[p]),React__default.default.createElement(PointCloudContext.Provider,{value:M},r)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var index$
|
|
1
|
+
"use strict";var index$3=require("../../../constant/index.js"),useSize=require("../../../hooks/useSize.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),icons=require("@ant-design/icons"),lbUtils=require("@labelbee/lb-utils"),es=require("antd/es"),classNames=require("classnames"),_=require("lodash"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),ctx=require("../../../store/ctx.js"),index$7=require("../../../index.js"),index$5=require("./ExportData/index.js"),index$6=require("./headerOption/index.js"),index$1=require("./StepSwitch/index.js"),index$2=require("../../../components/predictTracking/predictTrackingIcon/index.js"),index$4=require("./SwitchPattern/index.js"),reducer=require("../../../store/annotation/reducer.js"),index=require("../../../utils/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React);const NextButton=({disabled:e,imgList:a})=>{const{t}=reactI18next.useTranslation(),r=()=>{const{dispatch:n,getState:l}=index$7.store;a[0]?n(actionCreators.ToNextStep(0)):actionCreators.loadImgList(n,l,0).then(o=>{o&&n(actionCreators.ToNextStep(0))})};return React__default.default.createElement(es.Button,{type:"primary",style:{marginLeft:10},onClick:r,disabled:e},t("NextStep"))},NextStep=({step:e,stepProgress:a,stepList:t,imgList:r})=>{var n;const{t:l}=reactI18next.useTranslation(),o=(n=_.last(t))==null?void 0:n.step;if(t.length<2||e===o)return null;const i=a<1;return i?React__default.default.createElement(es.Tooltip,{title:l("StepNotFinishedNotify")},React__default.default.createElement("span",null,React__default.default.createElement(NextButton,{disabled:i,imgList:r}))):React__default.default.createElement(NextButton,{disabled:i,imgList:r})},ToolHeader=({goBack:e,exportData:a,header:t,headerName:r,imgList:n,stepProgress:l,stepInfo:o,stepList:i,step:u,annotationEngine:d,hasLangNode:S,hasHeaderOption:j,hasPredictTrackingIcon:b})=>{var f,p,m;const T=ctx.useDispatch(),[,L]=React.useReducer(s=>s+1,0),c=React.useRef(null),C=(f=reducer.getStepConfig(i,u))==null?void 0:f.config,y=(p=index.jsonParser(C))!=null?p:{},{enableSegment:k=!1}=y,x=useSize(c),w=React__default.default.createElement(index$5,{exportData:a}),P=()=>{T(actionCreators.ToSubmitFileData(index$3.ESubmitType.Quit)),e&&e(n)},v=s=>{lbUtils.i18n.changeLanguage(s),d==null||d.setLang(s),L()},g=lbUtils.i18n.language,D=(m=x==null?void 0:x.width)!=null?m:window.innerWidth,N=React__default.default.createElement(icons.LeftOutlined,{className:`${index$3.prefix}-header__icon`,onClick:P}),E=r?React__default.default.createElement("span",{className:`${index$3.prefix}-header__name`},r):"",h=i.length>1&&React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{stepProgress:l}),React__default.default.createElement(NextStep,{step:u,stepProgress:l,stepList:i,imgList:n})),$=j?React__default.default.createElement(index$6,{stepInfo:o}):null,R=index$4,F=React__default.default.createElement("div",{className:`${index$3.prefix}-header__lang`},React__default.default.createElement("span",{className:`${index$3.prefix}-langCN ${g==="cn"?"active":""}`,onClick:()=>v("cn")},"\u4E2D\u6587")," / ",React__default.default.createElement("span",{className:`${index$3.prefix}-langEN ${g==="en"?"active":""}`,onClick:()=>v("en")},"En")),q=React__default.default.createElement(React__default.default.Fragment,null,b&&React__default.default.createElement(index$2,null),S&&F);return t?typeof t=="function"?React__default.default.createElement("div",{className:classNames__default.default(`${index$3.prefix}-header`),ref:c},React__default.default.createElement("div",{className:`${index$3.prefix}-header__title`},t({backNode:N,headerNameNode:E,stepListNode:h,headerOptionNode:$,langNode:q,PointCloudSwitchPattern:R}))):t:React__default.default.createElement("div",{className:classNames__default.default(`${index$3.prefix}-header`),ref:c},React__default.default.createElement("div",{className:`${index$3.prefix}-header__title`},N,E,h,w,React__default.default.createElement("div",{id:"operationNode",className:`${index$3.prefix}-header__operationNode`,style:{left:D/2-174/2}},$),React__default.default.createElement("div",{className:`${index$3.prefix}-header__titlePlacement`}),k&&React__default.default.createElement(index$4,null),q))},mapStateToProps=e=>{var a;return{imgList:e.annotation.imgList,annotationEngine:e.annotation.annotationEngine,stepProgress:e.annotation.stepProgress,toolName:(a=e.annotation.stepList[e.annotation.step-1])==null?void 0:a.tool,stepList:e.annotation.stepList,stepInfo:e.annotation.stepList[e.annotation.step-1],step:e.annotation.step}};var ToolHeader$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(ToolHeader);module.exports=ToolHeader$1;
|