@labelbee/lb-components 1.12.2-alpha.1 → 1.12.2
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.
|
@@ -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"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,o,i)=>o in e?__defProp(e,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[o]=i,__spreadValues=(e,o)=>{for(var i in o||(o={}))__hasOwnProp.call(o,i)&&__defNormalProp(e,i,o[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(o))__propIsEnum.call(o,i)&&__defNormalProp(e,i,o[i]);return e},__spreadProps=(e,o)=>__defProps(e,__getOwnPropDescs(o)),__async=(e,o,i)=>new Promise((l,t)=>{var a=d=>{try{r(i.next(d))}catch(g){t(g)}},p=d=>{try{r(i.throw(d))}catch(g){t(g)}},r=d=>d.done?l(d.value):Promise.resolve(d.value).then(a,p);r((i=i.apply(e,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,DEFAULT_MIN_WIDTH=.01,DEFAULT_MIN_HEIGHT=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,o,i,l,t)=>{const{x:a,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(e,o),{defaultZ:r}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:a,y:p,z:r},id:e.id},g=l?__spreadValues(__spreadValues({},l),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},topViewPolygon2PointCloud=(e,o,i,l,t,a)=>{let p=e.pointList.map(v=>lbUtils.PointCloudUtils.transferCanvas2World(v,o)),r=0,d=1,g={};if(i){const v=i.getSensesPointZAxisInPolygon(p,void 0,a);a&&v.fittedCoordinates.length>0&&(p=v.fittedCoordinates),r=(v.maxZ+v.minZ)/2,d=v.maxZ-v.minZ,g={count:v.zCount}}const[f,x,I]=p,w=lbAnnotation.MathUtils.getLineCenterPoint([f,I]),V=lbAnnotation.MathUtils.getLineLength(f,x),_=lbAnnotation.MathUtils.getLineLength(x,I),D=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);l&&(r=l.center.z,d=l.depth);const b={center:{x:w.x,y:w.y,z:r},width:_||DEFAULT_MIN_WIDTH,height:V||DEFAULT_MIN_HEIGHT,depth:d,rotation:D,id:e.id},S=__spreadValues(l?__spreadValues(__spreadValues({},l),b):__spreadProps(__spreadValues({},b),{attribute:"",valid:!0}),g);t&&Object.assign(S,t);const O=p.map(v=>lbUtils.PointCloudUtils.transferWorld2Canvas(v,o));return{boxParams:S,newPointList:O}},sideViewPoint2PointCloud=(e,o,i)=>{const l={x:e.x-o.x,y:e.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-l.x,y:i.center.y,z:i.center.z-l.y}})},sideViewPolygon2PointCloud=(e,o,i,l)=>{const[t,a,p]=e.pointList,[r,d,g]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([t,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([r,g]),w={x:{x:f.x-x.x,y:f.y-x.y}.x,y:0,z:f.y-x.y},V=lbAnnotation.MathUtils.getLineLength(t,a),_=lbAnnotation.MathUtils.getLineLength(r,d),D=V-_,b=lbAnnotation.MathUtils.getLineLength(a,p),S=lbAnnotation.MathUtils.getLineLength(d,g),O=b-S,{newBoxParams:v}=l.getNewBoxBySideUpdate(w,O,D,i);return v},backViewPoint2PointCloud=(e,o,i)=>{const l={x:e.x-o.x,y:e.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-l.x,z:i.center.z-l.y}})},backViewPolygon2PointCloud=(e,o,i,l)=>{const[t,a,p]=e.pointList,[r,d,g]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([t,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([r,g]),w={x:{x:f.x-x.x,y:f.y-x.y}.x,y:0,z:f.y-x.y},V=lbAnnotation.MathUtils.getLineLength(t,a),_=lbAnnotation.MathUtils.getLineLength(r,d),D=V-_,b=lbAnnotation.MathUtils.getLineLength(a,p),S=lbAnnotation.MathUtils.getLineLength(d,g),O=b-S;let{newBoxParams:v}=l.getNewBoxByBackUpdate(w,O,D,i);return v},syncSideViewByPoint=(e,o,i,l,t)=>{var a;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);r.setInitCameraPosition(d);const{point2d:g,zoom:f}=r.getSphereSidePoint2DCoordinate(e);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),g),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(e,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=a.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(d),t.setResultAndSelectedID([{id:o.id,valid:e.valid,pointList:r,textAttribute:"",isRect:!0,attribute:e.attribute}],o.id)},syncBackViewByPoint=(e,o,i,l,t)=>{var a;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);r.setInitCameraPosition(d);const{point2d:g,zoom:f}=r.getSphereBackPoint2DCoordinate(e);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),g),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(e,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=a.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(d),t.setResultAndSelectedID([{id:o.id,valid:e.valid,pointList:r,textAttribute:"",isRect:!0,attribute:e.attribute}],o.id)},syncTopViewByPoint=(e,o,i,l)=>{if(!i||!l)return;l.generateSphere(e),l.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),l.render();const{toolInstance:t,pointCloudInstance:a}=i,{point2d:p}=a.getSphereTopPoint2DCoordinate(e),r=[...t.pointList].map(d=>d.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:e.valid,textAttribute:"",attribute:e.attribute}):d);t.setResult(r),t.setSelectedID(o.id)},synchronizeTopView=(e,o,i,l)=>{var t;if(!i||!l)return;l.generateBox(e,o.id),l.render();const{pointCloud2dOperation:a,pointCloudInstance:p}=i,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(e),d=[...a.polygonList],g=d.find(f=>f.id===o.id);g?g.pointList=r:d.push({id:o.id,pointList:r,textAttribute:"",isRect:!0,valid:(t=e.valid)!=null?t:!0}),a.setResultAndSelectedID(d,o.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:l,mainViewInstance:t,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:f,hideAttributes:x}=e,{addHistory:I,initHistory:w,pushHistoryUnderUpdatePolygon:V,pushHistoryUnderUpdateLine:_}=useHistory.useHistory(),{selectedPolygon:D}=usePolygon.usePolygon(),{updateSelectedBox:b,updateSelectedBoxes:S,getPointCloudByID:O}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:v,updatePointCloudSphere:q,selectedSphere:j}=useSphere.useSphere(),{currentData:k,config:L}=ctx.useSelector(n=>{const{stepList:s,step:P,imgList:c,imgIndex:u}=n.annotation;return{currentData:c[u],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,s).config)}}),F=ctx.useDispatch(),{selectedBox:A}=useSingleBox.useSingleBox(),{t:G}=reactI18next.useTranslation(),N=A==null?void 0:A.info;if(!o||!i||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,Q=n=>{t==null||t.generateBox(n),t==null||t.controls.update(),t==null||t.render()},X=n=>{t==null||t.generateSphere(n),t==null||t.controls.update(),t==null||t.render()},Y=({newPoint:n,size:s,zoom:P,trackConfigurable:c})=>{var u;const C={attribute:(u=o.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:f})});const h=topViewPoint2PointCloud(n,s,E,void 0,C);r(n.id);const y=p(h);M(PointCloudView.Top,n,h,P,y,L),I({newSphereParams:h})},J=({polygon:n,size:s,imgList:P,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var h,y;const m={attribute:(h=o.toolInstance.defaultAttribute)!=null?h:""};c===!0&&Object.assign(m,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:f})});const T=o==null?void 0:o.toolInstance,U=__spreadValues({},n),{boxParams:B,newPointList:z}=topViewPolygon2PointCloud(U,s,E,void 0,m,C);if((L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(G("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),T.deletePolygon(B.id);return}C&&(z==null?void 0:z.length)&&(U.pointList=z);const rt=x.includes(U.attribute),H=a(B),lt=(y=e==null?void 0:e.polygonList)!=null?y:[];o==null||o.updatePolygonList(H!=null?H:[],lt),rt?r([]):(r(B.id),T.selection.setSelectedIDs(U.id),R(PointCloudView.Top,U,B,u,H),C&&synchronizeTopView(B,U,o,t)),I({newBoxParams:B})},K=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:P,newSphereList:c})=>{var u;const C=o==null?void 0:o.toolInstance;if(!(d.length===0||!C)){if(n||(A==null?void 0:A.info)){const h=n!=null?n:A==null?void 0:A.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(d[0]);const y=C.selectedPolygon;if(d.length===1&&h){R(PointCloudView.Top,y,h,void 0,s);return}}if((P||j)&&d.length===1){const h=P!=null?P:j;C.setSelectedID(d[0]);const y=C.selectedPoint;h&&M(PointCloudView.Top,y,h,void 0,c,L)}}},W=(n,s,P)=>{if(N){let c,u;switch(P){case PointCloudView.Back:c=backViewPolygon2PointCloud;break;case PointCloudView.Side:c=sideViewPolygon2PointCloud;break;default:c=sideViewPolygon2PointCloud;break}if(u=c(n,s,N,i.pointCloudInstance),t){const{count:h}=t.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=__spreadProps(__spreadValues({},u),{count:h})}const C=b(u);return R(P,n,u,void 0,C),C}},Z=(n,s,P)=>{if(j){let c,u;switch(P){case PointCloudView.Back:c=backViewPoint2PointCloud;break;case PointCloudView.Side:c=sideViewPoint2PointCloud;break;default:c=sideViewPoint2PointCloud;break}u=c(n,s,j);const C=q(u);return M(P,n,u,void 0,C,L),C}},$=(n,s)=>{Z(n,s,PointCloudView.Side)},tt=(n,s)=>{Z(n,s,PointCloudView.Back)},et=(n,s)=>{W(n,s,PointCloudView.Side)},ot=(n,s)=>{W(n,s,PointCloudView.Back)},it=(n,s)=>{_(n)},nt=(n,s)=>{const P=v(n.id),c=topViewPoint2PointCloud(n,s,E,P),u=q(c);M(PointCloudView.Top,n,c,void 0,u,L)},st=(n,s)=>{if(D){const c=n[0].newPolygon;c.pointList=c.pointList.map(u=>lbUtils.PointCloudUtils.transferCanvas2World(u,s)),V(n[0].newPolygon);return}const P=n.map(({newPolygon:c})=>{const u=O(c.id),{boxParams:C}=topViewPolygon2PointCloud(c,s,o.pointCloudInstance,u);return C});if(P.length===1){const{newPolygon:c}=n[0],u=S(P);R(PointCloudView.Top,c,P[0],void 0,u)}else{const c=S(P);c&&e.syncAllViewPointCloudColor(c)}},M=(n,s,P,c,u,C)=>__async(void 0,null,function*(){const h=k==null?void 0:k.url,y={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,s,i,h,C)},[PointCloudView.Back]:()=>{l&&syncBackViewByPoint(P,s,l,h,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,s,o,t)}};Object.keys(y).forEach(m=>{m!==n&&y[m]()}),c&&(t==null||t.updateCameraZoom(c)),X(P)}),R=(n,s,P,c,u)=>__async(void 0,null,function*(){const C=k==null?void 0:k.url;u&&(yield e.syncAllViewPointCloudColor(u));const h={[PointCloudView.Side]:()=>{synchronizeSideView(P,s,i,C)},[PointCloudView.Back]:()=>{l&&synchronizeBackView(P,s,l,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,s,o,t)}};Object.keys(h).forEach(y=>{y!==n&&h[y]()}),c&&(t==null||t.updateCameraZoom(c)),Q(P)});return{topViewAddSphere:Y,topViewAddBox:J,topViewSelectedChanged:K,topViewUpdatePoint:nt,sideViewUpdatePoint:$,backViewUpdatePoint:tt,topViewUpdateBox:st,topViewUpdateLine:it,sideViewUpdateBox:et,backViewUpdateBox:ot,pointCloudBoxListUpdated:n=>{o.updatePolygonList(n),t==null||t.generateBoxes(n)},initPointCloud3d:n=>{if(!t)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(n);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=k){var P,c,u,C,h,y;if(!(s==null?void 0:s.url)||!t)return;actionCreators.SetPointCloudLoading(F,!0),yield t.loadPCDFile(s.url,(P=L==null?void 0:L.radius)!=null?P:DEFAULT_RADIUS),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let m=[],T=[],U=[],B=[];s.result&&(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),U=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),T=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),B=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(m),t==null||t.generateSpheres(B),e.syncAllViewPointCloudColor(m)),w({pointCloudBoxList:m,polygonList:U,lineList:T,pointCloudSphereList:B}),t.updateTopCamera();const z=(u=(c=index.jsonParser(s.result))==null?void 0:c.valid)!=null?u:!0;e.setPointCloudValid(z),(C=e.sideViewInstance)==null||C.clearAllData(),(h=e.backViewInstance)==null||h.clearAllData(),o.updateData(s.url,s.result,{radius:(y=L==null?void 0:L.radius)!=null?y:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(F,!1)})}};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;
|
|
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"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,o,i)=>o in e?__defProp(e,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[o]=i,__spreadValues=(e,o)=>{for(var i in o||(o={}))__hasOwnProp.call(o,i)&&__defNormalProp(e,i,o[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(o))__propIsEnum.call(o,i)&&__defNormalProp(e,i,o[i]);return e},__spreadProps=(e,o)=>__defProps(e,__getOwnPropDescs(o)),__async=(e,o,i)=>new Promise((l,t)=>{var d=a=>{try{r(i.next(a))}catch(g){t(g)}},p=a=>{try{r(i.throw(a))}catch(g){t(g)}},r=a=>a.done?l(a.value):Promise.resolve(a.value).then(d,p);r((i=i.apply(e,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,o,i,l,t)=>{const{x:d,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(e,o),{defaultZ:r}=lbUtils.DEFAULT_SPHERE_PARAMS,a={center:{x:d,y:p,z:r},id:e.id},g=l?__spreadValues(__spreadValues({},l),a):__spreadProps(__spreadValues({},a),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},topViewPolygon2PointCloud=(e,o,i,l,t,d)=>{let p=e.pointList.map(v=>lbUtils.PointCloudUtils.transferCanvas2World(v,o)),r=0,a=1,g={};if(i){const v=i.getSensesPointZAxisInPolygon(p,void 0,d);d&&v.fittedCoordinates.length>0&&(p=v.fittedCoordinates),r=(v.maxZ+v.minZ)/2,a=v.maxZ-v.minZ,g={count:v.zCount}}const[f,x,_]=p,U=lbAnnotation.MathUtils.getLineCenterPoint([f,_]),b=lbAnnotation.MathUtils.getLineLength(f,x),I=lbAnnotation.MathUtils.getLineLength(x,_),D=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);l&&(r=l.center.z,a=l.depth);const V={center:{x:U.x,y:U.y,z:r},width:d?I+INTELLIGENT_FIT_MARGIN:I,height:d?b+INTELLIGENT_FIT_MARGIN:b,depth:a,rotation:D,id:e.id},S=__spreadValues(l?__spreadValues(__spreadValues({},l),V):__spreadProps(__spreadValues({},V),{attribute:"",valid:!0}),g);t&&Object.assign(S,t);const O=p.map(v=>lbUtils.PointCloudUtils.transferWorld2Canvas(v,o));return{boxParams:S,newPointList:O}},sideViewPoint2PointCloud=(e,o,i)=>{const l={x:e.x-o.x,y:e.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-l.x,y:i.center.y,z:i.center.z-l.y}})},sideViewPolygon2PointCloud=(e,o,i,l)=>{const[t,d,p]=e.pointList,[r,a,g]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([t,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([r,g]),U={x:{x:f.x-x.x,y:f.y-x.y}.x,y:0,z:f.y-x.y},b=lbAnnotation.MathUtils.getLineLength(t,d),I=lbAnnotation.MathUtils.getLineLength(r,a),D=b-I,V=lbAnnotation.MathUtils.getLineLength(d,p),S=lbAnnotation.MathUtils.getLineLength(a,g),O=V-S,{newBoxParams:v}=l.getNewBoxBySideUpdate(U,O,D,i);return v},backViewPoint2PointCloud=(e,o,i)=>{const l={x:e.x-o.x,y:e.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-l.x,z:i.center.z-l.y}})},backViewPolygon2PointCloud=(e,o,i,l)=>{const[t,d,p]=e.pointList,[r,a,g]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([t,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([r,g]),U={x:{x:f.x-x.x,y:f.y-x.y}.x,y:0,z:f.y-x.y},b=lbAnnotation.MathUtils.getLineLength(t,d),I=lbAnnotation.MathUtils.getLineLength(r,a),D=b-I,V=lbAnnotation.MathUtils.getLineLength(d,p),S=lbAnnotation.MathUtils.getLineLength(a,g),O=V-S;let{newBoxParams:v}=l.getNewBoxByBackUpdate(U,O,D,i);return v},syncSideViewByPoint=(e,o,i,l,t)=>{var d;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:a}=r.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);r.setInitCameraPosition(a);const{point2d:g,zoom:f}=r.getSphereSidePoint2DCoordinate(e);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),g),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(e,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=i;d.loadPCDFileByBox(l,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(p);const{polygon2d:r,zoom:a}=d.getBoxSidePolygon2DCoordinate(e);d.camera.zoom=a,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(a),t.setResultAndSelectedID([{id:o.id,valid:e.valid,pointList:r,textAttribute:"",isRect:!0,attribute:e.attribute}],o.id)},syncBackViewByPoint=(e,o,i,l,t)=>{var d;if(!i)return;const{toolInstance:p,pointCloudInstance:r}=i;r.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:a}=r.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);r.setInitCameraPosition(a);const{point2d:g,zoom:f}=r.getSphereBackPoint2DCoordinate(e);r.camera.zoom=f,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(f),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),g),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(e,o,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=i;d.loadPCDFileByBox(l,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(p);const{polygon2d:r,zoom:a}=d.getBoxBackPolygon2DCoordinate(e);d.camera.zoom=a,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(a),t.setResultAndSelectedID([{id:o.id,valid:e.valid,pointList:r,textAttribute:"",isRect:!0,attribute:e.attribute}],o.id)},syncTopViewByPoint=(e,o,i,l)=>{if(!i||!l)return;l.generateSphere(e),l.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),l.render();const{toolInstance:t,pointCloudInstance:d}=i,{point2d:p}=d.getSphereTopPoint2DCoordinate(e),r=[...t.pointList].map(a=>a.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:e.valid,textAttribute:"",attribute:e.attribute}):a);t.setResult(r),t.setSelectedID(o.id)},synchronizeTopView=(e,o,i,l)=>{var t;if(!i||!l)return;l.generateBox(e,o.id),l.render();const{pointCloud2dOperation:d,pointCloudInstance:p}=i,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(e),a=[...d.polygonList],g=a.find(f=>f.id===o.id);g?g.pointList=r:a.push({id:o.id,pointList:r,textAttribute:"",isRect:!0,valid:(t=e.valid)!=null?t:!0}),d.setResultAndSelectedID(a,o.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:l,mainViewInstance:t,addPointCloudBox:d,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:a,pointCloudBoxList:g,pointCloudSphereList:f,hideAttributes:x}=e,{addHistory:_,initHistory:U,pushHistoryUnderUpdatePolygon:b,pushHistoryUnderUpdateLine:I}=useHistory.useHistory(),{selectedPolygon:D}=usePolygon.usePolygon(),{updateSelectedBox:V,updateSelectedBoxes:S,getPointCloudByID:O}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:v,updatePointCloudSphere:H,selectedSphere:j}=useSphere.useSphere(),{currentData:k,config:L}=ctx.useSelector(n=>{const{stepList:s,step:P,imgList:c,imgIndex:u}=n.annotation;return{currentData:c[u],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,s).config)}}),N=ctx.useDispatch(),{selectedBox:A}=useSingleBox.useSingleBox(),{t:G}=reactI18next.useTranslation(),F=A==null?void 0:A.info;if(!o||!i||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,Q=n=>{t==null||t.generateBox(n),t==null||t.controls.update(),t==null||t.render()},X=n=>{t==null||t.generateSphere(n),t==null||t.controls.update(),t==null||t.render()},Y=({newPoint:n,size:s,zoom:P,trackConfigurable:c})=>{var u;const C={attribute:(u=o.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:f})});const h=topViewPoint2PointCloud(n,s,E,void 0,C);r(n.id);const y=p(h);M(PointCloudView.Top,n,h,P,y,L),_({newSphereParams:h})},J=({polygon:n,size:s,imgList:P,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var h,y;const m={attribute:(h=o.toolInstance.defaultAttribute)!=null?h:""};c===!0&&Object.assign(m,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:f})});const T=o==null?void 0:o.toolInstance,w=__spreadValues({},n),{boxParams:B,newPointList:z}=topViewPolygon2PointCloud(w,s,E,void 0,m,C);if((L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(G("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),T.deletePolygon(B.id);return}C&&(z==null?void 0:z.length)&&(w.pointList=z);const rt=x.includes(w.attribute),q=d(B),lt=(y=e==null?void 0:e.polygonList)!=null?y:[];o==null||o.updatePolygonList(q!=null?q:[],lt),rt?r([]):(r(B.id),T.selection.setSelectedIDs(w.id),R(PointCloudView.Top,w,B,u,q),C&&synchronizeTopView(B,w,o,t)),_({newBoxParams:B})},K=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:P,newSphereList:c})=>{var u;const C=o==null?void 0:o.toolInstance;if(!(a.length===0||!C)){if(n||(A==null?void 0:A.info)){const h=n!=null?n:A==null?void 0:A.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(a[0]);const y=C.selectedPolygon;if(a.length===1&&h){R(PointCloudView.Top,y,h,void 0,s);return}}if((P||j)&&a.length===1){const h=P!=null?P:j;C.setSelectedID(a[0]);const y=C.selectedPoint;h&&M(PointCloudView.Top,y,h,void 0,c,L)}}},Z=(n,s,P)=>{if(F){let c,u;switch(P){case PointCloudView.Back:c=backViewPolygon2PointCloud;break;case PointCloudView.Side:c=sideViewPolygon2PointCloud;break;default:c=sideViewPolygon2PointCloud;break}if(u=c(n,s,F,i.pointCloudInstance),t){const{count:h}=t.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=__spreadProps(__spreadValues({},u),{count:h})}const C=V(u);return R(P,n,u,void 0,C),C}},W=(n,s,P)=>{if(j){let c,u;switch(P){case PointCloudView.Back:c=backViewPoint2PointCloud;break;case PointCloudView.Side:c=sideViewPoint2PointCloud;break;default:c=sideViewPoint2PointCloud;break}u=c(n,s,j);const C=H(u);return M(P,n,u,void 0,C,L),C}},$=(n,s)=>{W(n,s,PointCloudView.Side)},tt=(n,s)=>{W(n,s,PointCloudView.Back)},et=(n,s)=>{Z(n,s,PointCloudView.Side)},ot=(n,s)=>{Z(n,s,PointCloudView.Back)},it=(n,s)=>{I(n)},nt=(n,s)=>{const P=v(n.id),c=topViewPoint2PointCloud(n,s,E,P),u=H(c);M(PointCloudView.Top,n,c,void 0,u,L)},st=(n,s)=>{if(D){const c=n[0].newPolygon;c.pointList=c.pointList.map(u=>lbUtils.PointCloudUtils.transferCanvas2World(u,s)),b(n[0].newPolygon);return}const P=n.map(({newPolygon:c})=>{const u=O(c.id),{boxParams:C}=topViewPolygon2PointCloud(c,s,o.pointCloudInstance,u);return C});if(P.length===1){const{newPolygon:c}=n[0],u=S(P);R(PointCloudView.Top,c,P[0],void 0,u)}else{const c=S(P);c&&e.syncAllViewPointCloudColor(c)}},M=(n,s,P,c,u,C)=>__async(void 0,null,function*(){const h=k==null?void 0:k.url,y={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,s,i,h,C)},[PointCloudView.Back]:()=>{l&&syncBackViewByPoint(P,s,l,h,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,s,o,t)}};Object.keys(y).forEach(m=>{m!==n&&y[m]()}),c&&(t==null||t.updateCameraZoom(c)),X(P)}),R=(n,s,P,c,u)=>__async(void 0,null,function*(){const C=k==null?void 0:k.url;u&&(yield e.syncAllViewPointCloudColor(u));const h={[PointCloudView.Side]:()=>{synchronizeSideView(P,s,i,C)},[PointCloudView.Back]:()=>{l&&synchronizeBackView(P,s,l,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,s,o,t)}};Object.keys(h).forEach(y=>{y!==n&&h[y]()}),c&&(t==null||t.updateCameraZoom(c)),Q(P)});return{topViewAddSphere:Y,topViewAddBox:J,topViewSelectedChanged:K,topViewUpdatePoint:nt,sideViewUpdatePoint:$,backViewUpdatePoint:tt,topViewUpdateBox:st,topViewUpdateLine:it,sideViewUpdateBox:et,backViewUpdateBox:ot,pointCloudBoxListUpdated:n=>{o.updatePolygonList(n),t==null||t.generateBoxes(n)},initPointCloud3d:n=>{if(!t)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(n);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=k){var P,c,u,C,h,y;if(!(s==null?void 0:s.url)||!t)return;actionCreators.SetPointCloudLoading(N,!0),yield t.loadPCDFile(s.url,(P=L==null?void 0:L.radius)!=null?P:DEFAULT_RADIUS),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let m=[],T=[],w=[],B=[];s.result&&(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),w=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),T=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),B=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(m),t==null||t.generateSpheres(B),e.syncAllViewPointCloudColor(m)),U({pointCloudBoxList:m,polygonList:w,lineList:T,pointCloudSphereList:B}),t.updateTopCamera();const z=(u=(c=index.jsonParser(s.result))==null?void 0:c.valid)!=null?u:!0;e.setPointCloudValid(z),(C=e.sideViewInstance)==null||C.clearAllData(),(h=e.backViewInstance)==null||h.clearAllData(),o.updateData(s.url,s.result,{radius:(y=L==null?void 0:L.radius)!=null?y:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(N,!1)})}};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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MathUtils as x,getCuboidFromPointCloudBox as At}from"@labelbee/lb-annotation";import{EPerspectiveView as N,PointCloudUtils as I,DEFAULT_SPHERE_PARAMS as Ut}from"@labelbee/lb-utils";import{useContext as kt}from"react";import{PointCloudContext as Tt}from"../PointCloudContext.js";import{useSingleBox as st}from"./useSingleBox.js";import{useSphere as zt}from"./useSphere.js";import{useSelector as jt,useDispatch as Rt}from"../../../store/ctx.js";import Ht from"../../../utils/StepUtils.js";import{jsonParser as rt}from"../../../utils/index.js";import{SetPointCloudLoading as lt}from"../../../store/annotation/actionCreators.js";import{message as Et}from"antd";import{useTranslation as Ft}from"react-i18next";import{useHistory as Nt}from"./useHistory.js";import{usePolygon as Wt}from"./usePolygon.js";var Zt=Object.defineProperty,Mt=Object.defineProperties,Gt=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertySymbols,Qt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,at=(o,e,n)=>e in o?Zt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,h=(o,e)=>{for(var n in e||(e={}))Qt.call(e,n)&&at(o,n,e[n]);if(dt)for(var n of dt(e))Xt.call(e,n)&&at(o,n,e[n]);return o},A=(o,e)=>Mt(o,Gt(e)),q=(o,e,n)=>new Promise((l,t)=>{var a=d=>{try{r(n.next(d))}catch(g){t(g)}},p=d=>{try{r(n.throw(d))}catch(g){t(g)}},r=d=>d.done?l(d.value):Promise.resolve(d.value).then(a,p);r((n=n.apply(o,e)).next())});const G=5,Q=90,Yt=.01,qt=.01,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(o,e,n,l,t)=>{const{x:a,y:p}=I.transferCanvas2World(o,e),{defaultZ:r}=Ut,d={center:{x:a,y:p,z:r},id:o.id},g=l?h(h({},l),d):A(h({},d),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},K=(o,e,n,l,t,a)=>{let p=o.pointList.map(m=>I.transferCanvas2World(m,e)),r=0,d=1,g={};if(n){const m=n.getSensesPointZAxisInPolygon(p,void 0,a);a&&m.fittedCoordinates.length>0&&(p=m.fittedCoordinates),r=(m.maxZ+m.minZ)/2,d=m.maxZ-m.minZ,g={count:m.zCount}}const[y,B,U]=p,O=x.getLineCenterPoint([y,U]),k=x.getLineLength(y,B),T=x.getLineLength(B,U),z=x.getRadiusFromQuadrangle(o.pointList);l&&(r=l.center.z,d=l.depth);const V={center:{x:O.x,y:O.y,z:r},width:T||Yt,height:k||qt,depth:d,rotation:z,id:o.id},D=h(l?h(h({},l),V):A(h({},V),{attribute:"",valid:!0}),g);t&&Object.assign(D,t);const j=p.map(m=>I.transferWorld2Canvas(m,e));return{boxParams:D,newPointList:j}},ct=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return A(h({},n),{center:{x:n.center.x-l.x,y:n.center.y,z:n.center.z-l.y}})},ut=(o,e,n,l)=>{const[t,a,p]=o.pointList,[r,d,g]=e.pointList,y=x.getLineCenterPoint([t,p]),B=x.getLineCenterPoint([r,g]),O={x:{x:y.x-B.x,y:y.y-B.y}.x,y:0,z:y.y-B.y},k=x.getLineLength(t,a),T=x.getLineLength(r,d),z=k-T,V=x.getLineLength(a,p),D=x.getLineLength(d,g),j=V-D,{newBoxParams:m}=l.getNewBoxBySideUpdate(O,j,z,n);return m},Jt=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return A(h({},n),{center:{x:n.center.x,y:n.center.y-l.x,z:n.center.z-l.y}})},Kt=(o,e,n,l)=>{const[t,a,p]=o.pointList,[r,d,g]=e.pointList,y=x.getLineCenterPoint([t,p]),B=x.getLineCenterPoint([r,g]),O={x:{x:y.x-B.x,y:y.y-B.y}.x,y:0,z:y.y-B.y},k=x.getLineLength(t,a),T=x.getLineLength(r,d),z=k-T,V=x.getLineLength(a,p),D=x.getLineLength(d,g),j=V-D;let{newBoxParams:m}=l.getNewBoxByBackUpdate(O,j,z,n);return m},pt=(o,e,n,l,t)=>{var a;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:Q);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(o,N.Left);r.setInitCameraPosition(d);const{point2d:g,zoom:y}=r.getSphereSidePoint2DCoordinate(o);r.camera.zoom=y,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(y),p.setResult([A(h(h({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),p.setSelectedID(e.id)},ft=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=n;a.loadPCDFileByBox(l,o,{width:G,depth:G});const{cameraPositionVector:p}=a.updateOrthoCamera(o,N.Left);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxSidePolygon2DCoordinate(o);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(d),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:r,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},Ct=(o,e,n,l,t)=>{var a;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:Q);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(o,N.Back);r.setInitCameraPosition(d);const{point2d:g,zoom:y}=r.getSphereBackPoint2DCoordinate(o);r.camera.zoom=y,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(y),p.setResult([A(h(h({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),p.setSelectedID(e.id)},gt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=n;a.loadPCDFileByBox(l,o,{height:G,depth:G});const{cameraPositionVector:p}=a.updateOrthoCamera(o,N.Back);a.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=a.getBoxBackPolygon2DCoordinate(o);a.camera.zoom=d,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(d),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:r,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},Pt=(o,e,n,l)=>{if(!n||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,N.Top),l.render();const{toolInstance:t,pointCloudInstance:a}=n,{point2d:p}=a.getSphereTopPoint2DCoordinate(o),r=[...t.pointList].map(d=>d.id===e.id?A(h(h({},e),p),{valid:o.valid,textAttribute:"",attribute:o.attribute}):d);t.setResult(r),t.setSelectedID(e.id)},$=(o,e,n,l)=>{var t;if(!n||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:a,pointCloudInstance:p}=n,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(o),d=[...a.polygonList],g=d.find(y=>y.id===e.id);g?g.pointList=r:d.push({id:e.id,pointList:r,textAttribute:"",isRect:!0,valid:(t=o.valid)!=null?t:!0}),a.setResultAndSelectedID(d,e.id)},$t=()=>{const o=kt(Tt),{topViewInstance:e,sideViewInstance:n,backViewInstance:l,mainViewInstance:t,addPointCloudBox:a,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:y,hideAttributes:B}=o,{addHistory:U,initHistory:O,pushHistoryUnderUpdatePolygon:k,pushHistoryUnderUpdateLine:T}=Nt(),{selectedPolygon:z}=Wt(),{updateSelectedBox:V,updateSelectedBoxes:D,getPointCloudByID:j}=st(),{getPointCloudSphereByID:m,updatePointCloudSphere:tt,selectedSphere:W}=zt(),{currentData:H,config:S}=jt(i=>{const{stepList:s,step:f,imgList:c,imgIndex:u}=i.annotation;return{currentData:c[u],config:rt(Ht.getCurrentStepInfo(f,s).config)}}),ot=Rt(),{selectedBox:R}=st(),{t:yt}=Ft(),et=R==null?void 0:R.info;if(!e||!n||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:X}=e,Lt=i=>{t==null||t.generateBox(i),t==null||t.controls.update(),t==null||t.render()},ht=i=>{t==null||t.generateSphere(i),t==null||t.controls.update(),t==null||t.render()},mt=({newPoint:i,size:s,zoom:f,trackConfigurable:c})=>{var u;const C={attribute:(u=e.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:y})});const P=J(i,s,X,void 0,C);r(i.id);const v=p(P);Z(L.Top,i,P,f,v,S),U({newSphereParams:P})},vt=({polygon:i,size:s,imgList:f,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var P,v;const w={attribute:(P=e.toolInstance.defaultAttribute)!=null?P:""};c===!0&&Object.assign(w,{trackID:I.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:y})});const E=e==null?void 0:e.toolInstance,_=h({},i),{boxParams:b,newPointList:F}=K(_,s,X,void 0,w,C);if((S==null?void 0:S.lowerLimitPointsNumInBox)&&typeof b.count=="number"&&b.count<S.lowerLimitPointsNumInBox){Et.info(yt("LowerLimitPointsNumInBox",{num:S.lowerLimitPointsNumInBox})),E.deletePolygon(b.id);return}C&&(F==null?void 0:F.length)&&(_.pointList=F);const Ot=B.includes(_.attribute),Y=a(b),Vt=(v=o==null?void 0:o.polygonList)!=null?v:[];e==null||e.updatePolygonList(Y!=null?Y:[],Vt),Ot?r([]):(r(b.id),E.selection.setSelectedIDs(_.id),M(L.Top,_,b,u,Y),C&&$(b,_,e,t)),U({newBoxParams:b})},xt=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:f,newSphereList:c})=>{var u;const C=e==null?void 0:e.toolInstance;if(!(d.length===0||!C)){if(i||(R==null?void 0:R.info)){const P=i!=null?i:R==null?void 0:R.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(d[0]);const v=C.selectedPolygon;if(d.length===1&&P){M(L.Top,v,P,void 0,s);return}}if((f||W)&&d.length===1){const P=f!=null?f:W;C.setSelectedID(d[0]);const v=C.selectedPoint;P&&Z(L.Top,v,P,void 0,c,S)}}},nt=(i,s,f)=>{if(et){let c,u;switch(f){case L.Back:c=Kt;break;case L.Side:c=ut;break;default:c=ut;break}if(u=c(i,s,et,n.pointCloudInstance),t){const{count:P}=t.getSensesPointZAxisInPolygon(At(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=A(h({},u),{count:P})}const C=V(u);return M(f,i,u,void 0,C),C}},it=(i,s,f)=>{if(W){let c,u;switch(f){case L.Back:c=Jt;break;case L.Side:c=ct;break;default:c=ct;break}u=c(i,s,W);const C=tt(u);return Z(f,i,u,void 0,C,S),C}},Bt=(i,s)=>{it(i,s,L.Side)},St=(i,s)=>{it(i,s,L.Back)},bt=(i,s)=>{nt(i,s,L.Side)},It=(i,s)=>{nt(i,s,L.Back)},wt=(i,s)=>{T(i)},Dt=(i,s)=>{const f=m(i.id),c=J(i,s,X,f),u=tt(c);Z(L.Top,i,c,void 0,u,S)},_t=(i,s)=>{if(z){const c=i[0].newPolygon;c.pointList=c.pointList.map(u=>I.transferCanvas2World(u,s)),k(i[0].newPolygon);return}const f=i.map(({newPolygon:c})=>{const u=j(c.id),{boxParams:C}=K(c,s,e.pointCloudInstance,u);return C});if(f.length===1){const{newPolygon:c}=i[0],u=D(f);M(L.Top,c,f[0],void 0,u)}else{const c=D(f);c&&o.syncAllViewPointCloudColor(c)}},Z=(i,s,f,c,u,C)=>q(void 0,null,function*(){const P=H==null?void 0:H.url,v={[L.Side]:()=>{pt(f,s,n,P,C)},[L.Back]:()=>{l&&Ct(f,s,l,P,C)},[L.Top]:()=>{Pt(f,s,e,t)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),c&&(t==null||t.updateCameraZoom(c)),ht(f)}),M=(i,s,f,c,u)=>q(void 0,null,function*(){const C=H==null?void 0:H.url;u&&(yield o.syncAllViewPointCloudColor(u));const P={[L.Side]:()=>{ft(f,s,n,C)},[L.Back]:()=>{l&>(f,s,l,C)},[L.Top]:()=>{$(f,s,e,t)}};Object.keys(P).forEach(v=>{v!==i&&P[v]()}),c&&(t==null||t.updateCameraZoom(c)),Lt(f)});return{topViewAddSphere:mt,topViewAddBox:vt,topViewSelectedChanged:xt,topViewUpdatePoint:Dt,sideViewUpdatePoint:Bt,backViewUpdatePoint:St,topViewUpdateBox:_t,topViewUpdateLine:wt,sideViewUpdateBox:bt,backViewUpdateBox:It,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),t==null||t.generateBoxes(i)},initPointCloud3d:i=>{if(!t)return;const s=I.getDefaultOrthographicParams(i);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...i)=>q(void 0,[...i],function*(s=H){var f,c,u,C,P,v;if(!(s==null?void 0:s.url)||!t)return;lt(ot,!0),yield t.loadPCDFile(s.url,(f=S==null?void 0:S.radius)!=null?f:Q),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let w=[],E=[],_=[],b=[];s.result&&(w=I.getBoxParamsFromResultList(s.result),_=I.getPolygonListFromResultList(s.result),E=I.getLineListFromResultList(s.result),b=I.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(w),t==null||t.generateSpheres(b),o.syncAllViewPointCloudColor(w)),O({pointCloudBoxList:w,polygonList:_,lineList:E,pointCloudSphereList:b}),t.updateTopCamera();const F=(u=(c=rt(s.result))==null?void 0:c.valid)!=null?u:!0;o.setPointCloudValid(F),(C=o.sideViewInstance)==null||C.clearAllData(),(P=o.backViewInstance)==null||P.clearAllData(),e.updateData(s.url,s.result,{radius:(v=S==null?void 0:S.radius)!=null?v:Q}),lt(ot,!1)})}};export{Ct as syncBackViewByPoint,pt as syncSideViewByPoint,Pt as syncTopViewByPoint,gt as synchronizeBackView,ft as synchronizeSideView,$ as synchronizeTopView,J as topViewPoint2PointCloud,K as topViewPolygon2PointCloud,$t as usePointCloudViews};
|
|
1
|
+
import{MathUtils as x,getCuboidFromPointCloudBox as Ut}from"@labelbee/lb-annotation";import{EPerspectiveView as F,PointCloudUtils as I,DEFAULT_SPHERE_PARAMS as kt}from"@labelbee/lb-utils";import{useContext as Tt}from"react";import{PointCloudContext as zt}from"../PointCloudContext.js";import{useSingleBox as st}from"./useSingleBox.js";import{useSphere as jt}from"./useSphere.js";import{useSelector as Rt,useDispatch as Et}from"../../../store/ctx.js";import Ht from"../../../utils/StepUtils.js";import{jsonParser as rt}from"../../../utils/index.js";import{SetPointCloudLoading as lt}from"../../../store/annotation/actionCreators.js";import{message as Nt}from"antd";import{useTranslation as Ft}from"react-i18next";import{useHistory as Zt}from"./useHistory.js";import{usePolygon as Wt}from"./usePolygon.js";var Mt=Object.defineProperty,Gt=Object.defineProperties,Qt=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertySymbols,Xt=Object.prototype.hasOwnProperty,Yt=Object.prototype.propertyIsEnumerable,at=(o,e,n)=>e in o?Mt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,h=(o,e)=>{for(var n in e||(e={}))Xt.call(e,n)&&at(o,n,e[n]);if(dt)for(var n of dt(e))Yt.call(e,n)&&at(o,n,e[n]);return o},k=(o,e)=>Gt(o,Qt(e)),q=(o,e,n)=>new Promise((l,t)=>{var d=a=>{try{r(n.next(a))}catch(g){t(g)}},p=a=>{try{r(n.throw(a))}catch(g){t(g)}},r=a=>a.done?l(a.value):Promise.resolve(a.value).then(d,p);r((n=n.apply(o,e)).next())});const G=5,Q=90,ct=.01,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(o,e,n,l,t)=>{const{x:d,y:p}=I.transferCanvas2World(o,e),{defaultZ:r}=kt,a={center:{x:d,y:p,z:r},id:o.id},g=l?h(h({},l),a):k(h({},a),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},K=(o,e,n,l,t,d)=>{let p=o.pointList.map(m=>I.transferCanvas2World(m,e)),r=0,a=1,g={};if(n){const m=n.getSensesPointZAxisInPolygon(p,void 0,d);d&&m.fittedCoordinates.length>0&&(p=m.fittedCoordinates),r=(m.maxZ+m.minZ)/2,a=m.maxZ-m.minZ,g={count:m.zCount}}const[y,B,T]=p,O=x.getLineCenterPoint([y,T]),V=x.getLineLength(y,B),A=x.getLineLength(B,T),z=x.getRadiusFromQuadrangle(o.pointList);l&&(r=l.center.z,a=l.depth);const U={center:{x:O.x,y:O.y,z:r},width:d?A+ct:A,height:d?V+ct:V,depth:a,rotation:z,id:o.id},_=h(l?h(h({},l),U):k(h({},U),{attribute:"",valid:!0}),g);t&&Object.assign(_,t);const j=p.map(m=>I.transferWorld2Canvas(m,e));return{boxParams:_,newPointList:j}},ut=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return k(h({},n),{center:{x:n.center.x-l.x,y:n.center.y,z:n.center.z-l.y}})},pt=(o,e,n,l)=>{const[t,d,p]=o.pointList,[r,a,g]=e.pointList,y=x.getLineCenterPoint([t,p]),B=x.getLineCenterPoint([r,g]),O={x:{x:y.x-B.x,y:y.y-B.y}.x,y:0,z:y.y-B.y},V=x.getLineLength(t,d),A=x.getLineLength(r,a),z=V-A,U=x.getLineLength(d,p),_=x.getLineLength(a,g),j=U-_,{newBoxParams:m}=l.getNewBoxBySideUpdate(O,j,z,n);return m},qt=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return k(h({},n),{center:{x:n.center.x,y:n.center.y-l.x,z:n.center.z-l.y}})},Jt=(o,e,n,l)=>{const[t,d,p]=o.pointList,[r,a,g]=e.pointList,y=x.getLineCenterPoint([t,p]),B=x.getLineCenterPoint([r,g]),O={x:{x:y.x-B.x,y:y.y-B.y}.x,y:0,z:y.y-B.y},V=x.getLineLength(t,d),A=x.getLineLength(r,a),z=V-A,U=x.getLineLength(d,p),_=x.getLineLength(a,g),j=U-_;let{newBoxParams:m}=l.getNewBoxByBackUpdate(O,j,z,n);return m},ft=(o,e,n,l,t)=>{var d;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:Q);const{cameraPositionVector:a}=r.updateOrthoCameraBySphere(o,F.Left);r.setInitCameraPosition(a);const{point2d:g,zoom:y}=r.getSphereSidePoint2DCoordinate(o);r.camera.zoom=y,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(y),p.setResult([k(h(h({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),p.setSelectedID(e.id)},Ct=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=n;d.loadPCDFileByBox(l,o,{width:G,depth:G});const{cameraPositionVector:p}=d.updateOrthoCamera(o,F.Left);d.setInitCameraPosition(p);const{polygon2d:r,zoom:a}=d.getBoxSidePolygon2DCoordinate(o);d.camera.zoom=a,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(a),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:r,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},gt=(o,e,n,l,t)=>{var d;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:Q);const{cameraPositionVector:a}=r.updateOrthoCameraBySphere(o,F.Back);r.setInitCameraPosition(a);const{point2d:g,zoom:y}=r.getSphereBackPoint2DCoordinate(o);r.camera.zoom=y,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(y),p.setResult([k(h(h({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),p.setSelectedID(e.id)},Pt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=n;d.loadPCDFileByBox(l,o,{height:G,depth:G});const{cameraPositionVector:p}=d.updateOrthoCamera(o,F.Back);d.setInitCameraPosition(p);const{polygon2d:r,zoom:a}=d.getBoxBackPolygon2DCoordinate(o);d.camera.zoom=a,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(a),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:r,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},yt=(o,e,n,l)=>{if(!n||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,F.Top),l.render();const{toolInstance:t,pointCloudInstance:d}=n,{point2d:p}=d.getSphereTopPoint2DCoordinate(o),r=[...t.pointList].map(a=>a.id===e.id?k(h(h({},e),p),{valid:o.valid,textAttribute:"",attribute:o.attribute}):a);t.setResult(r),t.setSelectedID(e.id)},$=(o,e,n,l)=>{var t;if(!n||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:d,pointCloudInstance:p}=n,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(o),a=[...d.polygonList],g=a.find(y=>y.id===e.id);g?g.pointList=r:a.push({id:e.id,pointList:r,textAttribute:"",isRect:!0,valid:(t=o.valid)!=null?t:!0}),d.setResultAndSelectedID(a,e.id)},Kt=()=>{const o=Tt(zt),{topViewInstance:e,sideViewInstance:n,backViewInstance:l,mainViewInstance:t,addPointCloudBox:d,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:a,pointCloudBoxList:g,pointCloudSphereList:y,hideAttributes:B}=o,{addHistory:T,initHistory:O,pushHistoryUnderUpdatePolygon:V,pushHistoryUnderUpdateLine:A}=Zt(),{selectedPolygon:z}=Wt(),{updateSelectedBox:U,updateSelectedBoxes:_,getPointCloudByID:j}=st(),{getPointCloudSphereByID:m,updatePointCloudSphere:tt,selectedSphere:Z}=jt(),{currentData:E,config:S}=Rt(i=>{const{stepList:s,step:f,imgList:c,imgIndex:u}=i.annotation;return{currentData:c[u],config:rt(Ht.getCurrentStepInfo(f,s).config)}}),ot=Et(),{selectedBox:R}=st(),{t:Lt}=Ft(),et=R==null?void 0:R.info;if(!e||!n||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:X}=e,ht=i=>{t==null||t.generateBox(i),t==null||t.controls.update(),t==null||t.render()},mt=i=>{t==null||t.generateSphere(i),t==null||t.controls.update(),t==null||t.render()},vt=({newPoint:i,size:s,zoom:f,trackConfigurable:c})=>{var u;const C={attribute:(u=e.toolInstance.defaultAttribute)!=null?u:""};c===!0&&Object.assign(C,{trackID:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:y})});const P=J(i,s,X,void 0,C);r(i.id);const v=p(P);W(L.Top,i,P,f,v,S),T({newSphereParams:P})},xt=({polygon:i,size:s,imgList:f,trackConfigurable:c,zoom:u,intelligentFit:C})=>{var P,v;const w={attribute:(P=e.toolInstance.defaultAttribute)!=null?P:""};c===!0&&Object.assign(w,{trackID:I.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:y})});const H=e==null?void 0:e.toolInstance,D=h({},i),{boxParams:b,newPointList:N}=K(D,s,X,void 0,w,C);if((S==null?void 0:S.lowerLimitPointsNumInBox)&&typeof b.count=="number"&&b.count<S.lowerLimitPointsNumInBox){Nt.info(Lt("LowerLimitPointsNumInBox",{num:S.lowerLimitPointsNumInBox})),H.deletePolygon(b.id);return}C&&(N==null?void 0:N.length)&&(D.pointList=N);const Vt=B.includes(D.attribute),Y=d(b),At=(v=o==null?void 0:o.polygonList)!=null?v:[];e==null||e.updatePolygonList(Y!=null?Y:[],At),Vt?r([]):(r(b.id),H.selection.setSelectedIDs(D.id),M(L.Top,D,b,u,Y),C&&$(b,D,e,t)),T({newBoxParams:b})},Bt=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:f,newSphereList:c})=>{var u;const C=e==null?void 0:e.toolInstance;if(!(a.length===0||!C)){if(i||(R==null?void 0:R.info)){const P=i!=null?i:R==null?void 0:R.info;(u=C==null?void 0:C.selection)==null||u.setSelectedIDs(a[0]);const v=C.selectedPolygon;if(a.length===1&&P){M(L.Top,v,P,void 0,s);return}}if((f||Z)&&a.length===1){const P=f!=null?f:Z;C.setSelectedID(a[0]);const v=C.selectedPoint;P&&W(L.Top,v,P,void 0,c,S)}}},nt=(i,s,f)=>{if(et){let c,u;switch(f){case L.Back:c=Jt;break;case L.Side:c=pt;break;default:c=pt;break}if(u=c(i,s,et,n.pointCloudInstance),t){const{count:P}=t.getSensesPointZAxisInPolygon(Ut(u).polygonPointList,[u.center.z-u.depth/2,u.center.z+u.depth/2]);u=k(h({},u),{count:P})}const C=U(u);return M(f,i,u,void 0,C),C}},it=(i,s,f)=>{if(Z){let c,u;switch(f){case L.Back:c=qt;break;case L.Side:c=ut;break;default:c=ut;break}u=c(i,s,Z);const C=tt(u);return W(f,i,u,void 0,C,S),C}},St=(i,s)=>{it(i,s,L.Side)},bt=(i,s)=>{it(i,s,L.Back)},It=(i,s)=>{nt(i,s,L.Side)},wt=(i,s)=>{nt(i,s,L.Back)},_t=(i,s)=>{A(i)},Dt=(i,s)=>{const f=m(i.id),c=J(i,s,X,f),u=tt(c);W(L.Top,i,c,void 0,u,S)},Ot=(i,s)=>{if(z){const c=i[0].newPolygon;c.pointList=c.pointList.map(u=>I.transferCanvas2World(u,s)),V(i[0].newPolygon);return}const f=i.map(({newPolygon:c})=>{const u=j(c.id),{boxParams:C}=K(c,s,e.pointCloudInstance,u);return C});if(f.length===1){const{newPolygon:c}=i[0],u=_(f);M(L.Top,c,f[0],void 0,u)}else{const c=_(f);c&&o.syncAllViewPointCloudColor(c)}},W=(i,s,f,c,u,C)=>q(void 0,null,function*(){const P=E==null?void 0:E.url,v={[L.Side]:()=>{ft(f,s,n,P,C)},[L.Back]:()=>{l&>(f,s,l,P,C)},[L.Top]:()=>{yt(f,s,e,t)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),c&&(t==null||t.updateCameraZoom(c)),mt(f)}),M=(i,s,f,c,u)=>q(void 0,null,function*(){const C=E==null?void 0:E.url;u&&(yield o.syncAllViewPointCloudColor(u));const P={[L.Side]:()=>{Ct(f,s,n,C)},[L.Back]:()=>{l&&Pt(f,s,l,C)},[L.Top]:()=>{$(f,s,e,t)}};Object.keys(P).forEach(v=>{v!==i&&P[v]()}),c&&(t==null||t.updateCameraZoom(c)),ht(f)});return{topViewAddSphere:vt,topViewAddBox:xt,topViewSelectedChanged:Bt,topViewUpdatePoint:Dt,sideViewUpdatePoint:St,backViewUpdatePoint:bt,topViewUpdateBox:Ot,topViewUpdateLine:_t,sideViewUpdateBox:It,backViewUpdateBox:wt,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),t==null||t.generateBoxes(i)},initPointCloud3d:i=>{if(!t)return;const s=I.getDefaultOrthographicParams(i);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...i)=>q(void 0,[...i],function*(s=E){var f,c,u,C,P,v;if(!(s==null?void 0:s.url)||!t)return;lt(ot,!0),yield t.loadPCDFile(s.url,(f=S==null?void 0:S.radius)!=null?f:Q),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let w=[],H=[],D=[],b=[];s.result&&(w=I.getBoxParamsFromResultList(s.result),D=I.getPolygonListFromResultList(s.result),H=I.getLineListFromResultList(s.result),b=I.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(w),t==null||t.generateSpheres(b),o.syncAllViewPointCloudColor(w)),O({pointCloudBoxList:w,polygonList:D,lineList:H,pointCloudSphereList:b}),t.updateTopCamera();const N=(u=(c=rt(s.result))==null?void 0:c.valid)!=null?u:!0;o.setPointCloudValid(N),(C=o.sideViewInstance)==null||C.clearAllData(),(P=o.backViewInstance)==null||P.clearAllData(),e.updateData(s.url,s.result,{radius:(v=S==null?void 0:S.radius)!=null?v:Q}),lt(ot,!1)})}};export{gt as syncBackViewByPoint,ft as syncSideViewByPoint,yt as syncTopViewByPoint,Pt as synchronizeBackView,Ct as synchronizeSideView,$ as synchronizeTopView,J as topViewPoint2PointCloud,K as topViewPolygon2PointCloud,Kt as usePointCloudViews};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.12.2
|
|
3
|
+
"version": "1.12.2",
|
|
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.16.1
|
|
46
|
+
"@labelbee/lb-annotation": "1.16.1",
|
|
47
47
|
"@labelbee/lb-utils": "1.8.0",
|
|
48
48
|
"ahooks": "^3.4.0",
|
|
49
49
|
"classnames": "^2.3.0",
|