@labelbee/lb-components 1.6.0-alpha.3 → 1.6.0-alpha.4
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/assets/annotation/pointCloudTool/nodata.svg.js +1 -0
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudBackView.js +1 -1
- package/dist/components/pointCloudView/PointCloudInfos.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudSideView.js +1 -1
- package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
- package/dist/components/pointCloudView/components/EmptyPage/index.js +1 -0
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/hooks/useRotate.js +1 -1
- package/dist/index.css +4 -0
- package/dist/store/Actions.js +1 -1
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/types/components/pointCloudView/components/EmptyPage/index.d.ts +2 -0
- package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +2 -0
- package/dist/types/store/Actions.d.ts +1 -0
- package/dist/types/store/annotation/actionCreators.d.ts +1 -0
- package/dist/types/store/annotation/types.d.ts +1 -0
- package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
- package/es/assets/annotation/pointCloudTool/nodata.svg.js +1 -0
- package/es/assets/annotation/pointCloudTool/nodata.svg.js.map +1 -0
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.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/PointCloudInfos.js +1 -1
- package/es/components/pointCloudView/PointCloudInfos.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/PointCloudSideView.js +1 -1
- package/es/components/pointCloudView/PointCloudSideView.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/components/EmptyPage/index.js +1 -0
- package/es/components/pointCloudView/components/EmptyPage/index.js.map +1 -0
- package/es/components/pointCloudView/hooks/useBoxes.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/useRotate.js +1 -1
- package/es/components/pointCloudView/hooks/useRotate.js.map +1 -1
- package/es/components/pointCloudView/hooks/useSingleBox.js.map +1 -1
- package/es/index.css +4 -0
- package/es/store/Actions.js +1 -1
- package/es/store/Actions.js.map +1 -1
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/actionCreators.js.map +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/store/annotation/reducer.js.map +1 -1
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var img="data:image/svg+xml,%3csvg width='68' height='76' viewBox='0 0 68 76' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0_96880_20054)'%3e%3crect x='6.45483' y='0.848145' width='54.0956' height='56.7089' rx='1.04533' fill='url(%23paint0_linear_96880_20054)' fill-opacity='0.12'/%3e%3cpath d='M67 41.3584V75H0V57.755L65.6869 40.348C66.3501 40.1722 67 40.6723 67 41.3584Z' fill='url(%23paint1_linear_96880_20054)'/%3e%3cpath d='M0.182861 35.8192V75.3775H67.0837V59.9767L1.60277 34.8433C0.91818 34.5806 0.182861 35.086 0.182861 35.8192Z' fill='url(%23paint2_linear_96880_20054)'/%3e%3cpath d='M34.8791 22C31.5247 22 28.8956 22.9519 26.9464 24.8558C25.4935 26.2426 24.5938 28.0144 24.2124 30.171C23.9638 31.5762 25.1568 32.7431 26.5838 32.7431V32.7431C28.0108 32.7431 29.098 31.5652 29.4401 30.1799C29.627 29.423 29.912 28.7815 30.3008 28.2555C31.2074 27.0316 32.6126 26.4423 34.5618 26.4423C36.103 26.4423 37.3269 26.8503 38.1882 27.7115C39.0041 28.5728 39.4574 29.7514 39.4574 31.2473C39.4574 32.3805 39.0494 33.4684 38.2335 34.4657L37.6896 35.1003C34.7431 37.7294 32.9753 39.6332 32.386 40.8571C31.9171 41.7614 31.6462 42.8142 31.5366 43.9972C31.4651 44.7702 31.9823 45.4588 32.7224 45.6932V45.6932C33.2639 45.8647 33.8406 45.8939 34.3967 45.778L34.957 45.6612C35.9679 45.4505 36.6494 44.5444 36.9087 43.5449C37.0201 43.1152 37.1747 42.7029 37.3723 42.3077C37.7802 41.4918 38.3695 40.7212 39.1854 40.0865C41.3613 38.1827 42.6758 36.9588 43.0838 36.5055C44.1717 35.0549 44.761 33.1964 44.761 30.9299C44.761 28.1648 43.8544 25.989 42.0412 24.4025C40.228 22.7706 37.8255 22 34.8791 22ZM34.0632 48.1552C33.0659 48.1552 32.25 48.4725 31.6154 49.1071C30.8901 49.7418 30.5728 50.5577 30.5728 51.5549C30.5728 52.5522 30.8901 53.3681 31.6154 54.0027C32.25 54.6374 33.0659 55 34.0632 55C35.0604 55 35.8764 54.6827 36.6016 54.0481C37.2363 53.4135 37.5989 52.5522 37.5989 51.5549C37.5989 50.5577 37.2363 49.7418 36.6016 49.1071C35.9217 48.4725 35.0604 48.1552 34.0632 48.1552Z' fill='%23F3F3F3' fill-opacity='0.25'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient id='paint0_linear_96880_20054' x1='33.5026' y1='0.848145' x2='33.5026' y2='57.557' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%23EDEDED'/%3e%3cstop offset='1' stop-color='white'/%3e%3c/linearGradient%3e%3clinearGradient id='paint1_linear_96880_20054' x1='33.5' y1='32.9214' x2='33.5' y2='62.8103' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%23373737'/%3e%3cstop offset='1' stop-color='%230E0E0E'/%3e%3c/linearGradient%3e%3clinearGradient id='paint2_linear_96880_20054' x1='33.6333' y1='31.097' x2='33.6333' y2='74.1393' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%232C2C2C'/%3e%3cstop offset='1' stop-color='%23424242'/%3e%3c/linearGradient%3e%3cclipPath id='clip0_96880_20054'%3e%3crect width='68' height='76.0002' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";module.exports=img;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),index=require("../AnnotationView/index.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),icons=require("@ant-design/icons"),useSize=require("../../hooks/useSize.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e};const Toolbar=({onNext:e,onPrev:t,imgLength:n,imgIndex:
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),index=require("../AnnotationView/index.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),icons=require("@ant-design/icons"),useSize=require("../../hooks/useSize.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e};const Toolbar=({onNext:e,onPrev:t,imgLength:n,imgIndex:i})=>React__default.default.createElement("div",null,React__default.default.createElement(icons.LeftOutlined,{onClick:t}),React__default.default.createElement("span",null," ",i+1," / ",n," "),React__default.default.createElement(icons.RightOutlined,{onClick:e})),PointCloud2DView=({imgInfo:e})=>{var t,n;const[i,f]=React.useState([]),{pointCloudBoxList:s,topViewInstance:c}=React.useContext(PointCloudContext.PointCloudContext),[a,l]=React.useState(0),d=React.useRef(null),m=useSize(d),r=(t=e==null?void 0:e.mappingImgList)==null?void 0:t[a];if(React.useEffect(()=>{l(0)},[e]),React.useEffect(()=>{if(c&&r){const{pointCloudInstance:o}=c,v={fill:"transparent",color:"green"},g=s.reduce((C,P)=>{const _=o.pointCloudLidar2image(P,r.calib);return[...C,..._.map(p=>({type:p.type,annotation:__spreadValues({pointList:p.pointList},v)}))]},[]);f(g)}},[s,r]),!e)return React__default.default.createElement("div",null);const{mappingImgList:u}=e;return u?React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-2d-container"),title:"2D\u89C6\u56FE",toolbar:React__default.default.createElement(Toolbar,{imgIndex:a,imgLength:u.length,onNext:()=>{a>=u.length-1||l(o=>o+1)},onPrev:()=>{a<=0||l(o=>o-1)}})},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:d},React__default.default.createElement(index,{src:(n=r==null?void 0:r.url)!=null?n:"",annotations:i,size:m}))):React__default.default.createElement("div",null)},mapStateToProps=e=>{const{imgList:t,imgIndex:n}=e.annotation;return{imgInfo:t[n]}};var PointCloud2DView$1=reactRedux.connect(mapStateToProps)(PointCloud2DView);module.exports=PointCloud2DView$1;
|
|
@@ -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");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");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const TransferCanvas2WorldOffset=(t,e,n=1)=>{const{width:i,height:s}=e,r={x:t.x+i*n/2,y:t.y+s*n/2},o={x:e.width/2,y:e.height/2};return{offsetX:(o.x-r.x)/n,offsetY:-(o.y-r.y)/n}},updateBackViewByCanvas2D=(t,e,n,i,s)=>{const{offsetX:r,offsetY:o}=TransferCanvas2WorldOffset(t,n,e);if(s.camera.zoom=e,t){const c=Math.cos(i.rotation),a=Math.sin(i.rotation),l=r*c,u=r*a,{x:d,y:f,z:C}=s.initCameraPosition;s.camera.position.set(d+u,f-l,C+o)}s.camera.updateProjectionMatrix(),s.render()},PointCloudSideView=({currentData:t})=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),n=React.useRef(null),i=useSize(n),{updateSelectedBox:s,selectedBox:r}=useSingleBox.useSingleBox();return React.useEffect(()=>{if(n.current){const o={width:n.current.clientWidth,height:n.current.clientHeight},c=new lbAnnotation.PointCloudAnnotation({container:n.current,size:o,polygonOperationProps:{showDirectionLine:!1,forbidAddNew:!0}});e.setBackViewInstance(c)}},[]),React.useEffect(()=>{if(!i||!e.backViewInstance)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=e.backViewInstance;o.singleOn("renderZoom",(a,l)=>{!e.selectedPointCloudBox||updateBackViewByCanvas2D(l,a,i,e.selectedPointCloudBox,c)}),o.singleOn("dragMove",({currentPos:a,zoom:l})=>{!e.selectedPointCloudBox||updateBackViewByCanvas2D(a,l,i,e.selectedPointCloudBox,c)}),o.singleOn("updatePolygonByDrag",({newPolygon:a,originPolygon:l})=>{if(!e.selectedPointCloudBox||!e.mainViewInstance||!t.url)return;const[u,d,f]=a.pointList,[C,x,w]=l.pointList,p=lbAnnotation.MathUtils.getLineCenterPoint([u,f]),g=lbAnnotation.MathUtils.getLineCenterPoint([C,w]),P={x:{x:p.x-g.x,y:p.y-g.y}.x,y:0,z:p.y-g.y},v=lbAnnotation.MathUtils.getLineLength(u,d),m=lbAnnotation.MathUtils.getLineLength(C,x),y=v-m,B=lbAnnotation.MathUtils.getLineLength(d,f),V=lbAnnotation.MathUtils.getLineLength(x,w),L=B-V,{newBoxParams:h}=c.getNewBoxByBackUpdate(P,L,y,e.selectedPointCloudBox);usePointCloudViews.synchronizeTopView(h,a,e.topViewInstance,e.mainViewInstance),usePointCloudViews.synchronizeSideView(h,a,e.sideViewInstance,t.url),e.mainViewInstance.highlightOriginPointCloud(h),s(h)})},[e,i]),React.useEffect(()=>{var o;(o=e==null?void 0:e.backViewInstance)==null||o.initSize(i)},[i]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","back-view"),title:"\u80CC\u89C6\u56FE",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:n}),!r&&React__default.default.createElement(index,null)))};var PointCloudBackView=reactRedux.connect(map.aMapStateToProps)(PointCloudSideView);module.exports=PointCloudBackView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const DECIMAL_PLACES=2,SizeInfoForView=({perspectiveView:e})=>{const{pointCloudBoxList:o,selectedID:n}=React__default.default.useContext(PointCloudContext.PointCloudContext),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useSingleBox=require("./hooks/useSingleBox.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const DECIMAL_PLACES=2,SizeInfoForView=({perspectiveView:e})=>{const{pointCloudBoxList:o,selectedID:n}=React__default.default.useContext(PointCloudContext.PointCloudContext),l=o.find(t=>t.id===n);if(n&&l){const t=e===lbUtils.EPerspectiveView.Back?[{label:"\u5BBD",value:l.width},{label:"\u9AD8",value:l.depth}]:[{label:"\u957F",value:l.height},{label:"\u5BBD",value:l.width}];return React__default.default.createElement(React__default.default.Fragment,null,t.map((u,i)=>React__default.default.createElement("span",{key:i,style:{marginRight:i===0?16:0,fontSize:12}},`${u.label}: ${u.value.toFixed(DECIMAL_PLACES)}`)))}return null},BoxInfos=()=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),{selectedBox:o}=useSingleBox.useSingleBox(),[n,l]=React.useState([]);return React.useEffect(()=>{var t;if(!o)return;const{length:u,width:i,height:s,rotation_y:d}=lbUtils.PointCloudUtils.transferBox2Kitti(o.info);let a=[{label:"\u957F",value:u.toFixed(DECIMAL_PLACES)},{label:"\u5BBD",value:i.toFixed(DECIMAL_PLACES)},{label:"\u9AD8",value:s.toFixed(DECIMAL_PLACES)},{label:"\u671D\u5411\u89D2",value:lbAnnotation.UnitUtils.rad2deg(d).toFixed(DECIMAL_PLACES)}];(t=e.mainViewInstance)==null||t.filterPointsByBox(o.info).then(r=>{if(!r){l(a);return}a.push({label:"\u70B9\u6570",value:`${r.num}`}),l(a)})},[o]),o?React__default.default.createElement("div",{style:{position:"absolute",color:"white",backgroundColor:"rgba(153, 153, 153, 0.3)",right:8,top:8,fontSize:12,padding:8,zIndex:20}},n.map(t=>React__default.default.createElement("div",{key:t.label},`${t.label}: ${t.value}`))):null},PointCloudValidity=()=>React__default.default.useContext(PointCloudContext.PointCloudContext).valid===!1?React__default.default.createElement("div",{style:{position:"absolute",backgroundColor:"rgb(242, 101, 73)",color:"white",left:0,top:0,fontSize:20,padding:"8px 16px",zIndex:20}},"\u65E0\u6548"):null;exports.BoxInfos=BoxInfos,exports.PointCloudValidity=PointCloudValidity,exports.SizeInfoForView=SizeInfoForView;
|
|
@@ -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"),
|
|
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"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,e,r)=>e in o?__defProp(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,__spreadValues=(o,e)=>{for(var r in e||(e={}))__hasOwnProp.call(e,r)&&__defNormalProp(o,r,e[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))__propIsEnum.call(e,r)&&__defNormalProp(o,r,e[r]);return o},__spreadProps=(o,e)=>__defProps(o,__getOwnPropDescs(e));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:o})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:r,selectNextBox:P,selectPrevBox:x,updateSelectedBox:c}=useSingleBox.useSingleBox(),{clearAllResult:d}=useStatus.useStatus(),b=index.jsonParser(o.result),{copySelectedBoxes:f,pasteSelectedBoxes:w,copiedBoxes:C}=useBoxes.useBoxes(),{toolInstanceRef:a}=annotation.useCustomToolInstance({basicInfo:b}),{updateRotate:l}=useRotate.useRotate({currentData:o}),{updatePointCloudData:p}=usePointCloudViews.usePointCloudViews(),y=t=>{const{topViewInstance:s,mainViewInstance:u}=e;if(!s)return;const{pointCloud2dOperation:n}=s;switch(t){case"q":{l(2);break}case"e":l(-2);break;case"g":l(180);break;case"u":{const i=n.pattern===EPolygonPattern.Normal?EPolygonPattern.Rect:EPolygonPattern.Normal;n.setPattern(i);const _={[EPolygonPattern.Normal]:"Normal Pattern",[EPolygonPattern.Rect]:"Rect Pattern"};antd.message.success(`Change Pattern to ${_[i]} successfully`),n.clearActiveStatus(),n.clearDrawingStatus()}break;case"+":u==null||u.updatePointSize(!0);break;case"-":u==null||u.updatePointSize(!1);break;case"v":e.setPointCloudValid(!e.valid);break;case"z":P();break;case"c":x();break;case"f":r();break;default:return}},k=t=>{switch(t){case"c":f();break;case"v":w();break;case"a":e.selectedAllBoxes();break}},v=t=>{const s=t.key.toLocaleLowerCase();if(t.ctrlKey){k(s);return}y(s)};return React.useEffect(()=>{const{topViewInstance:t}=e;if(!!t)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}},[e,C]),React.useEffect(()=>{p==null||p()},[o,e.mainViewInstance]),React.useEffect(()=>{a.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],a.current.exportCustomData=()=>{var t;return{renderPolygon:(t=e.polygonList)!=null?t:[]}},a.current.setDefaultAttribute=t=>{const s=e.selectedPointCloudBox;s&&(s.attribute=t,c(s))},a.current.setSubAttribute=(t,s)=>{var u;const n=e.selectedPointCloudBox;if(n){const i=(u=n==null?void 0:n.subAttribute)!=null?u:{};n.subAttribute=__spreadProps(__spreadValues({},i),{[t]:s}),c(n)}},a.current.clearResult=()=>{d==null||d()}},[e.pointCloudBoxList,e.selectedID,e.valid,e.polygonList]),React.useEffect(()=>{a.current.setValid=t=>{a.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t)})}},[]),null};var PointCloudListener$1=reactRedux.connect(map.aMapStateToProps)(PointCloudListener);module.exports=PointCloudListener$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),dom=require("../../utils/dom.js"),PointCloudLayout=require("./PointCloudLayout.js"),React=require("react"),lbUtils=require("@labelbee/lb-utils"),PointCloudContext=require("./PointCloudContext.js"),PointCloudInfos=require("./PointCloudInfos.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSize=require("../../hooks/useSize.js");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React);const TransferCanvas2WorldOffset=(o,e,
|
|
1
|
+
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),dom=require("../../utils/dom.js"),PointCloudLayout=require("./PointCloudLayout.js"),React=require("react"),lbUtils=require("@labelbee/lb-utils"),PointCloudContext=require("./PointCloudContext.js"),PointCloudInfos=require("./PointCloudInfos.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSingleBox=require("./hooks/useSingleBox.js"),index=require("./components/EmptyPage/index.js"),useSize=require("../../hooks/useSize.js");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React);const TransferCanvas2WorldOffset=(o,e,s=1)=>{const{width:u,height:t}=e,i={x:o.x+u*s/2,y:o.y+t*s/2},n={x:e.width/2,y:e.height/2};return{offsetX:(n.x-i.x)/s,offsetY:-(n.y-i.y)/s}},updateSideViewByCanvas2D=(o,e,s,u,t)=>{const{offsetX:i,offsetY:n}=TransferCanvas2WorldOffset(o,s,e);if(t.camera.zoom=e,o){const l=Math.cos(u.rotation),r=Math.sin(u.rotation),a=i*l,c=i*r,{x:d,y:f,z:C}=t.initCameraPosition;t.camera.position.set(d-a,f-c,C+n)}t.camera.updateProjectionMatrix(),t.render()},PointCloudSideView=({currentData:o})=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),{sideViewUpdateBox:s}=usePointCloudViews.usePointCloudViews(),{selectedBox:u}=useSingleBox.useSingleBox(),t=React.useRef(null),i=useSize(t);return React.useEffect(()=>{if(t.current){const n={width:t.current.clientWidth,height:t.current.clientHeight},l=new lbAnnotation.PointCloudAnnotation({container:t.current,size:n,polygonOperationProps:{showDirectionLine:!1,forbidAddNew:!0}});e.setSideViewInstance(l)}},[]),React.useEffect(()=>{if(!i||!e.sideViewInstance)return;const{pointCloud2dOperation:n,pointCloudInstance:l}=e.sideViewInstance;n.singleOn("renderZoom",(r,a)=>{!e.selectedPointCloudBox||updateSideViewByCanvas2D(a,r,i,e.selectedPointCloudBox,l)}),n.singleOn("dragMove",({currentPos:r,zoom:a})=>{!e.selectedPointCloudBox||updateSideViewByCanvas2D(r,a,i,e.selectedPointCloudBox,l)}),n.singleOn("updatePolygonByDrag",({newPolygon:r,originPolygon:a})=>{s(r,a)})},[e,i]),React.useEffect(()=>{var n;(n=e==null?void 0:e.sideViewInstance)==null||n.initSize(i)},[i]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","side-view"),title:"\u4FA7\u89C6\u56FE",toolbar:React__default.default.createElement(PointCloudInfos.SizeInfoForView,{perspectiveView:lbUtils.EPerspectiveView.Left})},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}),!u&&React__default.default.createElement(index,null)))};var PointCloudSideView$1=reactRedux.connect(map.aMapStateToProps)(PointCloudSideView);module.exports=PointCloudSideView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),index=require("../../views/MainView/toolFooter/index.js"),index$1=require("../../views/MainView/toolFooter/ZoomController/index.js"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),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"),antd=require("antd"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),index=require("../../views/MainView/toolFooter/index.js"),index$1=require("../../views/MainView/toolFooter/ZoomController/index.js"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),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"),antd=require("antd"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const{EPolygonPattern}=lbAnnotation.cTool,TransferCanvas2WorldOffset=(t,l,e=1)=>{const{width:i,height:a}=l,r={x:t.x+i*e/2,y:t.y+a*e/2},u={x:l.width/2,y:l.height/2};return{offsetX:(u.x-r.x)/e,offsetY:-(u.y-r.y)/e}},TopViewToolbar=({currentData:t})=>{const{selectNextBox:l,selectPrevBox:e}=useSingleBox.useSingleBox(),{updateRotate:i}=useRotate.useRotate({currentData:t}),a=2,r=()=>{i(-a)},u=()=>{i(a)},d=()=>{i(180)};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("span",{onClick:u,className:dom.getClassName("point-cloud","rotate-reserve")}),React__default.default.createElement("span",{onClick:r,className:dom.getClassName("point-cloud","rotate")}),React__default.default.createElement("span",{onClick:d,className:dom.getClassName("point-cloud","rotate-180")}),React__default.default.createElement(index.FooterDivider,null),React__default.default.createElement(icons.UpSquareOutlined,{onClick:()=>{e()},className:dom.getClassName("point-cloud","prev")}),React__default.default.createElement(icons.DownSquareOutlined,{onClick:()=>{l()},className:dom.getClassName("point-cloud","next")}),React__default.default.createElement(index.FooterDivider,null),React__default.default.createElement(index$1.ZoomController,null))},ZAxisSlider=({setZAxisLimit:t,zAxisLimit:l})=>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:l,onAfterChange:e=>{t(e)}})),PointCloudTopView=({currentData:t})=>{const l=React.useRef(null),e=React__default.default.useContext(PointCloudContext.PointCloudContext),i=useSize(l),{addPolygon:a,deletePolygon:r}=usePolygon.usePolygon(),{deletePointCloudBox:u}=useSingleBox.useSingleBox(),[d,x]=React.useState(10),c=usePointCloudViews.usePointCloudViews();return React.useEffect(()=>{if(l.current&&(t==null?void 0:t.url)&&(t==null?void 0:t.result)){const o={width:l.current.clientWidth,height:l.current.clientHeight};if(e.topViewInstance)return;const n=new lbAnnotation.PointCloudAnnotation({container:l.current,size:o,pcdPath:t.url});n.addPolygonListOnTopView(t.result),e.setTopViewInstance(n)}},[t]),React.useEffect(()=>{if(!i||!e.topViewInstance||!e.sideViewInstance)return;const{pointCloud2dOperation:o}=e.topViewInstance;o.singleOn("polygonCreated",n=>{if(o.pattern===EPolygonPattern.Normal||!(t==null?void 0:t.url)){a(n);return}c.topViewAddBox(n,i)}),o.singleOn("deletedObject",({id:n})=>{u(n),r(n)}),o.singleOn("deleteSelectedIDs",()=>{e.setSelectedIDs([])}),o.singleOn("addSelectedIDs",n=>{e.addSelectedID(n)}),o.singleOn("setSelectedIDs",n=>{e.setSelectedIDs(n)}),o.singleOn("updatePolygonByDrag",({newPolygon:n})=>{var s;(s=c.topViewUpdateBox)==null||s.call(c,n,i)})},[e,i,t,c]),React.useEffect(()=>{if(!(i==null?void 0:i.width)||!e.topViewInstance)return;e.topViewInstance.initSize(i),e.topViewInstance.updatePolygonList(e.pointCloudBoxList);const{topViewInstance:{pointCloudInstance:o,pointCloud2dOperation:n}}=e;n.singleOn("renderZoom",(s,f)=>{const{offsetX:p,offsetY:C}=TransferCanvas2WorldOffset(f,i,s);if(o.camera.zoom=s,f){const{x:m,y:v,z:g}=o.initCameraPosition;o.camera.position.set(m+C,v-p,g)}o.camera.updateProjectionMatrix(),o.render()}),n.singleOn("dragMove",({currentPos:s,zoom:f})=>{const{offsetX:p,offsetY:C}=TransferCanvas2WorldOffset(s,i,f);o.camera.zoom=f;const{x:m,y:v,z:g}=o.initCameraPosition;o.camera.position.set(m+C,v-p,g),o.render()})},[i]),React.useEffect(()=>{var o,n;(n=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null||n.applyZAxisPoints(d)},[d]),React.useEffect(()=>{c.topViewSelectedChanged()},[e.selectedIDs]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","top-view"),title:"\u4FEF\u89C6\u56FE",toolbar:React__default.default.createElement(TopViewToolbar,{currentData:t})},React__default.default.createElement("div",{style:{position:"relative",flex:1}},React__default.default.createElement("div",{style:{width:"100%",height:"100%"},ref:l}),React__default.default.createElement(PointCloudInfos.BoxInfos,null),React__default.default.createElement(ZAxisSlider,{zAxisLimit:d,setZAxisLimit:x}),React__default.default.createElement(PointCloudInfos.PointCloudValidity,null)))};var PointCloudTopView$1=reactRedux.connect(map.aMapStateToProps)(PointCloudTopView);module.exports=PointCloudTopView$1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var React=require("react"),nodata=require("../../../../assets/annotation/pointCloudTool/nodata.svg.js"),dom=require("../../../../utils/dom.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const EmptyPage=()=>React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","empty-page")},React__default.default.createElement("img",{src:nodata}),React__default.default.createElement("span",{className:dom.getClassName("point-cloud-container","empty-page","text")},"\u6682\u65E0\u6570\u636E"));module.exports=EmptyPage;
|
|
@@ -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"),reactRedux=require("react-redux"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js");function _interopDefaultLegacy(
|
|
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"),reactRedux=require("react-redux"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_),__async=(e,i,s)=>new Promise((d,t)=>{var n=r=>{try{c(s.next(r))}catch(h){t(h)}},u=r=>{try{c(s.throw(r))}catch(h){t(h)}},c=r=>r.done?d(r.value):Promise.resolve(r.value).then(n,u);c((s=s.apply(e,i)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},transferCanvas2World=(e,i)=>{const{width:s,height:d}=i,{x:t,y:n}=e;return{x:-n+d/2,y:-(t-s/2)}},topViewPolygon2PointCloud=(e,i,s,d,t)=>{const[n,u,c,r]=e.pointList.map(f=>transferCanvas2World(f,i)),h=lbAnnotation.MathUtils.getLineCenterPoint([n,c]),L=lbAnnotation.MathUtils.getLineLength(n,u),p=lbAnnotation.MathUtils.getLineLength(u,c),g=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);let y=0,P=1;if(s){const f=s.getSensesPointZAxisInPolygon([n,u,c,r]);y=(f.maxZ+f.minZ)/2,P=f.maxZ-f.minZ}d&&(y=d.center.z,P=d.depth);const v={center:{x:h.x,y:h.y,z:y},width:p,height:L,depth:P,rotation:g,id:e.id,attribute:"",valid:!0};return t&&Object.assign(v,t),v},sideViewPolygon2PointCloud=(e,i,s,d)=>{const[t,n,u]=e.pointList,[c,r,h]=i.pointList,L=lbAnnotation.MathUtils.getLineCenterPoint([t,u]),p=lbAnnotation.MathUtils.getLineCenterPoint([c,h]),g={x:L.x-p.x,y:L.y-p.y},y=Math.cos(s.rotation),P=Math.sin(s.rotation),v={x:g.x,y:g.x*P+g.y*y,z:L.y-p.y},f=lbAnnotation.MathUtils.getLineLength(t,n),w=lbAnnotation.MathUtils.getLineLength(c,r),U=f-w,V=lbAnnotation.MathUtils.getLineLength(n,u),b=lbAnnotation.MathUtils.getLineLength(r,h),D=V-b,{newBoxParams:I}=d.getNewBoxBySideUpdate(v,D,U,s);return I},synchronizeSideView=(e,i,s,d)=>{if(!s)return;const{pointCloud2dOperation:t,pointCloudInstance:n}=s;n.loadPCDFileByBox(d,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:u}=n.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);n.setInitCameraPosition(u);const{polygon2d:c,zoom:r}=n.getBoxSidePolygon2DCoordinate(e);n.camera.zoom=r,n.camera.updateProjectionMatrix(),n.render(),t.initPosition(),t.zoomChangeOnCenter(r),t.setResultAndSelectedID([{id:i.id,pointList:c,textAttribute:"",isRect:!0}],i.id)},synchronizeBackView=(e,i,s,d)=>{if(!s)return;const{pointCloud2dOperation:t,pointCloudInstance:n}=s;n.loadPCDFileByBox(d,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:u}=n.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);n.setInitCameraPosition(u);const{polygon2d:c,zoom:r}=n.getBoxBackPolygon2DCoordinate(e);n.camera.zoom=r,n.camera.updateProjectionMatrix(),n.render(),t.initPosition(),t.zoomChangeOnCenter(r),t.setResultAndSelectedID([{id:i.id,pointList:c,textAttribute:"",isRect:!0}],i.id)},synchronizeTopView=(e,i,s,d)=>{if(!s||!d)return;d.generateBox(e,i.id),d.updateCameraByBox(e,lbUtils.EPerspectiveView.Top),d.render();const{pointCloud2dOperation:t,pointCloudInstance:n}=s,{polygon2d:u}=n.getBoxTopPolygon2DCoordinate(e),c=[...t.polygonList],r=c.find(h=>h.id===i.id);r?r.pointList=u:c.push({id:i.id,pointList:u,textAttribute:"",isRect:!0}),t.setResultAndSelectedID(c,i.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:i,sideViewInstance:s,backViewInstance:d,mainViewInstance:t,addPointCloudBox:n,setSelectedIDs:u,selectedIDs:c,pointCloudBoxList:r,setPointCloudResult:h}=e,{updateSelectedBox:L}=useSingleBox.useSingleBox(),{currentData:p,config:g}=reactRedux.useSelector(o=>{const{stepList:l,step:a,imgList:C,imgIndex:x}=o.annotation;return{currentData:C[x],config:index.jsonParser(StepUtils.getCurrentStepInfo(a,l).config)}}),y=reactRedux.useDispatch(),{selectedBox:P}=useSingleBox.useSingleBox(),v=P==null?void 0:P.info;if(!i||!s)return{topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{}};const{pointCloudInstance:f}=i,w=()=>{var o;return r.length>0?((o=r.sort((a,C)=>a.trackID-C.trackID).slice(-1)[0])==null?void 0:o.trackID)+1:1},U=o=>{t==null||t.generateBox(o),t==null||t.controls.update(),t==null||t.render()},V=(o,l)=>{var a,C,x;const m=topViewPolygon2PointCloud(o,l,f,void 0,{attribute:(x=(C=(a=g==null?void 0:g.attributeList)==null?void 0:a[0])==null?void 0:C.value)!=null?x:""}),O=i==null?void 0:i.pointCloud2dOperation,B=Object.assign(m,{trackID:w()});O.setSelectedIDs([o.id]),u(B.id),S(PointCloudView.Top,o,B),n(B)},b=()=>{const o=P==null?void 0:P.info,l=i==null?void 0:i.pointCloud2dOperation;if(l.setSelectedIDs(c),!o||!l)return;const a=l.selectedPolygon;S(PointCloudView.Top,a,o)},D=(o,l,a)=>{if(v){const C=sideViewPolygon2PointCloud(o,l,v,s.pointCloudInstance);L(C),S(a,o,C)}},I=(o,l)=>{D(o,l,PointCloudView.Side)},k=(o,l)=>{D(o,l,PointCloudView.Back)},R=(o,l)=>{if(v){const a=topViewPolygon2PointCloud(o,l,void 0,v);Object.assign(v,___default.default.pickBy(a,(C,x)=>["width","height","x","y"])),L(a),S(PointCloudView.Top,o,v)}},S=(o,l,a)=>{const C=p==null?void 0:p.url,x={[PointCloudView.Side]:()=>{synchronizeSideView(a,l,s,C)},[PointCloudView.Back]:()=>{d&&synchronizeBackView(a,l,d,C)},[PointCloudView.Top]:()=>{synchronizeTopView(a,l,i,t)}};Object.keys(x).forEach(m=>{m!==o&&x[m]()}),U(a),t==null||t.highlightOriginPointCloud(a)};return{topViewAddBox:V,topViewSelectedChanged:b,topViewUpdateBox:R,sideViewUpdateBox:I,backViewUpdateBox:k,pointCloudBoxListUpdated:o=>{i.updatePolygonList(o),t==null||t.generateBoxes(o)},clearAllResult:()=>{r.forEach(o=>{t==null||t.removeObjectByName(o.id)}),t==null||t.render(),h([]),i.pointCloud2dOperation.clearActiveStatus(),i.pointCloud2dOperation.clearResult()},initPointCloud3d:()=>{!t||(t.initPerspectiveCamera(),t.initRenderer(),t.render())},updatePointCloudData:()=>__async(void 0,null,function*(){var o,l,a,C,x,m;if(!(p==null?void 0:p.url)||!t)return;if(actionCreators.SetPointCloudLoading(y,!0),yield t.loadPCDFile(p.url,(o=g==null?void 0:g.radius)!=null?o:DEFAULT_RADIUS),r.forEach(B=>{t==null||t.removeObjectByName(B.id)}),p.result){const B=lbUtils.PointCloudUtils.getBoxParamsFromResultList(p.result),A=lbUtils.PointCloudUtils.getPolygonListFromResultList(p.result);B.forEach(j=>{t==null||t.generateBox(j)}),e.setPointCloudResult(B),e.setPolygonList(A)}else e.setPointCloudResult([]),e.setPolygonList([]);t.updateTopCamera();const O=(a=(l=index.jsonParser(p.result))==null?void 0:l.valid)!=null?a:!0;e.setPointCloudValid(O),(C=e.sideViewInstance)==null||C.clearAllData(),(x=e.backViewInstance)==null||x.clearAllData(),i.updateData(p.url,p.result,{radius:(m=g==null?void 0:g.radius)!=null?m:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(y,!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"),usePointCloudViews=require("./usePointCloudViews.js"),useSingleBox=require("./useSingleBox.js"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation");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");const{ERotateDirection}=lbAnnotation.cAnnotation,useRotate=({currentData:t})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{selectedBox:i,updateSelectedBox:a}=useSingleBox.useSingleBox();return{updateRotate:React.useCallback(s=>{const{topViewInstance:l,mainViewInstance:n}=e;if(!l||!n)return;const{pointCloud2dOperation:u}=l,o=i==null?void 0:i.info;if(!o||!(t==null?void 0:t.url)||!e.backViewInstance)return;a({rotation:o.rotation+Number(Math.PI*s)/180}),u.rotatePolygon(s,ERotateDirection.Anticlockwise);const r=u.selectedPolygon;n.generateBox(o),n.highlightOriginPointCloud(o),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;
|
package/dist/index.css
CHANGED
|
@@ -1348,11 +1348,15 @@
|
|
|
1348
1348
|
display: flex;
|
|
1349
1349
|
justify-content: center;
|
|
1350
1350
|
align-items: center;
|
|
1351
|
+
flex-direction: column;
|
|
1351
1352
|
font-size: 16px;
|
|
1352
1353
|
z-index: 20;
|
|
1353
1354
|
height: calc(100% - 40px);
|
|
1354
1355
|
width: 100%;
|
|
1355
1356
|
}
|
|
1357
|
+
.bee-point-cloud-wrapper .bee-point-cloud-container__right .bee-point-cloud-container__right-bottom .bee-point-cloud-container__empty-page .bee-point-cloud-container__empty-page__text {
|
|
1358
|
+
margin-top: 13px;
|
|
1359
|
+
}
|
|
1356
1360
|
.bee-point-cloud-wrapper .bee-point-cloud-container__right .bee-point-cloud-container__right-bottom .bee-point-cloud-container__side-view {
|
|
1357
1361
|
border-right: 1px solid white;
|
|
1358
1362
|
}
|
package/dist/store/Actions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const ANNOTATION_ACTIONS={UPDATE_TOOL_INSTANCE:"@@UPDATE_TOOL_INSTANCE",UPDATE_IMG_LIST:"@@UPDATE_IMG_LIST",UPDATE_ANNOTATION_CONFIG:"@@UPDATE_ANNOTATION_CONFIG",LOAD_FILE_DATA:"@@LOAD_FILE_DATA",SUBMIT_FILE_DATA:"@@SUBMIT_FILE_DATA",SET_TASK_CONFIG:"@@SET_TASK_CONFIG",INIT_TOOL:"@@INIT_TOOL",SET_TOOL:"@@SET_TOOL",UPDATE_ON_SUBMIT:"@@UPDATE_ON_SUBMIT",UPDATE_ON_SAVE:"@@UPDATE_ON_SAVE",UPDATE_ON_PAGE_CHANGE:"@@UPDATE_ON_PAGE_CHANGE",UPDATE_ON_STEP_CHANGE:"@@UPDATE_ON_STEP_CHANGE",UPDATE_ROTATE:"@@UPDATE_ROTATE",UPDATE_GET_FILE_DATA:"@@UPDATE_GET_FILE_DATA",UPDATE_PAGE_SIZE:"@@UPDATE_PAGE_SIZE",UPDATE_LOAD_FILE_LIST:"@@UPDATE_LOAD_FILE_LIST",GET_FILE_DATA:"@@GET_FILE_DATA",SET_FILE_DATA:"@@SET_FILE_DATA",COPY_BACKWARD_RESULT:"@@COPY_BACKWARD_RESULT",SET_STEP:"@@SET_STEP",SUBMIT_RESULT:"@@SUBMIT_RESULT",SAVE_RESULT:"@@SAVE_RESULT",SET_BASIC_INDEX:"@@SET_BASIC_INDEX",CALC_STEP_PROGRESS:"@@CALC_STEP_PROGRESS",SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:"@@SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED",SKIP_BEFORE_PAGE_TURNING:"@@SKIP_BEFORE_PAGE_TURNING",SET_LOADING:"@@SET_LOADING"},IMAGE_ATTRIBUTE_ACTIONS={UPDATE_IMG_ATTRIBUTE:"@@UPDATE_IMG_ATTRIBUTE",INIT_IMG_ATTRIBUTE:"@@INIT_IMG_ATTRIBUTE"},TOOL_STYLE_ACTIONS={INIT_TOOL_STYLE_CONFIG:"@@INIT_TOOL_STYLE_CONFIG",UPDATE_TOOL_STYLE_CONFIG:"@@UPDATE_TOOL_STYLE_CONFIG"};exports.ANNOTATION_ACTIONS=ANNOTATION_ACTIONS,exports.IMAGE_ATTRIBUTE_ACTIONS=IMAGE_ATTRIBUTE_ACTIONS,exports.TOOL_STYLE_ACTIONS=TOOL_STYLE_ACTIONS;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const ANNOTATION_ACTIONS={UPDATE_TOOL_INSTANCE:"@@UPDATE_TOOL_INSTANCE",UPDATE_IMG_LIST:"@@UPDATE_IMG_LIST",UPDATE_ANNOTATION_CONFIG:"@@UPDATE_ANNOTATION_CONFIG",LOAD_FILE_DATA:"@@LOAD_FILE_DATA",SUBMIT_FILE_DATA:"@@SUBMIT_FILE_DATA",SET_TASK_CONFIG:"@@SET_TASK_CONFIG",INIT_TOOL:"@@INIT_TOOL",SET_TOOL:"@@SET_TOOL",UPDATE_ON_SUBMIT:"@@UPDATE_ON_SUBMIT",UPDATE_ON_SAVE:"@@UPDATE_ON_SAVE",UPDATE_ON_PAGE_CHANGE:"@@UPDATE_ON_PAGE_CHANGE",UPDATE_ON_STEP_CHANGE:"@@UPDATE_ON_STEP_CHANGE",UPDATE_ROTATE:"@@UPDATE_ROTATE",UPDATE_GET_FILE_DATA:"@@UPDATE_GET_FILE_DATA",UPDATE_PAGE_SIZE:"@@UPDATE_PAGE_SIZE",UPDATE_LOAD_FILE_LIST:"@@UPDATE_LOAD_FILE_LIST",GET_FILE_DATA:"@@GET_FILE_DATA",SET_FILE_DATA:"@@SET_FILE_DATA",COPY_BACKWARD_RESULT:"@@COPY_BACKWARD_RESULT",SET_STEP:"@@SET_STEP",SUBMIT_RESULT:"@@SUBMIT_RESULT",SAVE_RESULT:"@@SAVE_RESULT",SET_BASIC_INDEX:"@@SET_BASIC_INDEX",CALC_STEP_PROGRESS:"@@CALC_STEP_PROGRESS",SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:"@@SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED",SKIP_BEFORE_PAGE_TURNING:"@@SKIP_BEFORE_PAGE_TURNING",SET_LOADING:"@@SET_LOADING",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING"},IMAGE_ATTRIBUTE_ACTIONS={UPDATE_IMG_ATTRIBUTE:"@@UPDATE_IMG_ATTRIBUTE",INIT_IMG_ATTRIBUTE:"@@INIT_IMG_ATTRIBUTE"},TOOL_STYLE_ACTIONS={INIT_TOOL_STYLE_CONFIG:"@@INIT_TOOL_STYLE_CONFIG",UPDATE_TOOL_STYLE_CONFIG:"@@UPDATE_TOOL_STYLE_CONFIG"};exports.ANNOTATION_ACTIONS=ANNOTATION_ACTIONS,exports.IMAGE_ATTRIBUTE_ACTIONS=IMAGE_ATTRIBUTE_ACTIONS,exports.TOOL_STYLE_ACTIONS=TOOL_STYLE_ACTIONS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Actions=require("../Actions.js"),reducer=require("./reducer.js"),index=require("../../constant/index.js"),AnnotationSize=require("../../data/enums/AnnotationSize.js"),PageOperator=require("../../utils/PageOperator.js"),index$1=require("../../utils/index.js"),__async=(e,t,n)=>new Promise((a,o)=>{var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Actions=require("../Actions.js"),reducer=require("./reducer.js"),index=require("../../constant/index.js"),AnnotationSize=require("../../data/enums/AnnotationSize.js"),PageOperator=require("../../utils/PageOperator.js"),index$1=require("../../utils/index.js"),__async=(e,t,n)=>new Promise((a,o)=>{var p=i=>{try{u(n.next(i))}catch(s){o(s)}},r=i=>{try{u(n.throw(i))}catch(s){o(s)}},u=i=>i.done?a(i.value):Promise.resolve(i.value).then(p,r);u((n=n.apply(e,t)).next())});const dispatchTasks=(e,t)=>t.map(n=>e(n)),getSubmitByPageOperation=e=>e===AnnotationSize.EPageTurningOperation.Forward?index.ESubmitType.Forward:e===AnnotationSize.EPageTurningOperation.Backward?index.ESubmitType.Backward:e===AnnotationSize.EPageTurningOperation.Jump?index.ESubmitType.Jump:index.ESubmitType.Forward,getBasicIndex=(e,t)=>{var n,a;const{imgList:o,imgIndex:p}=e,{dataSourceStep:r}=reducer.getStepConfig(e.stepList,e.step);return((a=(n=index$1.jsonParser(o[p-1].result)[`step_${r}`])==null?void 0:n.result)==null?void 0:a.length)-1||t};function UpdateToolInstance(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE,payload:{toolInstance:e}}}function SetTaskConfig({stepList:e,step:t}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG,payload:{stepList:e,step:t}}}function UpdateOnSubmit(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT,payload:{onSubmit:e}}}function UpdateOnSave(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE,payload:{onSave:e}}}function UpdateOnPageChange(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:e}}}function UpdateOnStepChange(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:e}}}function UpdateGetFileData(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA,payload:{getFileData:e}}}function UpdatePageSize(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE,payload:{pageSize:e}}}function UpdateGetFileList(e){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:e}}}function UpdateRotate(){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE}}function UpdateSkipBeforePageTurning(e){return{type:Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:e}}}function CopyBackWordResult(){return{type:Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT}}function InitTaskData({onSubmit:e,onSave:t,onPageChange:n,onStepChange:a,getFileData:o,pageSize:p,loadFileList:r,step:u,stepList:i,skipBeforePageTurning:s}){const T=[];return e&&T.push(UpdateOnSubmit(e)),t&&T.push(UpdateOnSave(t)),n&&T.push(UpdateOnPageChange(n)),a&&T.push(UpdateOnStepChange(a)),o&&T.push(UpdateGetFileData(o)),r&&T.push(UpdateGetFileList(r)),p&&T.push(UpdatePageSize(p)),s&&T.push(UpdateSkipBeforePageTurning(s)),T.push(SetTaskConfig({stepList:i,step:u})),T.push({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),T.push({type:Actions.ANNOTATION_ACTIONS.INIT_TOOL}),N=>dispatchTasks(N,T)}const getNextStep=(e,t)=>{var n;const a=t==null?void 0:t.findIndex(o=>(o==null?void 0:o.step)===e);return(n=t[a+1])==null?void 0:n.step},ToNextStep=e=>(t,n)=>{const{annotation:a}=n(),{step:o,stepList:p}=a,r=getNextStep(o,p);return[t(UpdateProcessingStep(r,e))]},UpdateProcessingStep=(e,t)=>(n,a)=>{var o,p;const{annotation:r}=a();(o=r==null?void 0:r.onStepChange)==null||o.call(r,e);const u=(p=r==null?void 0:r.imgIndex)!=null?p:0;return[n({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),n({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:index.ESubmitType.StepChanged}}),n({type:Actions.ANNOTATION_ACTIONS.SET_STEP,payload:{toStep:e}}),n({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),n(reducer.LoadFileAndFileData(t!=null?t:u,0))]},ToSubmitFileData=e=>t=>[t({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),t({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:e}})],SubmitAndChangeFileIndex=(e,t,n,a)=>[e(ToSubmitFileData(n)),e(reducer.LoadFileAndFileData(t,a))],ChangeBasicIndex=(e,t)=>[e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),e({type:Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX,payload:{basicIndex:t}})],ChangeTriggerEventAfterIndexChanged=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:t}})},PageBackward=(e=!1)=>(t,n)=>DispatcherTurning(t,n,AnnotationSize.EPageTurningOperation.Backward,e),PageForward=(e=!1)=>(t,n)=>DispatcherTurning(t,n,AnnotationSize.EPageTurningOperation.Forward,e),PageJump=(e,t=!1)=>(n,a)=>{if(e!==a().imgIndex)return DispatcherTurning(n,a,AnnotationSize.EPageTurningOperation.Jump,t,e)},loadImgList=(e,t,n,a)=>__async(void 0,null,function*(){var o;const{loadFileList:p,imgList:r,pageSize:u}=t().annotation,i=Math.floor(n/u);SetAnnotationLoading(e,!0);try{const s=yield p(i,u);if(SetAnnotationLoading(e,!1),!((o=s==null?void 0:s.fileList)==null?void 0:o.length)||!(s==null?void 0:s.total))throw new Error("fileList and total are required");const T=a?new Array(s.total):[...r];return T.splice(i*u,u,...s.fileList),e({type:Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST,payload:{imgList:T}}),!0}catch(s){SetAnnotationLoading(e,!1),console.error(s)}}),DispatcherTurning=(e,t,n,a=!1,o)=>__async(void 0,null,function*(){var p;const r=t().annotation,{fileIndexChanged:u,fileIndex:i,basicIndexChanged:s,basicIndex:T}=PageOperator.getNextPageInfo(n,r,o),N=getSubmitByPageOperation(n);if(ChangeTriggerEventAfterIndexChanged(e,a),u){if(r.loading||!r.imgList[i]&&!(yield loadImgList(e,t,i)))return;(p=r.onPageChange)==null||p.call(r,i);const A=N===index.ESubmitType.Backward?getBasicIndex(t().annotation,T):T;return SubmitAndChangeFileIndex(e,i,N,A)}return s?ChangeBasicIndex(e,T):e(ToSubmitFileData(N))}),ChangeSave=e=>{e(ToSubmitFileData(index.ESubmitType.Save)),e({type:Actions.ANNOTATION_ACTIONS.SAVE_RESULT})},SetAnnotationLoading=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:t}})},SetPointCloudLoading=(e,t)=>{e({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:t}})};exports.ChangeSave=ChangeSave,exports.CopyBackWordResult=CopyBackWordResult,exports.DispatcherTurning=DispatcherTurning,exports.InitTaskData=InitTaskData,exports.PageBackward=PageBackward,exports.PageForward=PageForward,exports.PageJump=PageJump,exports.SetAnnotationLoading=SetAnnotationLoading,exports.SetPointCloudLoading=SetPointCloudLoading,exports.SetTaskConfig=SetTaskConfig,exports.ToNextStep=ToNextStep,exports.ToSubmitFileData=ToSubmitFileData,exports.UpdateGetFileData=UpdateGetFileData,exports.UpdateGetFileList=UpdateGetFileList,exports.UpdateOnPageChange=UpdateOnPageChange,exports.UpdateOnSave=UpdateOnSave,exports.UpdateOnStepChange=UpdateOnStepChange,exports.UpdateOnSubmit=UpdateOnSubmit,exports.UpdatePageSize=UpdatePageSize,exports.UpdateProcessingStep=UpdateProcessingStep,exports.UpdateRotate=UpdateRotate,exports.UpdateSkipBeforePageTurning=UpdateSkipBeforePageTurning,exports.UpdateToolInstance=UpdateToolInstance,exports.loadImgList=loadImgList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("../../components/customResizeHook/index.js"),styleString=require("../../constant/styleString.js"),Actions=require("../Actions.js"),index=require("../../utils/index.js"),AnnotationDataUtils=require("../../utils/AnnotationDataUtils.js"),ConfigUtils=require("../../utils/ConfigUtils.js"),data=require("../../utils/data.js"),StepUtils=require("../../utils/StepUtils.js"),ToolUtils=require("../../utils/ToolUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),es=require("antd/es"),_=require("lodash"),actionCreators=require("./actionCreators.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,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__spreadValues=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,o)=>new Promise((c,r)=>{var A=d=>{try{p(o.next(d))}catch(E){r(E)}},N=d=>{try{p(o.throw(d))}catch(E){r(E)}},p=d=>d.done?c(d.value):Promise.resolve(d.value).then(A,N);p((o=o.apply(e,t)).next())});const getStepConfig=(e,t)=>e.find(o=>o.step===t),initialState={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,triggerEventAfterIndexChanged:!1},getTotalPage=e=>{const{imgList:t,imgPageSize:o}=e;return Math.ceil(t.length/o)},calcStepProgress=(e,t)=>e.reduce((o,c)=>{if(c){const r=c.result;if(index.jsonParser(r)[`step_${t}`])return o+1}return o},0)/e.length,updateToolInstance=(e,t)=>{const{step:o,stepList:c}=e,r=StepUtils.getCurrentStepInfo(o,c),A=ConfigUtils.ConfigUtils.jsonParser(r.config);if(ToolUtils.isVideoTool(r==null?void 0:r.tool)||ToolUtils.isPointCloudTool(r==null?void 0:r.tool))return;const N=document.getElementById("toolContainer");if(!N)throw"Not exist dom named id-toolContainer";const p=index$1.getFormatSize({width:window.innerWidth,height:window.innerHeight}),d=new lbAnnotation.AnnotationEngine({container:N,toolName:r.tool,size:p,imgNode:t,config:A,style:JSON.parse(styleString)});return{toolInstance:d==null?void 0:d.toolInstance,annotationEngine:d}},LoadFileAndFileData=(e,t)=>(o,c)=>__async(void 0,null,function*(){const{stepList:r,step:A}=c().annotation,N=StepUtils.currentToolIsVideo(A,r),p=StepUtils.currentToolIsPointCloud(A,r);if(actionCreators.SetAnnotationLoading(o,!0),o(TryGetFileDataByAPI(e)),N||p){o(AfterVideoLoaded(e));return}o(AfterImageLoaded(e,t))}),TryGetFileDataByAPI=e=>(t,o)=>__async(void 0,null,function*(){const{getFileData:c,imgList:r}=o().annotation;if(c){const A=yield c(r[e],e);t({type:Actions.ANNOTATION_ACTIONS.SET_FILE_DATA,payload:{fileData:A,index:e}})}}),AfterVideoLoaded=e=>t=>{actionCreators.SetAnnotationLoading(t,!1),t({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e}})},AfterImageLoaded=(e,t)=>(o,c)=>{var r;const{toolInstance:A,imgList:N}=c().annotation,p=(r=N==null?void 0:N[e])==null?void 0:r.url;lbAnnotation.ImgUtils.load(p).then(d=>{actionCreators.SetAnnotationLoading(o,!1),o({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{imgNode:d,nextIndex:e,nextBasicIndex:t}})}).catch(()=>{actionCreators.SetAnnotationLoading(o,!1),A==null||A.setErrorImg(),o({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e,nextBasicIndex:t}})})},annotationReducer=(e=initialState,t)=>{var o,c,r,A,N,p,d,E,b,h,U,x,F,j,B,w,G,q,V,z;switch(t.type){case Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE:return __spreadProps(__spreadValues({},e),{toolInstance:t.payload.toolInstance});case Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST:return __spreadProps(__spreadValues({},e),{imgList:t.payload.imgList});case Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS:{const{imgList:n,step:s}=e,l=calcStepProgress(n,s);return __spreadProps(__spreadValues({},e),{stepProgress:l})}case Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:s,step:l,stepList:i,toolInstance:a,onSubmit:u,resultList:O}=e;if(!a||!n[s])return e;const T=((o=n[s])==null?void 0:o.result)||"",[,I]=(c=a==null?void 0:a.exportData())!=null?c:[],g=(A=(r=a==null?void 0:a.exportCustomData)==null?void 0:r.call(a))!=null?A:{},v=data.composeResultWithBasicImgInfo(T,I),f=data.composeResult(v,{step:l,stepList:i},{rect:O},g);n[s].result=AnnotationDataUtils.dataCorrection(f,T,l,i),u&&u([n[s]],(N=t.payload)==null?void 0:N.submitType,s);const C=calcStepProgress(n,l);return __spreadProps(__spreadValues({},e),{stepProgress:C,imgList:n})}case Actions.ANNOTATION_ACTIONS.SAVE_RESULT:{const{imgList:n,imgIndex:s,onSave:l}=e;return l==null||l(n[s],s,n),__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT:{const{imgList:n,basicIndex:s,resultList:l,toolInstance:i,basicResultList:a}=e;if(!i)return e;const[u]=(p=i==null?void 0:i.exportData())!=null?p:[];let O=u;if((a==null?void 0:a.length)>0){const T=(d=a[s])==null?void 0:d.id,I=u.map(g=>__spreadProps(__spreadValues({},g),{sourceID:T}));O=___default.default.cloneDeep(l).filter(g=>g.sourceID!==T),O.push(...I)}return __spreadProps(__spreadValues({},e),{resultList:O,imgList:n})}case Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX:{const{toolInstance:n,step:s,imgList:l,imgIndex:i,stepList:a,annotationEngine:u,resultList:O,basicResultList:T}=e;if(!n||!u)return e;const I=t.payload.basicIndex,g=(E=T[I])==null?void 0:E.id,v=index.jsonParser((b=l[i])==null?void 0:b.result),f=(O||[]).filter(R=>R.sourceID===g),C=getStepConfig(a,s),{dataSourceStep:m,tool:y}=C,D=getStepConfig(a,m);let S=[];return m&&y&&(S=(h=v[`step_${m}`])==null?void 0:h.result,(S==null?void 0:S.length)>0?(u==null||u.setBasicInfo(D.tool,S[I]),u==null||u.launchOperation()):(u==null||u.setBasicInfo(D.tool),u==null||u.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),n==null||n.setResult(f),n==null||n.history.initRecord(f,!0),__spreadProps(__spreadValues({},e),{basicIndex:I})}case Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=t.payload;return __spreadProps(__spreadValues({},e),{triggerEventAfterIndexChanged:!!n})}case Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA:{const{imgList:n,step:s,toolInstance:l,annotationEngine:i,stepList:a}=e;if(!l)return __spreadProps(__spreadValues({},e),{imgIndex:t.payload.nextIndex});const u=StepUtils.getCurrentStepInfo(s,a),{nextIndex:O,imgNode:T,nextBasicIndex:I,imgError:g}=t.payload,v=I!=null?I:0,f=index.jsonParser((U=n[O])==null?void 0:U.result),C=f[`step_${s}`],m=!C,y={rotate:(x=f.rotate)!=null?x:0,valid:(F=f.valid)!=null?F:!0};T&&g!==!0?i==null||i.setImgNode(T,y):l==null||l.setValid(y.valid);const D=getStepConfig(a,s),{dataSourceStep:S,tool:R}=D,H=getStepConfig(a,S),M=S&&R,L=(B=(j=f[`step_${S}`])==null?void 0:j.result)!=null?B:[],P=AnnotationDataUtils.getInitialResultList(C==null?void 0:C.result,l,D,L,m);if(i==null||i.launchOperation(),M&&((L==null?void 0:L.length)>0?i==null||i.setBasicInfo(H.tool,L[v]):(i==null||i.setBasicInfo(H.tool),i==null||i.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),u.tool!=="check"){const $=(G=(w=L[v])==null?void 0:w.id)!=null?G:"",k=M?P.filter(W=>lbAnnotation.CommonToolUtils.isSameSourceID(W.sourceID,$)):P;l==null||l.setResult(k),l==null||l.history.initRecord(P,!0)}return __spreadProps(__spreadValues({},e),{imgIndex:O,basicIndex:v,basicResultList:L,resultList:P})}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_CONFIG:return __spreadProps(__spreadValues({},e),{config:(q=t.payload.config)!=null?q:"{}"});case Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG:{const{stepList:n,step:s}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n,step:s})}case Actions.ANNOTATION_ACTIONS.INIT_TOOL:{const{imgNode:n}=e,s=updateToolInstance(e,n);if(s){const{toolInstance:l,annotationEngine:i}=s;return __spreadProps(__spreadValues({},e),{toolInstance:l,annotationEngine:i})}return __spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SET_TOOL:{const n=(V=t.payload)==null?void 0:V.instance;return n?__spreadProps(__spreadValues({},e),{toolInstance:n}):__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT:return __spreadProps(__spreadValues({},e),{onSubmit:t.payload.onSubmit});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE:return __spreadProps(__spreadValues({},e),{onSave:t.payload.onSave});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE:return __spreadProps(__spreadValues({},e),{onPageChange:t.payload.onPageChange});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE:return __spreadProps(__spreadValues({},e),{onStepChange:t.payload.onStepChange});case Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA:return __spreadProps(__spreadValues({},e),{getFileData:t.payload.getFileData});case Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE:return __spreadProps(__spreadValues({},e),{pageSize:t.payload.pageSize});case Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST:return __spreadProps(__spreadValues({},e),{loadFileList:t.payload.loadFileList});case Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING:return __spreadProps(__spreadValues({},e),{skipBeforePageTurning:t.payload.skipBeforePageTurning});case Actions.ANNOTATION_ACTIONS.SET_FILE_DATA:{const{fileData:n,index:s}=t.payload,{imgList:l}=e;return l[s]=__spreadValues(__spreadValues({},l[s]),n),__spreadProps(__spreadValues({},e),{imgList:l})}case Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE:{const{toolInstance:n}=e;return n==null||n.updateRotate(),e}case Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:s,imgList:l,step:i}=e;if(!n)return e;if(s===0||s>=l.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),e;const a=l[s-1].result;if(!a)return e;const u=AnnotationDataUtils.copyResultChange(a,i,(z=l[s].result)!=null?z:"");l[s]=__spreadProps(__spreadValues({},l[s]),{result:u});const T=index.jsonParser(u)[`step_${i}`],I=(T==null?void 0:T.result)||[];return n==null||n.setResult(I),n==null||n.history.pushHistory(I),__spreadProps(__spreadValues({},e),{imgList:[...l]})}case Actions.ANNOTATION_ACTIONS.SET_STEP:{const{stepList:n,annotationEngine:s}=e,{toStep:l}=t.payload;if(!s)return e;const i=getStepConfig(n,l);return s==null||s.setToolName(i.tool,i.config),__spreadProps(__spreadValues({},e),{step:l,toolInstance:s==null?void 0:s.toolInstance})}case Actions.ANNOTATION_ACTIONS.SET_LOADING:{const{loading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loading:!!n})}default:return e}};exports.LoadFileAndFileData=LoadFileAndFileData,exports.annotationReducer=annotationReducer,exports.getStepConfig=getStepConfig,exports.getTotalPage=getTotalPage;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("../../components/customResizeHook/index.js"),styleString=require("../../constant/styleString.js"),Actions=require("../Actions.js"),index=require("../../utils/index.js"),AnnotationDataUtils=require("../../utils/AnnotationDataUtils.js"),ConfigUtils=require("../../utils/ConfigUtils.js"),data=require("../../utils/data.js"),StepUtils=require("../../utils/StepUtils.js"),ToolUtils=require("../../utils/ToolUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),es=require("antd/es"),_=require("lodash"),actionCreators=require("./actionCreators.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,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__spreadValues=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,o)=>new Promise((c,r)=>{var A=d=>{try{O(o.next(d))}catch(L){r(L)}},N=d=>{try{O(o.throw(d))}catch(L){r(L)}},O=d=>d.done?c(d.value):Promise.resolve(d.value).then(A,N);O((o=o.apply(e,t)).next())});const getStepConfig=(e,t)=>e.find(o=>o.step===t),initialState={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1},getTotalPage=e=>{const{imgList:t,imgPageSize:o}=e;return Math.ceil(t.length/o)},calcStepProgress=(e,t)=>e.reduce((o,c)=>{if(c){const r=c.result;if(index.jsonParser(r)[`step_${t}`])return o+1}return o},0)/e.length,updateToolInstance=(e,t)=>{const{step:o,stepList:c}=e,r=StepUtils.getCurrentStepInfo(o,c),A=ConfigUtils.ConfigUtils.jsonParser(r.config);if(ToolUtils.isVideoTool(r==null?void 0:r.tool)||ToolUtils.isPointCloudTool(r==null?void 0:r.tool))return;const N=document.getElementById("toolContainer");if(!N)throw"Not exist dom named id-toolContainer";const O=index$1.getFormatSize({width:window.innerWidth,height:window.innerHeight}),d=new lbAnnotation.AnnotationEngine({container:N,toolName:r.tool,size:O,imgNode:t,config:A,style:JSON.parse(styleString)});return{toolInstance:d==null?void 0:d.toolInstance,annotationEngine:d}},LoadFileAndFileData=(e,t)=>(o,c)=>__async(void 0,null,function*(){const{stepList:r,step:A}=c().annotation,N=StepUtils.currentToolIsVideo(A,r),O=StepUtils.currentToolIsPointCloud(A,r);if(actionCreators.SetAnnotationLoading(o,!0),o(TryGetFileDataByAPI(e)),N||O){o(AfterVideoLoaded(e));return}o(AfterImageLoaded(e,t))}),TryGetFileDataByAPI=e=>(t,o)=>__async(void 0,null,function*(){const{getFileData:c,imgList:r}=o().annotation;if(c){const A=yield c(r[e],e);t({type:Actions.ANNOTATION_ACTIONS.SET_FILE_DATA,payload:{fileData:A,index:e}})}}),AfterVideoLoaded=e=>t=>{actionCreators.SetAnnotationLoading(t,!1),t({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e}})},AfterImageLoaded=(e,t)=>(o,c)=>{var r;const{toolInstance:A,imgList:N}=c().annotation,O=(r=N==null?void 0:N[e])==null?void 0:r.url;lbAnnotation.ImgUtils.load(O).then(d=>{actionCreators.SetAnnotationLoading(o,!1),o({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{imgNode:d,nextIndex:e,nextBasicIndex:t}})}).catch(()=>{actionCreators.SetAnnotationLoading(o,!1),A==null||A.setErrorImg(),o({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e,nextBasicIndex:t}})})},annotationReducer=(e=initialState,t)=>{var o,c,r,A,N,O,d,L,b,h,U,x,F,j,w,B,G,q,V,z;switch(t.type){case Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE:return __spreadProps(__spreadValues({},e),{toolInstance:t.payload.toolInstance});case Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST:return __spreadProps(__spreadValues({},e),{imgList:t.payload.imgList});case Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS:{const{imgList:n,step:s}=e,i=calcStepProgress(n,s);return __spreadProps(__spreadValues({},e),{stepProgress:i})}case Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:s,step:i,stepList:l,toolInstance:a,onSubmit:u,resultList:p}=e;if(!a||!n[s])return e;const T=((o=n[s])==null?void 0:o.result)||"",[,I]=(c=a==null?void 0:a.exportData())!=null?c:[],g=(A=(r=a==null?void 0:a.exportCustomData)==null?void 0:r.call(a))!=null?A:{},v=data.composeResultWithBasicImgInfo(T,I),f=data.composeResult(v,{step:i,stepList:l},{rect:p},g);n[s].result=AnnotationDataUtils.dataCorrection(f,T,i,l),u&&u([n[s]],(N=t.payload)==null?void 0:N.submitType,s);const C=calcStepProgress(n,i);return __spreadProps(__spreadValues({},e),{stepProgress:C,imgList:n})}case Actions.ANNOTATION_ACTIONS.SAVE_RESULT:{const{imgList:n,imgIndex:s,onSave:i}=e;return i==null||i(n[s],s,n),__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT:{const{imgList:n,basicIndex:s,resultList:i,toolInstance:l,basicResultList:a}=e;if(!l)return e;const[u]=(O=l==null?void 0:l.exportData())!=null?O:[];let p=u;if((a==null?void 0:a.length)>0){const T=(d=a[s])==null?void 0:d.id,I=u.map(g=>__spreadProps(__spreadValues({},g),{sourceID:T}));p=___default.default.cloneDeep(i).filter(g=>g.sourceID!==T),p.push(...I)}return __spreadProps(__spreadValues({},e),{resultList:p,imgList:n})}case Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX:{const{toolInstance:n,step:s,imgList:i,imgIndex:l,stepList:a,annotationEngine:u,resultList:p,basicResultList:T}=e;if(!n||!u)return e;const I=t.payload.basicIndex,g=(L=T[I])==null?void 0:L.id,v=index.jsonParser((b=i[l])==null?void 0:b.result),f=(p||[]).filter(R=>R.sourceID===g),C=getStepConfig(a,s),{dataSourceStep:m,tool:y}=C,D=getStepConfig(a,m);let S=[];return m&&y&&(S=(h=v[`step_${m}`])==null?void 0:h.result,(S==null?void 0:S.length)>0?(u==null||u.setBasicInfo(D.tool,S[I]),u==null||u.launchOperation()):(u==null||u.setBasicInfo(D.tool),u==null||u.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),n==null||n.setResult(f),n==null||n.history.initRecord(f,!0),__spreadProps(__spreadValues({},e),{basicIndex:I})}case Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=t.payload;return __spreadProps(__spreadValues({},e),{triggerEventAfterIndexChanged:!!n})}case Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA:{const{imgList:n,step:s,toolInstance:i,annotationEngine:l,stepList:a}=e;if(!i)return __spreadProps(__spreadValues({},e),{imgIndex:t.payload.nextIndex});const u=StepUtils.getCurrentStepInfo(s,a),{nextIndex:p,imgNode:T,nextBasicIndex:I,imgError:g}=t.payload,v=I!=null?I:0,f=index.jsonParser((U=n[p])==null?void 0:U.result),C=f[`step_${s}`],m=!C,y={rotate:(x=f.rotate)!=null?x:0,valid:(F=f.valid)!=null?F:!0};T&&g!==!0?l==null||l.setImgNode(T,y):i==null||i.setValid(y.valid);const D=getStepConfig(a,s),{dataSourceStep:S,tool:R}=D,H=getStepConfig(a,S),M=S&&R,E=(w=(j=f[`step_${S}`])==null?void 0:j.result)!=null?w:[],P=AnnotationDataUtils.getInitialResultList(C==null?void 0:C.result,i,D,E,m);if(l==null||l.launchOperation(),M&&((E==null?void 0:E.length)>0?l==null||l.setBasicInfo(H.tool,E[v]):(l==null||l.setBasicInfo(H.tool),l==null||l.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),u.tool!=="check"){const $=(G=(B=E[v])==null?void 0:B.id)!=null?G:"",k=M?P.filter(W=>lbAnnotation.CommonToolUtils.isSameSourceID(W.sourceID,$)):P;i==null||i.setResult(k),i==null||i.history.initRecord(P,!0)}return __spreadProps(__spreadValues({},e),{imgIndex:p,basicIndex:v,basicResultList:E,resultList:P})}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_CONFIG:return __spreadProps(__spreadValues({},e),{config:(q=t.payload.config)!=null?q:"{}"});case Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG:{const{stepList:n,step:s}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n,step:s})}case Actions.ANNOTATION_ACTIONS.INIT_TOOL:{const{imgNode:n}=e,s=updateToolInstance(e,n);if(s){const{toolInstance:i,annotationEngine:l}=s;return __spreadProps(__spreadValues({},e),{toolInstance:i,annotationEngine:l})}return __spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SET_TOOL:{const n=(V=t.payload)==null?void 0:V.instance;return n?__spreadProps(__spreadValues({},e),{toolInstance:n}):__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT:return __spreadProps(__spreadValues({},e),{onSubmit:t.payload.onSubmit});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE:return __spreadProps(__spreadValues({},e),{onSave:t.payload.onSave});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE:return __spreadProps(__spreadValues({},e),{onPageChange:t.payload.onPageChange});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE:return __spreadProps(__spreadValues({},e),{onStepChange:t.payload.onStepChange});case Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA:return __spreadProps(__spreadValues({},e),{getFileData:t.payload.getFileData});case Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE:return __spreadProps(__spreadValues({},e),{pageSize:t.payload.pageSize});case Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST:return __spreadProps(__spreadValues({},e),{loadFileList:t.payload.loadFileList});case Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING:return __spreadProps(__spreadValues({},e),{skipBeforePageTurning:t.payload.skipBeforePageTurning});case Actions.ANNOTATION_ACTIONS.SET_FILE_DATA:{const{fileData:n,index:s}=t.payload,{imgList:i}=e,l=[...i];return l[s]=__spreadValues(__spreadValues({},l[s]),n),__spreadProps(__spreadValues({},e),{imgList:l})}case Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE:{const{toolInstance:n}=e;return n==null||n.updateRotate(),e}case Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:s,imgList:i,step:l}=e;if(!n)return e;if(s===0||s>=i.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),e;const a=i[s-1].result;if(!a)return e;const u=AnnotationDataUtils.copyResultChange(a,l,(z=i[s].result)!=null?z:"");i[s]=__spreadProps(__spreadValues({},i[s]),{result:u});const T=index.jsonParser(u)[`step_${l}`],I=(T==null?void 0:T.result)||[];return n==null||n.setResult(I),n==null||n.history.pushHistory(I),__spreadProps(__spreadValues({},e),{imgList:[...i]})}case Actions.ANNOTATION_ACTIONS.SET_STEP:{const{stepList:n,annotationEngine:s}=e,{toStep:i}=t.payload;if(!s)return e;const l=getStepConfig(n,i);return s==null||s.setToolName(l.tool,l.config),__spreadProps(__spreadValues({},e),{step:i,toolInstance:s==null?void 0:s.toolInstance})}case Actions.ANNOTATION_ACTIONS.SET_LOADING:{const{loading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=t.payload;return __spreadProps(__spreadValues({},e),{pointCloudLoading:!!n})}default:return e}};exports.LoadFileAndFileData=LoadFileAndFileData,exports.annotationReducer=annotationReducer,exports.getStepConfig=getStepConfig,exports.getTotalPage=getTotalPage;
|
|
@@ -49,6 +49,7 @@ export declare const usePointCloudViews: () => {
|
|
|
49
49
|
pointCloudBoxListUpdated?: undefined;
|
|
50
50
|
clearAllResult?: undefined;
|
|
51
51
|
initPointCloud3d?: undefined;
|
|
52
|
+
updatePointCloudData?: undefined;
|
|
52
53
|
} | {
|
|
53
54
|
topViewAddBox: (newPolygon: any, size: ISize) => void;
|
|
54
55
|
topViewSelectedChanged: () => void;
|
|
@@ -58,4 +59,5 @@ export declare const usePointCloudViews: () => {
|
|
|
58
59
|
pointCloudBoxListUpdated: (newBoxes: IPointCloudBox[]) => void;
|
|
59
60
|
clearAllResult: () => void;
|
|
60
61
|
initPointCloud3d: () => void;
|
|
62
|
+
updatePointCloudData: () => Promise<void>;
|
|
61
63
|
};
|
|
@@ -26,6 +26,7 @@ export declare const ANNOTATION_ACTIONS: {
|
|
|
26
26
|
SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED: string;
|
|
27
27
|
SKIP_BEFORE_PAGE_TURNING: string;
|
|
28
28
|
SET_LOADING: string;
|
|
29
|
+
SET_POINT_CLOUD_LOADING: string;
|
|
29
30
|
};
|
|
30
31
|
export declare const IMAGE_ATTRIBUTE_ACTIONS: {
|
|
31
32
|
UPDATE_IMG_ATTRIBUTE: string;
|
|
@@ -67,3 +67,4 @@ export declare const DispatcherTurning: (dispatch: any, getState: any, pageTurni
|
|
|
67
67
|
* */
|
|
68
68
|
export declare const ChangeSave: (dispatch: Function) => void;
|
|
69
69
|
export declare const SetAnnotationLoading: (dispatch: Function, loading: boolean) => void;
|
|
70
|
+
export declare const SetPointCloudLoading: (dispatch: Function, loading: boolean) => void;
|
|
@@ -34,6 +34,7 @@ export interface AnnotationState {
|
|
|
34
34
|
/** 阻止文件切换后的事件 */
|
|
35
35
|
triggerEventAfterIndexChanged: boolean;
|
|
36
36
|
skipBeforePageTurning?: (pageTurning: Function) => void;
|
|
37
|
+
pointCloudLoading: boolean;
|
|
37
38
|
}
|
|
38
39
|
interface UpdateToolInstance {
|
|
39
40
|
type: typeof ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var index=require("../common/index.js"),icon_move_kj=require("../../../../../../assets/annotation/toolHotKeyIcon/icon_move_kj.svg.js"),icon_mouse_left_kj=require("../../../../../../assets/annotation/toolHotKeyIcon/icon_mouse_left_kj.svg.js"),icon_mouse_right_kj=require("../../../../../../assets/annotation/toolHotKeyIcon/icon_mouse_right_kj.svg.js"),changePointCloudValid=require("../../../../../../assets/annotation/pointCloudTool/changePointCloudValid.svg.js"),copy=require("../../../../../../assets/annotation/pointCloudTool/copy.svg.js"),nextBox=require("../../../../../../assets/annotation/pointCloudTool/nextBox.svg.js"),patse=require("../../../../../../assets/annotation/pointCloudTool/patse.svg.js"),prevBox=require("../../../../../../assets/annotation/pointCloudTool/prevBox.svg.js"),rotate180_black=require("../../../../../../assets/annotation/pointCloudTool/rotate180_black.svg.js"),selectAll=require("../../../../../../assets/annotation/pointCloudTool/selectAll.svg.js"),selectMultiple=require("../../../../../../assets/annotation/pointCloudTool/selectMultiple.svg.js"),icon_tab_kj=require("../../../../../../assets/annotation/toolHotKeyIcon/icon_tab_kj.svg.js"),React=require("react"),icons=require("@ant-design/icons");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var index=require("../common/index.js"),icon_move_kj=require("../../../../../../assets/annotation/toolHotKeyIcon/icon_move_kj.svg.js"),icon_mouse_left_kj=require("../../../../../../assets/annotation/toolHotKeyIcon/icon_mouse_left_kj.svg.js"),icon_mouse_right_kj=require("../../../../../../assets/annotation/toolHotKeyIcon/icon_mouse_right_kj.svg.js"),changePointCloudValid=require("../../../../../../assets/annotation/pointCloudTool/changePointCloudValid.svg.js"),copy=require("../../../../../../assets/annotation/pointCloudTool/copy.svg.js"),nextBox=require("../../../../../../assets/annotation/pointCloudTool/nextBox.svg.js"),patse=require("../../../../../../assets/annotation/pointCloudTool/patse.svg.js"),prevBox=require("../../../../../../assets/annotation/pointCloudTool/prevBox.svg.js"),rotate180_black=require("../../../../../../assets/annotation/pointCloudTool/rotate180_black.svg.js"),selectAll=require("../../../../../../assets/annotation/pointCloudTool/selectAll.svg.js"),selectMultiple=require("../../../../../../assets/annotation/pointCloudTool/selectMultiple.svg.js"),icon_tab_kj=require("../../../../../../assets/annotation/toolHotKeyIcon/icon_tab_kj.svg.js"),React=require("react"),icons=require("@ant-design/icons");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React);const changePointSize={name:"\u70B9\u7684\u663E\u793A\u7C97\u7EC6",icon:React__default.default.createElement("span",{style:{display:" inline-block",width:14,height:14,borderRadius:"50%",border:"1px solid"}}),shortCut:["+","-"],linkSymbol:""},rotateRoundCenter={name:"\u7ED5\u4E2D\u5FC3\u70B9\u65CB\u8F6C\u753B\u9762",icon:React__default.default.createElement(icons.ReloadOutlined,null),shortCut:[icon_mouse_left_kj],noticeInfo:"\u62D6\u52A8"},Drag3D={name:"\u70B9\u4E91\u5E73\u79FB",icon:icon_move_kj,shortCut:[icon_mouse_right_kj],noticeInfo:"\u62D6\u52A8"},DragTopView={name:"\u4FEF\u89C6\u56FE\u5E73\u79FB",icon:icon_move_kj,shortCut:[icon_mouse_right_kj],noticeInfo:"\u62D6\u52A8"},ChangeInvalid={name:"\u5207\u6362\u70B9\u4E91\u6709\u6548\u6027",icon:changePointCloudValid,shortCut:["V"]},CopyBox={name:"\u590D\u5236\u6846",icon:copy,shortCut:["Ctrl","C"]},PasteBox={name:"\u7C98\u8D34\u6846",icon:patse,shortCut:["Ctrl","V"]},LeftRotate={name:"\u5411\u5DE6\u65CB\u8F6C\u5FAE\u8C03",icon:React__default.default.createElement(icons.RotateLeftOutlined,null),shortCut:["Q"]},RightRotate={name:"\u5411\u53F3\u65CB\u8F6C\u5FAE\u8C03",icon:React__default.default.createElement(icons.RotateRightOutlined,null),shortCut:["E"]},PrevBox={name:"\u4E0A\u4E00\u6846",icon:prevBox,shortCut:["Z"]},NextBox={name:"\u4E0B\u4E00\u6846",icon:nextBox,shortCut:["C"]},Rotate180={name:"\u65CB\u8F6C180\xB0",icon:rotate180_black,shortCut:["G"],noticeInfo:"\u9009\u4E2D\u65F6"},CopyPrevPage={name:"\u590D\u5236\u4E0A\u4E00\u9875",icon:copy,shortCut:["Alt","C"]},ChangeBoxInvalid={name:"\u5207\u6362\u6807\u6CE8\u6846\u6709\u6548\u6027",icon:icon_tab_kj,shortCut:["F"],noticeInfo:"\u9009\u4E2D\u65F6"},SelectMulti={name:"\u591A\u9009",icon:selectMultiple,shortCut:["Ctrl",icon_mouse_right_kj]},SelectAll={name:"\u5168\u9009",icon:selectAll,shortCut:["Ctrl","A"]},pointCloudShortCutTable=[{name:"\u901A\u7528"},index.backward,index.forward,changePointSize,index.scale,rotateRoundCenter,Drag3D,DragTopView,ChangeInvalid,{name:"\u62C9\u6846\u6A21\u5F0F"},CopyBox,PasteBox,LeftRotate,RightRotate,PrevBox,NextBox,Rotate180,CopyPrevPage,ChangeBoxInvalid,SelectMulti,SelectAll,index.fullScreen];module.exports=pointCloudShortCutTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="data:image/svg+xml,%3csvg width='68' height='76' viewBox='0 0 68 76' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0_96880_20054)'%3e%3crect x='6.45483' y='0.848145' width='54.0956' height='56.7089' rx='1.04533' fill='url(%23paint0_linear_96880_20054)' fill-opacity='0.12'/%3e%3cpath d='M67 41.3584V75H0V57.755L65.6869 40.348C66.3501 40.1722 67 40.6723 67 41.3584Z' fill='url(%23paint1_linear_96880_20054)'/%3e%3cpath d='M0.182861 35.8192V75.3775H67.0837V59.9767L1.60277 34.8433C0.91818 34.5806 0.182861 35.086 0.182861 35.8192Z' fill='url(%23paint2_linear_96880_20054)'/%3e%3cpath d='M34.8791 22C31.5247 22 28.8956 22.9519 26.9464 24.8558C25.4935 26.2426 24.5938 28.0144 24.2124 30.171C23.9638 31.5762 25.1568 32.7431 26.5838 32.7431V32.7431C28.0108 32.7431 29.098 31.5652 29.4401 30.1799C29.627 29.423 29.912 28.7815 30.3008 28.2555C31.2074 27.0316 32.6126 26.4423 34.5618 26.4423C36.103 26.4423 37.3269 26.8503 38.1882 27.7115C39.0041 28.5728 39.4574 29.7514 39.4574 31.2473C39.4574 32.3805 39.0494 33.4684 38.2335 34.4657L37.6896 35.1003C34.7431 37.7294 32.9753 39.6332 32.386 40.8571C31.9171 41.7614 31.6462 42.8142 31.5366 43.9972C31.4651 44.7702 31.9823 45.4588 32.7224 45.6932V45.6932C33.2639 45.8647 33.8406 45.8939 34.3967 45.778L34.957 45.6612C35.9679 45.4505 36.6494 44.5444 36.9087 43.5449C37.0201 43.1152 37.1747 42.7029 37.3723 42.3077C37.7802 41.4918 38.3695 40.7212 39.1854 40.0865C41.3613 38.1827 42.6758 36.9588 43.0838 36.5055C44.1717 35.0549 44.761 33.1964 44.761 30.9299C44.761 28.1648 43.8544 25.989 42.0412 24.4025C40.228 22.7706 37.8255 22 34.8791 22ZM34.0632 48.1552C33.0659 48.1552 32.25 48.4725 31.6154 49.1071C30.8901 49.7418 30.5728 50.5577 30.5728 51.5549C30.5728 52.5522 30.8901 53.3681 31.6154 54.0027C32.25 54.6374 33.0659 55 34.0632 55C35.0604 55 35.8764 54.6827 36.6016 54.0481C37.2363 53.4135 37.5989 52.5522 37.5989 51.5549C37.5989 50.5577 37.2363 49.7418 36.6016 49.1071C35.9217 48.4725 35.0604 48.1552 34.0632 48.1552Z' fill='%23F3F3F3' fill-opacity='0.25'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient id='paint0_linear_96880_20054' x1='33.5026' y1='0.848145' x2='33.5026' y2='57.557' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%23EDEDED'/%3e%3cstop offset='1' stop-color='white'/%3e%3c/linearGradient%3e%3clinearGradient id='paint1_linear_96880_20054' x1='33.5' y1='32.9214' x2='33.5' y2='62.8103' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%23373737'/%3e%3cstop offset='1' stop-color='%230E0E0E'/%3e%3c/linearGradient%3e%3clinearGradient id='paint2_linear_96880_20054' x1='33.6333' y1='31.097' x2='33.6333' y2='74.1393' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%232C2C2C'/%3e%3cstop offset='1' stop-color='%23424242'/%3e%3c/linearGradient%3e%3cclipPath id='clip0_96880_20054'%3e%3crect width='68' height='76.0002' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodata.svg.js","sources":["../../../../src/assets/annotation/pointCloudTool/nodata.svg"],"sourcesContent":["var img = \"data:image/svg+xml,%3csvg width='68' height='76' viewBox='0 0 68 76' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0_96880_20054)'%3e%3crect x='6.45483' y='0.848145' width='54.0956' height='56.7089' rx='1.04533' fill='url(%23paint0_linear_96880_20054)' fill-opacity='0.12'/%3e%3cpath d='M67 41.3584V75H0V57.755L65.6869 40.348C66.3501 40.1722 67 40.6723 67 41.3584Z' fill='url(%23paint1_linear_96880_20054)'/%3e%3cpath d='M0.182861 35.8192V75.3775H67.0837V59.9767L1.60277 34.8433C0.91818 34.5806 0.182861 35.086 0.182861 35.8192Z' fill='url(%23paint2_linear_96880_20054)'/%3e%3cpath d='M34.8791 22C31.5247 22 28.8956 22.9519 26.9464 24.8558C25.4935 26.2426 24.5938 28.0144 24.2124 30.171C23.9638 31.5762 25.1568 32.7431 26.5838 32.7431V32.7431C28.0108 32.7431 29.098 31.5652 29.4401 30.1799C29.627 29.423 29.912 28.7815 30.3008 28.2555C31.2074 27.0316 32.6126 26.4423 34.5618 26.4423C36.103 26.4423 37.3269 26.8503 38.1882 27.7115C39.0041 28.5728 39.4574 29.7514 39.4574 31.2473C39.4574 32.3805 39.0494 33.4684 38.2335 34.4657L37.6896 35.1003C34.7431 37.7294 32.9753 39.6332 32.386 40.8571C31.9171 41.7614 31.6462 42.8142 31.5366 43.9972C31.4651 44.7702 31.9823 45.4588 32.7224 45.6932V45.6932C33.2639 45.8647 33.8406 45.8939 34.3967 45.778L34.957 45.6612C35.9679 45.4505 36.6494 44.5444 36.9087 43.5449C37.0201 43.1152 37.1747 42.7029 37.3723 42.3077C37.7802 41.4918 38.3695 40.7212 39.1854 40.0865C41.3613 38.1827 42.6758 36.9588 43.0838 36.5055C44.1717 35.0549 44.761 33.1964 44.761 30.9299C44.761 28.1648 43.8544 25.989 42.0412 24.4025C40.228 22.7706 37.8255 22 34.8791 22ZM34.0632 48.1552C33.0659 48.1552 32.25 48.4725 31.6154 49.1071C30.8901 49.7418 30.5728 50.5577 30.5728 51.5549C30.5728 52.5522 30.8901 53.3681 31.6154 54.0027C32.25 54.6374 33.0659 55 34.0632 55C35.0604 55 35.8764 54.6827 36.6016 54.0481C37.2363 53.4135 37.5989 52.5522 37.5989 51.5549C37.5989 50.5577 37.2363 49.7418 36.6016 49.1071C35.9217 48.4725 35.0604 48.1552 34.0632 48.1552Z' fill='%23F3F3F3' fill-opacity='0.25'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient id='paint0_linear_96880_20054' x1='33.5026' y1='0.848145' x2='33.5026' y2='57.557' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%23EDEDED'/%3e%3cstop offset='1' stop-color='white'/%3e%3c/linearGradient%3e%3clinearGradient id='paint1_linear_96880_20054' x1='33.5' y1='32.9214' x2='33.5' y2='62.8103' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%23373737'/%3e%3cstop offset='1' stop-color='%230E0E0E'/%3e%3c/linearGradient%3e%3clinearGradient id='paint2_linear_96880_20054' x1='33.6333' y1='31.097' x2='33.6333' y2='74.1393' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%232C2C2C'/%3e%3cstop offset='1' stop-color='%23424242'/%3e%3c/linearGradient%3e%3cclipPath id='clip0_96880_20054'%3e%3crect width='68' height='76.0002' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e\";\n export default img;"],"names":[],"mappings":"AAAG,IAAC,GAAG,GAAG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as f}from"../../utils/dom.js";import o,{useState as g,useContext as
|
|
1
|
+
import{getClassName as f}from"../../utils/dom.js";import o,{useState as g,useContext as h,useRef as j,useEffect as v}from"react";import{PointCloudContainer as I}from"./PointCloudLayout.js";import S from"../AnnotationView/index.js";import{PointCloudContext as V}from"./PointCloudContext.js";import{connect as b}from"react-redux";import{LeftOutlined as D,RightOutlined as N}from"@ant-design/icons";import A from"../../hooks/useSize.js";var z=Object.defineProperty,C=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,P=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t)=>{for(var n in t||(t={}))R.call(t,n)&&P(e,n,t[n]);if(C)for(var n of C(t))T.call(t,n)&&P(e,n,t[n]);return e};const B=({onNext:e,onPrev:t,imgLength:n,imgIndex:l})=>o.createElement("div",null,o.createElement(D,{onClick:t}),o.createElement("span",null," ",l+1," / ",n," "),o.createElement(N,{onClick:e})),F=({imgInfo:e})=>{var t,n;const[l,E]=g([]),{pointCloudBoxList:c,topViewInstance:p}=h(V),[a,s]=g(0),m=j(null),_=A(m),r=(t=e==null?void 0:e.mappingImgList)==null?void 0:t[a];if(v(()=>{s(0)},[e]),v(()=>{if(p&&r){const{pointCloudInstance:i}=p,w={fill:"transparent",color:"green"},x=c.reduce((L,y)=>{const O=i.pointCloudLidar2image(y,r.calib);return[...L,...O.map(d=>({type:d.type,annotation:k({pointList:d.pointList},w)}))]},[]);E(x)}},[c,r]),!e)return o.createElement("div",null);const{mappingImgList:u}=e;return u?o.createElement(I,{className:f("point-cloud-2d-container"),title:"2D\u89C6\u56FE",toolbar:o.createElement(B,{imgIndex:a,imgLength:u.length,onNext:()=>{a>=u.length-1||s(i=>i+1)},onPrev:()=>{a<=0||s(i=>i-1)}})},o.createElement("div",{className:f("point-cloud-2d-image"),ref:m},o.createElement(S,{src:(n=r==null?void 0:r.url)!=null?n:"",annotations:l,size:_}))):o.createElement("div",null)},M=e=>{const{imgList:t,imgIndex:n}=e.annotation;return{imgInfo:t[n]}};var $=b(M)(F);export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointCloud2DView.js","sources":["../../../src/components/pointCloudView/PointCloud2DView.tsx"],"sourcesContent":["import { getClassName } from '@/utils/dom';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport AnnotationView from '@/components/AnnotationView';\nimport { PointCloudContext } from './PointCloudContext';\nimport { AppState } from '@/store';\nimport { connect } from 'react-redux';\nimport { IFileItem } from '@/types/data';\nimport { LeftOutlined, RightOutlined } from '@ant-design/icons';\nimport useSize from '@/hooks/useSize';\n\ninterface IProps {\n imgInfo: IFileItem;\n}\n\nconst Toolbar = ({\n onNext,\n onPrev,\n imgLength,\n imgIndex,\n}: {\n onNext: () => void;\n onPrev: () => void;\n imgLength: number;\n imgIndex: number;\n}) => {\n return (\n <div>\n <LeftOutlined onClick={onPrev} />\n <span>\n {' '}\n {imgIndex + 1} / {imgLength}{' '}\n </span>\n\n <RightOutlined onClick={onNext} />\n </div>\n );\n};\n\n// TODO, It will be deleted when the exported type of lb-annotation is work.\ninterface IAnnotationDataTemporarily {\n type: string;\n annotation: any;\n}\n\nconst PointCloud2DView = ({ imgInfo }: IProps) => {\n const [annotations2d, setAnnotations2d] = useState<IAnnotationDataTemporarily[]>([]);\n const { pointCloudBoxList, topViewInstance } = useContext(PointCloudContext);\n const [mappingIndex, setMappingIndex] = useState(0);\n const ref = useRef(null);\n const size = useSize(ref);\n\n const mappingData = imgInfo?.mappingImgList?.[mappingIndex];\n\n useEffect(() => {\n if (topViewInstance && mappingData) {\n const { pointCloudInstance } = topViewInstance;\n const defaultViewStyle = {\n fill: 'transparent',\n color: 'green',\n };\n const newAnnotations2d: IAnnotationDataTemporarily[] = pointCloudBoxList.reduce(\n (acc: IAnnotationDataTemporarily[], pointCloudBox) => {\n const viewDataPointList = pointCloudInstance.pointCloudLidar2image(\n pointCloudBox,\n mappingData.calib,\n );\n return [\n ...acc,\n ...viewDataPointList.map((v: any) => {\n return {\n type: v.type,\n annotation: {\n pointList: v.pointList,\n ...defaultViewStyle,\n },\n };\n }),\n ];\n },\n [],\n );\n\n setAnnotations2d(newAnnotations2d);\n }\n }, [pointCloudBoxList, mappingData]);\n\n if (!imgInfo) {\n return <div />;\n }\n\n const { mappingImgList } = imgInfo;\n\n if (!mappingImgList) {\n return <div />;\n }\n\n
|
|
1
|
+
{"version":3,"file":"PointCloud2DView.js","sources":["../../../src/components/pointCloudView/PointCloud2DView.tsx"],"sourcesContent":["import { getClassName } from '@/utils/dom';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport AnnotationView from '@/components/AnnotationView';\nimport { PointCloudContext } from './PointCloudContext';\nimport { AppState } from '@/store';\nimport { connect } from 'react-redux';\nimport { IFileItem } from '@/types/data';\nimport { LeftOutlined, RightOutlined } from '@ant-design/icons';\nimport useSize from '@/hooks/useSize';\n\ninterface IProps {\n imgInfo: IFileItem;\n}\n\nconst Toolbar = ({\n onNext,\n onPrev,\n imgLength,\n imgIndex,\n}: {\n onNext: () => void;\n onPrev: () => void;\n imgLength: number;\n imgIndex: number;\n}) => {\n return (\n <div>\n <LeftOutlined onClick={onPrev} />\n <span>\n {' '}\n {imgIndex + 1} / {imgLength}{' '}\n </span>\n\n <RightOutlined onClick={onNext} />\n </div>\n );\n};\n\n// TODO, It will be deleted when the exported type of lb-annotation is work.\ninterface IAnnotationDataTemporarily {\n type: string;\n annotation: any;\n}\n\nconst PointCloud2DView = ({ imgInfo }: IProps) => {\n const [annotations2d, setAnnotations2d] = useState<IAnnotationDataTemporarily[]>([]);\n const { pointCloudBoxList, topViewInstance } = useContext(PointCloudContext);\n const [mappingIndex, setMappingIndex] = useState(0);\n const ref = useRef(null);\n const size = useSize(ref);\n\n const mappingData = imgInfo?.mappingImgList?.[mappingIndex];\n\n useEffect(() => {\n setMappingIndex(0);\n }, [imgInfo]);\n\n useEffect(() => {\n if (topViewInstance && mappingData) {\n const { pointCloudInstance } = topViewInstance;\n const defaultViewStyle = {\n fill: 'transparent',\n color: 'green',\n };\n const newAnnotations2d: IAnnotationDataTemporarily[] = pointCloudBoxList.reduce(\n (acc: IAnnotationDataTemporarily[], pointCloudBox) => {\n const viewDataPointList = pointCloudInstance.pointCloudLidar2image(\n pointCloudBox,\n mappingData.calib,\n );\n return [\n ...acc,\n ...viewDataPointList.map((v: any) => {\n return {\n type: v.type,\n annotation: {\n pointList: v.pointList,\n ...defaultViewStyle,\n },\n };\n }),\n ];\n },\n [],\n );\n\n setAnnotations2d(newAnnotations2d);\n }\n }, [pointCloudBoxList, mappingData]);\n\n if (!imgInfo) {\n return <div />;\n }\n\n const { mappingImgList } = imgInfo;\n\n if (!mappingImgList) {\n return <div />;\n }\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-2d-container')}\n title='2D视图'\n toolbar={\n <Toolbar\n imgIndex={mappingIndex}\n imgLength={mappingImgList.length}\n onNext={() => {\n if (mappingIndex >= mappingImgList.length - 1) {\n return;\n }\n setMappingIndex((v) => v + 1);\n }}\n onPrev={() => {\n if (mappingIndex <= 0) {\n return;\n }\n setMappingIndex((v) => v - 1);\n }}\n />\n }\n >\n <div className={getClassName('point-cloud-2d-image')} ref={ref}>\n <AnnotationView src={mappingData?.url ?? ''} annotations={annotations2d} size={size} />\n </div>\n </PointCloudContainer>\n );\n};\n\nconst mapStateToProps = (state: AppState) => {\n const { imgList, imgIndex } = state.annotation;\n\n return {\n imgInfo: imgList[imgIndex],\n };\n};\n\nexport default connect(mapStateToProps)(PointCloud2DView);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,UAAU,CAAC;AAAA,EACf,MAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,CAMI,KAAA;AACJ,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAD,IACE,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAD,EAAA;AAAA,IAAc,OAAS,EAAA,MAAA;AAAA,GACvB,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,MAAD,EAAA,IAAA,EACG,GACA,EAAA,QAAA,GAAW,GAAE,KAAI,EAAA,SAAA,EAAW,GAG/B,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAD,EAAA;AAAA,IAAe,OAAS,EAAA,MAAA;AAAA,GAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAW9B,MAAM,gBAAA,GAAmB,CAAC,CAAE,OAAsB,CAAA,KAAA;AA7ClD,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AA8CE,EAAM,MAAA,CAAC,aAAe,EAAA,gBAAA,CAAA,GAAoB,QAAuC,CAAA,EAAA,CAAA,CAAA;AACjF,EAAM,MAAA,CAAE,iBAAmB,EAAA,eAAA,CAAA,GAAoB,UAAW,CAAA,iBAAA,CAAA,CAAA;AAC1D,EAAM,MAAA,CAAC,YAAc,EAAA,eAAA,CAAA,GAAmB,QAAS,CAAA,CAAA,CAAA,CAAA;AACjD,EAAA,MAAM,MAAM,MAAO,CAAA,IAAA,CAAA,CAAA;AACnB,EAAA,MAAM,OAAO,OAAQ,CAAA,GAAA,CAAA,CAAA;AAErB,EAAM,MAAA,WAAA,GAAc,CAAS,EAAA,GAAA,OAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,cAAA,KAAT,IAA0B,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,YAAA,CAAA,CAAA;AAE9C,EAAA,SAAA,CAAU,MAAM;AACd,IAAgB,eAAA,CAAA,CAAA,CAAA,CAAA;AAAA,GAAA,EACf,CAAC,OAAA,CAAA,CAAA,CAAA;AAEJ,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,mBAAmB,WAAa,EAAA;AAClC,MAAA,MAAM,CAAE,kBAAuB,CAAA,GAAA,eAAA,CAAA;AAC/B,MAAA,MAAM,gBAAmB,GAAA;AAAA,QACvB,IAAM,EAAA,aAAA;AAAA,QACN,KAAO,EAAA,OAAA;AAAA,OAAA,CAAA;AAET,MAAA,MAAM,gBAAiD,GAAA,iBAAA,CAAkB,MACvE,CAAA,CAAC,KAAmC,aAAkB,KAAA;AACpD,QAAA,MAAM,iBAAoB,GAAA,kBAAA,CAAmB,qBAC3C,CAAA,aAAA,EACA,WAAY,CAAA,KAAA,CAAA,CAAA;AAEd,QAAO,OAAA;AAAA,UACL,GAAG,GAAA;AAAA,UACH,GAAG,iBAAA,CAAkB,GAAI,CAAA,CAAC,CAAW,KAAA;AACnC,YAAO,OAAA;AAAA,cACL,MAAM,CAAE,CAAA,IAAA;AAAA,cACR,UAAY,EAAA,cAAA,CAAA;AAAA,gBACV,WAAW,CAAE,CAAA,SAAA;AAAA,eACV,EAAA,gBAAA,CAAA;AAAA,aAAA,CAAA;AAAA,WAAA,CAAA;AAAA,SAAA,CAAA;AAAA,OAMb,EAAA,EAAA,CAAA,CAAA;AAGF,MAAiB,gBAAA,CAAA,gBAAA,CAAA,CAAA;AAAA,KAAA;AAAA,GAAA,EAElB,CAAC,iBAAmB,EAAA,WAAA,CAAA,CAAA,CAAA;AAEvB,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAA,2CAAQ,KAAD,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAGT,EAAA,MAAM,CAAE,cAAmB,CAAA,GAAA,OAAA,CAAA;AAE3B,EAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,IAAA,2CAAQ,KAAD,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAGT,EAAA,2CACG,mBAAD,EAAA;AAAA,IACE,WAAW,YAAa,CAAA,0BAAA,CAAA;AAAA,IACxB,KAAM,EAAA,gBAAA;AAAA,IACN,OAAA,sCACG,OAAD,EAAA;AAAA,MACE,QAAU,EAAA,YAAA;AAAA,MACV,WAAW,cAAe,CAAA,MAAA;AAAA,MAC1B,QAAQ,MAAM;AACZ,QAAI,IAAA,YAAA,IAAgB,cAAe,CAAA,MAAA,GAAS,CAAG,EAAA;AAC7C,UAAA,OAAA;AAAA,SAAA;AAEF,QAAgB,eAAA,CAAA,CAAC,MAAM,CAAI,GAAA,CAAA,CAAA,CAAA;AAAA,OAAA;AAAA,MAE7B,QAAQ,MAAM;AACZ,QAAA,IAAI,gBAAgB,CAAG,EAAA;AACrB,UAAA,OAAA;AAAA,SAAA;AAEF,QAAgB,eAAA,CAAA,CAAC,MAAM,CAAI,GAAA,CAAA,CAAA,CAAA;AAAA,OAAA;AAAA,KAAA,CAAA;AAAA,GAAA,sCAKhC,KAAD,EAAA;AAAA,IAAK,WAAW,YAAa,CAAA,sBAAA,CAAA;AAAA,IAAyB,GAAA;AAAA,GAAA,sCACnD,cAAD,EAAA;AAAA,IAAgB,GAAA,EAAK,CAAa,EAAA,GAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,CAAA,GAAA,KAAb,IAAoB,GAAA,EAAA,GAAA,EAAA;AAAA,IAAI,WAAa,EAAA,aAAA;AAAA,IAAe,IAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAMjF,MAAM,eAAA,GAAkB,CAAC,KAAoB,KAAA;AAC3C,EAAM,MAAA,CAAE,OAAS,EAAA,QAAA,CAAA,GAAa,KAAM,CAAA,UAAA,CAAA;AAEpC,EAAO,OAAA;AAAA,IACL,SAAS,OAAQ,CAAA,QAAA,CAAA;AAAA,GAAA,CAAA;AAAA,CAAA,CAAA;AAIrB,yBAAe,QAAQ,eAAiB,CAAA,CAAA,gBAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloudAnnotation as
|
|
1
|
+
import{PointCloudAnnotation as S,MathUtils as d}from"@labelbee/lb-annotation";import{getClassName as x}from"../../utils/dom.js";import{PointCloudContainer as O}from"./PointCloudLayout.js";import f,{useRef as z,useEffect as P}from"react";import{PointCloudContext as M}from"./PointCloudContext.js";import{useSingleBox as N}from"./hooks/useSingleBox.js";import{EPerspectiveView as X}from"@labelbee/lb-utils";import{SizeInfoForView as W}from"./PointCloudInfos.js";import{connect as A}from"react-redux";import{aMapStateToProps as H}from"../../store/annotation/map.js";import{synchronizeTopView as T,synchronizeSideView as Y}from"./hooks/usePointCloudViews.js";import D from"../../hooks/useSize.js";import F from"./components/EmptyPage/index.js";const R=(r,t,e=1)=>{const{width:n,height:i}=t,c={x:r.x+n*e/2,y:r.y+i*e/2},o={x:t.width/2,y:t.height/2};return{offsetX:(o.x-c.x)/e,offsetY:-(o.y-c.y)/e}},V=(r,t,e,n,i)=>{const{offsetX:c,offsetY:o}=R(r,e,t);if(i.camera.zoom=t,r){const a=Math.cos(n.rotation),s=Math.sin(n.rotation),l=c*a,u=c*s,{x:p,y:m,z:h}=i.initCameraPosition;i.camera.position.set(p+u,m-l,h+o)}i.camera.updateProjectionMatrix(),i.render()},U=({currentData:r})=>{const t=f.useContext(M),e=z(null),n=D(e),{updateSelectedBox:i,selectedBox:c}=N();return P(()=>{if(e.current){const o={width:e.current.clientWidth,height:e.current.clientHeight},a=new S({container:e.current,size:o,polygonOperationProps:{showDirectionLine:!1,forbidAddNew:!0}});t.setBackViewInstance(a)}},[]),P(()=>{if(!n||!t.backViewInstance)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=t.backViewInstance;o.singleOn("renderZoom",(s,l)=>{!t.selectedPointCloudBox||V(l,s,n,t.selectedPointCloudBox,a)}),o.singleOn("dragMove",({currentPos:s,zoom:l})=>{!t.selectedPointCloudBox||V(s,l,n,t.selectedPointCloudBox,a)}),o.singleOn("updatePolygonByDrag",({newPolygon:s,originPolygon:l})=>{if(!t.selectedPointCloudBox||!t.mainViewInstance||!r.url)return;const[u,p,m]=s.pointList,[h,y,B]=l.pointList,g=d.getLineCenterPoint([u,m]),w=d.getLineCenterPoint([h,B]),v={x:{x:g.x-w.x,y:g.y-w.y}.x,y:0,z:g.y-w.y},L=d.getLineLength(u,p),I=d.getLineLength(h,y),b=L-I,j=d.getLineLength(p,m),k=d.getLineLength(y,B),E=j-k,{newBoxParams:C}=a.getNewBoxByBackUpdate(v,E,b,t.selectedPointCloudBox);T(C,s,t.topViewInstance,t.mainViewInstance),Y(C,s,t.sideViewInstance,r.url),t.mainViewInstance.highlightOriginPointCloud(C),i(C)})},[t,n]),P(()=>{var o;(o=t==null?void 0:t.backViewInstance)==null||o.initSize(n)},[n]),f.createElement(O,{className:x("point-cloud-container","back-view"),title:"\u80CC\u89C6\u56FE",toolbar:f.createElement(W,{perspectiveView:X.Back})},f.createElement("div",{className:x("point-cloud-container","bottom-view-content")},f.createElement("div",{className:x("point-cloud-container","core-instance"),ref:e}),!c&&f.createElement(F,null)))};var Z=A(H)(U);export{Z as default};
|