@labelbee/lb-components 1.8.0-alpha.1 → 1.8.0-alpha.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.
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudBackView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
- package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/hooks/usePolygon.js +1 -1
- package/dist/components/pointCloudView/hooks/useRotate.js +1 -1
- package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +2 -1
- package/dist/types/components/pointCloudView/PointCloudListener.d.ts +4 -1
- package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +4 -3
- package/dist/types/components/pointCloudView/hooks/usePolygon.d.ts +2 -0
- package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +2 -2
- package/dist/views/MainView/toolFooter/PageNumber/index.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js.map +1 -1
- package/es/components/pointCloudView/PointCloudBackView.js +1 -1
- package/es/components/pointCloudView/PointCloudBackView.js.map +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js.map +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js.map +1 -1
- package/es/components/pointCloudView/PointCloudTopView.js +1 -1
- package/es/components/pointCloudView/PointCloudTopView.js.map +1 -1
- package/es/components/pointCloudView/hooks/useHistory.js +1 -1
- package/es/components/pointCloudView/hooks/useHistory.js.map +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js.map +1 -1
- package/es/components/pointCloudView/hooks/usePolygon.js +1 -1
- package/es/components/pointCloudView/hooks/usePolygon.js.map +1 -1
- package/es/components/pointCloudView/hooks/useRotate.js +1 -1
- package/es/components/pointCloudView/hooks/useRotate.js.map +1 -1
- package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
- package/es/components/pointCloudView/hooks/useSingleBox.js.map +1 -1
- package/es/components/pointCloudView/index.js +1 -1
- package/es/components/pointCloudView/index.js.map +1 -1
- package/es/views/MainView/toolFooter/PageNumber/index.js +1 -1
- package/es/views/MainView/toolFooter/PageNumber/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{}}),PointCloudViewIcon=({perspectiveView:e})=>{const{isActive:t,setTarget3DView:r}=React.useContext(PointCloud3DContext),
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{}}),PointCloudViewIcon=({perspectiveView:e})=>{const{isActive:t,setTarget3DView:r}=React.useContext(PointCloud3DContext),o=c=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",c)]:!0,active:t});return React__default.default.createElement("span",{onClick:()=>{r(lbUtils.EPerspectiveView[e])},className:o(e.toLocaleLowerCase())})},PointCloud3DSideBar=()=>{const{reset3DView:e}=React.useContext(PointCloud3DContext);return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Top"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Front"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Left"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Back"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Right"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"LFT"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"RBT"}),React__default.default.createElement("span",{onClick:()=>{e()},className:dom.getClassName("point-cloud-3d-view","reset")}))},PointCloud3D=({currentData:e,config:t})=>{var r;const o=React.useContext(PointCloudContext.PointCloudContext),[c,C]=React.useState(!0),u=React.useRef(null),{initPointCloud3d:d}=usePointCloudViews.usePointCloudViews(),n=useSize(u),{t:v}=reactI18next.useTranslation();React.useEffect(()=>{!o.mainViewInstance||d==null||d(n)},[n]);const{selectedBox:l}=useSingleBox.useSingleBox(),m=i=>{var a;const s=l==null?void 0:l.info;s&&((a=o.mainViewInstance)==null||a.updateCameraByBox(s,i))},w=()=>{var i;(i=o.mainViewInstance)==null||i.resetCamera()};React.useEffect(()=>{var i;if(u.current&&(e==null?void 0:e.url)){let a=o.mainViewInstance;if(!a&&n.width){const s={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};a=new lbAnnotation.PointCloud({container:u.current,isOrthographicCamera:!0,orthographicParams:s}),o.setMainViewInstance(a)}if(e.result){const s=lbUtils.PointCloudUtils.getBoxParamsFromResultList(e.result);s.forEach(p=>{var f;const x=(f=lbUtils.toolStyleConverter.getColorFromConfig({attribute:p.attribute},__spreadProps(__spreadValues({},t),{attributeConfigurable:!0}),{}))==null?void 0:f.hex;a==null||a.generateBox(p,x)}),o.setPointCloudResult(s),o.setPointCloudValid((i=index.jsonParser(e.result))==null?void 0:i.valid)}}},[e,n]),React.useEffect(()=>{l&&m(lbUtils.EPerspectiveView.Top)},[l]);const P=React.useMemo(()=>({reset3DView:w,setTarget3DView:m,isActive:!!l}),[l]),g=React__default.default.createElement("div",null,React__default.default.createElement("span",{style:{marginRight:8}},v("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:c,onChange:i=>{var a;C(i),(a=o.mainViewInstance)==null||a.setShowDirection(i)}}));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-3d-container"),title:v("3DView"),toolbar:g,style:{height:e.mappingImgList&&((r=e.mappingImgList)==null?void 0:r.length)>0?"55%":"100%"}},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},React__default.default.createElement(PointCloud3DContext.Provider,{value:P},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:u})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),dom=require("../../utils/dom.js"),PointCloudLayout=require("./PointCloudLayout.js"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),useSingleBox=require("./hooks/useSingleBox.js"),lbUtils=require("@labelbee/lb-utils"),PointCloudInfos=require("./PointCloudInfos.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),index=require("./components/EmptyPage/index.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),dom=require("../../utils/dom.js"),PointCloudLayout=require("./PointCloudLayout.js"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),useSingleBox=require("./hooks/useSingleBox.js"),lbUtils=require("@labelbee/lb-utils"),PointCloudInfos=require("./PointCloudInfos.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),index=require("./components/EmptyPage/index.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React);const TransferCanvas2WorldOffset=(n,a,r=1)=>{const{width:e,height:t}=a,o={x:n.x+e*r/2,y:n.y+t*r/2},l={x:a.width/2,y:a.height/2};return{offsetX:(l.x-o.x)/r,offsetY:-(l.y-o.y)/r}},updateBackViewByCanvas2D=(n,a,r,e,t)=>{const{offsetX:o,offsetY:l}=TransferCanvas2WorldOffset(n,r,a);if(t.camera.zoom=a,n){const f=Math.cos(e.rotation),d=Math.sin(e.rotation),i=o*f,u=o*d,{x:s,y:c,z:C}=t.initCameraPosition;t.camera.position.set(s+u,c-i,C+l)}t.camera.updateProjectionMatrix(),t.render()},PointCloudSideView=({currentData:n,config:a,checkMode:r})=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),t=React.useRef(null),o=useSize(t),{selectedBox:l}=useSingleBox.useSingleBox(),{t:f}=reactI18next.useTranslation(),{backViewUpdateBox:d}=usePointCloudViews.usePointCloudViews();return React.useEffect(()=>{if(t.current){const i={width:t.current.clientWidth,height:t.current.clientHeight},u=new lbAnnotation.PointCloudAnnotation({container:t.current,size:i,polygonOperationProps:{showDirectionLine:!1,forbidAddNew:!0},config:a,checkMode:r});e.setBackViewInstance(u)}},[]),React.useEffect(()=>{if(!o||!e.backViewInstance)return;const{pointCloud2dOperation:i,pointCloudInstance:u}=e.backViewInstance;i.singleOn("renderZoom",(s,c)=>{!e.selectedPointCloudBox||updateBackViewByCanvas2D(c,s,o,e.selectedPointCloudBox,u)}),i.singleOn("dragMove",({currentPos:s,zoom:c})=>{!e.selectedPointCloudBox||updateBackViewByCanvas2D(s,c,o,e.selectedPointCloudBox,u)}),i.singleOn("updatePolygonByDrag",({newPolygon:s,originPolygon:c})=>{d==null||d(s,c)})},[e,o]),React.useEffect(()=>{var i;(i=e==null?void 0:e.backViewInstance)==null||i.initSize(o)},[o]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","back-view"),title:f("BackView"),toolbar:React__default.default.createElement(PointCloudInfos.SizeInfoForView,{perspectiveView:lbUtils.EPerspectiveView.Back})},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","bottom-view-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","core-instance"),ref:t}),!l&&React__default.default.createElement(index,null)))};var PointCloudBackView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSideView);module.exports=PointCloudBackView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),React=require("react");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],polygonList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),React=require("react");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],polygonList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],setPolygonList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,syncAllViewPointCloudColor:()=>{}}),PointCloudProvider=({children:o})=>{const[s,r]=React.useState([]),[u,V]=React.useState([]),[t,a]=React.useState([]),[C,I]=React.useState(!0),[P,v]=React.useState(1),[c,x]=React.useState(),[f,m]=React.useState(),[w,A]=React.useState(),[i,g]=React.useState(),B=React.useRef(new lbAnnotation.ActionsHistory).current,S=React.useMemo(()=>t.length===1?t[0]:"",[t]),h=React.useMemo(()=>{const L=s.find(e=>e.id===S),b=e=>{const n=s.concat(e);return r(n),n},_=e=>{I(e!==!1)},l=e=>{e===void 0&&a([]),typeof e=="string"&&a([e]),Array.isArray(e)&&a(Array.from(new Set(e)))};return{selectedID:S,pointCloudBoxList:s,selectedIDs:t,setPointCloudResult:r,setSelectedIDs:l,addPointCloudBox:b,valid:C,selectedPointCloudBox:L,setPointCloudValid:_,addSelectedID:e=>{t.includes(e)?l(t.filter(n=>n!==e)):l([...t,e])},selectedAllBoxes:()=>{l(s.map(e=>e.id))},topViewInstance:c,setTopViewInstance:x,sideViewInstance:f,setSideViewInstance:m,backViewInstance:w,setBackViewInstance:A,mainViewInstance:i,setMainViewInstance:g,polygonList:u,setPolygonList:V,zoom:P,setZoom:v,history:B,syncAllViewPointCloudColor:e=>{const n=i==null?void 0:i.highlightOriginPointCloud(e);return new Promise(D=>{n==null||n.then(d=>{[c].forEach(p=>{var y;d&&((y=p==null?void 0:p.pointCloudInstance)==null||y.updateColor(d),D({color:d}))})})})}}},[C,t,s,u,c,f,w,i,P]);return React__default.default.createElement(PointCloudContext.Provider,{value:h},o)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),annotation=require("../../hooks/annotation.js"),useStatus=require("./hooks/useStatus.js"),index=require("../../utils/index.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"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(n,r,
|
|
1
|
+
"use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),annotation=require("../../hooks/annotation.js"),useStatus=require("./hooks/useStatus.js"),index=require("../../utils/index.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"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(n,r,i)=>r in n?__defProp(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i,__spreadValues=(n,r)=>{for(var i in r||(r={}))__hasOwnProp.call(r,i)&&__defNormalProp(n,i,r[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(r))__propIsEnum.call(r,i)&&__defNormalProp(n,i,r[i]);return n},__spreadProps=(n,r)=>__defProps(n,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:n,config:r,checkMode:i})=>{const o=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:m,selectNextBox:g,selectPrevBox:h,updateSelectedBox:b}=useSingleBox.useSingleBox(),{clearAllResult:p}=useStatus.useStatus(),k=index.jsonParser(n.result),{copySelectedBoxes:_,pasteSelectedBoxes:B,copiedBoxes:S}=useBoxes.useBoxes(),{toolInstanceRef:a}=annotation.useCustomToolInstance({basicInfo:k}),{updateRotate:v}=useRotate.useRotate({currentData:n}),{updatePointCloudData:f,topViewSelectedChanged:V}=usePointCloudViews.usePointCloudViews(),{redo:P,undo:y,pushHistoryWithList:I,pushHistoryUnderUpdatePolygon:A}=useHistory.useHistory(),{syncThreeViewsAttribute:C}=useAttribute.useAttribute(),{syncAllViewsConfig:O,reRenderTopViewRange:j}=useConfig.useConfig(),{selectedPolygon:w}=usePolygon.usePolygon(),q=(e,t)=>{var s;const{topViewInstance:u,mainViewInstance:c}=o;if(!u)return;const{pointCloud2dOperation:l}=u;switch(e){case"q":{v(2);break}case"e":v(-2);break;case"g":v(180);break;case"u":{const d=l.pattern===EPolygonPattern.Normal?EPolygonPattern.Rect:EPolygonPattern.Normal;l.setPattern(d);const E={[EPolygonPattern.Normal]:"Normal Pattern",[EPolygonPattern.Rect]:"Rect Pattern"};antd.message.success(`Change Pattern to ${E[d]} successfully`),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":c==null||c.updatePointSize(!0);break;case"-":c==null||c.updatePointSize(!1);break;case"v":o.setPointCloudValid(!o.valid);break;case"tab":if(t.shiftKey){h();break}g();break;case"f":m();break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const d=lbAnnotation.AttributeUtils.getAttributeByKeycode(t.keyCode,r.attributeList);d!==void 0&&a.current.setDefaultAttribute(d)}return}}},L=(e,t)=>{switch(e){case"c":_();break;case"v":B();break;case"a":o.selectedAllBoxes();break;case"z":{t.shiftKey?P():y();break}}},x=e=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(e)||i===!0)return;const t=e.key.toLocaleLowerCase();if(e.ctrlKey){L(t,e);return}q(t,e)};return React.useEffect(()=>{const{topViewInstance:e}=o;if(!!e)return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x)}},[o,S,r,o.pointCloudBoxList,o.polygonList]),React.useEffect(()=>{O(r)},[r]),React.useEffect(()=>{(r==null?void 0:r.radius)&&j(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{f==null||f()},[n,o.mainViewInstance]),React.useEffect(()=>{a.current.exportData=()=>[o.pointCloudBoxList,{valid:o.valid}],a.current.exportCustomData=()=>{var e;return{resultPolygon:(e=o.polygonList)!=null?e:[]}},a.current.setDefaultAttribute=e=>{C(e);const t=o.selectedPointCloudBox;if(t){t.attribute=e;const s=b(t);o.mainViewInstance&&V(t,s)}w&&A(__spreadProps(__spreadValues({},w),{attribute:e}))},a.current.setSubAttribute=(e,t)=>{var s;const u=o.selectedPointCloudBox;if(u){const c=(s=u==null?void 0:u.subAttribute)!=null?s:{};u.subAttribute=__spreadProps(__spreadValues({},c),{[e]:t}),b(u)}},a.current.clearResult=()=>{p==null||p()},a.current.redo=()=>{P()},a.current.undo=()=>{y()},a.current.setValid=e=>{a.current.valid=e,setTimeout(()=>{o.setPointCloudValid(e),e===!1&&p()})},a.current.setForbidOperation=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&o.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=e=>{var t,s;(s=(t=o.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)}},[o.pointCloudBoxList,o.selectedID,o.valid,o.polygonList,o.mainViewInstance]),React.useEffect(()=>{a.current.history={pushHistory:e=>{I({pointCloudBoxList:e})},initRecord:()=>{}}},[]),React.useEffect(()=>{var e;const t=(e=o.topViewInstance)==null?void 0:e.pointCloud2dOperation;if(!t)return;const s=l=>{C(l)},u=l=>{antd.message.error(l)},c=l=>{antd.message.info(l)};return t.on("syncAttribute",s),t.on("messageError",u),t.on("messageInfo",c),()=>{t.unbind("syncAttribute",s),t.unbind("messageError",u),t.unbind("messageInfo",c)}},[o.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),index$1=require("../../views/MainView/toolFooter/index.js"),index$2=require("../../views/MainView/toolFooter/ZoomController/index.js"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useSingleBox=require("./hooks/useSingleBox.js"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudInfos=require("./PointCloudInfos.js"),usePolygon=require("./hooks/usePolygon.js"),useZoom=require("./hooks/useZoom.js"),antd=require("antd"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),index$1=require("../../views/MainView/toolFooter/index.js"),index$2=require("../../views/MainView/toolFooter/ZoomController/index.js"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useSingleBox=require("./hooks/useSingleBox.js"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudInfos=require("./PointCloudInfos.js"),usePolygon=require("./hooks/usePolygon.js"),useZoom=require("./hooks/useZoom.js"),antd=require("antd"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,i,l)=>i in e?__defProp(e,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[i]=l,__spreadValues=(e,i)=>{for(var l in i||(i={}))__hasOwnProp.call(i,l)&&__defNormalProp(e,l,i[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(i))__propIsEnum.call(i,l)&&__defNormalProp(e,l,i[l]);return e},__spreadProps=(e,i)=>__defProps(e,__getOwnPropDescs(i));const{EPolygonPattern}=lbAnnotation.cTool,TransferCanvas2WorldOffset=(e,i,l=1)=>{const{width:d,height:p}=i,m={x:e.x+d*l/2,y:e.y+p*l/2},f={x:i.width/2,y:i.height/2};return{offsetX:(f.x-m.x)/l,offsetY:-(f.y-m.y)/l}},TopViewToolbar=({currentData:e})=>{const{zoom:i,zoomIn:l,zoomOut:d,initialPosition:p}=useZoom.useZoom(),{selectNextBox:m,selectPrevBox:f}=useSingleBox.useSingleBox(),{updateRotate:r}=useRotate.useRotate({currentData:e}),t=2,a=()=>{r(-t)},C=()=>{r(t)},P=()=>{r(180)};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("span",{onClick:C,className:dom.getClassName("point-cloud","rotate-reserve")}),React__default.default.createElement("span",{onClick:a,className:dom.getClassName("point-cloud","rotate")}),React__default.default.createElement("span",{onClick:P,className:dom.getClassName("point-cloud","rotate-180")}),React__default.default.createElement(index$1.FooterDivider,null),React__default.default.createElement(icons.UpSquareOutlined,{onClick:()=>{f()},className:dom.getClassName("point-cloud","prev")}),React__default.default.createElement(icons.DownSquareOutlined,{onClick:()=>{m()},className:dom.getClassName("point-cloud","next")}),React__default.default.createElement(index$1.FooterDivider,null),React__default.default.createElement(index$2.ZoomController,{initialPosition:p,zoomIn:l,zoomOut:d,zoom:i}))},ZAxisSlider=({setZAxisLimit:e,zAxisLimit:i,checkMode:l})=>l?null:React__default.default.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},React__default.default.createElement(antd.Slider,{vertical:!0,step:.5,max:10,min:.5,defaultValue:i,onAfterChange:d=>{e(d)}})),PointCloudTopView=({currentData:e,imgList:i,stepInfo:l,drawLayerSlot:d,checkMode:p})=>{const[m,f]=React.useState({zoom:1,currentPos:{x:0,y:0}}),r=React.useRef(null),t=React__default.default.useContext(PointCloudContext.PointCloudContext),a=useSize(r),C=index.jsonParser(l.config),{setZoom:P}=useZoom.useZoom(),{addPolygon:I,deletePolygon:O}=usePolygon.usePolygon(),{deletePointCloudBox:h,changeValidByID:E}=useSingleBox.useSingleBox(),[w,_]=React.useState(10),{t:q}=reactI18next.useTranslation(),g=usePointCloudViews.usePointCloudViews();return React.useLayoutEffect(()=>{if(!t.topViewInstance&&r.current&&(e==null?void 0:e.url)&&(e==null?void 0:e.result)){const n={width:r.current.clientWidth,height:r.current.clientHeight},u=new lbAnnotation.PointCloudAnnotation({container:r.current,size:n,pcdPath:e.url,config:C,checkMode:p});t.setTopViewInstance(u)}},[e]),React.useEffect(()=>{if(!a||!t.topViewInstance||!t.sideViewInstance)return;const{pointCloud2dOperation:n}=t.topViewInstance;n.singleOn("polygonCreated",(o,s)=>{if(n.pattern===EPolygonPattern.Normal||!(e==null?void 0:e.url)){const c=__spreadProps(__spreadValues({},o),{pointList:o.pointList.map(v=>lbUtils.PointCloudUtils.transferCanvas2World(v,a))});I(c),t.setSelectedIDs(o.id);return}g.topViewAddBox({newPolygon:o,size:a,imgList:i,trackConfigurable:C.trackConfigurable,zoom:s})}),n.singleOn("deletedObject",({id:o})=>{h(o),O(o)}),n.singleOn("deleteSelectedIDs",()=>{t.setSelectedIDs([])}),n.singleOn("addSelectedIDs",o=>{t.addSelectedID(o)}),n.singleOn("setSelectedIDs",o=>{t.setSelectedIDs(o)}),n.singleOn("updatePolygonByDrag",({newPolygon:o})=>{var s;(s=g.topViewUpdateBox)==null||s.call(g,o,a)});const u=o=>{var s;const c=E(o);c&&t.syncAllViewPointCloudColor(c),t.polygonList.find(v=>v.id===o)&&((s=t.topViewInstance)==null||s.pointCloud2dOperation.setPolygonValidAndRender(o,!0))};return n.on("validUpdate",u),()=>{n.unbind("validUpdate",u)}},[t,a,e,g,t.polygonList]),React.useEffect(()=>{if(!(a==null?void 0:a.width)||!t.topViewInstance)return;t.topViewInstance.initSize(a),t.topViewInstance.updatePolygonList(t.pointCloudBoxList,t.polygonList);const{topViewInstance:{pointCloudInstance:n,pointCloud2dOperation:u}}=t;u.singleOn("renderZoom",(o,s)=>{const{offsetX:c,offsetY:v}=TransferCanvas2WorldOffset(s,a,o);if(n.camera.zoom=o,s){const{x,y,z:V}=n.initCameraPosition;n.camera.position.set(x+v,y-c,V)}n.camera.updateProjectionMatrix(),n.render(),P(o),f({zoom:o,currentPos:s})}),u.singleOn("dragMove",({currentPos:o,zoom:s})=>{const{offsetX:c,offsetY:v}=TransferCanvas2WorldOffset(o,a,s);n.camera.zoom=s;const{x,y,z:V}=n.initCameraPosition;n.camera.position.set(x+v,y-c,V),n.render(),f({zoom:s,currentPos:o})})},[a,t.topViewInstance]),React.useEffect(()=>{var n,u;(u=(n=t.topViewInstance)==null?void 0:n.pointCloudInstance)==null||u.applyZAxisPoints(w)},[w]),React.useEffect(()=>{g.topViewSelectedChanged()},[t.selectedIDs]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","top-view"),title:q("TopView"),toolbar:React__default.default.createElement(TopViewToolbar,{currentData:e})},React__default.default.createElement("div",{style:{position:"relative",flex:1}},React__default.default.createElement("div",{style:{width:"100%",height:"100%"},ref:r},d==null?void 0:d(m)),React__default.default.createElement(PointCloudInfos.BoxInfos,{checkMode:p,config:C}),React__default.default.createElement(ZAxisSlider,{checkMode:p,zAxisLimit:w,setZAxisLimit:_}),React__default.default.createElement(PointCloudInfos.PointCloudValidity,null)))};var PointCloudTopView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudTopView);module.exports=PointCloudTopView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,e,s)=>e in i?__defProp(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s,__spreadValues=(i,e)=>{for(var s in e||(e={}))__hasOwnProp.call(e,s)&&__defNormalProp(i,s,e[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(e))__propIsEnum.call(e,s)&&__defNormalProp(i,s,e[s]);return i};const useHistory=()=>{const{history:i,setPointCloudResult:e,setSelectedIDs:s,pointCloudBoxList:r,mainViewInstance:u,topViewInstance:y,polygonList:d,setPolygonList:f}=React.useContext(PointCloudContext.PointCloudContext),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,e,s)=>e in i?__defProp(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s,__spreadValues=(i,e)=>{for(var s in e||(e={}))__hasOwnProp.call(e,s)&&__defNormalProp(i,s,e[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(e))__propIsEnum.call(e,s)&&__defNormalProp(i,s,e[s]);return i};const useHistory=()=>{const{history:i,setPointCloudResult:e,setSelectedIDs:s,pointCloudBoxList:r,mainViewInstance:u,topViewInstance:y,polygonList:d,setPolygonList:f,syncAllViewPointCloudColor:L}=React.useContext(PointCloudContext.PointCloudContext),C=({newBoxParams:t,newPolygon:o})=>{const n={pointCloudBoxList:r,polygonList:d};t&&(n.pointCloudBoxList=r.concat(t)),o&&(n.polygonList=d.concat(o)),i.pushHistory(n)},P=t=>{const o={pointCloudBoxList:r,polygonList:d};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),i.pushHistory(o)},g=t=>{if(d.find(n=>n.id===t.id)){const n=d.map(c=>c.id===t.id?t:__spreadValues({},c));i.pushHistory({pointCloudBoxList:r,polygonList:n}),f(n)}},x=({pointCloudBoxList:t,polygonList:o})=>{i.initRecord([{pointCloudBoxList:t,polygonList:o}],!0)},a=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:n=[]}=t;if(o){r.length!==o.length&&s();const c=r.filter(l=>o.findIndex(p=>p.id===l.id)>=0),h=o.filter(l=>r.findIndex(p=>p.id!==l.id)>=0);c.forEach(l=>{u==null||u.removeObjectByName(l.id)}),h.forEach(l=>{u==null||u.generateBox(l)}),e(o),L(o)}n&&f(n),y==null||y.updatePolygonList(o!=null?o:[],n!=null?n:[])};return{addHistory:C,pushHistoryWithList:P,initHistory:x,pushHistoryUnderUpdatePolygon:g,redo:()=>{a(i.redo())},undo:()=>{a(i.undo())}}};exports.useHistory=useHistory;
|
|
@@ -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"),_=require("lodash"),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");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,
|
|
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"),_=require("lodash"),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");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,n)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,__spreadValues=(t,o)=>{for(var n in o||(o={}))__hasOwnProp.call(o,n)&&__defNormalProp(t,n,o[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(o))__propIsEnum.call(o,n)&&__defNormalProp(t,n,o[n]);return t},__spreadProps=(t,o)=>__defProps(t,__getOwnPropDescs(o)),__async=(t,o,n)=>new Promise((a,e)=>{var s=r=>{try{c(n.next(r))}catch(P){e(P)}},g=r=>{try{c(n.throw(r))}catch(P){e(P)}},c=r=>r.done?a(r.value):Promise.resolve(r.value).then(s,g);c((n=n.apply(t,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},transferCanvas2World=(t,o)=>{const{width:n,height:a}=o,{x:e,y:s}=t;return{x:-s+a/2,y:-(e-n/2)}},topViewPolygon2PointCloud=(t,o,n,a,e)=>{const[s,g,c,r]=t.pointList.map(v=>transferCanvas2World(v,o)),P=lbAnnotation.MathUtils.getLineCenterPoint([s,c]),f=lbAnnotation.MathUtils.getLineLength(s,g),L=lbAnnotation.MathUtils.getLineLength(g,c),O=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);let B=0,h=1,C={};if(n){const v=n.getSensesPointZAxisInPolygon([s,g,c,r]);B=(v.maxZ+v.minZ)/2,h=v.maxZ-v.minZ,C={count:v.zCount}}a&&(B=a.center.z,h=a.depth);const b={center:{x:P.x,y:P.y,z:B},width:L,height:f,depth:h,rotation:O,id:t.id},m=__spreadValues(a?__spreadValues(__spreadValues({},a),b):__spreadProps(__spreadValues({},b),{attribute:"",valid:!0}),C);return e&&Object.assign(m,e),m},sideViewPolygon2PointCloud=(t,o,n,a)=>{const[e,s,g]=t.pointList,[c,r,P]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([e,g]),L=lbAnnotation.MathUtils.getLineCenterPoint([c,P]),B={x:{x:f.x-L.x,y:f.y-L.y}.x,y:0,z:f.y-L.y},h=lbAnnotation.MathUtils.getLineLength(e,s),C=lbAnnotation.MathUtils.getLineLength(c,r),b=h-C,m=lbAnnotation.MathUtils.getLineLength(s,g),v=lbAnnotation.MathUtils.getLineLength(r,P),U=m-v,{newBoxParams:S}=a.getNewBoxBySideUpdate(B,U,b,n);return S},backViewPolygon2PointCloud=(t,o,n,a)=>{const[e,s,g]=t.pointList,[c,r,P]=o.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([e,g]),L=lbAnnotation.MathUtils.getLineCenterPoint([c,P]),B={x:{x:f.x-L.x,y:f.y-L.y}.x,y:0,z:f.y-L.y},h=lbAnnotation.MathUtils.getLineLength(e,s),C=lbAnnotation.MathUtils.getLineLength(c,r),b=h-C,m=lbAnnotation.MathUtils.getLineLength(s,g),v=lbAnnotation.MathUtils.getLineLength(r,P),U=m-v;let{newBoxParams:S}=a.getNewBoxByBackUpdate(B,U,b,n);return S},synchronizeSideView=(t,o,n,a)=>{if(!n)return;const{pointCloud2dOperation:e,pointCloudInstance:s}=n;s.loadPCDFileByBox(a,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:g}=s.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);s.setInitCameraPosition(g);const{polygon2d:c,zoom:r}=s.getBoxSidePolygon2DCoordinate(t);s.camera.zoom=r,s.camera.updateProjectionMatrix(),s.render(),e.initPosition(),e.zoomChangeOnCenter(r),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:c,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},synchronizeBackView=(t,o,n,a)=>{if(!n)return;const{pointCloud2dOperation:e,pointCloudInstance:s}=n;s.loadPCDFileByBox(a,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:g}=s.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);s.setInitCameraPosition(g);const{polygon2d:c,zoom:r}=s.getBoxBackPolygon2DCoordinate(t);s.camera.zoom=r,s.camera.updateProjectionMatrix(),s.render(),e.initPosition(),e.zoomChangeOnCenter(r),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:c,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},synchronizeTopView=(t,o,n,a)=>{var e;if(!n||!a)return;a.generateBox(t,o.id),a.updateCameraByBox(t,lbUtils.EPerspectiveView.Top),a.render();const{pointCloud2dOperation:s,pointCloudInstance:g}=n,{polygon2d:c}=g.getBoxTopPolygon2DCoordinate(t),r=[...s.polygonList],P=r.find(f=>f.id===o.id);P?P.pointList=c:r.push({id:o.id,pointList:c,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),s.setResultAndSelectedID(r,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:n,backViewInstance:a,mainViewInstance:e,addPointCloudBox:s,setSelectedIDs:g,selectedIDs:c,pointCloudBoxList:r}=t,{addHistory:P,initHistory:f,pushHistoryUnderUpdatePolygon:L}=useHistory.useHistory(),{selectedPolygon:O}=usePolygon.usePolygon(),{updateSelectedBox:B}=useSingleBox.useSingleBox(),{currentData:h,config:C}=ctx.useSelector(i=>{const{stepList:l,step:p,imgList:u,imgIndex:d}=i.annotation;return{currentData:u[d],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,l).config)}}),b=ctx.useDispatch(),{selectedBox:m}=useSingleBox.useSingleBox(),{t:v}=reactI18next.useTranslation(),U=m==null?void 0:m.info;if(!o||!n||!a)return{topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{}};const{pointCloudInstance:S}=o,k=i=>{e==null||e.generateBox(i),e==null||e.controls.update(),e==null||e.render()},M=({newPolygon:i,size:l,imgList:p,trackConfigurable:u,zoom:d})=>{var x;const y={attribute:(x=o.pointCloud2dOperation.defaultAttribute)!=null?x:""};u===!0&&Object.assign(y,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:r})});const w=topViewPolygon2PointCloud(i,l,S,void 0,y),V=o==null?void 0:o.pointCloud2dOperation,D=w;if((C==null?void 0:C.lowerLimitPointsNumInBox)&&typeof w.count=="number"&&w.count<C.lowerLimitPointsNumInBox){antd.message.info(v("LowerLimitPointsNumInBox",{num:C.lowerLimitPointsNumInBox})),V.deletePolygon(w.id);return}V.setSelectedIDs([i.id]),g(D.id);const R=s(D);I(PointCloudView.Top,i,D,d,R),P({newBoxParams:D})},A=(i,l)=>{const p=i!=null?i:m==null?void 0:m.info,u=o==null?void 0:o.pointCloud2dOperation;if(u.setSelectedIDs(c),!p||!u)return;const d=u.selectedPolygon;I(PointCloudView.Top,d,p,void 0,l)},j=(i,l,p)=>{if(U){let u,d;switch(p){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}if(d=u(i,l,U,n.pointCloudInstance),e){const{count:y}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(d).polygonPointList,[d.center.z-d.depth/2,d.center.z+d.depth/2]);d=__spreadProps(__spreadValues({},d),{count:y})}const x=B(d);return I(p,i,d,void 0,x),x}},T=(i,l)=>{j(i,l,PointCloudView.Side)},z=(i,l)=>{j(i,l,PointCloudView.Back)},q=(i,l)=>{if(O){const p=__spreadProps(__spreadValues({},i),{pointList:i.pointList.map(u=>lbUtils.PointCloudUtils.transferCanvas2World(u,l))});L(p);return}if(U){const p=topViewPolygon2PointCloud(i,l,o.pointCloudInstance,U);Object.assign(U,___default.default.pickBy(p,(d,x)=>["width","height","x","y"]));const u=B(p);I(PointCloudView.Top,i,U,void 0,u)}},I=(i,l,p,u,d)=>__async(void 0,null,function*(){const x=h==null?void 0:h.url;d&&(yield t.syncAllViewPointCloudColor(d));const y={[PointCloudView.Side]:()=>{synchronizeSideView(p,l,n,x)},[PointCloudView.Back]:()=>{a&&synchronizeBackView(p,l,a,x)},[PointCloudView.Top]:()=>{synchronizeTopView(p,l,o,e)}};Object.keys(y).forEach(w=>{w!==i&&y[w]()}),u&&(e==null||e.updateCameraZoom(u)),k(p)});return{topViewAddBox:M,topViewSelectedChanged:A,topViewUpdateBox:q,sideViewUpdateBox:T,backViewUpdateBox:z,pointCloudBoxListUpdated:i=>{o.updatePolygonList(i),e==null||e.generateBoxes(i)},initPointCloud3d:i=>{if(!e)return;const l={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};e.initOrthographicCamera(l),e.initRenderer(),e.render()},updatePointCloudData:()=>__async(void 0,null,function*(){var i,l,p,u,d,x;if(!(h==null?void 0:h.url)||!e)return;actionCreators.SetPointCloudLoading(b,!0),yield e.loadPCDFile(h.url,(i=C==null?void 0:C.radius)!=null?i:DEFAULT_RADIUS),r.forEach(D=>{e==null||e.removeObjectByName(D.id)});let y=[],w=[];h.result?(y=lbUtils.PointCloudUtils.getBoxParamsFromResultList(h.result),w=lbUtils.PointCloudUtils.getPolygonListFromResultList(h.result),y.forEach(D=>{e==null||e.generateBox(D)}),t.setPointCloudResult(y),t.setPolygonList(w)):(t.setPointCloudResult([]),t.setPolygonList([])),f({pointCloudBoxList:y,polygonList:w}),e.updateTopCamera();const V=(p=(l=index.jsonParser(h.result))==null?void 0:l.valid)!=null?p:!0;t.setPointCloudValid(V),(u=t.sideViewInstance)==null||u.clearAllData(),(d=t.backViewInstance)==null||d.clearAllData(),o.updateData(h.url,h.result,{radius:(x=C==null?void 0:C.radius)!=null?x:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(b,!1)})}};exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.transferCanvas2World=transferCanvas2World,exports.usePointCloudViews=usePointCloudViews;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useHistory=require("./useHistory.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useHistory=require("./useHistory.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,e,t)=>e in o?__defProp(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,__spreadValues=(o,e)=>{for(var t in e||(e={}))__hasOwnProp.call(e,t)&&__defNormalProp(o,t,e[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))__propIsEnum.call(e,t)&&__defNormalProp(o,t,e[t]);return o},__spreadProps=(o,e)=>__defProps(o,__getOwnPropDescs(e));const usePolygon=()=>{const{polygonList:o,setPolygonList:e,selectedID:t}=React.useContext(PointCloudContext.PointCloudContext),{addHistory:l,pushHistoryWithList:a}=useHistory.useHistory(),i=o.find(r=>r.id===t);return{addPolygon:r=>{e(o.concat(r)),l({newPolygon:r})},deletePolygon:r=>{const s=o.filter(n=>n.id!==r).map(n=>__spreadValues({},n));e(s),a({polygonList:s})},selectedPolygon:i,updateSelectedPolygon:r=>{i&&e(o.map(s=>s.id===t?r:s))},updatePolygonValidByID:r=>{o.find(n=>n.id===r)&&e(o.map(n=>n.id===r?__spreadProps(__spreadValues({},n),{valid:!n.valid}):n))}}};exports.usePolygon=usePolygon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),usePointCloudViews=require("./usePointCloudViews.js"),useSingleBox=require("./useSingleBox.js"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils");const{ERotateDirection}=lbAnnotation.cAnnotation,useRotate=({currentData:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),usePointCloudViews=require("./usePointCloudViews.js"),useSingleBox=require("./useSingleBox.js"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils");const{ERotateDirection}=lbAnnotation.cAnnotation,useRotate=({currentData:t})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{selectedBox:i,updateSelectedBox:a}=useSingleBox.useSingleBox();return{updateRotate:React.useCallback(l=>{const{topViewInstance:s,mainViewInstance:n,syncAllViewPointCloudColor:c}=e;if(!s||!n)return;const{pointCloud2dOperation:u}=s,o=i==null?void 0:i.info;if(!o||!(t==null?void 0:t.url)||!e.backViewInstance)return;const d=a({rotation:lbUtils.PointCloudUtils.restrictAngleRange(o.rotation+Number(Math.PI*l)/180)});u.rotatePolygon(l,ERotateDirection.Anticlockwise);const r=u.selectedPolygon;n.generateBox(o),c(d),usePointCloudViews.synchronizeSideView(o,r,e.sideViewInstance,t.url),usePointCloudViews.synchronizeBackView(o,r,e.backViewInstance,t.url),n.render()},[e.selectedID,e.pointCloudBoxList,e.setPointCloudResult,e.topViewInstance,t])}};exports.useRotate=useRotate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_);const{ESortDirection}=lbAnnotation.cAnnotation,useSingleBox=()=>{const{pointCloudBoxList:e,setPointCloudResult:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const{ESortDirection}=lbAnnotation.cAnnotation,useSingleBox=()=>{const{pointCloudBoxList:e,setPointCloudResult:n,topViewInstance:t,backViewInstance:c,sideViewInstance:p,selectedIDs:y,selectedID:f,mainViewInstance:a,setSelectedIDs:C,syncAllViewPointCloudColor:P,polygonList:g}=React.useContext(PointCloudContext.PointCloudContext),{selectedPolygon:d,updateSelectedPolygon:b,updatePolygonValidByID:w}=usePolygon.usePolygon(),{pushHistoryWithList:B}=useHistory.useHistory(),r=React.useMemo(()=>{const o=e.findIndex(l=>l.id===f);if(o>-1)return{info:e[o],index:o}},[f,e]),v=React.useCallback(o=>{if(r==null?void 0:r.info){e.splice(r.index,1,___default.default.merge(r.info,o));const l=___default.default.cloneDeep(e);return n(l),B({pointCloudBoxList:l}),l}return e},[f,e]),O=React.useCallback((o,l)=>{const i=e.findIndex(s=>s.id===l);if(i>-1){e.splice(i,1,___default.default.merge(e[i],o));const s=___default.default.cloneDeep(e);return n(s),s}return e},[e]),u=React.useCallback(o=>{t==null||t.pointCloud2dOperation.setPolygonValidAndRender(o,!0),p==null||p.pointCloud2dOperation.setPolygonValidAndRender(o,!0),c==null||c.pointCloud2dOperation.setPolygonValidAndRender(o,!0)},[t,p,c]),I=React.useCallback(()=>{if(r==null?void 0:r.info){const{id:o,valid:l=!0}=r.info,i=v({valid:!l});P(i),u(o)}d&&(b(__spreadProps(__spreadValues({},d),{valid:!d.valid})),t==null||t.pointCloud2dOperation.setPolygonValidAndRender(d.id,!0))},[u,r,d]),V=React.useCallback(o=>{const l=e.find(i=>i.id===o);if(l){const{id:i,valid:s=!0}=l,D=O({valid:!s},i);return u(i),D}w(o)},[u,e,g]),x=React.useCallback((o=ESortDirection.ascend)=>{if(!t||y.length>1)return;const{pointCloud2dOperation:l}=t,i=l.switchToNextPolygon(o);i&&C(i)},[t]);return{selectedBox:r,updateSelectedBox:v,changeSelectedBoxValid:I,changeValidByID:V,selectNextBox:x,selectPrevBox:()=>{x(ESortDirection.descend)},deletePointCloudBox:o=>{const l=e.filter(i=>i.id!==o);n(l),a==null||a.removeObjectByName(o),a==null||a.render(),P(l)}}};exports.useSingleBox=useSingleBox;
|
|
@@ -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"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const PointCloudView=({imgList:e,drawLayerSlot:a,checkMode:t})=>e.length===0?null:React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,
|
|
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"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const PointCloudView=({imgList:e,drawLayerSlot:a,checkMode:t})=>e.length===0?null:React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:t}),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("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud2DView,null),React__default.default.createElement(PointCloud3DView,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","right")},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:a,checkMode:t}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","right-bottom")},React__default.default.createElement(PointCloudSideView,{checkMode:t}),React__default.default.createElement(PointCloudBackView,{checkMode:t})))))),mapStateToProps=e=>({imgList:e.annotation.imgList});var PointCloudView$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
|
|
@@ -22,12 +22,13 @@ export interface IPointCloudContext extends IPointCloudContextInstances {
|
|
|
22
22
|
addSelectedID: (selectedID: string) => void;
|
|
23
23
|
selectedAllBoxes: () => void;
|
|
24
24
|
selectedID: string;
|
|
25
|
-
addPointCloudBox: (boxParams: IPointCloudBox) =>
|
|
25
|
+
addPointCloudBox: (boxParams: IPointCloudBox) => IPointCloudBox[];
|
|
26
26
|
polygonList: IPolygonData[];
|
|
27
27
|
setPolygonList: (polygonList: IPolygonData[]) => void;
|
|
28
28
|
zoom: number;
|
|
29
29
|
setZoom: (zoom: number) => void;
|
|
30
30
|
history: ActionsHistory;
|
|
31
|
+
syncAllViewPointCloudColor: (newPointCloudList?: IPointCloudBox[]) => void;
|
|
31
32
|
}
|
|
32
33
|
export declare const PointCloudContext: React.Context<IPointCloudContext>;
|
|
33
34
|
export declare const PointCloudProvider: React.FC<{}>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IA2MapStateProps } from '@/store/annotation/map';
|
|
3
|
-
|
|
3
|
+
interface IProps extends IA2MapStateProps {
|
|
4
|
+
checkMode?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
|
|
4
7
|
children?: React.ReactNode;
|
|
5
8
|
}, "imgList" | "config" | "currentData" | "stepInfo">>;
|
|
6
9
|
export default _default;
|
|
@@ -51,17 +51,18 @@ export declare const usePointCloudViews: () => {
|
|
|
51
51
|
initPointCloud3d?: undefined;
|
|
52
52
|
updatePointCloudData?: undefined;
|
|
53
53
|
} | {
|
|
54
|
-
topViewAddBox: ({ newPolygon, size, imgList, trackConfigurable, }: {
|
|
54
|
+
topViewAddBox: ({ newPolygon, size, imgList, trackConfigurable, zoom, }: {
|
|
55
55
|
newPolygon: any;
|
|
56
56
|
size: ISize;
|
|
57
57
|
imgList: IFileItem[];
|
|
58
58
|
trackConfigurable?: boolean | undefined;
|
|
59
|
+
zoom: number;
|
|
59
60
|
}) => void;
|
|
60
|
-
topViewSelectedChanged: () => void;
|
|
61
|
+
topViewSelectedChanged: (newSelectedBox?: IPointCloudBox, newPointCloudList?: IPointCloudBox[]) => void;
|
|
61
62
|
topViewUpdateBox: (polygon: IPolygonData, size: ISize) => void;
|
|
62
63
|
sideViewUpdateBox: (newPolygon: any, originPolygon: any) => void;
|
|
63
64
|
backViewUpdateBox: (newPolygon: any, originPolygon: any) => void;
|
|
64
65
|
pointCloudBoxListUpdated: (newBoxes: IPointCloudBox[]) => void;
|
|
65
|
-
initPointCloud3d: () => void;
|
|
66
|
+
initPointCloud3d: (size: ISize) => void;
|
|
66
67
|
updatePointCloudData: () => Promise<void>;
|
|
67
68
|
};
|
|
@@ -7,4 +7,6 @@ export declare const usePolygon: () => {
|
|
|
7
7
|
addPolygon: (polygon: IPolygonData) => void;
|
|
8
8
|
deletePolygon: (id: string) => void;
|
|
9
9
|
selectedPolygon: IPolygonData | undefined;
|
|
10
|
+
updateSelectedPolygon: (polygon: IPolygonData) => void;
|
|
11
|
+
updatePolygonValidByID: (id: string) => void;
|
|
10
12
|
};
|
|
@@ -5,9 +5,9 @@ export declare const useSingleBox: () => {
|
|
|
5
5
|
info: IPointCloudBox;
|
|
6
6
|
index: number;
|
|
7
7
|
} | undefined;
|
|
8
|
-
updateSelectedBox: (params: Partial<IPointCloudBox>) =>
|
|
8
|
+
updateSelectedBox: (params: Partial<IPointCloudBox>) => import("@labelbee/lb-utils").IPointCloudBoxList;
|
|
9
9
|
changeSelectedBoxValid: () => void;
|
|
10
|
-
|
|
10
|
+
changeValidByID: (id: string) => import("@labelbee/lb-utils").IPointCloudBoxList | undefined;
|
|
11
11
|
selectNextBox: (sort?: any) => void;
|
|
12
12
|
selectPrevBox: () => void;
|
|
13
13
|
deletePointCloudBox: (id: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),reactRedux=require("react-redux"),es=require("antd/es"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const PageNumber=e=>{var r;const{toolInstance:t}=e,[
|
|
1
|
+
"use strict";var React=require("react"),reactRedux=require("react-redux"),es=require("antd/es"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const PageNumber=e=>{var n,r;const{toolInstance:t}=e,[i,a]=React.useState(0),{pointCloudBoxList:u}=React.useContext(PointCloudContext.PointCloudContext),{t:l}=reactI18next.useTranslation();if(React.useEffect(()=>{t&&t.singleOn("updatePageNumber",()=>{a(c=>c+1)})},[t]),!t)return null;const o=(r=(n=t==null?void 0:t.currentPageResult)==null?void 0:n.length)!=null?r:u.length;return o>=0?React__default.default.createElement("span",null,`${l("ItemsOfThisPage")}: ${o}`,React__default.default.createElement(es.Divider,{type:"vertical",style:{background:"rgba(153, 153, 153, 1)",height:"16px"}})):null},mapStateToProps=e=>{var n;return{toolInstance:(n=e.annotation)==null?void 0:n.toolInstance}};var PageNumber$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PageNumber);module.exports=PageNumber$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as
|
|
1
|
+
import{getClassName as u}from"../../utils/dom.js";import{PointCloud as D}from"@labelbee/lb-annotation";import{PointCloudUtils as I,toolStyleConverter as L,EPerspectiveView as E}from"@labelbee/lb-utils";import y from"classnames";import t,{useContext as v,useState as T,useRef as N,useEffect as f,useMemo as R}from"react";import{PointCloudContainer as k}from"./PointCloudLayout.js";import{PointCloudContext as A}from"./PointCloudContext.js";import{a2MapStateToProps as z}from"../../store/annotation/map.js";import{connect as F}from"react-redux";import{jsonParser as M}from"../../utils/index.js";import{useSingleBox as U}from"./hooks/useSingleBox.js";import{Switch as q}from"antd";import G from"../../hooks/useSize.js";import{usePointCloudViews as H}from"./hooks/usePointCloudViews.js";import{useTranslation as J}from"react-i18next";import{LabelBeeContext as K}from"../../store/ctx.js";var Q=Object.defineProperty,W=Object.defineProperties,X=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,_=(e,o,r)=>o in e?Q(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,$=(e,o)=>{for(var r in o||(o={}))Y.call(o,r)&&_(e,r,o[r]);if(x)for(var r of x(o))Z.call(o,r)&&_(e,r,o[r]);return e},ee=(e,o)=>W(e,X(o));const te="LABELBEE-POINTCLOUD",w=t.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{}}),c=({perspectiveView:e})=>{const{isActive:o,setTarget3DView:r}=v(w),n=d=>y({[u("point-cloud-3d-view",d)]:!0,active:o});return t.createElement("span",{onClick:()=>{r(E[e])},className:n(e.toLocaleLowerCase())})},oe=()=>{const{reset3DView:e}=v(w);return t.createElement("div",{className:u("point-cloud-3d-sidebar")},t.createElement(c,{perspectiveView:"Top"}),t.createElement(c,{perspectiveView:"Front"}),t.createElement(c,{perspectiveView:"Left"}),t.createElement(c,{perspectiveView:"Back"}),t.createElement(c,{perspectiveView:"Right"}),t.createElement(c,{perspectiveView:"LFT"}),t.createElement(c,{perspectiveView:"RBT"}),t.createElement("span",{onClick:()=>{e()},className:u("point-cloud-3d-view","reset")}))},re=({currentData:e,config:o})=>{var r;const n=v(A),[d,b]=T(!0),p=N(null),{initPointCloud3d:C}=H(),a=G(p),{t:P}=J();f(()=>{!n.mainViewInstance||C==null||C(a)},[a]);const{selectedBox:m}=U(),g=s=>{var i;const l=m==null?void 0:m.info;l&&((i=n.mainViewInstance)==null||i.updateCameraByBox(l,s))},O=()=>{var s;(s=n.mainViewInstance)==null||s.resetCamera()};f(()=>{var s;if(p.current&&(e==null?void 0:e.url)){let i=n.mainViewInstance;if(!i&&a.width){const l={left:-a.width/2,right:a.width/2,top:a.height/2,bottom:-a.height/2,near:100,far:-100};i=new D({container:p.current,isOrthographicCamera:!0,orthographicParams:l}),n.setMainViewInstance(i)}if(e.result){const l=I.getBoxParamsFromResultList(e.result);l.forEach(h=>{var V;const B=(V=L.getColorFromConfig({attribute:h.attribute},ee($({},o),{attributeConfigurable:!0}),{}))==null?void 0:V.hex;i==null||i.generateBox(h,B)}),n.setPointCloudResult(l),n.setPointCloudValid((s=M(e.result))==null?void 0:s.valid)}}},[e,a]),f(()=>{m&&g(E.Top)},[m]);const j=R(()=>({reset3DView:O,setTarget3DView:g,isActive:!!m}),[m]),S=t.createElement("div",null,t.createElement("span",{style:{marginRight:8}},P("ShowArrows")),t.createElement(q,{size:"small",checked:d,onChange:s=>{var i;b(s),(i=n.mainViewInstance)==null||i.setShowDirection(s)}}));return t.createElement(k,{className:u("point-cloud-3d-container"),title:P("3DView"),toolbar:S,style:{height:e.mappingImgList&&((r=e.mappingImgList)==null?void 0:r.length)>0?"55%":"100%"}},t.createElement("div",{className:u("point-cloud-3d-content")},t.createElement(w.Provider,{value:j},t.createElement(oe,null)),t.createElement("div",{className:u("point-cloud-3d-view"),id:te,ref:p})))};var ie=F(z,null,null,{context:K})(re);export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointCloud3DView.js","sources":["../../../src/components/pointCloudView/PointCloud3DView.tsx"],"sourcesContent":["/*\n * @Author: Laoluo luozefeng@sensetime.com\n * @Date: 2022-06-13 19:31:36\n * @LastEditors: Laoluo luozefeng@sensetime.com\n * @LastEditTime: 2022-06-27 19:43:25\n */\n\nimport { getClassName } from '@/utils/dom';\nimport { PointCloud } from '@labelbee/lb-annotation';\nimport {\n EPerspectiveView,\n IPointCloudBox,\n PointCloudUtils,\n toolStyleConverter,\n} from '@labelbee/lb-utils';\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport { PointCloudContext } from './PointCloudContext';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { connect } from 'react-redux';\nimport { jsonParser } from '@/utils';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { Switch } from 'antd';\nimport useSize from '@/hooks/useSize';\nimport { usePointCloudViews } from './hooks/usePointCloudViews';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\n\nconst pointCloudID = 'LABELBEE-POINTCLOUD';\nconst PointCloud3DContext = React.createContext<{\n isActive: boolean;\n setTarget3DView: (perspectiveView: EPerspectiveView) => void;\n reset3DView: () => void;\n}>({\n isActive: false,\n setTarget3DView: () => {},\n reset3DView: () => {},\n});\n\nconst PointCloudViewIcon = ({\n perspectiveView,\n}: {\n perspectiveView: keyof typeof EPerspectiveView;\n}) => {\n const { isActive, setTarget3DView } = useContext(PointCloud3DContext);\n\n const getTarget3DViewClassName = (position: string) => {\n return classNames({\n [getClassName('point-cloud-3d-view', position)]: true,\n active: isActive,\n });\n };\n\n return (\n <span\n onClick={() => {\n setTarget3DView(EPerspectiveView[perspectiveView]);\n }}\n className={getTarget3DViewClassName(perspectiveView.toLocaleLowerCase())}\n />\n );\n};\n\nconst PointCloud3DSideBar = () => {\n const { reset3DView } = useContext(PointCloud3DContext);\n return (\n <div className={getClassName('point-cloud-3d-sidebar')}>\n <PointCloudViewIcon perspectiveView='Top' />\n <PointCloudViewIcon perspectiveView='Front' />\n <PointCloudViewIcon perspectiveView='Left' />\n <PointCloudViewIcon perspectiveView='Back' />\n <PointCloudViewIcon perspectiveView='Right' />\n <PointCloudViewIcon perspectiveView='LFT' />\n <PointCloudViewIcon perspectiveView='RBT' />\n <span\n onClick={() => {\n reset3DView();\n }}\n className={getClassName('point-cloud-3d-view', 'reset')}\n />\n </div>\n );\n};\n\nconst PointCloud3D: React.FC<IA2MapStateProps> = ({ currentData, config }) => {\n const ptCtx = useContext(PointCloudContext);\n const [showDirection, setShowDirection] = useState(true);\n const ref = useRef<HTMLDivElement>(null);\n const { initPointCloud3d } = usePointCloudViews();\n const size = useSize(ref);\n const { t } = useTranslation();\n\n useEffect(() => {\n if (!ptCtx.mainViewInstance) {\n return;\n }\n initPointCloud3d?.();\n }, [size]);\n const { selectedBox } = useSingleBox();\n\n const setTarget3DView = (perspectiveView: EPerspectiveView) => {\n const box = selectedBox?.info;\n\n if (box) {\n ptCtx.mainViewInstance?.updateCameraByBox(box, perspectiveView);\n }\n };\n\n const reset3DView = () => {\n ptCtx.mainViewInstance?.resetCamera();\n };\n\n useEffect(() => {\n if (ref.current && currentData?.url) {\n let pointCloud = ptCtx.mainViewInstance;\n if (!pointCloud) {\n pointCloud = new PointCloud({\n container: ref.current,\n backgroundColor: '#4c4c4c',\n config,\n });\n }\n\n if (currentData.result) {\n const boxParamsList = PointCloudUtils.getBoxParamsFromResultList(currentData.result);\n\n // Add Init Box\n boxParamsList.forEach((v: IPointCloudBox) => {\n const hex = toolStyleConverter.getColorFromConfig(\n { attribute: v.attribute },\n { ...config, attributeConfigurable: true },\n {},\n )?.hex;\n\n pointCloud?.generateBox(v, hex);\n });\n\n ptCtx.setPointCloudResult(boxParamsList);\n ptCtx.setPointCloudValid(jsonParser(currentData.result)?.valid);\n }\n\n ptCtx.setMainViewInstance(pointCloud);\n }\n }, [currentData]);\n\n /**\n * Observe selectedID and reset camera to target top-view\n */\n useEffect(() => {\n if (selectedBox) {\n setTarget3DView(EPerspectiveView.Top);\n }\n }, [selectedBox]);\n\n const ptCloud3DCtx = useMemo(() => {\n return { reset3DView, setTarget3DView, isActive: !!selectedBox };\n }, [selectedBox]);\n\n const PointCloud3DTitle = (\n <div>\n <span style={{ marginRight: 8 }}>{t('ShowArrows')}</span>\n <Switch\n size='small'\n checked={showDirection}\n onChange={(showDirection) => {\n setShowDirection(showDirection);\n ptCtx.mainViewInstance?.setShowDirection(showDirection);\n }}\n />\n </div>\n );\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-3d-container')}\n title={t('3DView')}\n toolbar={PointCloud3DTitle}\n style={{\n height:\n currentData.mappingImgList && currentData.mappingImgList?.length > 0 ? '55%' : '100%',\n }}\n >\n <div className={getClassName('point-cloud-3d-content')}>\n <PointCloud3DContext.Provider value={ptCloud3DCtx}>\n <PointCloud3DSideBar />\n </PointCloud3DContext.Provider>\n <div className={getClassName('point-cloud-3d-view')} id={pointCloudID} ref={ref} />\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(PointCloud3D);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,YAAe,GAAA,qBAAA,CAAA;AACrB,MAAM,mBAAA,GAAsB,MAAM,aAI/B,CAAA;AAAA,EACD,QAAU,EAAA,KAAA;AAAA,EACV,iBAAiB,MAAM;AAAA,GAAA;AAAA,EACvB,aAAa,MAAM;AAAA,GAAA;AAAA,CAAA,CAAA,CAAA;AAGrB,MAAM,qBAAqB,CAAC;AAAA,EAC1B,eAAA;AAAA,CAGI,KAAA;AACJ,EAAM,MAAA,CAAE,QAAU,EAAA,eAAA,CAAA,GAAoB,UAAW,CAAA,mBAAA,CAAA,CAAA;AAEjD,EAAM,MAAA,wBAAA,GAA2B,CAAC,QAAqB,KAAA;AACrD,IAAA,OAAO,UAAW,CAAA;AAAA,MACf,CAAA,YAAA,CAAa,uBAAuB,QAAY,CAAA,GAAA,IAAA;AAAA,MACjD,MAAQ,EAAA,QAAA;AAAA,KAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAIZ,E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,MAAA,EACE,YAAY,cAAkB,IAAA,CAAA,CAAA,EAAA,GAAA,WAAA,CAAY,mBAAZ,IAA4B,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAA,IAAS,IAAI,KAAQ,GAAA,MAAA;AAAA,KAAA;AAAA,GAAA,sCAGlF,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,wBAAA,CAAA;AAAA,GAC3B,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAoB,QAArB,EAAA;AAAA,IAA8B,KAAO,EAAA,YAAA;AAAA,GAAA,kBAClC,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAD,IAEF,CAAA,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,qBAAA,CAAA;AAAA,IAAwB,EAAI,EAAA,YAAA;AAAA,IAAc,GAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAM/E,uBAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAAmB,CAAA,CAAA,CAAA,YAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"PointCloud3DView.js","sources":["../../../src/components/pointCloudView/PointCloud3DView.tsx"],"sourcesContent":["/*\n * @Author: Laoluo luozefeng@sensetime.com\n * @Date: 2022-06-13 19:31:36\n * @LastEditors: Laoluo luozefeng@sensetime.com\n * @LastEditTime: 2022-06-27 19:43:25\n */\n\nimport { getClassName } from '@/utils/dom';\nimport { PointCloud } from '@labelbee/lb-annotation';\nimport {\n EPerspectiveView,\n IPointCloudBox,\n PointCloudUtils,\n toolStyleConverter,\n} from '@labelbee/lb-utils';\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport { PointCloudContext } from './PointCloudContext';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { connect } from 'react-redux';\nimport { jsonParser } from '@/utils';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { Switch } from 'antd';\nimport useSize from '@/hooks/useSize';\nimport { usePointCloudViews } from './hooks/usePointCloudViews';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\n\nconst pointCloudID = 'LABELBEE-POINTCLOUD';\nconst PointCloud3DContext = React.createContext<{\n isActive: boolean;\n setTarget3DView: (perspectiveView: EPerspectiveView) => void;\n reset3DView: () => void;\n}>({\n isActive: false,\n setTarget3DView: () => { },\n reset3DView: () => { },\n});\n\nconst PointCloudViewIcon = ({\n perspectiveView,\n}: {\n perspectiveView: keyof typeof EPerspectiveView;\n}) => {\n const { isActive, setTarget3DView } = useContext(PointCloud3DContext);\n\n const getTarget3DViewClassName = (position: string) => {\n return classNames({\n [getClassName('point-cloud-3d-view', position)]: true,\n active: isActive,\n });\n };\n\n return (\n <span\n onClick={() => {\n setTarget3DView(EPerspectiveView[perspectiveView]);\n }}\n className={getTarget3DViewClassName(perspectiveView.toLocaleLowerCase())}\n />\n );\n};\n\nconst PointCloud3DSideBar = () => {\n const { reset3DView } = useContext(PointCloud3DContext);\n return (\n <div className={getClassName('point-cloud-3d-sidebar')}>\n <PointCloudViewIcon perspectiveView='Top' />\n <PointCloudViewIcon perspectiveView='Front' />\n <PointCloudViewIcon perspectiveView='Left' />\n <PointCloudViewIcon perspectiveView='Back' />\n <PointCloudViewIcon perspectiveView='Right' />\n <PointCloudViewIcon perspectiveView='LFT' />\n <PointCloudViewIcon perspectiveView='RBT' />\n <span\n onClick={() => {\n reset3DView();\n }}\n className={getClassName('point-cloud-3d-view', 'reset')}\n />\n </div>\n );\n};\n\nconst PointCloud3D: React.FC<IA2MapStateProps> = ({ currentData, config }) => {\n const ptCtx = useContext(PointCloudContext);\n const [showDirection, setShowDirection] = useState(true);\n const ref = useRef<HTMLDivElement>(null);\n const { initPointCloud3d } = usePointCloudViews();\n const size = useSize(ref);\n const { t } = useTranslation();\n\n useEffect(() => {\n if (!ptCtx.mainViewInstance) {\n return;\n }\n initPointCloud3d?.(size);\n }, [size]);\n const { selectedBox } = useSingleBox();\n\n const setTarget3DView = (perspectiveView: EPerspectiveView) => {\n const box = selectedBox?.info;\n\n if (box) {\n ptCtx.mainViewInstance?.updateCameraByBox(box, perspectiveView);\n }\n };\n\n const reset3DView = () => {\n ptCtx.mainViewInstance?.resetCamera();\n };\n\n /**\n * Listen for data changes.\n */\n useEffect(() => {\n if (ref.current && currentData?.url) {\n let pointCloud = ptCtx.mainViewInstance;\n if (!pointCloud && size.width) {\n const orthographicParams = {\n left: -size.width / 2,\n right: size.width / 2,\n top: size.height / 2,\n bottom: -size.height / 2,\n near: 100,\n far: -100,\n }\n\n // Need to be showed\n pointCloud = new PointCloud({\n container: ref.current,\n isOrthographicCamera: true,\n orthographicParams,\n });\n ptCtx.setMainViewInstance(pointCloud);\n }\n\n if (currentData.result) {\n const boxParamsList = PointCloudUtils.getBoxParamsFromResultList(currentData.result);\n\n // Add Init Box\n boxParamsList.forEach((v: IPointCloudBox) => {\n const hex = toolStyleConverter.getColorFromConfig(\n { attribute: v.attribute },\n { ...config, attributeConfigurable: true },\n {},\n )?.hex;\n\n pointCloud?.generateBox(v, hex);\n });\n\n ptCtx.setPointCloudResult(boxParamsList);\n ptCtx.setPointCloudValid(jsonParser(currentData.result)?.valid);\n }\n\n }\n }, [currentData, size]);\n\n /**\n * Observe selectedID and reset camera to target top-view\n */\n useEffect(() => {\n if (selectedBox) {\n setTarget3DView(EPerspectiveView.Top);\n }\n }, [selectedBox]);\n\n const ptCloud3DCtx = useMemo(() => {\n return { reset3DView, setTarget3DView, isActive: !!selectedBox };\n }, [selectedBox]);\n\n const PointCloud3DTitle = (\n <div>\n <span style={{ marginRight: 8 }}>{t('ShowArrows')}</span>\n <Switch\n size='small'\n checked={showDirection}\n onChange={(showDirection) => {\n setShowDirection(showDirection);\n ptCtx.mainViewInstance?.setShowDirection(showDirection);\n }}\n />\n </div>\n );\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-3d-container')}\n title={t('3DView')}\n toolbar={PointCloud3DTitle}\n style={{\n height:\n currentData.mappingImgList && currentData.mappingImgList?.length > 0 ? '55%' : '100%',\n }}\n >\n <div className={getClassName('point-cloud-3d-content')}>\n <PointCloud3DContext.Provider value={ptCloud3DCtx}>\n <PointCloud3DSideBar />\n </PointCloud3DContext.Provider>\n <div className={getClassName('point-cloud-3d-view')} id={pointCloudID} ref={ref} />\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(PointCloud3D);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,YAAe,GAAA,qBAAA,CAAA;AACrB,MAAM,mBAAA,GAAsB,MAAM,aAI/B,CAAA;AAAA,EACD,QAAU,EAAA,KAAA;AAAA,EACV,iBAAiB,MAAM;AAAA,GAAA;AAAA,EACvB,aAAa,MAAM;AAAA,GAAA;AAAA,CAAA,CAAA,CAAA;AAGrB,MAAM,qBAAqB,CAAC;AAAA,EAC1B,eAAA;AAAA,CAGI,KAAA;AACJ,EAAM,MAAA,CAAE,QAAU,EAAA,eAAA,CAAA,GAAoB,UAAW,CAAA,mBAAA,CAAA,CAAA;AAEjD,EAAM,MAAA,wBAAA,GAA2B,CAAC,QAAqB,KAAA;AACrD,IAAA,OAAO,UAAW,CAAA;AAAA,MACf,CAAA,YAAA,CAAa,uBAAuB,QAAY,CAAA,GAAA,IAAA;AAAA,MACjD,MAAQ,EAAA,QAAA;AAAA,KAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAIZ,EAAA,2CACG,MAAD,EAAA;AAAA,IACE,SAAS,MAAM;AACb,MAAA,eAAA,CAAgB,gBAAiB,CAAA,eAAA,CAAA,CAAA,CAAA;AAAA,KAAA;AAAA,IAEnC,SAAA,EAAW,yBAAyB,eAAgB,CAAA,iBAAA,EAAA,CAAA;AAAA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,CAAA,CAAA,CAAA;AAMjD,EAAA,2CACG,mBAAD,EAAA;AAAA,IACE,WAAW,YAAa,CAAA,0BAAA,CAAA;AAAA,IACxB,OAAO,CAAE,CAAA,QAAA,CAAA;AAAA,IACT,OAAS,EAAA,iBAAA;AAAA,IACT,KAAO,EAAA;AAAA,MACL,MAAA,EACE,YAAY,cAAkB,IAAA,CAAA,CAAA,EAAA,GAAA,WAAA,CAAY,mBAAZ,IAA4B,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAA,IAAS,IAAI,KAAQ,GAAA,MAAA;AAAA,KAAA;AAAA,GAAA,sCAGlF,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,wBAAA,CAAA;AAAA,GAC3B,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAoB,QAArB,EAAA;AAAA,IAA8B,KAAO,EAAA,YAAA;AAAA,GAAA,kBAClC,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAD,IAEF,CAAA,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,qBAAA,CAAA;AAAA,IAAwB,EAAI,EAAA,YAAA;AAAA,IAAc,GAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAM/E,uBAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAAmB,CAAA,CAAA,CAAA,YAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloudAnnotation as
|
|
1
|
+
import{PointCloudAnnotation as P}from"@labelbee/lb-annotation";import{getClassName as p}from"../../utils/dom.js";import{PointCloudContainer as h}from"./PointCloudLayout.js";import d,{useRef as g,useEffect as C}from"react";import{PointCloudContext as v}from"./PointCloudContext.js";import{useSingleBox as B}from"./hooks/useSingleBox.js";import{EPerspectiveView as y}from"@labelbee/lb-utils";import{SizeInfoForView as V}from"./PointCloudInfos.js";import{connect as b}from"react-redux";import{a2MapStateToProps as j}from"../../store/annotation/map.js";import{usePointCloudViews as k}from"./hooks/usePointCloudViews.js";import E from"../../hooks/useSize.js";import S from"./components/EmptyPage/index.js";import{useTranslation as I}from"react-i18next";import{LabelBeeContext as O}from"../../store/ctx.js";const M=(c,i,r=1)=>{const{width:t,height:e}=i,o={x:c.x+t*r/2,y:c.y+e*r/2},l={x:i.width/2,y:i.height/2};return{offsetX:(l.x-o.x)/r,offsetY:-(l.y-o.y)/r}},x=(c,i,r,t,e)=>{const{offsetX:o,offsetY:l}=M(c,r,i);if(e.camera.zoom=i,c){const f=Math.cos(t.rotation),m=Math.sin(t.rotation),n=o*f,u=o*m,{x:s,y:a,z:w}=e.initCameraPosition;e.camera.position.set(s+u,a-n,w+l)}e.camera.updateProjectionMatrix(),e.render()},N=({currentData:c,config:i,checkMode:r})=>{const t=d.useContext(v),e=g(null),o=E(e),{selectedBox:l}=B(),{t:f}=I(),{backViewUpdateBox:m}=k();return C(()=>{if(e.current){const n={width:e.current.clientWidth,height:e.current.clientHeight},u=new P({container:e.current,size:n,polygonOperationProps:{showDirectionLine:!1,forbidAddNew:!0},config:i,checkMode:r});t.setBackViewInstance(u)}},[]),C(()=>{if(!o||!t.backViewInstance)return;const{pointCloud2dOperation:n,pointCloudInstance:u}=t.backViewInstance;n.singleOn("renderZoom",(s,a)=>{!t.selectedPointCloudBox||x(a,s,o,t.selectedPointCloudBox,u)}),n.singleOn("dragMove",({currentPos:s,zoom:a})=>{!t.selectedPointCloudBox||x(s,a,o,t.selectedPointCloudBox,u)}),n.singleOn("updatePolygonByDrag",({newPolygon:s,originPolygon:a})=>{m==null||m(s,a)})},[t,o]),C(()=>{var n;(n=t==null?void 0:t.backViewInstance)==null||n.initSize(o)},[o]),d.createElement(h,{className:p("point-cloud-container","back-view"),title:f("BackView"),toolbar:d.createElement(V,{perspectiveView:y.Back})},d.createElement("div",{className:p("point-cloud-container","bottom-view-content")},d.createElement("div",{className:p("point-cloud-container","core-instance"),ref:e}),!l&&d.createElement(S,null)))};var X=b(j,null,null,{context:O})(N);export{X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointCloudBackView.js","sources":["../../../src/components/pointCloudView/PointCloudBackView.tsx"],"sourcesContent":["/*\n * @Author: Laoluo luozefeng@sensetime.com\n * @Date: 2022-06-22 11:08:31\n * @LastEditors: Laoluo luozefeng@sensetime.com\n * @LastEditTime: 2022-07-08 11:08:02\n */\nimport {\n PointCloud,\n MathUtils,\n PointCloudAnnotation,\n getCuboidFromPointCloudBox,\n} from '@labelbee/lb-annotation';\nimport { getClassName } from '@/utils/dom';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport React, { useEffect, useRef } from 'react';\nimport { PointCloudContext } from './PointCloudContext';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { EPerspectiveView, IPointCloudBox, IPolygonPoint } from '@labelbee/lb-utils';\nimport { SizeInfoForView } from './PointCloudInfos';\nimport { connect } from 'react-redux';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { synchronizeSideView, synchronizeTopView } from './hooks/usePointCloudViews';\nimport useSize from '@/hooks/useSize';\nimport EmptyPage from './components/EmptyPage';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\n\n/**\n * 统一一下,将其拓展为 二维转换为 三维坐标的转换\n * Get the offset from canvas2d-coordinate to world coordinate\n * @param currentPos\n * @param size\n * @param zoom\n * @returns\n */\nconst TransferCanvas2WorldOffset = (\n currentPos: { x: number; y: number },\n size: { width: number; height: number },\n zoom = 1,\n) => {\n const { width: w, height: h } = size;\n\n const canvasCenterPoint = {\n x: currentPos.x + (w * zoom) / 2,\n y: currentPos.y + (h * zoom) / 2,\n };\n\n const worldCenterPoint = {\n x: size.width / 2,\n y: size.height / 2,\n };\n\n return {\n offsetX: (worldCenterPoint.x - canvasCenterPoint.x) / zoom,\n offsetY: -(worldCenterPoint.y - canvasCenterPoint.y) / zoom,\n };\n};\nconst updateBackViewByCanvas2D = (\n currentPos: { x: number; y: number },\n zoom: number,\n size: { width: number; height: number },\n selectedPointCloudBox: IPointCloudBox,\n backPointCloud: PointCloud,\n) => {\n const { offsetX, offsetY } = TransferCanvas2WorldOffset(currentPos, size, zoom);\n backPointCloud.camera.zoom = zoom;\n if (currentPos) {\n const cos = Math.cos(selectedPointCloudBox.rotation);\n const sin = Math.sin(selectedPointCloudBox.rotation);\n const offsetXX = offsetX * cos;\n const offsetXY = offsetX * sin;\n const { x, y, z } = backPointCloud.initCameraPosition;\n backPointCloud.camera.position.set(x + offsetXY, y - offsetXX, z + offsetY);\n }\n backPointCloud.camera.updateProjectionMatrix();\n backPointCloud.render();\n};\n\ninterface IProps {\n checkMode?: boolean\n}\n\nconst PointCloudSideView = ({ currentData, config, checkMode }: IA2MapStateProps & IProps) => {\n const ptCtx = React.useContext(PointCloudContext);\n const ref = useRef<HTMLDivElement>(null);\n const size = useSize(ref);\n const { updateSelectedBox, selectedBox } = useSingleBox();\n const { t } = useTranslation();\n\n useEffect(() => {\n if (ref.current) {\n const size = {\n width: ref.current.clientWidth,\n height: ref.current.clientHeight,\n };\n\n const pointCloudAnnotation = new PointCloudAnnotation({\n container: ref.current,\n size,\n polygonOperationProps: { showDirectionLine: false, forbidAddNew: true },\n config,\n checkMode\n });\n ptCtx.setBackViewInstance(pointCloudAnnotation);\n }\n }, []);\n\n useEffect(() => {\n // By the way as an initialization judgment\n if (!size || !ptCtx.backViewInstance) {\n return;\n }\n\n const {\n pointCloud2dOperation: backPointCloudPolygonOperation,\n pointCloudInstance: backPointCloud,\n } = ptCtx.backViewInstance;\n\n /**\n * Synchronized 3d point cloud view displacement operations\n *\n * Change Orthographic Camera size\n */\n backPointCloudPolygonOperation.singleOn('renderZoom', (zoom: number, currentPos: any) => {\n if (!ptCtx.selectedPointCloudBox) {\n return;\n }\n updateBackViewByCanvas2D(currentPos, zoom, size, ptCtx.selectedPointCloudBox, backPointCloud);\n });\n\n // Synchronized 3d point cloud view displacement operations\n backPointCloudPolygonOperation.singleOn('dragMove', ({ currentPos, zoom }: any) => {\n if (!ptCtx.selectedPointCloudBox) {\n return;\n }\n updateBackViewByCanvas2D(currentPos, zoom, size, ptCtx.selectedPointCloudBox, backPointCloud);\n });\n\n backPointCloudPolygonOperation.singleOn(\n 'updatePolygonByDrag',\n ({ newPolygon, originPolygon }: any) => {\n if (!ptCtx.selectedPointCloudBox || !ptCtx.mainViewInstance || !currentData.url) {\n return;\n }\n\n // Notice. The sort of polygon is important.\n const [point1, point2, point3] = newPolygon.pointList;\n const [op1, op2, op3] = originPolygon.pointList;\n\n // 2D centerPoint => 3D x & z\n const newCenterPoint = MathUtils.getLineCenterPoint([point1, point3]);\n const oldCenterPoint = MathUtils.getLineCenterPoint([op1, op3]);\n\n const offset = {\n x: newCenterPoint.x - oldCenterPoint.x,\n y: newCenterPoint.y - oldCenterPoint.y,\n };\n\n const offsetCenterPoint = {\n x: offset.x,\n y: 0, // Not be used.\n z: newCenterPoint.y - oldCenterPoint.y,\n };\n\n // 2D height => 3D depth\n const height = MathUtils.getLineLength(point1, point2);\n const oldHeight = MathUtils.getLineLength(op1, op2);\n const offsetHeight = height - oldHeight; // 3D depth\n\n // 2D width => 3D width\n const width = MathUtils.getLineLength(point2, point3);\n const oldWidth = MathUtils.getLineLength(op2, op3);\n const offsetWidth = width - oldWidth; // 3D width\n\n let { newBoxParams } = backPointCloud.getNewBoxByBackUpdate(\n offsetCenterPoint,\n offsetWidth,\n offsetHeight,\n ptCtx.selectedPointCloudBox,\n );\n\n // Update count\n if (ptCtx.mainViewInstance) {\n const { count } = ptCtx.mainViewInstance.getSensesPointZAxisInPolygon(\n getCuboidFromPointCloudBox(newBoxParams).polygonPointList as IPolygonPoint[],\n [\n newBoxParams.center.z - newBoxParams.depth / 2,\n newBoxParams.center.z + newBoxParams.depth / 2,\n ],\n );\n\n newBoxParams = {\n ...newBoxParams,\n count,\n };\n }\n\n synchronizeTopView(newBoxParams, newPolygon, ptCtx.topViewInstance, ptCtx.mainViewInstance);\n synchronizeSideView(newBoxParams, newPolygon, ptCtx.sideViewInstance, currentData.url);\n ptCtx.mainViewInstance.highlightOriginPointCloud(newBoxParams);\n updateSelectedBox(newBoxParams);\n },\n );\n }, [ptCtx, size]);\n\n useEffect(() => {\n // Update Size\n ptCtx?.backViewInstance?.initSize(size);\n }, [size]);\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-container', 'back-view')}\n title={t('BackView')}\n toolbar={<SizeInfoForView perspectiveView={EPerspectiveView.Back} />}\n >\n <div className={getClassName('point-cloud-container', 'bottom-view-content')}>\n <div className={getClassName('point-cloud-container', 'core-instance')} ref={ref} />\n {!selectedBox && <EmptyPage />}\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloudSideView,\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,0BAA6B,GAAA,CACjC,UACA,EAAA,IAAA,EACA,OAAO,CACJ,KAAA;AACH,EAAA,MAAM,CAAE,KAAA,EAAO,CAAG,EAAA,MAAA,EAAQ,CAAM,CAAA,GAAA,IAAA,CAAA;AAEhC,EAAA,MAAM,iBAAoB,GAAA;AAAA,IACxB,CAAG,EAAA,UAAA,CAAW,CAAK,GAAA,CAAA,GAAI,IAAQ,GAAA,CAAA;AAAA,IAC/B,CAAG,EAAA,UAAA,CAAW,CAAK,GAAA,CAAA,GAAI,IAAQ,GAAA,CAAA;AAAA,GAAA,CAAA;AAGjC,EAAA,MAAM,gBAAmB,GAAA;AAAA,IACvB,CAAA,EAAG,KAAK,KAAQ,GAAA,CAAA;AAAA,IAChB,CAAA,EAAG,KAAK,MAAS,GAAA,CAAA;AAAA,GAAA,CAAA;AAGnB,EAAO,OAAA;AAAA,IACL,OAAU,EAAA,CAAA,gBAAA,CAAiB,CAAI,GAAA,iBAAA,CAAkB,CAAK,IAAA,IAAA;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/pointCloudView/PointCloudBackView.tsx"],"sourcesContent":["/*\n * @Author: Laoluo luozefeng@sensetime.com\n * @Date: 2022-06-22 11:08:31\n * @LastEditors: Laoluo luozefeng@sensetime.com\n * @LastEditTime: 2022-07-08 11:08:02\n */\nimport {\n PointCloud,\n PointCloudAnnotation,\n} from '@labelbee/lb-annotation';\nimport { getClassName } from '@/utils/dom';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport React, { useEffect, useRef } from 'react';\nimport { PointCloudContext } from './PointCloudContext';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { EPerspectiveView, IPointCloudBox } from '@labelbee/lb-utils';\nimport { SizeInfoForView } from './PointCloudInfos';\nimport { connect } from 'react-redux';\nimport { a2MapStateToProps, IA2MapStateProps } from '@/store/annotation/map';\nimport { usePointCloudViews } from './hooks/usePointCloudViews';\nimport useSize from '@/hooks/useSize';\nimport EmptyPage from './components/EmptyPage';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\n\n/**\n * 统一一下,将其拓展为 二维转换为 三维坐标的转换\n * Get the offset from canvas2d-coordinate to world coordinate\n * @param currentPos\n * @param size\n * @param zoom\n * @returns\n */\nconst TransferCanvas2WorldOffset = (\n currentPos: { x: number; y: number },\n size: { width: number; height: number },\n zoom = 1,\n) => {\n const { width: w, height: h } = size;\n\n const canvasCenterPoint = {\n x: currentPos.x + (w * zoom) / 2,\n y: currentPos.y + (h * zoom) / 2,\n };\n\n const worldCenterPoint = {\n x: size.width / 2,\n y: size.height / 2,\n };\n\n return {\n offsetX: (worldCenterPoint.x - canvasCenterPoint.x) / zoom,\n offsetY: -(worldCenterPoint.y - canvasCenterPoint.y) / zoom,\n };\n};\nconst updateBackViewByCanvas2D = (\n currentPos: { x: number; y: number },\n zoom: number,\n size: { width: number; height: number },\n selectedPointCloudBox: IPointCloudBox,\n backPointCloud: PointCloud,\n) => {\n const { offsetX, offsetY } = TransferCanvas2WorldOffset(currentPos, size, zoom);\n backPointCloud.camera.zoom = zoom;\n if (currentPos) {\n const cos = Math.cos(selectedPointCloudBox.rotation);\n const sin = Math.sin(selectedPointCloudBox.rotation);\n const offsetXX = offsetX * cos;\n const offsetXY = offsetX * sin;\n const { x, y, z } = backPointCloud.initCameraPosition;\n backPointCloud.camera.position.set(x + offsetXY, y - offsetXX, z + offsetY);\n }\n backPointCloud.camera.updateProjectionMatrix();\n backPointCloud.render();\n};\n\ninterface IProps {\n checkMode?: boolean\n}\n\nconst PointCloudSideView = ({ currentData, config, checkMode }: IA2MapStateProps & IProps) => {\n const ptCtx = React.useContext(PointCloudContext);\n const ref = useRef<HTMLDivElement>(null);\n const size = useSize(ref);\n const { selectedBox } = useSingleBox();\n const { t } = useTranslation();\n const { backViewUpdateBox } = usePointCloudViews();\n\n useEffect(() => {\n if (ref.current) {\n const size = {\n width: ref.current.clientWidth,\n height: ref.current.clientHeight,\n };\n\n const pointCloudAnnotation = new PointCloudAnnotation({\n container: ref.current,\n size,\n polygonOperationProps: { showDirectionLine: false, forbidAddNew: true },\n config,\n checkMode\n });\n ptCtx.setBackViewInstance(pointCloudAnnotation);\n }\n }, []);\n\n useEffect(() => {\n // By the way as an initialization judgment\n if (!size || !ptCtx.backViewInstance) {\n return;\n }\n\n const {\n pointCloud2dOperation: backPointCloudPolygonOperation,\n pointCloudInstance: backPointCloud,\n } = ptCtx.backViewInstance;\n\n /**\n * Synchronized 3d point cloud view displacement operations\n *\n * Change Orthographic Camera size\n */\n backPointCloudPolygonOperation.singleOn('renderZoom', (zoom: number, currentPos: any) => {\n if (!ptCtx.selectedPointCloudBox) {\n return;\n }\n updateBackViewByCanvas2D(currentPos, zoom, size, ptCtx.selectedPointCloudBox, backPointCloud);\n });\n\n // Synchronized 3d point cloud view displacement operations\n backPointCloudPolygonOperation.singleOn('dragMove', ({ currentPos, zoom }: any) => {\n if (!ptCtx.selectedPointCloudBox) {\n return;\n }\n updateBackViewByCanvas2D(currentPos, zoom, size, ptCtx.selectedPointCloudBox, backPointCloud);\n });\n\n backPointCloudPolygonOperation.singleOn(\n 'updatePolygonByDrag',\n ({ newPolygon, originPolygon }: any) => {\n backViewUpdateBox?.(newPolygon, originPolygon)\n },\n );\n }, [ptCtx, size]);\n\n useEffect(() => {\n // Update Size\n ptCtx?.backViewInstance?.initSize(size);\n }, [size]);\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-container', 'back-view')}\n title={t('BackView')}\n toolbar={<SizeInfoForView perspectiveView={EPerspectiveView.Back} />}\n >\n <div className={getClassName('point-cloud-container', 'bottom-view-content')}>\n <div className={getClassName('point-cloud-container', 'core-instance')} ref={ref} />\n {!selectedBox && <EmptyPage />}\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloudSideView,\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiCA,MAAM,0BAA6B,GAAA,CACjC,UACA,EAAA,IAAA,EACA,OAAO,CACJ,KAAA;AACH,EAAA,MAAM,CAAE,KAAA,EAAO,CAAG,EAAA,MAAA,EAAQ,CAAM,CAAA,GAAA,IAAA,CAAA;AAEhC,EAAA,MAAM,iBAAoB,GAAA;AAAA,IACxB,CAAG,EAAA,UAAA,CAAW,CAAK,GAAA,CAAA,GAAI,IAAQ,GAAA,CAAA;AAAA,IAC/B,CAAG,EAAA,UAAA,CAAW,CAAK,GAAA,CAAA,GAAI,IAAQ,GAAA,CAAA;AAAA,GAAA,CAAA;AAGjC,EAAA,MAAM,gBAAmB,GAAA;AAAA,IACvB,CAAA,EAAG,KAAK,KAAQ,GAAA,CAAA;AAAA,IAChB,CAAA,EAAG,KAAK,MAAS,GAAA,CAAA;AAAA,GAAA,CAAA;AAGnB,EAAO,OAAA;AAAA,IACL,OAAU,EAAA,CAAA,gBAAA,CAAiB,CAAI,GAAA,iBAAA,CAAkB,CAAK,IAAA,IAAA;AAAA,IACtD,OAAS,EAAA,EAAmB,gBAAA,CAAA,CAAA,GAAI,kBAAkB,CAAK,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a,uBAAyB,EAAA,eAAA,CAAA;AAAA,IAAkB,GAAA;AAAA,GACvE,CAAA,EAAA,CAAC,WAAe,oBAAA,KAAA,CAAA,aAAA,CAAC,SAAD,EAAA,IAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAMzB,yBAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC/D,CAAA,CAAA,CAAA,kBAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ActionsHistory as
|
|
1
|
+
import{ActionsHistory as p}from"@labelbee/lb-annotation";import y,{useState as e,useRef as Z,useMemo as x}from"react";const v=y.createContext({pointCloudBoxList:[],polygonList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],setPolygonList:()=>{},zoom:1,setZoom:()=>{},history:new p,syncAllViewPointCloudColor:()=>{}}),H=({children:S})=>{const[s,r]=e([]),[u,A]=e([]),[o,c]=e([]),[C,B]=e(!0),[w,g]=e(1),[d,h]=e(),[P,L]=e(),[V,b]=e(),[i,D]=e(),R=Z(new p).current,I=x(()=>o.length===1?o[0]:"",[o]),k=x(()=>{const M=s.find(t=>t.id===I),z=t=>{const n=s.concat(t);return r(n),n},E=t=>{B(t!==!1)},l=t=>{t===void 0&&c([]),typeof t=="string"&&c([t]),Array.isArray(t)&&c(Array.from(new Set(t)))};return{selectedID:I,pointCloudBoxList:s,selectedIDs:o,setPointCloudResult:r,setSelectedIDs:l,addPointCloudBox:z,valid:C,selectedPointCloudBox:M,setPointCloudValid:E,addSelectedID:t=>{o.includes(t)?l(o.filter(n=>n!==t)):l([...o,t])},selectedAllBoxes:()=>{l(s.map(t=>t.id))},topViewInstance:d,setTopViewInstance:h,sideViewInstance:P,setSideViewInstance:L,backViewInstance:V,setBackViewInstance:b,mainViewInstance:i,setMainViewInstance:D,polygonList:u,setPolygonList:A,zoom:w,setZoom:g,history:R,syncAllViewPointCloudColor:t=>{const n=i==null?void 0:i.highlightOriginPointCloud(t);return new Promise(T=>{n==null||n.then(a=>{[d].forEach(f=>{var m;a&&((m=f==null?void 0:f.pointCloudInstance)==null||m.updateColor(a),T({color:a}))})})})}}},[C,o,s,u,d,P,V,i,w]);return y.createElement(v.Provider,{value:k},S)};export{v as PointCloudContext,H as PointCloudProvider};
|