@labelbee/lb-components 1.14.0-alpha.4 → 1.14.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
  2. package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
  3. package/dist/components/pointCloudView/PointCloudBackView.js +1 -1
  4. package/dist/components/pointCloudView/components/HighlightVisible/index.js +1 -1
  5. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  6. package/dist/components/pointCloudView/index.js +1 -1
  7. package/dist/index.css +5 -2
  8. package/dist/store/Actions.js +1 -1
  9. package/dist/store/annotation/actionCreators.js +1 -1
  10. package/dist/store/annotation/map.js +1 -1
  11. package/dist/store/annotation/reducer.js +1 -1
  12. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +1 -1
  13. package/dist/types/components/pointCloudView/PointCloud3DView.d.ts +1 -1
  14. package/dist/types/components/pointCloudView/PointCloudBackView.d.ts +1 -1
  15. package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -1
  16. package/dist/types/components/pointCloudView/PointCloudSegment.d.ts +1 -1
  17. package/dist/types/components/pointCloudView/PointCloudSegmentListener.d.ts +1 -1
  18. package/dist/types/components/pointCloudView/PointCloudSideView.d.ts +1 -1
  19. package/dist/types/components/pointCloudView/PointCloudTopView.d.ts +1 -1
  20. package/dist/types/components/pointCloudView/index.d.ts +1 -1
  21. package/dist/types/store/Actions.d.ts +1 -1
  22. package/dist/types/store/annotation/actionCreators.d.ts +1 -1
  23. package/dist/types/store/annotation/map.d.ts +2 -2
  24. package/dist/types/store/annotation/reducer.d.ts +1 -1
  25. package/dist/types/store/annotation/types.d.ts +1 -1
  26. package/es/components/pointCloudView/PointCloud2DView.js +1 -1
  27. package/es/components/pointCloudView/PointCloud3DView.js +1 -1
  28. package/es/components/pointCloudView/PointCloudBackView.js +1 -1
  29. package/es/components/pointCloudView/components/HighlightVisible/index.js +1 -1
  30. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  31. package/es/components/pointCloudView/index.js +1 -1
  32. package/es/index.css +5 -2
  33. package/es/store/Actions.js +1 -1
  34. package/es/store/annotation/actionCreators.js +1 -1
  35. package/es/store/annotation/map.js +1 -1
  36. package/es/store/annotation/reducer.js +1 -1
  37. package/package.json +2 -2
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:f,setCurIndex:u,curIndex:p=0,index:a,annotations2d:v})=>n?React__default.default.createElement(index,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{f(!1),u(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",v==null?void 0:v.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{f(!0),u(a)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:f,highlightAttribute:u})=>{var p;const[a,v]=React.useState([]),{topViewInstance:q,displayPointCloudList:b}=React.useContext(PointCloudContext.PointCloudContext),[y,F]=React.useState(""),[m,E]=React.useState(!1),[r,g]=React.useState(void 0);React.useEffect(()=>{var l;if(q&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const o={fill:"transparent",color:"green"};let i=[];e==null||e.mappingImgList.forEach(s=>{var c;const I=b.reduce((S,d)=>{var C;const N=d.id===y||u===d.attribute,{transferViewData:R,viewRangePointList:_}=lbAnnotation.pointCloudLidar2image(d,s.calib,{createRange:N}),h=(C=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},n),{attributeConfigurable:!0}),{}))==null?void 0:C.stroke,V=O({viewDataPointList:R,pointCloudBox:d,defaultViewStyle:o,stroke:h}),L=[...S,...V];return(_==null?void 0:_.length)>0&&L.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:y,pointList:_},o),{stroke:h,fill:"rgba(255, 255, 255, 0.6)"})}),L},[]);i.push({annotations:I,url:s==null?void 0:s.url,calName:(c=s.calib)==null?void 0:c.calName,calib:s==null?void 0:s.calib})}),v(i)}},[b,e==null?void 0:e.mappingImgList,y,u]),React.useEffect(()=>(window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}),[r]);const w=l=>{const{keyCode:o}=l;switch(o){case EKeyCode.Esc:m&&E(!1);break;case EKeyCode.Left:P();break;case EKeyCode.Right:x();break}},P=()=>{r===void 0||!m||Number(r)>0&&g(r-1)},x=()=>{r===void 0||!m||Number(r)<(a==null?void 0:a.length)-1&&g(r+1)},O=({viewDataPointList:l,pointCloudBox:o,defaultViewStyle:i,stroke:s})=>l.map(c=>({type:c.type,annotation:__spreadProps(__spreadValues({id:o.id,pointList:c.pointList},i),{stroke:s})})),j=!e||!(e==null?void 0:e.mappingImgList)||!(((p=e==null?void 0:e.mappingImgList)==null?void 0:p.length)>0),k=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>P()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>x()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{E(!1),g(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(a==null?void 0:a.length)>0?React__default.default.createElement(React__default.default.Fragment,null,a.map((l,o)=>{const i=m&&o===r;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-3d-containerZoom")]:i}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:i,isEnlargeTopView:f,data:l,setIsEnlarge:E,setCurIndex:g,curIndex:r,index:o,annotations2d:a}),titleOnSurface:!i,style:{display:j?"none":"flex",width:i?"100%":t},key:o,toolbar:k},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:l,setSelectedID:F}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:f,setCurIndex:u,curIndex:p=0,index:a,annotations2d:v})=>n?React__default.default.createElement(index,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{f(!1),u(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",v==null?void 0:v.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{f(!0),u(a)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:f,highlightAttribute:u})=>{var p;const[a,v]=React.useState([]),{topViewInstance:q,displayPointCloudList:b}=React.useContext(PointCloudContext.PointCloudContext),[y,F]=React.useState(""),[m,E]=React.useState(!1),[r,g]=React.useState(void 0);React.useEffect(()=>{var l;if(q&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const o={fill:"transparent",color:"green"};let i=[];e==null||e.mappingImgList.forEach(s=>{var c;const I=b.reduce((S,d)=>{var C;const N=d.id===y||u===d.attribute,{transferViewData:R,viewRangePointList:_}=lbAnnotation.pointCloudLidar2image(d,s.calib,{createRange:N}),h=(C=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},n),{attributeConfigurable:!0}),{}))==null?void 0:C.stroke,V=O({viewDataPointList:R,pointCloudBox:d,defaultViewStyle:o,stroke:h}),L=[...S,...V];return(_==null?void 0:_.length)>0&&L.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:y,pointList:_},o),{stroke:h,fill:"rgba(255, 255, 255, 0.6)"})}),L},[]);i.push({annotations:I,url:s==null?void 0:s.url,calName:(c=s.calib)==null?void 0:c.calName,calib:s==null?void 0:s.calib})}),v(i)}},[b,e==null?void 0:e.mappingImgList,y,u]),React.useEffect(()=>(window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}),[r]);const w=l=>{const{keyCode:o}=l;switch(o){case EKeyCode.Esc:m&&E(!1);break;case EKeyCode.Left:P();break;case EKeyCode.Right:x();break}},P=()=>{r===void 0||!m||Number(r)>0&&g(r-1)},x=()=>{r===void 0||!m||Number(r)<(a==null?void 0:a.length)-1&&g(r+1)},O=({viewDataPointList:l,pointCloudBox:o,defaultViewStyle:i,stroke:s})=>l.map(c=>({type:c.type,annotation:__spreadProps(__spreadValues({id:o.id,pointList:c.pointList},i),{stroke:s})})),j=!e||!(e==null?void 0:e.mappingImgList)||!(((p=e==null?void 0:e.mappingImgList)==null?void 0:p.length)>0),k=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>P()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>x()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{E(!1),g(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(a==null?void 0:a.length)>0?React__default.default.createElement(React__default.default.Fragment,null,a.map((l,o)=>{const i=m&&o===r;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:i}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:i,isEnlargeTopView:f,data:l,setIsEnlarge:E,setCurIndex:g,curIndex:r,index:o,annotations2d:a}),titleOnSurface:!i,style:{display:j?"none":"flex",width:i?"100%":t},key:o,toolbar:k},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:l,setSelectedID:F}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js"),index$2=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,i)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[o]=i,__spreadValues=(t,o)=>{for(var i in o||(o={}))__hasOwnProp.call(o,i)&&__defNormalProp(t,i,o[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(o))__propIsEnum.call(o,i)&&__defNormalProp(t,i,o[i]);return t},__spreadProps=(t,o)=>__defProps(t,__getOwnPropDescs(o));const EKeyCode=lbAnnotation.cKeyCode.default,pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:t})=>{const{isActive:o,setTarget3DView:i}=React.useContext(PointCloud3DContext),n=u=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",u)]:!0,active:o});return React__default.default.createElement("span",{onClick:()=>{i(lbUtils.EPerspectiveView[t])},className:n(t.toLocaleLowerCase())})},PointCloud3DSideBar=({isEnlarge:t})=>{const{reset3DView:o,followTopView:i}=React.useContext(PointCloud3DContext),{t:n}=reactI18next.useTranslation(),u=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Top"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Front"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Left"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Back"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Right"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"LFT"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"RBT"})),p=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Tooltip,{title:n("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{i()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{o()},className:dom.getClassName("point-cloud-3d-view","reset")}));return t?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebarZoom")},p,u):React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},u,p)},PointCloud3D=({currentData:t,config:o,highlightAttribute:i})=>{const n=React.useContext(PointCloudContext.PointCloudContext),[u,p]=React.useState(!0),[d,w]=React.useState(!1),m=React.useRef(null),{initPointCloud3d:E}=usePointCloudViews.usePointCloudViews(),f=useSize(m),{t:C}=reactI18next.useTranslation();React.useEffect(()=>{!n.mainViewInstance||E==null||E(f)},[f]);const{selectedBox:c}=useSingleBox.useSingleBox(),{selectedSphere:v}=useSphere.useSphere(),V=e=>{var a,l;const r=c==null?void 0:c.info;if(r){const s=__spreadValues({},r.center);s.x=s.x-.01,s.z=1e3;const g=e===lbUtils.EPerspectiveView.Top;(a=n.mainViewInstance)==null||a.updateCameraByBox(r,e,g?s:void 0)}v&&((l=n.mainViewInstance)==null||l.updateCameraBySphere(v,e))},_=()=>{var e;(e=n.mainViewInstance)==null||e.resetCamera()},h=()=>{var e,a;const l=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance.camera;l&&((a=n.mainViewInstance)==null||a.applyCameraTarget(l))};React.useEffect(()=>{if(m.current&&(t==null?void 0:t.url)){let e=n.mainViewInstance;!e&&f.width&&(e=new lbAnnotation.PointCloud({container:m.current,isOrthographicCamera:!0,orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(f),config:o}),n.setMainViewInstance(e))}},[f,t]),React.useEffect(()=>{var e;if(m.current&&(t==null?void 0:t.url)&&t.result&&n.mainViewInstance){let a=n.mainViewInstance;const l=lbUtils.PointCloudUtils.getBoxParamsFromResultList(t.result);l.forEach(r=>{var s;const g=(s=lbUtils.toolStyleConverter.getColorFromConfig({attribute:r.attribute},__spreadProps(__spreadValues({},o),{attributeConfigurable:!0}),{}))==null?void 0:s.hex;a==null||a.addBoxToSense(r,g)}),a.render(),n.setPointCloudResult(l),n.setPointCloudValid((e=index.jsonParser(t.result))==null?void 0:e.valid)}},[t,n.mainViewInstance]),React.useEffect(()=>{var e,a,l,r;if(c){V(lbUtils.EPerspectiveView.Top);const s=(l=(a=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?l:1;(r=n.mainViewInstance)==null||r.updateCameraZoom(s)}},[c]),React.useEffect(()=>{var e,a,l,r;if(v){V(lbUtils.EPerspectiveView.Top);const s=(l=(a=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?l:1;(r=n.mainViewInstance)==null||r.updateCameraZoom(s)}},[v]),React.useEffect(()=>(window.addEventListener("keydown",P),()=>{window.removeEventListener("keydown",P)}),[]);const P=e=>{if(e.keyCode===EKeyCode.Esc){w(!1);return}},x=React.useMemo(()=>({reset3DView:_,setTarget3DView:V,isActive:!!c,followTopView:h}),[c,n.mainViewInstance]);React.useEffect(()=>{var e,a,l;const r=n.pointCloudBoxList.filter(s=>s.attribute===i);(r==null?void 0:r.length)>0&&((e=n.mainViewInstance)==null||e.clearHighlightBoxes(),(a=n.mainViewInstance)==null||a.highlightBoxes(r)),r.length===0&&((l=n.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[i,n.mainViewInstance]);const I=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{onChange:e=>{var a;(a=n.mainViewInstance)==null||a.updatePointSize({customSize:e})}}),React__default.default.createElement("span",{style:{marginRight:8}},C("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:u,onChange:e=>{var a;p(e),(a=n.mainViewInstance)==null||a.setShowDirection(e)}}),d&&React__default.default.createElement(PointCloud3DContext.Provider,{value:x},React__default.default.createElement(PointCloud3DSideBar,{isEnlarge:d})));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-3d-container")]:!0,[dom.getClassName("point-cloud-3d-containerZoom")]:d}),title:d?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{w(!1)}}),C("3DView")):React__default.default.createElement(index$2,{title:C("3DView"),onClick:()=>{w(!0)}}),toolbar:I},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},!d&&React__default.default.createElement(PointCloud3DContext.Provider,{value:x},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:m})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
1
+ "use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js"),index$2=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,i)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[o]=i,__spreadValues=(t,o)=>{for(var i in o||(o={}))__hasOwnProp.call(o,i)&&__defNormalProp(t,i,o[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(o))__propIsEnum.call(o,i)&&__defNormalProp(t,i,o[i]);return t},__spreadProps=(t,o)=>__defProps(t,__getOwnPropDescs(o));const EKeyCode=lbAnnotation.cKeyCode.default,pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:t})=>{const{isActive:o,setTarget3DView:i}=React.useContext(PointCloud3DContext),n=u=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",u)]:!0,active:o});return React__default.default.createElement("span",{onClick:()=>{i(lbUtils.EPerspectiveView[t])},className:n(t.toLocaleLowerCase())})},PointCloud3DSideBar=({isEnlarge:t})=>{const{reset3DView:o,followTopView:i}=React.useContext(PointCloud3DContext),{t:n}=reactI18next.useTranslation(),u=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Top"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Front"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Left"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Back"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"Right"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"LFT"}),React__default.default.createElement(PointCloudViewIcon,{perspectiveView:"RBT"})),p=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Tooltip,{title:n("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{i()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{o()},className:dom.getClassName("point-cloud-3d-view","reset")}));return t?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebarZoom")},p,u):React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},u,p)},PointCloud3D=({currentData:t,config:o,highlightAttribute:i})=>{const n=React.useContext(PointCloudContext.PointCloudContext),[u,p]=React.useState(!0),[d,w]=React.useState(!1),m=React.useRef(null),{initPointCloud3d:E}=usePointCloudViews.usePointCloudViews(),f=useSize(m),{t:C}=reactI18next.useTranslation();React.useEffect(()=>{!n.mainViewInstance||E==null||E(f)},[f]);const{selectedBox:c}=useSingleBox.useSingleBox(),{selectedSphere:v}=useSphere.useSphere(),V=e=>{var a,l;const r=c==null?void 0:c.info;if(r){const s=__spreadValues({},r.center);s.x=s.x-.01,s.z=1e3;const g=e===lbUtils.EPerspectiveView.Top;(a=n.mainViewInstance)==null||a.updateCameraByBox(r,e,g?s:void 0)}v&&((l=n.mainViewInstance)==null||l.updateCameraBySphere(v,e))},_=()=>{var e;(e=n.mainViewInstance)==null||e.resetCamera()},h=()=>{var e,a;const l=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance.camera;l&&((a=n.mainViewInstance)==null||a.applyCameraTarget(l))};React.useEffect(()=>{if(m.current&&(t==null?void 0:t.url)){let e=n.mainViewInstance;!e&&f.width&&(e=new lbAnnotation.PointCloud({container:m.current,isOrthographicCamera:!0,orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(f),config:o}),n.setMainViewInstance(e))}},[f,t]),React.useEffect(()=>{var e;if(m.current&&(t==null?void 0:t.url)&&t.result&&n.mainViewInstance){let a=n.mainViewInstance;const l=lbUtils.PointCloudUtils.getBoxParamsFromResultList(t.result);l.forEach(r=>{var s;const g=(s=lbUtils.toolStyleConverter.getColorFromConfig({attribute:r.attribute},__spreadProps(__spreadValues({},o),{attributeConfigurable:!0}),{}))==null?void 0:s.hex;a==null||a.addBoxToSense(r,g)}),a.render(),n.setPointCloudResult(l),n.setPointCloudValid((e=index.jsonParser(t.result))==null?void 0:e.valid)}},[t,n.mainViewInstance]),React.useEffect(()=>{var e,a,l,r;if(c){V(lbUtils.EPerspectiveView.Top);const s=(l=(a=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?l:1;(r=n.mainViewInstance)==null||r.updateCameraZoom(s)}},[c]),React.useEffect(()=>{var e,a,l,r;if(v){V(lbUtils.EPerspectiveView.Top);const s=(l=(a=(e=n.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?l:1;(r=n.mainViewInstance)==null||r.updateCameraZoom(s)}},[v]),React.useEffect(()=>(window.addEventListener("keydown",P),()=>{window.removeEventListener("keydown",P)}),[]);const P=e=>{if(e.keyCode===EKeyCode.Esc){w(!1);return}},x=React.useMemo(()=>({reset3DView:_,setTarget3DView:V,isActive:!!c,followTopView:h}),[c,n.mainViewInstance]);React.useEffect(()=>{var e,a,l;const r=n.pointCloudBoxList.filter(s=>s.attribute===i);(r==null?void 0:r.length)>0&&((e=n.mainViewInstance)==null||e.clearHighlightBoxes(),(a=n.mainViewInstance)==null||a.highlightBoxes(r)),r.length===0&&((l=n.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[i,n.mainViewInstance]);const I=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{onChange:e=>{var a;(a=n.mainViewInstance)==null||a.updatePointSize({customSize:e})}}),React__default.default.createElement("span",{style:{marginRight:8}},C("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:u,onChange:e=>{var a;p(e),(a=n.mainViewInstance)==null||a.setShowDirection(e)}}),d&&React__default.default.createElement(PointCloud3DContext.Provider,{value:x},React__default.default.createElement(PointCloud3DSideBar,{isEnlarge:d})));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-3d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:d}),title:d?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{w(!1)}}),C("3DView")):React__default.default.createElement(index$2,{title:C("3DView"),onClick:()=>{w(!0)}}),toolbar:I},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},!d&&React__default.default.createElement(PointCloud3DContext.Provider,{value:x},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:m})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
@@ -1 +1 @@
1
- "use strict";var lbAnnotation=require("@labelbee/lb-annotation"),dom=require("../../utils/dom.js"),PointCloudLayout=require("./PointCloudLayout.js"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),useZoom=require("./hooks/useZoom.js"),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$1=require("./components/EmptyPage/index.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),ToolUtils=require("../../utils/ToolUtils.js"),index=require("./components/TitleButton/index.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React);const TransferCanvas2WorldOffset=(n,s,l=1)=>{const{width:e,height:o}=s,t={x:n.x+e*l/2,y:n.y+o*l/2},c={x:s.width/2,y:s.height/2};return{offsetX:(c.x-t.x)/l,offsetY:-(c.y-t.y)/l}},updateBackViewByCanvas2D=(n,s,l,e,o)=>{const{offsetX:t,offsetY:c}=TransferCanvas2WorldOffset(n,l,s);if(o.camera.zoom=s,n){const d=Math.cos(e),f=Math.sin(e),x=t*d,C=t*f,{x:v,y:i,z:u}=o.initCameraPosition;o.camera.position.set(v+C,i-x,u+c)}o.camera.updateProjectionMatrix(),o.render()},PointCloudBackView=({currentData:n,config:s,checkMode:l})=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),o=React.useRef(null),t=useSize(o),{selectedBox:c}=useSingleBox.useSingleBox(),{selectedSphere:d}=useSphere.useSphere(),{syncBackviewToolZoom:f}=useZoom.useZoom(),{t:x}=reactI18next.useTranslation(),{backViewUpdateBox:C,backViewUpdatePoint:v}=usePointCloudViews.usePointCloudViews();return React.useEffect(()=>{if(o.current){const i={width:o.current.clientWidth,height:o.current.clientHeight},u=new lbAnnotation.PointCloudAnnotation({container:o.current,size:i,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:s,checkMode:l,toolName:ToolUtils.getPointCloudToolList()});e.setBackViewInstance(u)}},[]),React.useEffect(()=>{if(!t||!e.backViewInstance)return;const{toolInstance:i,pointCloudInstance:u}=e.backViewInstance;i.singleOn("renderZoom",(r,a)=>{if(e.selectedPointCloudBox){updateBackViewByCanvas2D(a,r,t,e.selectedPointCloudBox.rotation,u),f(a,r,t);return}if(d){updateBackViewByCanvas2D(a,r,t,0,u),f(a,r,t);return}}),i.singleOn("dragMove",({currentPos:r,zoom:a})=>{!e.selectedPointCloudBox&&!d||updateBackViewByCanvas2D(r,a,t,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,u)}),i.singleOn("updatePointByDrag",(r,a)=>{d&&(v==null||v(r,a[0]))}),i.singleOn("updatePolygonByDrag",r=>{if(e.selectedIDs.length===1&&r.length===1){const{newPolygon:a,originPolygon:p}=r[0];a&&p&&C(a,p)}})},[e,t]),React.useEffect(()=>{var i;(i=e==null?void 0:e.backViewInstance)==null||i.initSize(t)},[t]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","back-view"),title:React__default.default.createElement(index,{title:x("BackView")}),titleOnSurface:!0},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:o,style:{width:360}}),!c&&!d&&React__default.default.createElement(index$1,null),React__default.default.createElement(PointCloudInfos.SizeInfoForView,{perspectiveView:lbUtils.EPerspectiveView.Back})))};var PointCloudBackView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudBackView);module.exports=PointCloudBackView$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"),lbUtils=require("@labelbee/lb-utils"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),useZoom=require("./hooks/useZoom.js"),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$1=require("./components/EmptyPage/index.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),ToolUtils=require("../../utils/ToolUtils.js"),index=require("./components/TitleButton/index.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React);const TransferCanvas2WorldOffset=(n,s,l=1)=>{const{width:e,height:o}=s,t={x:n.x+e*l/2,y:n.y+o*l/2},c={x:s.width/2,y:s.height/2};return{offsetX:(c.x-t.x)/l,offsetY:-(c.y-t.y)/l}},updateBackViewByCanvas2D=(n,s,l,e,o)=>{const{offsetX:t,offsetY:c}=TransferCanvas2WorldOffset(n,l,s);if(o.camera.zoom=s,n){const d=Math.cos(e),f=Math.sin(e),x=t*d,C=t*f,{x:v,y:i,z:u}=o.initCameraPosition;o.camera.position.set(v+C,i-x,u+c)}o.camera.updateProjectionMatrix(),o.render()},PointCloudBackView=({currentData:n,config:s,checkMode:l})=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),o=React.useRef(null),t=useSize(o),{selectedBox:c}=useSingleBox.useSingleBox(),{selectedSphere:d}=useSphere.useSphere(),{syncBackviewToolZoom:f}=useZoom.useZoom(),{t:x}=reactI18next.useTranslation(),{backViewUpdateBox:C,backViewUpdatePoint:v}=usePointCloudViews.usePointCloudViews();return React.useEffect(()=>{if(o.current){const i={width:o.current.clientWidth,height:o.current.clientHeight},u=new lbAnnotation.PointCloudAnnotation({container:o.current,size:i,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:s,checkMode:l,toolName:ToolUtils.getPointCloudToolList()});e.setBackViewInstance(u)}},[]),React.useEffect(()=>{if(!t||!e.backViewInstance)return;const{toolInstance:i,pointCloudInstance:u}=e.backViewInstance;i.singleOn("renderZoom",(r,a)=>{if(e.selectedPointCloudBox){updateBackViewByCanvas2D(a,r,t,e.selectedPointCloudBox.rotation,u),f(a,r,t);return}if(d){updateBackViewByCanvas2D(a,r,t,0,u),f(a,r,t);return}}),i.singleOn("dragMove",({currentPos:r,zoom:a})=>{!e.selectedPointCloudBox&&!d||updateBackViewByCanvas2D(r,a,t,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,u)}),i.singleOn("updatePointByDrag",(r,a)=>{d&&(v==null||v(r,a[0]))}),i.singleOn("updatePolygonByDrag",r=>{if(e.selectedIDs.length===1&&r.length===1){const{newPolygon:a,originPolygon:p}=r[0];a&&p&&C(a,p)}})},[e,t]),React.useEffect(()=>{var i;(i=e==null?void 0:e.backViewInstance)==null||i.initSize(t)},[t]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","back-view"),title:React__default.default.createElement(index,{title:x("BackView")}),titleOnSurface:!0},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:o}),!c&&!d&&React__default.default.createElement(index$1,null),React__default.default.createElement(PointCloudInfos.SizeInfoForView,{perspectiveView:lbUtils.EPerspectiveView.Back})))};var PointCloudBackView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudBackView);module.exports=PointCloudBackView$1;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),icons=require("@ant-design/icons");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,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const HighlightVisible=({visible:e,style:r,onClick:t,loading:a})=>{const o={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16,zIndex:101};let i=e?icons.EyeFilled:icons.EyeInvisibleFilled;return a&&(i=icons.LoadingOutlined,Object.assign(o,{borderRadius:100})),React__default.default.createElement(i,{style:__spreadValues(__spreadValues({},o),r),onClick:a?()=>{}:t})};module.exports=HighlightVisible;
1
+ "use strict";var React=require("react"),icons=require("@ant-design/icons"),dom=require("../../../../utils/dom.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,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const HighlightVisible=({visible:e,style:r,onClick:t,loading:a})=>{const i={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16,zIndex:101};let o=e?icons.EyeFilled:icons.EyeInvisibleFilled;return a&&(o=icons.LoadingOutlined,Object.assign(i,{borderRadius:100})),React__default.default.createElement(o,{className:dom.getClassName("point-cloud-highlight-view"),style:__spreadValues(__spreadValues({},i),r),onClick:a?()=>{}:t})};module.exports=HighlightVisible;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,e,i)=>e in o?__defProp(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i,__spreadValues=(o,e)=>{for(var i in e||(e={}))__hasOwnProp.call(e,i)&&__defNormalProp(o,i,e[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(e))__propIsEnum.call(e,i)&&__defNormalProp(o,i,e[i]);return o},__spreadProps=(o,e)=>__defProps(o,__getOwnPropDescs(e)),__async=(o,e,i)=>new Promise((l,t)=>{var a=c=>{try{d(i.next(c))}catch(g){t(g)}},P=c=>{try{d(i.throw(c))}catch(g){t(g)}},d=c=>c.done?l(c.value):Promise.resolve(c.value).then(a,P);d((i=i.apply(o,e)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(o,e,i,l,t)=>{const{x:a,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,e),{defaultZ:d}=lbUtils.DEFAULT_SPHERE_PARAMS,c={center:{x:a,y:P,z:d},id:o.id},g=l?__spreadValues(__spreadValues({},l),c):__spreadProps(__spreadValues({},c),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},topViewPolygon2PointCloud=(o,e,i,l,t,a)=>{let P=o.pointList.map(f=>lbUtils.PointCloudUtils.transferCanvas2World(f,e)),d=0,c=1,g={};if(i){const f=i.getSensesPointZAxisInPolygon(P,void 0,a);a&&f.fittedCoordinates.length>0&&(P=f.fittedCoordinates),d=(f.maxZ+f.minZ)/2,c=f.maxZ-f.minZ,g={count:f.zCount}}const[h,m,T]=P,b=lbAnnotation.MathUtils.getLineCenterPoint([h,T]),I=lbAnnotation.MathUtils.getLineLength(h,m),D=lbAnnotation.MathUtils.getLineLength(m,T),O=lbAnnotation.MathUtils.getRadiusFromQuadrangle(o.pointList);l&&(d=l.center.z,c=l.depth);const _={center:{x:b.x,y:b.y,z:d},width:a?D+INTELLIGENT_FIT_MARGIN:D,height:a?I+INTELLIGENT_FIT_MARGIN:I,depth:c,rotation:O,id:o.id},k=__spreadValues(l?__spreadValues(__spreadValues({},l),_):__spreadProps(__spreadValues({},_),{attribute:"",valid:!0}),g);t&&Object.assign(k,t);const S=P.map(f=>lbUtils.PointCloudUtils.transferWorld2Canvas(f,e));return{boxParams:k,newPointList:S}},sideViewPoint2PointCloud=(o,e,i)=>{const l={x:o.x-e.x,y:o.y-e.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-l.x,y:i.center.y,z:i.center.z-l.y}})},sideViewPolygon2PointCloud=(o,e,i,l)=>{const[t,a,P]=o.pointList,[d,c,g]=e.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([t,P]),m=lbAnnotation.MathUtils.getLineCenterPoint([d,g]),b={x:{x:h.x-m.x,y:h.y-m.y}.x,y:0,z:h.y-m.y},I=lbAnnotation.MathUtils.getLineLength(t,a),D=lbAnnotation.MathUtils.getLineLength(d,c),O=I-D,_=lbAnnotation.MathUtils.getLineLength(a,P),k=lbAnnotation.MathUtils.getLineLength(c,g),S=_-k,{newBoxParams:f}=l.getNewBoxBySideUpdate(b,S,O,i);return f},backViewPoint2PointCloud=(o,e,i)=>{const l={x:o.x-e.x,y:o.y-e.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-l.x,z:i.center.z-l.y}})},backViewPolygon2PointCloud=(o,e,i,l)=>{const[t,a,P]=o.pointList,[d,c,g]=e.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([t,P]),m=lbAnnotation.MathUtils.getLineCenterPoint([d,g]),b={x:{x:h.x-m.x,y:h.y-m.y}.x,y:0,z:h.y-m.y},I=lbAnnotation.MathUtils.getLineLength(t,a),D=lbAnnotation.MathUtils.getLineLength(d,c),O=I-D,_=lbAnnotation.MathUtils.getLineLength(a,P),k=lbAnnotation.MathUtils.getLineLength(c,g),S=_-k;let{newBoxParams:f}=l.getNewBoxByBackUpdate(b,S,O,i);return f},syncSideViewByPoint=(o,e,i,l,t)=>{var a;if(!i)return;const{toolInstance:P,pointCloudInstance:d}=i;d.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:c}=d.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(c);const{point2d:g,zoom:h}=d.getSphereSidePoint2DCoordinate(o);d.camera.zoom=h,d.camera.updateProjectionMatrix(),d.render(),P.initPosition(),P.zoomChangeOnCenter(h),P.setResult([__spreadProps(__spreadValues(__spreadValues({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(e.id)},synchronizeSideView=(o,e,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=a.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);a.setInitCameraPosition(P);const{polygon2d:d,zoom:c}=a.getBoxSidePolygon2DCoordinate(o);a.camera.zoom=c,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(c),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:d,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},syncBackViewByPoint=(o,e,i,l,t)=>{var a;if(!i)return;const{toolInstance:P,pointCloudInstance:d}=i;d.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:c}=d.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(c);const{point2d:g,zoom:h}=d.getSphereBackPoint2DCoordinate(o);d.camera.zoom=h,d.camera.updateProjectionMatrix(),d.render(),P.initPosition(),P.zoomChangeOnCenter(h),P.setResult([__spreadProps(__spreadValues(__spreadValues({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(e.id)},synchronizeBackView=(o,e,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=a.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);a.setInitCameraPosition(P);const{polygon2d:d,zoom:c}=a.getBoxBackPolygon2DCoordinate(o);a.camera.zoom=c,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(c),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:d,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},syncTopViewByPoint=(o,e,i,l)=>{if(!i||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),l.render();const{toolInstance:t,pointCloudInstance:a}=i,{point2d:P}=a.getSphereTopPoint2DCoordinate(o),d=[...t.pointList].map(c=>c.id===e.id?__spreadProps(__spreadValues(__spreadValues({},e),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):c);t.setResult(d),t.setSelectedID(e.id)},synchronizeTopView=(o,e,i,l)=>{var t,a;if(!i||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:P,pointCloudInstance:d}=i,{polygon2d:c}=d.getBoxTopPolygon2DCoordinate(o),g=[...P.polygonList],h=g.find(m=>m.id===e.id);h?(h.pointList=c,h.valid=(t=o.valid)!=null?t:!0):g.push({id:e.id,pointList:c,textAttribute:"",isRect:!0,valid:(a=o.valid)!=null?a:!0}),P.setResultAndSelectedID(g,e.id)},usePointCloudViews=()=>{const o=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:e,sideViewInstance:i,backViewInstance:l,mainViewInstance:t,addPointCloudBox:a,addPointCloudSphere:P,setSelectedIDs:d,selectedIDs:c,pointCloudBoxList:g,pointCloudSphereList:h,hideAttributes:m,setHighlight2DDataList:T}=o,{addHistory:b,initHistory:I,pushHistoryUnderUpdatePolygon:D,pushHistoryUnderUpdateLine:O}=useHistory.useHistory(),{selectedPolygon:_}=usePolygon.usePolygon(),{updateSelectedBox:k,updateSelectedBoxes:S,getPointCloudByID:f}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:G,updatePointCloudSphere:H,selectedSphere:M}=useSphere.useSphere(),{currentData:z,config:L}=ctx.useSelector(n=>{const{stepList:s,step:p,imgList:u,imgIndex:r}=n.annotation;return{currentData:u[r],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,s).config)}}),A=ctx.useDispatch(),{selectedBox:w}=useSingleBox.useSingleBox(),{t:Q}=reactI18next.useTranslation(),F=w==null?void 0:w.info;if(!e||!i||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:N}=e,X=n=>{t==null||t.generateBox(n),t==null||t.controls.update(),t==null||t.render()},Y=n=>{t==null||t.generateSphere(n),t==null||t.controls.update(),t==null||t.render()},J=({newPoint:n,size:s,zoom:p,trackConfigurable:u})=>{var r;const C={attribute:(r=e.toolInstance.defaultAttribute)!=null?r:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const x=topViewPoint2PointCloud(n,s,N,void 0,C);d(n.id);const y=P(x);E(PointCloudView.Top,n,x,p,y,L),b({newSphereParams:x})},K=({polygon:n,size:s,imgList:p,trackConfigurable:u,zoom:r,intelligentFit:C})=>{var x,y;const v={attribute:(x=e.toolInstance.defaultAttribute)!=null?x:""};u===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:h})});const U=e==null?void 0:e.toolInstance,V=__spreadValues({},n);let{boxParams:B,newPointList:R}=topViewPolygon2PointCloud(V,s,N,void 0,v,C);if(B=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[B],stepConfig:L,action:"viewUpdateBox"}))[0],(L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(Q("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),U.deletePolygon(B.id);return}C&&(R==null?void 0:R.length)&&(V.pointList=R);const at=m.includes(V.attribute),q=a(B),dt=(y=o==null?void 0:o.polygonList)!=null?y:[];e==null||e.updatePolygonList(q!=null?q:[],dt),at?d([]):(d(B.id),U.selection.setSelectedIDs(V.id),j({omitView:PointCloudView.Top,polygon:V,boxParams:B,zoom:r,newPointCloudBoxList:q}),C&&synchronizeTopView(B,V,e,t)),b({newBoxParams:B})},$=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:u})=>{var r;const C=e==null?void 0:e.toolInstance;if(!(c.length===0||!C)){if(n||(w==null?void 0:w.info)){const x=n!=null?n:w==null?void 0:w.info;(r=C==null?void 0:C.selection)==null||r.setSelectedIDs(c[0]);const y=C.selectedPolygon;if(c.length===1&&x){j({omitView:PointCloudView.Top,polygon:y,boxParams:x,newPointCloudBoxList:s});return}}if((p||M)&&c.length===1){const x=p!=null?p:M;C.setSelectedID(c[0]);const y=C.selectedPoint;x&&E(PointCloudView.Top,y,x,void 0,u,L)}}},Z=(n,s,p)=>{if(F){let u,r;switch(p){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}r=u(n,s,F,i.pointCloudInstance);const x=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:L,action:"viewUpdateBox"}))[0],y=r.valid!==x.valid;if(r=x,t){const{count:U}=t.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:U})}const v=k(r);return r=v.find(U=>U.id===r.id),j({omitView:y?void 0:p,polygon:n,boxParams:r,newPointCloudBoxList:[r]}),v}},W=(n,s,p)=>{if(M){let u,r;switch(p){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}r=u(n,s,M);const C=H(r);return E(p,n,r,void 0,C,L),C}},tt=(n,s)=>{W(n,s,PointCloudView.Side)},ot=(n,s)=>{W(n,s,PointCloudView.Back)},et=(n,s)=>{Z(n,s,PointCloudView.Side)},it=(n,s)=>{Z(n,s,PointCloudView.Back)},nt=(n,s)=>{O(n)},st=(n,s)=>{const p=G(n.id),u=topViewPoint2PointCloud(n,s,N,p),r=H(u);E(PointCloudView.Top,n,u,void 0,r,L)},rt=(n,s)=>{if(_){const u=n[0].newPolygon;u.pointList=u.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,s)),D(n[0].newPolygon);return}let p=n.map(({newPolygon:u})=>{const r=f(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,s,e.pointCloudInstance,r);return C});if(p=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:p,stepConfig:L,action:"viewUpdateBox"})),p.length===1){const{newPolygon:u}=n[0],r=S(p);j({omitView:PointCloudView.Top,polygon:u,boxParams:p[0],newPointCloudBoxList:r})}else{const u=S(p);u&&o.syncAllViewPointCloudColor(u)}},lt=n=>{var s;if(w){const p=w==null?void 0:w.info.trackID,r=((s=e==null?void 0:e.toolInstance)==null?void 0:s.polygonList).find(y=>(y==null?void 0:y.trackID)===p),C=__spreadProps(__spreadValues({},w.info),{width:Number(n.widthDefault),depth:Number(n.depthDefault),height:Number(n.heightDefault)}),x=S([C]);j({omitView:PointCloudView["3D"],polygon:r,boxParams:C,newPointCloudBoxList:x})}},E=(n,s,p,u,r,C)=>__async(void 0,null,function*(){const x=z==null?void 0:z.url,y={[PointCloudView.Side]:()=>{syncSideViewByPoint(p,s,i,x,C)},[PointCloudView.Back]:()=>{l&&syncBackViewByPoint(p,s,l,x,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(p,s,e,t)}};Object.keys(y).forEach(v=>{v!==n&&y[v]()}),u&&(t==null||t.updateCameraZoom(u)),Y(p)}),j=n=>__async(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:u,zoom:r,newPointCloudBoxList:C}=n,x=z==null?void 0:z.url;C&&(yield o.syncAllViewPointCloudColor(C));const y={[PointCloudView.Side]:()=>{synchronizeSideView(u,p,i,x)},[PointCloudView.Back]:()=>{l&&synchronizeBackView(u,p,l,x)},[PointCloudView.Top]:()=>{synchronizeTopView(u,p,e,t)}};Object.keys(y).forEach(v=>{v!==s&&y[v]()}),r&&(t==null||t.updateCameraZoom(r)),X(u)});return{topViewAddSphere:J,topViewAddBox:K,topViewSelectedChanged:$,topViewUpdatePoint:st,sideViewUpdatePoint:tt,backViewUpdatePoint:ot,topViewUpdateBox:rt,topViewUpdateLine:nt,sideViewUpdateBox:et,backViewUpdateBox:it,pointCloudBoxListUpdated:n=>{e.updatePolygonList(n),t==null||t.generateBoxes(n)},initPointCloud3d:n=>{if(!t)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(n);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=z){var p,u,r,C,x,y;if(!(s==null?void 0:s.url)||!t)return;T([]),actionCreators.SetPointCloudLoading(A,!0),actionCreators.SetLoadPcdFileProgress(A,!0),yield t.loadPCDFile(s.url,(p=L==null?void 0:L.radius)!=null?p:DEFAULT_RADIUS),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let v=[],U=[],V=[],B=[];t.updateTopCamera();const R=(r=(u=index.jsonParser(s.result))==null?void 0:u.valid)!=null?r:!0;o.setPointCloudValid(R),(C=o.sideViewInstance)==null||C.clearAllData(),(x=o.backViewInstance)==null||x.clearAllData(),e.updateData(s.url,s.result,{radius:(y=L==null?void 0:L.radius)!=null?y:DEFAULT_RADIUS}),s.result&&(v=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),V=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),U=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),B=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(v),t==null||t.generateSpheres(B),yield o.syncAllViewPointCloudColor(v,[])),I({pointCloudBoxList:v,polygonList:V,lineList:U,pointCloudSphereList:B}),actionCreators.SetPointCloudLoading(A,!1),actionCreators.SetLoadPcdFileProgress(A,!1)}),updateViewsByDefaultSize:lt}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,e,i)=>e in o?__defProp(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i,__spreadValues=(o,e)=>{for(var i in e||(e={}))__hasOwnProp.call(e,i)&&__defNormalProp(o,i,e[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(e))__propIsEnum.call(e,i)&&__defNormalProp(o,i,e[i]);return o},__spreadProps=(o,e)=>__defProps(o,__getOwnPropDescs(e)),__async=(o,e,i)=>new Promise((l,t)=>{var a=c=>{try{d(i.next(c))}catch(g){t(g)}},P=c=>{try{d(i.throw(c))}catch(g){t(g)}},d=c=>c.done?l(c.value):Promise.resolve(c.value).then(a,P);d((i=i.apply(o,e)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(o,e,i,l,t)=>{const{x:a,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,e),{defaultZ:d}=lbUtils.DEFAULT_SPHERE_PARAMS,c={center:{x:a,y:P,z:d},id:o.id},g=l?__spreadValues(__spreadValues({},l),c):__spreadProps(__spreadValues({},c),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},topViewPolygon2PointCloud=(o,e,i,l,t,a)=>{let P=o.pointList.map(f=>lbUtils.PointCloudUtils.transferCanvas2World(f,e)),d=0,c=1,g={};if(i){const f=i.getSensesPointZAxisInPolygon(P,void 0,a);a&&f.fittedCoordinates.length>0&&(P=f.fittedCoordinates),d=(f.maxZ+f.minZ)/2,c=f.maxZ-f.minZ,g={count:f.zCount}}const[h,m,T]=P,b=lbAnnotation.MathUtils.getLineCenterPoint([h,T]),D=lbAnnotation.MathUtils.getLineLength(h,m),I=lbAnnotation.MathUtils.getLineLength(m,T),O=lbAnnotation.MathUtils.getRadiusFromQuadrangle(o.pointList);l&&(d=l.center.z,c=l.depth);const _={center:{x:b.x,y:b.y,z:d},width:a?I+INTELLIGENT_FIT_MARGIN:I,height:a?D+INTELLIGENT_FIT_MARGIN:D,depth:c,rotation:O,id:o.id},k=__spreadValues(l?__spreadValues(__spreadValues({},l),_):__spreadProps(__spreadValues({},_),{attribute:"",valid:!0}),g);t&&Object.assign(k,t);const S=P.map(f=>lbUtils.PointCloudUtils.transferWorld2Canvas(f,e));return{boxParams:k,newPointList:S}},sideViewPoint2PointCloud=(o,e,i)=>{const l={x:o.x-e.x,y:o.y-e.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-l.x,y:i.center.y,z:i.center.z-l.y}})},sideViewPolygon2PointCloud=(o,e,i,l)=>{const[t,a,P]=o.pointList,[d,c,g]=e.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([t,P]),m=lbAnnotation.MathUtils.getLineCenterPoint([d,g]),b={x:{x:h.x-m.x,y:h.y-m.y}.x,y:0,z:h.y-m.y},D=lbAnnotation.MathUtils.getLineLength(t,a),I=lbAnnotation.MathUtils.getLineLength(d,c),O=D-I,_=lbAnnotation.MathUtils.getLineLength(a,P),k=lbAnnotation.MathUtils.getLineLength(c,g),S=_-k,{newBoxParams:f}=l.getNewBoxBySideUpdate(b,S,O,i);return f},backViewPoint2PointCloud=(o,e,i)=>{const l={x:o.x-e.x,y:o.y-e.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-l.x,z:i.center.z-l.y}})},backViewPolygon2PointCloud=(o,e,i,l)=>{const[t,a,P]=o.pointList,[d,c,g]=e.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([t,P]),m=lbAnnotation.MathUtils.getLineCenterPoint([d,g]),b={x:{x:h.x-m.x,y:h.y-m.y}.x,y:0,z:h.y-m.y},D=lbAnnotation.MathUtils.getLineLength(t,a),I=lbAnnotation.MathUtils.getLineLength(d,c),O=D-I,_=lbAnnotation.MathUtils.getLineLength(a,P),k=lbAnnotation.MathUtils.getLineLength(c,g),S=_-k;let{newBoxParams:f}=l.getNewBoxByBackUpdate(b,S,O,i);return f},syncSideViewByPoint=(o,e,i,l,t)=>{var a;if(!i)return;const{toolInstance:P,pointCloudInstance:d}=i;d.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:c}=d.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(c);const{point2d:g,zoom:h}=d.getSphereSidePoint2DCoordinate(o);d.camera.zoom=h,d.camera.updateProjectionMatrix(),d.render(),P.initPosition(),P.zoomChangeOnCenter(h),P.setResult([__spreadProps(__spreadValues(__spreadValues({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(e.id)},synchronizeSideView=(o,e,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=a.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);a.setInitCameraPosition(P);const{polygon2d:d,zoom:c}=a.getBoxSidePolygon2DCoordinate(o);a.camera.zoom=c,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(c),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:d,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},syncBackViewByPoint=(o,e,i,l,t)=>{var a;if(!i)return;const{toolInstance:P,pointCloudInstance:d}=i;d.loadPCDFile(l,(a=t==null?void 0:t.radius)!=null?a:DEFAULT_RADIUS);const{cameraPositionVector:c}=d.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(c);const{point2d:g,zoom:h}=d.getSphereBackPoint2DCoordinate(o);d.camera.zoom=h,d.camera.updateProjectionMatrix(),d.render(),P.initPosition(),P.zoomChangeOnCenter(h),P.setResult([__spreadProps(__spreadValues(__spreadValues({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(e.id)},synchronizeBackView=(o,e,i,l)=>{if(!i)return;const{pointCloud2dOperation:t,pointCloudInstance:a}=i;a.loadPCDFileByBox(l,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=a.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);a.setInitCameraPosition(P);const{polygon2d:d,zoom:c}=a.getBoxBackPolygon2DCoordinate(o);a.camera.zoom=c,a.camera.updateProjectionMatrix(),a.render(),t.initPosition(),t.zoomChangeOnCenter(c),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:d,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},syncTopViewByPoint=(o,e,i,l)=>{if(!i||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),l.render();const{toolInstance:t,pointCloudInstance:a}=i,{point2d:P}=a.getSphereTopPoint2DCoordinate(o),d=[...t.pointList].map(c=>c.id===e.id?__spreadProps(__spreadValues(__spreadValues({},e),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):c);t.setResult(d),t.setSelectedID(e.id)},synchronizeTopView=(o,e,i,l)=>{var t,a;if(!i||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:P,pointCloudInstance:d}=i,{polygon2d:c}=d.getBoxTopPolygon2DCoordinate(o),g=[...P.polygonList],h=g.find(m=>m.id===e.id);h?(h.pointList=c,h.valid=(t=o.valid)!=null?t:!0):g.push({id:e.id,pointList:c,textAttribute:"",isRect:!0,valid:(a=o.valid)!=null?a:!0}),P.setResultAndSelectedID(g,e.id)},usePointCloudViews=()=>{const o=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:e,sideViewInstance:i,backViewInstance:l,mainViewInstance:t,addPointCloudBox:a,addPointCloudSphere:P,setSelectedIDs:d,selectedIDs:c,pointCloudBoxList:g,pointCloudSphereList:h,hideAttributes:m,setHighlight2DDataList:T}=o,{addHistory:b,initHistory:D,pushHistoryUnderUpdatePolygon:I,pushHistoryUnderUpdateLine:O}=useHistory.useHistory(),{selectedPolygon:_}=usePolygon.usePolygon(),{updateSelectedBox:k,updateSelectedBoxes:S,getPointCloudByID:f}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:G,updatePointCloudSphere:H,selectedSphere:M}=useSphere.useSphere(),{currentData:z,config:L}=ctx.useSelector(n=>{const{stepList:s,step:p,imgList:u,imgIndex:r}=n.annotation;return{currentData:u[r],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,s).config)}}),A=ctx.useDispatch(),{selectedBox:w}=useSingleBox.useSingleBox(),{t:Q}=reactI18next.useTranslation(),F=w==null?void 0:w.info;if(!e||!i||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:N}=e,X=n=>{t==null||t.generateBox(n),t==null||t.controls.update(),t==null||t.render()},Y=n=>{t==null||t.generateSphere(n),t==null||t.controls.update(),t==null||t.render()},J=({newPoint:n,size:s,zoom:p,trackConfigurable:u})=>{var r;const C={attribute:(r=e.toolInstance.defaultAttribute)!=null?r:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const x=topViewPoint2PointCloud(n,s,N,void 0,C);d(n.id);const y=P(x);E(PointCloudView.Top,n,x,p,y,L),b({newSphereParams:x})},K=({polygon:n,size:s,imgList:p,trackConfigurable:u,zoom:r,intelligentFit:C})=>{var x,y;const v={attribute:(x=e.toolInstance.defaultAttribute)!=null?x:""};u===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:h})});const U=e==null?void 0:e.toolInstance,V=__spreadValues({},n);let{boxParams:B,newPointList:R}=topViewPolygon2PointCloud(V,s,N,void 0,v,C);if(B=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[B],stepConfig:L,action:"viewUpdateBox"}))[0],(L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(Q("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),U.deletePolygon(B.id);return}C&&(R==null?void 0:R.length)&&(V.pointList=R);const at=m.includes(V.attribute),q=a(B),dt=(y=o==null?void 0:o.polygonList)!=null?y:[];e==null||e.updatePolygonList(q!=null?q:[],dt),at?d([]):(d(B.id),U.selection.setSelectedIDs(V.id),j({omitView:PointCloudView.Top,polygon:V,boxParams:B,zoom:r,newPointCloudBoxList:q}),C&&synchronizeTopView(B,V,e,t)),b({newBoxParams:B})},$=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:u})=>{var r;const C=e==null?void 0:e.toolInstance;if(!(c.length===0||!C)){if(n||(w==null?void 0:w.info)){const x=n!=null?n:w==null?void 0:w.info;(r=C==null?void 0:C.selection)==null||r.setSelectedIDs(c[0]);const y=C.selectedPolygon;if(c.length===1&&x){j({omitView:PointCloudView.Top,polygon:y,boxParams:x,newPointCloudBoxList:s});return}}if((p||M)&&c.length===1){const x=p!=null?p:M;C.setSelectedID(c[0]);const y=C.selectedPoint;x&&E(PointCloudView.Top,y,x,void 0,u,L)}}},Z=(n,s,p)=>{if(F){let u,r;switch(p){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}r=u(n,s,F,i.pointCloudInstance);const x=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:L,action:"viewUpdateBox"}))[0],y=r.valid!==x.valid;if(r=x,t){const{count:U}=t.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:U})}const v=k(r);return r=v.find(U=>U.id===r.id),j({omitView:y?void 0:p,polygon:n,boxParams:r,newPointCloudBoxList:v}),v}},W=(n,s,p)=>{if(M){let u,r;switch(p){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}r=u(n,s,M);const C=H(r);return E(p,n,r,void 0,C,L),C}},tt=(n,s)=>{W(n,s,PointCloudView.Side)},ot=(n,s)=>{W(n,s,PointCloudView.Back)},et=(n,s)=>{Z(n,s,PointCloudView.Side)},it=(n,s)=>{Z(n,s,PointCloudView.Back)},nt=(n,s)=>{O(n)},st=(n,s)=>{const p=G(n.id),u=topViewPoint2PointCloud(n,s,N,p),r=H(u);E(PointCloudView.Top,n,u,void 0,r,L)},rt=(n,s)=>{if(_){const u=n[0].newPolygon;u.pointList=u.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,s)),I(n[0].newPolygon);return}let p=n.map(({newPolygon:u})=>{const r=f(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,s,e.pointCloudInstance,r);return C});if(p=A(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:p,stepConfig:L,action:"viewUpdateBox"})),p.length===1){const{newPolygon:u}=n[0],r=S(p);j({omitView:PointCloudView.Top,polygon:u,boxParams:p[0],newPointCloudBoxList:r})}else{const u=S(p);u&&o.syncAllViewPointCloudColor(u)}},lt=n=>{var s;if(w){const p=w==null?void 0:w.info.trackID,r=((s=e==null?void 0:e.toolInstance)==null?void 0:s.polygonList).find(y=>(y==null?void 0:y.trackID)===p),C=__spreadProps(__spreadValues({},w.info),{width:Number(n.widthDefault),depth:Number(n.depthDefault),height:Number(n.heightDefault)}),x=S([C]);j({omitView:PointCloudView["3D"],polygon:r,boxParams:C,newPointCloudBoxList:x})}},E=(n,s,p,u,r,C)=>__async(void 0,null,function*(){const x=z==null?void 0:z.url,y={[PointCloudView.Side]:()=>{syncSideViewByPoint(p,s,i,x,C)},[PointCloudView.Back]:()=>{l&&syncBackViewByPoint(p,s,l,x,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(p,s,e,t)}};Object.keys(y).forEach(v=>{v!==n&&y[v]()}),u&&(t==null||t.updateCameraZoom(u)),Y(p)}),j=n=>__async(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:u,zoom:r,newPointCloudBoxList:C}=n,x=z==null?void 0:z.url;C&&(yield o.syncAllViewPointCloudColor(C));const y={[PointCloudView.Side]:()=>{synchronizeSideView(u,p,i,x)},[PointCloudView.Back]:()=>{l&&synchronizeBackView(u,p,l,x)},[PointCloudView.Top]:()=>{synchronizeTopView(u,p,e,t)}};Object.keys(y).forEach(v=>{v!==s&&y[v]()}),r&&(t==null||t.updateCameraZoom(r)),X(u)});return{topViewAddSphere:J,topViewAddBox:K,topViewSelectedChanged:$,topViewUpdatePoint:st,sideViewUpdatePoint:tt,backViewUpdatePoint:ot,topViewUpdateBox:rt,topViewUpdateLine:nt,sideViewUpdateBox:et,backViewUpdateBox:it,pointCloudBoxListUpdated:n=>{e.updatePolygonList(n),t==null||t.generateBoxes(n)},initPointCloud3d:n=>{if(!t)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(n);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=z){var p,u,r,C,x,y;if(!(s==null?void 0:s.url)||!t)return;T([]),actionCreators.SetPointCloudLoading(A,!0),actionCreators.SetLoadPCDFileLoading(A,!0),yield t.loadPCDFile(s.url,(p=L==null?void 0:L.radius)!=null?p:DEFAULT_RADIUS),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let v=[],U=[],V=[],B=[];t.updateTopCamera();const R=(r=(u=index.jsonParser(s.result))==null?void 0:u.valid)!=null?r:!0;o.setPointCloudValid(R),(C=o.sideViewInstance)==null||C.clearAllData(),(x=o.backViewInstance)==null||x.clearAllData(),e.updateData(s.url,s.result,{radius:(y=L==null?void 0:L.radius)!=null?y:DEFAULT_RADIUS}),s.result&&(v=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),V=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),U=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),B=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(v),t==null||t.generateSpheres(B),yield o.syncAllViewPointCloudColor(v,[])),D({pointCloudBoxList:v,polygonList:V,lineList:U,pointCloudSphereList:B}),actionCreators.SetPointCloudLoading(A,!1),actionCreators.SetLoadPCDFileLoading(A,!1)}),updateViewsByDefaultSize:lt}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=({currentData:t,imgList:C,drawLayerSlot:s,checkMode:a,intelligentFit:P,imgIndex:g,loadPCDFileProgress:v})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:d,setGlobalPattern:p,selectedIDs:c}=e,[l,m]=React.useState(!1),E=(c==null?void 0:c.length)>0&&l,x=index.jsonParser(t.result),{toolInstanceRef:o,clearToolInstance:L}=annotation.useCustomToolInstance({basicInfo:x});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=n=>{n!==d&&(p(n),e.clearAllDetectionInstance(),L())}},[d]),React.useEffect(()=>{var n;if(t){const{boxParamsList:i,polygonList:r,lineList:u,sphereParamsList:b,segmentation:q}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((n=t==null?void 0:t.result)!=null?n:"");e.setPointCloudResult(i),e.setPolygonList(r),e.setLineList(u),e.setPointCloudSphereList(b),e.setSegmentation(q)}},[g]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var n,i,r,u;return{resultPolygon:(n=e.polygonList)!=null?n:[],resultLine:(i=e.lineList)!=null?i:[],resultPoint:(r=e.pointCloudSphereList)!=null?r:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),C.length===0)return null;if(d===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:a,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement(PointCloudSegment,{checkMode:a}),React__default.default.createElement(PointCloudSegmentStatus,null),s==null?void 0:s({direct:!0}));let f=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:a}),React__default.default.createElement(PointCloudSideView,{checkMode:a}));return l&&(f=React__default.default.createElement(index$2,{selectAndEnlarge:E,checkMode:a})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:a,toolInstanceRef:o}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud3DView,null),f),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:l})},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:s,checkMode:a,intelligentFit:P,setIsEnlargeTopView:m,onExitZoom:()=>{m(!1)},isEnlargeTopView:l}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right-bottom")]:!l,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:l})},!v&&React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:l,thumbnailWidth:l?300:455})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=({currentData:t,imgList:C,drawLayerSlot:s,checkMode:a,intelligentFit:P,imgIndex:g,loadPCDFileLoading:v})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:d,setGlobalPattern:p,selectedIDs:c}=e,[l,m]=React.useState(!1),E=(c==null?void 0:c.length)>0&&l,x=index.jsonParser(t.result),{toolInstanceRef:o,clearToolInstance:L}=annotation.useCustomToolInstance({basicInfo:x});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=n=>{n!==d&&(p(n),e.clearAllDetectionInstance(),L())}},[d]),React.useEffect(()=>{var n;if(t){const{boxParamsList:i,polygonList:r,lineList:u,sphereParamsList:b,segmentation:q}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((n=t==null?void 0:t.result)!=null?n:"");e.setPointCloudResult(i),e.setPolygonList(r),e.setLineList(u),e.setPointCloudSphereList(b),e.setSegmentation(q)}},[g]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var n,i,r,u;return{resultPolygon:(n=e.polygonList)!=null?n:[],resultLine:(i=e.lineList)!=null?i:[],resultPoint:(r=e.pointCloudSphereList)!=null?r:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),C.length===0)return null;if(d===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:a,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement(PointCloudSegment,{checkMode:a}),React__default.default.createElement(PointCloudSegmentStatus,null),s==null?void 0:s({direct:!0}));let f=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:a}),React__default.default.createElement(PointCloudSideView,{checkMode:a}));return l&&(f=React__default.default.createElement(index$2,{selectAndEnlarge:E,checkMode:a})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:a,toolInstanceRef:o}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud3DView,null),f),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:l})},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:s,checkMode:a,intelligentFit:P,setIsEnlargeTopView:m,onExitZoom:()=>{m(!1)},isEnlargeTopView:l}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right-bottom")]:!l,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:l})},!v&&React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:l,thumbnailWidth:l?300:455})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
package/dist/index.css CHANGED
@@ -1346,7 +1346,7 @@
1346
1346
  background-color: #fff;
1347
1347
  color: #000000;
1348
1348
  }
1349
- .bee-point-cloud-wrapper .bee-point-cloud-3d-containerZoom {
1349
+ .bee-point-cloud-wrapper .bee-point-cloud-container__zoom {
1350
1350
  position: absolute;
1351
1351
  top: 0px;
1352
1352
  left: 0px;
@@ -1354,7 +1354,7 @@
1354
1354
  height: 100%;
1355
1355
  z-index: 1001;
1356
1356
  }
1357
- .bee-point-cloud-wrapper .bee-point-cloud-3d-containerZoom .bee-point-cloud-container__header {
1357
+ .bee-point-cloud-wrapper .bee-point-cloud-container__zoom .bee-point-cloud-container__header {
1358
1358
  background-color: #4c4c4c;
1359
1359
  height: auto;
1360
1360
  line-height: normal;
@@ -1366,6 +1366,9 @@
1366
1366
  border-bottom: 1px solid;
1367
1367
  font-size: 14px;
1368
1368
  }
1369
+ .bee-point-cloud-wrapper .bee-point-cloud-container__zoom .bee-point-cloud-highlight-view {
1370
+ display: none;
1371
+ }
1369
1372
  .bee-point-cloud-wrapper .bee-point-cloud-container__left {
1370
1373
  width: 455px;
1371
1374
  display: flex;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const ANNOTATION_ACTIONS={INIT_ALL_STATE:"@@INIT_ALL_STATE",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",UPDATE_BEFORE_ROTATE:"@@UPDATE_BEFORE_ROTATE",SET_LOADING:"@@SET_LOADING",SET_LOADPCDFILE_PROGRESS:"@@SET_LOADPCDFILE_PROGRESS",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING",SET_CHECK_MODE:"@@SET_CHECK_MODE",SET_TASK_STEP_LIST:"@@SET_TASK_STEP_LIST",UPDATE_ANNOTATION_VALID:"@@UPDATE_ANNOTATION_VALID",BATCH_UPDATE_TRACK_ID:"@@BATCH_UPDATE_TRACK_ID",BATCH_UPDATE_RESULT_BY_TRACK_ID:"@@BATCH_UPDATE_RESULT_BY_TRACK_ID",BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:"@@BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT",SET_PREDICT_RESULT_VISIBLE:"@@SET_PREDICT_RESULT_VISIBLE",SET_PREDICT_RESULT:"@@SET_PREDICT_RESULT",SET_HIGHLIGHT_ATTRIBUTE:"@@SET_HIGHLIGHT_ATTRIBUTE",UPDATE_PRE_DATA_PROCESS:"@@UPDATE_PRE_DATA_PROCESS"},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={INIT_ALL_STATE:"@@INIT_ALL_STATE",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",UPDATE_BEFORE_ROTATE:"@@UPDATE_BEFORE_ROTATE",SET_LOADING:"@@SET_LOADING",SET_LOADPCDFILE_LOADING:"@@SET_LOADPCDFILE_LOADING",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING",SET_CHECK_MODE:"@@SET_CHECK_MODE",SET_TASK_STEP_LIST:"@@SET_TASK_STEP_LIST",UPDATE_ANNOTATION_VALID:"@@UPDATE_ANNOTATION_VALID",BATCH_UPDATE_TRACK_ID:"@@BATCH_UPDATE_TRACK_ID",BATCH_UPDATE_RESULT_BY_TRACK_ID:"@@BATCH_UPDATE_RESULT_BY_TRACK_ID",BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:"@@BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT",SET_PREDICT_RESULT_VISIBLE:"@@SET_PREDICT_RESULT_VISIBLE",SET_PREDICT_RESULT:"@@SET_PREDICT_RESULT",SET_HIGHLIGHT_ATTRIBUTE:"@@SET_HIGHLIGHT_ATTRIBUTE",UPDATE_PRE_DATA_PROCESS:"@@UPDATE_PRE_DATA_PROCESS"},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"),util=require("../../components/predictTracking/previewResult/util.js"),__async=(t,e,n)=>new Promise((a,r)=>{var o=s=>{try{u(n.next(s))}catch(i){r(i)}},T=s=>{try{u(n.throw(s))}catch(i){r(i)}},u=s=>s.done?a(s.value):Promise.resolve(s.value).then(o,T);u((n=n.apply(t,e)).next())});const dispatchTasks=(t,e)=>e.map(n=>t(n)),getSubmitByPageOperation=t=>t===AnnotationSize.EPageTurningOperation.Forward?index.ESubmitType.Forward:t===AnnotationSize.EPageTurningOperation.Backward?index.ESubmitType.Backward:t===AnnotationSize.EPageTurningOperation.Jump?index.ESubmitType.Jump:index.ESubmitType.Forward,getBasicIndex=(t,e)=>{var n,a;const{imgList:r,imgIndex:o}=t,{dataSourceStep:T}=reducer.getStepConfig(t.stepList,t.step);return((a=(n=index$1.jsonParser(r[o-1].result)[`step_${T}`])==null?void 0:n.result)==null?void 0:a.length)-1||e};function UpdateToolInstance(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function SetTaskStepList({stepList:t}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST,payload:{stepList:t}}}function SetTaskConfig({stepList:t,step:e}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG,payload:{stepList:t,step:e}}}function UpdateOnSubmit(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function UpdateOnSave(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE,payload:{onSave:t}}}function UpdateOnPageChange(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function UpdateOnStepChange(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function UpdateGetFileData(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function UpdatePageSize(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function UpdateGetFileList(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function UpdateRotate(){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE}}function UpdateSkipBeforePageTurning(t){return{type:Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function UpdateBeforeRotate(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function UpdatePreDataProcess(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function CopyBackWordResult(){return{type:Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT}}function BatchUpdateTrackID({id:t,newID:e,rangeIndex:n,imgList:a}){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:e,rangeIndex:n,imgList:a}}}function BatchUpdateResultByTrackID(t,e,n){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:e,rangeIndex:n}}}function BatchUpdateImgListResultByPredictResult(){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const UpdateCheckMode=t=>({type:Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE,payload:{checkMode:t}}),UpdateHighlightAttribute=t=>({type:Actions.ANNOTATION_ACTIONS.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function InitTaskData({onSubmit:t,onSave:e,onPageChange:n,onStepChange:a,getFileData:r,pageSize:o,loadFileList:T,step:u,stepList:s,skipBeforePageTurning:i,beforeRotate:N,checkMode:p,highlightAttribute:I,preDataProcess:O}){const A=[];return t&&A.push(UpdateOnSubmit(t)),e&&A.push(UpdateOnSave(e)),n&&A.push(UpdateOnPageChange(n)),a&&A.push(UpdateOnStepChange(a)),r&&A.push(UpdateGetFileData(r)),T&&A.push(UpdateGetFileList(T)),o&&A.push(UpdatePageSize(o)),i&&A.push(UpdateSkipBeforePageTurning(i)),N&&A.push(UpdateBeforeRotate(N)),O&&A.push(UpdatePreDataProcess(O)),typeof p=="boolean"&&A.push(UpdateCheckMode(p)),A.push(UpdateHighlightAttribute(I)),A.push(SetTaskConfig({stepList:s,step:u})),A.push({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),A.push({type:Actions.ANNOTATION_ACTIONS.INIT_TOOL}),d=>dispatchTasks(d,A)}function UpdateInjectFunc({onSubmit:t,onSave:e,onPageChange:n,onStepChange:a,getFileData:r,pageSize:o,loadFileList:T,stepList:u,beforeRotate:s,highlightAttribute:i,preDataProcess:N}){const p=[];return t&&p.push(UpdateOnSubmit(t)),e&&p.push(UpdateOnSave(e)),n&&p.push(UpdateOnPageChange(n)),a&&p.push(UpdateOnStepChange(a)),r&&p.push(UpdateGetFileData(r)),T&&p.push(UpdateGetFileList(T)),o&&p.push(UpdatePageSize(o)),s&&p.push(UpdateBeforeRotate(s)),N&&p.push(UpdatePreDataProcess(N)),p.push(UpdateHighlightAttribute(i)),p.push(SetTaskStepList({stepList:u})),I=>dispatchTasks(I,p)}const getNextStep=(t,e)=>{var n;const a=e==null?void 0:e.findIndex(r=>(r==null?void 0:r.step)===t);return(n=e[a+1])==null?void 0:n.step},ToNextStep=t=>(e,n)=>{const{annotation:a}=n(),{step:r,stepList:o}=a,T=getNextStep(r,o);return[e(UpdateProcessingStep(T,t))]},UpdateProcessingStep=(t,e)=>(n,a)=>{var r,o;const{annotation:T}=a();(r=T==null?void 0:T.onStepChange)==null||r.call(T,t);const u=(o=T==null?void 0:T.imgIndex)!=null?o: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:t}}),n({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),n(reducer.LoadFileAndFileData(e!=null?e:u,0))]},ToSubmitFileData=t=>e=>[e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:t}})],SubmitAndChangeFileIndex=(t,e,n,a)=>[t(ToSubmitFileData(n)),t(reducer.LoadFileAndFileData(e,a))],ChangeBasicIndex=(t,e)=>[t({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),t({type:Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX,payload:{basicIndex:e}})],ChangeTriggerEventAfterIndexChanged=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:e}})},PageBackward=(t=!1)=>(e,n)=>DispatcherTurning(e,n,AnnotationSize.EPageTurningOperation.Backward,t),PageForward=(t=!1)=>(e,n)=>DispatcherTurning(e,n,AnnotationSize.EPageTurningOperation.Forward,t),PageJump=(t,e=!1)=>(n,a)=>{if(t!==a().imgIndex)return DispatcherTurning(n,a,AnnotationSize.EPageTurningOperation.Jump,e,t)},loadImgList=(t,e,n,a)=>__async(void 0,null,function*(){var r;const{loadFileList:o,imgList:T,pageSize:u}=e().annotation,s=Math.floor(n/u);SetAnnotationLoading(t,!0);try{const i=yield o(s,u);if(SetAnnotationLoading(t,!1),!((r=i==null?void 0:i.fileList)==null?void 0:r.length)||!(i==null?void 0:i.total))throw new Error("fileList and total are required");const N=a?new Array(i.total):[...T];return N.splice(s*u,u,...i.fileList),t({type:Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST,payload:{imgList:N}}),!0}catch(i){SetAnnotationLoading(t,!1),console.error(i)}}),DispatcherTurning=(t,e,n,a=!1,r)=>__async(void 0,null,function*(){var o;const T=e().annotation,{fileIndexChanged:u,fileIndex:s,basicIndexChanged:i,basicIndex:N}=PageOperator.getNextPageInfo(n,T,r),p=getSubmitByPageOperation(n);if(ChangeTriggerEventAfterIndexChanged(t,a),u){if(T.loading||!T.imgList[s]&&!(yield loadImgList(t,e,s)))return;(o=T.onPageChange)==null||o.call(T,s);const I=p===index.ESubmitType.Backward?getBasicIndex(e().annotation,N):N;return SubmitAndChangeFileIndex(t,s,p,I)}return i?ChangeBasicIndex(t,N):t(ToSubmitFileData(p))}),ChangeSave=t=>{t(ToSubmitFileData(index.ESubmitType.Save)),t({type:Actions.ANNOTATION_ACTIONS.SAVE_RESULT})},SetAnnotationLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:e}})},SetPointCloudLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:e}})},SetLoadPcdFileProgress=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADPCDFILE_PROGRESS,payload:{loadPCDFileProgress:e}})},InitAnnotationState=t=>{t({type:Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE,payload:{}})},SetPredictResult=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT,payload:{result:e}})},SetPredictResultVisible=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE,payload:{visible:e}})},GetBoxesByID=(t,e)=>(n,a)=>{const{imgList:r,step:o}=a().annotation;return util.getBoxesByTrackID(r,o,t,e)},PreDataProcess=t=>(e,n)=>{var a,r;const{annotation:o}=n();return(r=(a=o==null?void 0:o.preDataProcess)==null?void 0:a.call(o,t))!=null?r:t.dataList};exports.BatchUpdateImgListResultByPredictResult=BatchUpdateImgListResultByPredictResult,exports.BatchUpdateResultByTrackID=BatchUpdateResultByTrackID,exports.BatchUpdateTrackID=BatchUpdateTrackID,exports.ChangeSave=ChangeSave,exports.CopyBackWordResult=CopyBackWordResult,exports.DispatcherTurning=DispatcherTurning,exports.GetBoxesByID=GetBoxesByID,exports.InitAnnotationState=InitAnnotationState,exports.InitTaskData=InitTaskData,exports.PageBackward=PageBackward,exports.PageForward=PageForward,exports.PageJump=PageJump,exports.PreDataProcess=PreDataProcess,exports.SetAnnotationLoading=SetAnnotationLoading,exports.SetLoadPcdFileProgress=SetLoadPcdFileProgress,exports.SetPointCloudLoading=SetPointCloudLoading,exports.SetPredictResult=SetPredictResult,exports.SetPredictResultVisible=SetPredictResultVisible,exports.SetTaskConfig=SetTaskConfig,exports.SetTaskStepList=SetTaskStepList,exports.ToNextStep=ToNextStep,exports.ToSubmitFileData=ToSubmitFileData,exports.UpdateBeforeRotate=UpdateBeforeRotate,exports.UpdateCheckMode=UpdateCheckMode,exports.UpdateGetFileData=UpdateGetFileData,exports.UpdateGetFileList=UpdateGetFileList,exports.UpdateHighlightAttribute=UpdateHighlightAttribute,exports.UpdateInjectFunc=UpdateInjectFunc,exports.UpdateOnPageChange=UpdateOnPageChange,exports.UpdateOnSave=UpdateOnSave,exports.UpdateOnStepChange=UpdateOnStepChange,exports.UpdateOnSubmit=UpdateOnSubmit,exports.UpdatePageSize=UpdatePageSize,exports.UpdatePreDataProcess=UpdatePreDataProcess,exports.UpdateProcessingStep=UpdateProcessingStep,exports.UpdateRotate=UpdateRotate,exports.UpdateSkipBeforePageTurning=UpdateSkipBeforePageTurning,exports.UpdateToolInstance=UpdateToolInstance,exports.loadImgList=loadImgList;
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"),util=require("../../components/predictTracking/previewResult/util.js"),__async=(t,e,n)=>new Promise((a,r)=>{var o=s=>{try{u(n.next(s))}catch(i){r(i)}},T=s=>{try{u(n.throw(s))}catch(i){r(i)}},u=s=>s.done?a(s.value):Promise.resolve(s.value).then(o,T);u((n=n.apply(t,e)).next())});const dispatchTasks=(t,e)=>e.map(n=>t(n)),getSubmitByPageOperation=t=>t===AnnotationSize.EPageTurningOperation.Forward?index.ESubmitType.Forward:t===AnnotationSize.EPageTurningOperation.Backward?index.ESubmitType.Backward:t===AnnotationSize.EPageTurningOperation.Jump?index.ESubmitType.Jump:index.ESubmitType.Forward,getBasicIndex=(t,e)=>{var n,a;const{imgList:r,imgIndex:o}=t,{dataSourceStep:T}=reducer.getStepConfig(t.stepList,t.step);return((a=(n=index$1.jsonParser(r[o-1].result)[`step_${T}`])==null?void 0:n.result)==null?void 0:a.length)-1||e};function UpdateToolInstance(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function SetTaskStepList({stepList:t}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST,payload:{stepList:t}}}function SetTaskConfig({stepList:t,step:e}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG,payload:{stepList:t,step:e}}}function UpdateOnSubmit(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function UpdateOnSave(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE,payload:{onSave:t}}}function UpdateOnPageChange(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function UpdateOnStepChange(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function UpdateGetFileData(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function UpdatePageSize(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function UpdateGetFileList(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function UpdateRotate(){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE}}function UpdateSkipBeforePageTurning(t){return{type:Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function UpdateBeforeRotate(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function UpdatePreDataProcess(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function CopyBackWordResult(){return{type:Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT}}function BatchUpdateTrackID({id:t,newID:e,rangeIndex:n,imgList:a}){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:e,rangeIndex:n,imgList:a}}}function BatchUpdateResultByTrackID(t,e,n){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:e,rangeIndex:n}}}function BatchUpdateImgListResultByPredictResult(){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const UpdateCheckMode=t=>({type:Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE,payload:{checkMode:t}}),UpdateHighlightAttribute=t=>({type:Actions.ANNOTATION_ACTIONS.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function InitTaskData({onSubmit:t,onSave:e,onPageChange:n,onStepChange:a,getFileData:r,pageSize:o,loadFileList:T,step:u,stepList:s,skipBeforePageTurning:i,beforeRotate:N,checkMode:p,highlightAttribute:I,preDataProcess:O}){const A=[];return t&&A.push(UpdateOnSubmit(t)),e&&A.push(UpdateOnSave(e)),n&&A.push(UpdateOnPageChange(n)),a&&A.push(UpdateOnStepChange(a)),r&&A.push(UpdateGetFileData(r)),T&&A.push(UpdateGetFileList(T)),o&&A.push(UpdatePageSize(o)),i&&A.push(UpdateSkipBeforePageTurning(i)),N&&A.push(UpdateBeforeRotate(N)),O&&A.push(UpdatePreDataProcess(O)),typeof p=="boolean"&&A.push(UpdateCheckMode(p)),A.push(UpdateHighlightAttribute(I)),A.push(SetTaskConfig({stepList:s,step:u})),A.push({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),A.push({type:Actions.ANNOTATION_ACTIONS.INIT_TOOL}),d=>dispatchTasks(d,A)}function UpdateInjectFunc({onSubmit:t,onSave:e,onPageChange:n,onStepChange:a,getFileData:r,pageSize:o,loadFileList:T,stepList:u,beforeRotate:s,highlightAttribute:i,preDataProcess:N}){const p=[];return t&&p.push(UpdateOnSubmit(t)),e&&p.push(UpdateOnSave(e)),n&&p.push(UpdateOnPageChange(n)),a&&p.push(UpdateOnStepChange(a)),r&&p.push(UpdateGetFileData(r)),T&&p.push(UpdateGetFileList(T)),o&&p.push(UpdatePageSize(o)),s&&p.push(UpdateBeforeRotate(s)),N&&p.push(UpdatePreDataProcess(N)),p.push(UpdateHighlightAttribute(i)),p.push(SetTaskStepList({stepList:u})),I=>dispatchTasks(I,p)}const getNextStep=(t,e)=>{var n;const a=e==null?void 0:e.findIndex(r=>(r==null?void 0:r.step)===t);return(n=e[a+1])==null?void 0:n.step},ToNextStep=t=>(e,n)=>{const{annotation:a}=n(),{step:r,stepList:o}=a,T=getNextStep(r,o);return[e(UpdateProcessingStep(T,t))]},UpdateProcessingStep=(t,e)=>(n,a)=>{var r,o;const{annotation:T}=a();(r=T==null?void 0:T.onStepChange)==null||r.call(T,t);const u=(o=T==null?void 0:T.imgIndex)!=null?o: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:t}}),n({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),n(reducer.LoadFileAndFileData(e!=null?e:u,0))]},ToSubmitFileData=t=>e=>[e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:t}})],SubmitAndChangeFileIndex=(t,e,n,a)=>[t(ToSubmitFileData(n)),t(reducer.LoadFileAndFileData(e,a))],ChangeBasicIndex=(t,e)=>[t({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),t({type:Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX,payload:{basicIndex:e}})],ChangeTriggerEventAfterIndexChanged=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:e}})},PageBackward=(t=!1)=>(e,n)=>DispatcherTurning(e,n,AnnotationSize.EPageTurningOperation.Backward,t),PageForward=(t=!1)=>(e,n)=>DispatcherTurning(e,n,AnnotationSize.EPageTurningOperation.Forward,t),PageJump=(t,e=!1)=>(n,a)=>{if(t!==a().imgIndex)return DispatcherTurning(n,a,AnnotationSize.EPageTurningOperation.Jump,e,t)},loadImgList=(t,e,n,a)=>__async(void 0,null,function*(){var r;const{loadFileList:o,imgList:T,pageSize:u}=e().annotation,s=Math.floor(n/u);SetAnnotationLoading(t,!0);try{const i=yield o(s,u);if(SetAnnotationLoading(t,!1),!((r=i==null?void 0:i.fileList)==null?void 0:r.length)||!(i==null?void 0:i.total))throw new Error("fileList and total are required");const N=a?new Array(i.total):[...T];return N.splice(s*u,u,...i.fileList),t({type:Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST,payload:{imgList:N}}),!0}catch(i){SetAnnotationLoading(t,!1),console.error(i)}}),DispatcherTurning=(t,e,n,a=!1,r)=>__async(void 0,null,function*(){var o;const T=e().annotation,{fileIndexChanged:u,fileIndex:s,basicIndexChanged:i,basicIndex:N}=PageOperator.getNextPageInfo(n,T,r),p=getSubmitByPageOperation(n);if(ChangeTriggerEventAfterIndexChanged(t,a),u){if(T.loading||!T.imgList[s]&&!(yield loadImgList(t,e,s)))return;(o=T.onPageChange)==null||o.call(T,s);const I=p===index.ESubmitType.Backward?getBasicIndex(e().annotation,N):N;return SubmitAndChangeFileIndex(t,s,p,I)}return i?ChangeBasicIndex(t,N):t(ToSubmitFileData(p))}),ChangeSave=t=>{t(ToSubmitFileData(index.ESubmitType.Save)),t({type:Actions.ANNOTATION_ACTIONS.SAVE_RESULT})},SetAnnotationLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:e}})},SetPointCloudLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:e}})},SetLoadPCDFileLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADPCDFILE_LOADING,payload:{loadPCDFileLoading:e}})},InitAnnotationState=t=>{t({type:Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE,payload:{}})},SetPredictResult=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT,payload:{result:e}})},SetPredictResultVisible=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE,payload:{visible:e}})},GetBoxesByID=(t,e)=>(n,a)=>{const{imgList:r,step:o}=a().annotation;return util.getBoxesByTrackID(r,o,t,e)},PreDataProcess=t=>(e,n)=>{var a,r;const{annotation:o}=n();return(r=(a=o==null?void 0:o.preDataProcess)==null?void 0:a.call(o,t))!=null?r:t.dataList};exports.BatchUpdateImgListResultByPredictResult=BatchUpdateImgListResultByPredictResult,exports.BatchUpdateResultByTrackID=BatchUpdateResultByTrackID,exports.BatchUpdateTrackID=BatchUpdateTrackID,exports.ChangeSave=ChangeSave,exports.CopyBackWordResult=CopyBackWordResult,exports.DispatcherTurning=DispatcherTurning,exports.GetBoxesByID=GetBoxesByID,exports.InitAnnotationState=InitAnnotationState,exports.InitTaskData=InitTaskData,exports.PageBackward=PageBackward,exports.PageForward=PageForward,exports.PageJump=PageJump,exports.PreDataProcess=PreDataProcess,exports.SetAnnotationLoading=SetAnnotationLoading,exports.SetLoadPCDFileLoading=SetLoadPCDFileLoading,exports.SetPointCloudLoading=SetPointCloudLoading,exports.SetPredictResult=SetPredictResult,exports.SetPredictResultVisible=SetPredictResultVisible,exports.SetTaskConfig=SetTaskConfig,exports.SetTaskStepList=SetTaskStepList,exports.ToNextStep=ToNextStep,exports.ToSubmitFileData=ToSubmitFileData,exports.UpdateBeforeRotate=UpdateBeforeRotate,exports.UpdateCheckMode=UpdateCheckMode,exports.UpdateGetFileData=UpdateGetFileData,exports.UpdateGetFileList=UpdateGetFileList,exports.UpdateHighlightAttribute=UpdateHighlightAttribute,exports.UpdateInjectFunc=UpdateInjectFunc,exports.UpdateOnPageChange=UpdateOnPageChange,exports.UpdateOnSave=UpdateOnSave,exports.UpdateOnStepChange=UpdateOnStepChange,exports.UpdateOnSubmit=UpdateOnSubmit,exports.UpdatePageSize=UpdatePageSize,exports.UpdatePreDataProcess=UpdatePreDataProcess,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 StepUtils=require("../../utils/StepUtils.js"),index=require("../../utils/index.js");const a2MapStateToProps=n=>{var e,o,i;const{annotation:{imgList:r,imgIndex:s,highlightAttribute:a,loadPCDFileProgress:l}}=n,u=(e=r[s])!=null?e:{},t=StepUtils.getCurrentStepInfo((o=n.annotation)==null?void 0:o.step,(i=n.annotation)==null?void 0:i.stepList);return{currentData:u,imgIndex:s,imgList:r,stepInfo:t,config:index.jsonParser(t==null?void 0:t.config),configString:t==null?void 0:t.config,highlightAttribute:a,loadPCDFileProgress:l}};exports.a2MapStateToProps=a2MapStateToProps;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var StepUtils=require("../../utils/StepUtils.js"),index=require("../../utils/index.js");const a2MapStateToProps=n=>{var e,i,o;const{annotation:{imgList:r,imgIndex:s,highlightAttribute:a,loadPCDFileLoading:l}}=n,u=(e=r[s])!=null?e:{},t=StepUtils.getCurrentStepInfo((i=n.annotation)==null?void 0:i.step,(o=n.annotation)==null?void 0:o.stepList);return{currentData:u,imgIndex:s,imgList:r,stepInfo:t,config:index.jsonParser(t==null?void 0:t.config),configString:t==null?void 0:t.config,highlightAttribute:a,loadPCDFileLoading:l}};exports.a2MapStateToProps=a2MapStateToProps;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$2=require("../../components/customResizeHook/index.js"),index$1=require("../../constant/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"),antd=require("antd"),es=require("antd/es"),_=require("lodash"),actionCreators=require("./actionCreators.js"),ToolType=require("../../data/enums/ToolType.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,s)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,__spreadValues=(e,t)=>{for(var s in t||(t={}))__hasOwnProp.call(t,s)&&__defNormalProp(e,s,t[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(t))__propIsEnum.call(t,s)&&__defNormalProp(e,s,t[s]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,s)=>new Promise((O,u)=>{var A=I=>{try{S(s.next(I))}catch(L){u(L)}},g=I=>{try{S(s.throw(I))}catch(L){u(L)}},S=I=>I.done?O(I.value):Promise.resolve(I.value).then(A,g);S((s=s.apply(e,t)).next())});const getStepConfig=(e,t)=>e.find(s=>s.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,loadPCDFileProgress:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},getTotalPage=e=>{const{imgList:t,imgPageSize:s}=e;return Math.ceil(t.length/s)},calcStepProgress=(e,t)=>e.reduce((s,O)=>{if(O){const u=O.result;if(index.jsonParser(u)[`step_${t}`])return s+1}return s},0)/e.length,updateToolInstance=(e,t)=>{const{step:s,stepList:O}=e,u=StepUtils.getCurrentStepInfo(s,O),A=ConfigUtils.ConfigUtils.jsonParser(u.config);if(ToolUtils.isVideoTool(u==null?void 0:u.tool)||ToolUtils.isPointCloudTool(u==null?void 0:u.tool)||ToolType.EToolName.LLM===(u==null?void 0:u.tool))return;const g=document.getElementById("toolContainer");if(!g)throw"Not exist dom named id-toolContainer";const S=index$2.getFormatSize({width:window.innerWidth,height:window.innerHeight}),I=new lbAnnotation.AnnotationEngine({container:g,toolName:u.tool,size:S,imgNode:t,config:A,style:JSON.parse(styleString)});return{toolInstance:I==null?void 0:I.toolInstance,annotationEngine:I}},LoadFileAndFileData=(e,t)=>(s,O)=>__async(void 0,null,function*(){var u;const{stepList:A,step:g}=O().annotation,S=StepUtils.currentToolIsVideo(g,A),I=StepUtils.currentToolIsPointCloud(g,A),L=((u=StepUtils.getCurrentStepInfo(g,A))==null?void 0:u.tool)===ToolType.EToolName.LLM;if(actionCreators.SetAnnotationLoading(s,!0),yield s(TryGetFileDataByAPI(e)),S||I||L){s(AfterVideoLoaded(e));return}s(AfterImageLoaded(e,t))}),TryGetFileDataByAPI=e=>(t,s)=>__async(void 0,null,function*(){const{getFileData:O,imgList:u}=s().annotation;if(O){const A=yield O(u[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)=>(s,O)=>{var u;const{toolInstance:A,imgList:g}=O().annotation,S=(u=g==null?void 0:g[e])==null?void 0:u.url;lbAnnotation.ImgUtils.load(S).then(I=>{actionCreators.SetAnnotationLoading(s,!1),s({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{imgNode:I,nextIndex:e,nextBasicIndex:t}})}).catch(()=>{actionCreators.SetAnnotationLoading(s,!1),A==null||A.setErrorImg(),s({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e,nextBasicIndex:t}})})},composeResultByToolInstance=({toolInstance:e,imgList:t,imgIndex:s,stepList:O,step:u=1})=>{var A,g,S,I;const L=((A=t[s])==null?void 0:A.result)||"",[h,b,U]=(g=e==null?void 0:e.exportData())!=null?g:[],x=(I=(S=e==null?void 0:e.exportCustomData)==null?void 0:S.call(e))!=null?I:{},B=data.composeResultWithBasicImgInfo(L,b),w=data.composeResult(B,{step:u,stepList:O},{rect:h},x);return t.map((P,F)=>F===s?__spreadValues(__spreadProps(__spreadValues({},P),{result:w}),U):__spreadValues({},P))},annotationReducer=(e=__spreadValues({},initialState),t)=>{var s,O,u,A,g,S,I,L,h,b,U,x,B,w,P,F,G,V,M,q,k,H,z;switch(t.type){case Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE:return __spreadValues(__spreadValues({},e),initialState);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:o}=e,r=calcStepProgress(n,o);return __spreadProps(__spreadValues({},e),{stepProgress:r})}case Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:o,step:r,stepList:i,toolInstance:a,onSubmit:l,resultList:N}=e;if(!a||!n[o])return e;const T=((s=n[o])==null?void 0:s.result)||"",[,c,d]=(O=a==null?void 0:a.exportData())!=null?O:[],p=(A=(u=a==null?void 0:a.exportCustomData)==null?void 0:u.call(a))!=null?A:{},f=data.composeResultWithBasicImgInfo(T,c),C=data.composeResult(f,{step:r,stepList:i},{rect:N},p),m=e.imgList.map((v,E)=>{if(E===o){const R=AnnotationDataUtils.dataCorrection(C,T,r,i);return __spreadValues(__spreadProps(__spreadValues({},v),{result:R}),d)}return v});if(((g=t.payload)==null?void 0:g.submitType)===index$1.ESubmitType.SyncImgList)return __spreadProps(__spreadValues({},e),{imgList:m});l&&l([m[o]],(S=t.payload)==null?void 0:S.submitType,o,m);const D=calcStepProgress(m,r);return __spreadProps(__spreadValues({},e),{stepProgress:D,imgList:m})}case Actions.ANNOTATION_ACTIONS.SAVE_RESULT:{const{imgList:n,imgIndex:o,onSave:r}=e;return r==null||r(n[o],o,n),__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT:{const{imgList:n,basicIndex:o,resultList:r,toolInstance:i,basicResultList:a}=e;if(!i)return e;const[l]=(I=i==null?void 0:i.exportData())!=null?I:[];let N=l;if((a==null?void 0:a.length)>0){const T=(L=a[o])==null?void 0:L.id,c=l.map(d=>__spreadProps(__spreadValues({},d),{sourceID:T}));N=___default.default.cloneDeep(r).filter(d=>d.sourceID!==T),N.push(...c)}return __spreadProps(__spreadValues({},e),{resultList:N,imgList:n})}case Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX:{const{toolInstance:n,step:o,imgList:r,imgIndex:i,stepList:a,annotationEngine:l,resultList:N,basicResultList:T}=e;if(!n||!l)return e;const c=t.payload.basicIndex,d=(h=T[c])==null?void 0:h.id,p=index.jsonParser((b=r[i])==null?void 0:b.result),f=(N||[]).filter(R=>R.sourceID===d),C=getStepConfig(a,o),{dataSourceStep:m,tool:D}=C,v=getStepConfig(a,m);let E=[];return m&&D&&(E=(U=p[`step_${m}`])==null?void 0:U.result,(E==null?void 0:E.length)>0?(l==null||l.setBasicInfo(v.tool,E[c]),l==null||l.launchOperation()):(l==null||l.setBasicInfo(v.tool),l==null||l.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),n==null||n.setResult(f),n==null||n.history.initRecord(f,!0),__spreadProps(__spreadValues({},e),{basicIndex:c})}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:o,toolInstance:r,annotationEngine:i,stepList:a}=e;if(!r)return __spreadProps(__spreadValues({},e),{imgIndex:t.payload.nextIndex});const l=StepUtils.getCurrentStepInfo(o,a),{nextIndex:N,imgNode:T,nextBasicIndex:c,imgError:d}=t.payload,p=c!=null?c:0,f=index.jsonParser((x=n[N])==null?void 0:x.result),C=f[`step_${l.step}`],m=!C,D={rotate:(B=f.rotate)!=null?B:0,valid:(w=f.valid)!=null?w:!0};T&&d!==!0?i==null||i.setImgNode(T,D):r==null||r.setValid(D.valid);const v=getStepConfig(a,l.step),{dataSourceStep:E,tool:R}=v,K=getStepConfig(a,E),W=E&&R,y=(F=(P=f[`step_${E}`])==null?void 0:P.result)!=null?F:[],j=AnnotationDataUtils.getInitialResultList(C==null?void 0:C.result,r,v,y,m);if(i==null||i.launchOperation(),W&&((y==null?void 0:y.length)>0?i==null||i.setBasicInfo(K.tool,y[p]):(i==null||i.setBasicInfo(K.tool),i==null||i.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),l.tool!=="check"){const $=(V=(G=y[p])==null?void 0:G.id)!=null?V:"",Y=W?j.filter(J=>lbAnnotation.CommonToolUtils.isSameSourceID(J.sourceID,$)):j;r==null||r.history.initRecord(j,!0),r==null||r.setResult(Y)}return __spreadProps(__spreadValues({},e),{imgIndex:N,basicIndex:p,basicResultList:y,resultList:j})}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_CONFIG:return __spreadProps(__spreadValues({},e),{config:(M=t.payload.config)!=null?M:"{}"});case Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST:{const{stepList:n}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n})}case Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG:{const{stepList:n,step:o}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n,step:o})}case Actions.ANNOTATION_ACTIONS.INIT_TOOL:{const{imgNode:n}=e,o=updateToolInstance(e,n);if(o){const{toolInstance:r,annotationEngine:i}=o;return __spreadProps(__spreadValues({},e),{toolInstance:r,annotationEngine:i})}return __spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SET_TOOL:{const n=(q=t.payload)==null?void 0:q.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.SET_PREDICT_RESULT:return __spreadProps(__spreadValues({},e),{predictionResult:t.payload.result});case Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE:return __spreadProps(__spreadValues({},e),{predictionResultVisible:t.payload.visible});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.UPDATE_BEFORE_ROTATE:return __spreadProps(__spreadValues({},e),{beforeRotate:t.payload.beforeRotate});case Actions.ANNOTATION_ACTIONS.UPDATE_PRE_DATA_PROCESS:return __spreadProps(__spreadValues({},e),{preDataProcess:t.payload.preDataProcess});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:o}=t.payload,{imgList:r}=e,i=[...r];return i[o]=__spreadValues(__spreadValues({},i[o]),n),__spreadProps(__spreadValues({},e),{imgList:i})}case Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:o}=e;return o&&o()===!1||n==null||n.updateRotate(),e}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=e,o=(k=n==null?void 0:n.valid)!=null?k:!0;return antd.Modal.destroyAll(),antd.Modal.confirm({content:lbUtils.i18n.t(o?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!o)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")}),e}case Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:o,imgList:r,step:i}=e;if(!n)return e;if(o===0||o>=r.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),e;const a=r[o-1].result;if(!a)return e;const l=AnnotationDataUtils.copyResultChange(a,i,(H=r[o].result)!=null?H:"");r[o]=__spreadProps(__spreadValues({},r[o]),{result:l});const T=index.jsonParser(l)[`step_${i}`],c=(T==null?void 0:T.result)||[];return n==null||n.setResult(c),n==null||n.history.pushHistory(c),(z=n==null?void 0:n.asyncData)==null||z.call(n,r[o]),__spreadProps(__spreadValues({},e),{imgList:[...r]})}case Actions.ANNOTATION_ACTIONS.SET_STEP:{const{stepList:n,annotationEngine:o}=e,{toStep:r}=t.payload;if(!o)return e;const i=getStepConfig(n,r);return o==null||o.setToolName(i.tool,i.config),__spreadProps(__spreadValues({},e),{step:r,toolInstance:o==null?void 0:o.toolInstance})}case Actions.ANNOTATION_ACTIONS.SET_LOADING:{const{loadPCDFileProgress:n}=t.payload;return __spreadProps(__spreadValues({},e),{loadPCDFileProgress:!!n})}case Actions.ANNOTATION_ACTIONS.SET_LOADPCDFILE_PROGRESS:{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})}case Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE:{const{checkMode:n}=t.payload;return __spreadProps(__spreadValues({},e),{checkMode:!!n})}case Actions.ANNOTATION_ACTIONS.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=t.payload;return __spreadProps(__spreadValues({},e),{highlightAttribute:n})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:o,rangeIndex:r,imgList:i}=t.payload,{imgIndex:a,onSubmit:l}=e,N=[],T=i.map((c,d)=>{if(lbAnnotation.MathUtils.isInRange(d,r)){const p=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateTrackID({id:n,newID:o,result:c.result})});return N.push({imgIndex:d,newInfo:p}),p}return c});return l&&l([T[a]],index$1.ESubmitType.BatchUpdateTrackID,a,T,{updateImgList:N}),__spreadProps(__spreadValues({},e),{imgList:T})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:o,rangeIndex:r}=t.payload,{imgList:i,imgIndex:a,onSubmit:l}=e,N=[],T=i.map((c,d)=>{if(lbAnnotation.MathUtils.isInRange(d,r)){const p=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateResultByTrackID({id:n,newData:o,result:c.result})});return N.push({imgIndex:d,newInfo:p}),p}return c});return l&&l([T[a]],index$1.ESubmitType.BatchUpdateTrackID,a,T,{updateImgList:N}),__spreadProps(__spreadValues({},e),{imgList:T})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:o,stepList:r,step:i,predictionResult:a}=e,l={};a.forEach(d=>{const{index:p}=d;l[p]=___default.default.pick(d,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const N=`step_${i}`,T=[],c=o.map((d,p)=>{if(l[p]){const f=d.result==="{}"?index.jsonParser(data.composeResult("",{step:i,stepList:r},{rect:[]},{})):index.jsonParser(d.result);f[N].result.push(l[p]);const C=__spreadProps(__spreadValues({},d),{result:JSON.stringify(f)});return T.push({imgIndex:p,newInfo:C}),C}return d});return n==null||n(c,index$1.ESubmitType.BatchUpdateImgList,-1,c,{updateImgList:T}),__spreadProps(__spreadValues({},e),{imgList:c})}default:return e}};exports.LoadFileAndFileData=LoadFileAndFileData,exports.annotationReducer=annotationReducer,exports.composeResultByToolInstance=composeResultByToolInstance,exports.getStepConfig=getStepConfig,exports.getTotalPage=getTotalPage;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$2=require("../../components/customResizeHook/index.js"),index$1=require("../../constant/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"),antd=require("antd"),es=require("antd/es"),_=require("lodash"),actionCreators=require("./actionCreators.js"),ToolType=require("../../data/enums/ToolType.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,s)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,__spreadValues=(e,t)=>{for(var s in t||(t={}))__hasOwnProp.call(t,s)&&__defNormalProp(e,s,t[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(t))__propIsEnum.call(t,s)&&__defNormalProp(e,s,t[s]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,s)=>new Promise((O,u)=>{var A=I=>{try{S(s.next(I))}catch(m){u(m)}},g=I=>{try{S(s.throw(I))}catch(m){u(m)}},S=I=>I.done?O(I.value):Promise.resolve(I.value).then(A,g);S((s=s.apply(e,t)).next())});const getStepConfig=(e,t)=>e.find(s=>s.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,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},getTotalPage=e=>{const{imgList:t,imgPageSize:s}=e;return Math.ceil(t.length/s)},calcStepProgress=(e,t)=>e.reduce((s,O)=>{if(O){const u=O.result;if(index.jsonParser(u)[`step_${t}`])return s+1}return s},0)/e.length,updateToolInstance=(e,t)=>{const{step:s,stepList:O}=e,u=StepUtils.getCurrentStepInfo(s,O),A=ConfigUtils.ConfigUtils.jsonParser(u.config);if(ToolUtils.isVideoTool(u==null?void 0:u.tool)||ToolUtils.isPointCloudTool(u==null?void 0:u.tool)||ToolType.EToolName.LLM===(u==null?void 0:u.tool))return;const g=document.getElementById("toolContainer");if(!g)throw"Not exist dom named id-toolContainer";const S=index$2.getFormatSize({width:window.innerWidth,height:window.innerHeight}),I=new lbAnnotation.AnnotationEngine({container:g,toolName:u.tool,size:S,imgNode:t,config:A,style:JSON.parse(styleString)});return{toolInstance:I==null?void 0:I.toolInstance,annotationEngine:I}},LoadFileAndFileData=(e,t)=>(s,O)=>__async(void 0,null,function*(){var u;const{stepList:A,step:g}=O().annotation,S=StepUtils.currentToolIsVideo(g,A),I=StepUtils.currentToolIsPointCloud(g,A),m=((u=StepUtils.getCurrentStepInfo(g,A))==null?void 0:u.tool)===ToolType.EToolName.LLM;if(actionCreators.SetAnnotationLoading(s,!0),yield s(TryGetFileDataByAPI(e)),S||I||m){s(AfterVideoLoaded(e));return}s(AfterImageLoaded(e,t))}),TryGetFileDataByAPI=e=>(t,s)=>__async(void 0,null,function*(){const{getFileData:O,imgList:u}=s().annotation;if(O){const A=yield O(u[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)=>(s,O)=>{var u;const{toolInstance:A,imgList:g}=O().annotation,S=(u=g==null?void 0:g[e])==null?void 0:u.url;lbAnnotation.ImgUtils.load(S).then(I=>{actionCreators.SetAnnotationLoading(s,!1),s({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{imgNode:I,nextIndex:e,nextBasicIndex:t}})}).catch(()=>{actionCreators.SetAnnotationLoading(s,!1),A==null||A.setErrorImg(),s({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e,nextBasicIndex:t}})})},composeResultByToolInstance=({toolInstance:e,imgList:t,imgIndex:s,stepList:O,step:u=1})=>{var A,g,S,I;const m=((A=t[s])==null?void 0:A.result)||"",[h,b,U]=(g=e==null?void 0:e.exportData())!=null?g:[],x=(I=(S=e==null?void 0:e.exportCustomData)==null?void 0:S.call(e))!=null?I:{},B=data.composeResultWithBasicImgInfo(m,b),w=data.composeResult(B,{step:u,stepList:O},{rect:h},x);return t.map((P,F)=>F===s?__spreadValues(__spreadProps(__spreadValues({},P),{result:w}),U):__spreadValues({},P))},annotationReducer=(e=__spreadValues({},initialState),t)=>{var s,O,u,A,g,S,I,m,h,b,U,x,B,w,P,F,G,V,M,q,k,H,z;switch(t.type){case Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE:return __spreadValues(__spreadValues({},e),initialState);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:o}=e,i=calcStepProgress(n,o);return __spreadProps(__spreadValues({},e),{stepProgress:i})}case Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:o,step:i,stepList:r,toolInstance:a,onSubmit:l,resultList:N}=e;if(!a||!n[o])return e;const d=((s=n[o])==null?void 0:s.result)||"",[,c,T]=(O=a==null?void 0:a.exportData())!=null?O:[],p=(A=(u=a==null?void 0:a.exportCustomData)==null?void 0:u.call(a))!=null?A:{},f=data.composeResultWithBasicImgInfo(d,c),C=data.composeResult(f,{step:i,stepList:r},{rect:N},p),L=e.imgList.map((v,E)=>{if(E===o){const R=AnnotationDataUtils.dataCorrection(C,d,i,r);return __spreadValues(__spreadProps(__spreadValues({},v),{result:R}),T)}return v});if(((g=t.payload)==null?void 0:g.submitType)===index$1.ESubmitType.SyncImgList)return __spreadProps(__spreadValues({},e),{imgList:L});l&&l([L[o]],(S=t.payload)==null?void 0:S.submitType,o,L);const D=calcStepProgress(L,i);return __spreadProps(__spreadValues({},e),{stepProgress:D,imgList:L})}case Actions.ANNOTATION_ACTIONS.SAVE_RESULT:{const{imgList:n,imgIndex:o,onSave:i}=e;return i==null||i(n[o],o,n),__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT:{const{imgList:n,basicIndex:o,resultList:i,toolInstance:r,basicResultList:a}=e;if(!r)return e;const[l]=(I=r==null?void 0:r.exportData())!=null?I:[];let N=l;if((a==null?void 0:a.length)>0){const d=(m=a[o])==null?void 0:m.id,c=l.map(T=>__spreadProps(__spreadValues({},T),{sourceID:d}));N=___default.default.cloneDeep(i).filter(T=>T.sourceID!==d),N.push(...c)}return __spreadProps(__spreadValues({},e),{resultList:N,imgList:n})}case Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX:{const{toolInstance:n,step:o,imgList:i,imgIndex:r,stepList:a,annotationEngine:l,resultList:N,basicResultList:d}=e;if(!n||!l)return e;const c=t.payload.basicIndex,T=(h=d[c])==null?void 0:h.id,p=index.jsonParser((b=i[r])==null?void 0:b.result),f=(N||[]).filter(R=>R.sourceID===T),C=getStepConfig(a,o),{dataSourceStep:L,tool:D}=C,v=getStepConfig(a,L);let E=[];return L&&D&&(E=(U=p[`step_${L}`])==null?void 0:U.result,(E==null?void 0:E.length)>0?(l==null||l.setBasicInfo(v.tool,E[c]),l==null||l.launchOperation()):(l==null||l.setBasicInfo(v.tool),l==null||l.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),n==null||n.setResult(f),n==null||n.history.initRecord(f,!0),__spreadProps(__spreadValues({},e),{basicIndex:c})}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:o,toolInstance:i,annotationEngine:r,stepList:a}=e;if(!i)return __spreadProps(__spreadValues({},e),{imgIndex:t.payload.nextIndex});const l=StepUtils.getCurrentStepInfo(o,a),{nextIndex:N,imgNode:d,nextBasicIndex:c,imgError:T}=t.payload,p=c!=null?c:0,f=index.jsonParser((x=n[N])==null?void 0:x.result),C=f[`step_${l.step}`],L=!C,D={rotate:(B=f.rotate)!=null?B:0,valid:(w=f.valid)!=null?w:!0};d&&T!==!0?r==null||r.setImgNode(d,D):i==null||i.setValid(D.valid);const v=getStepConfig(a,l.step),{dataSourceStep:E,tool:R}=v,K=getStepConfig(a,E),W=E&&R,y=(F=(P=f[`step_${E}`])==null?void 0:P.result)!=null?F:[],j=AnnotationDataUtils.getInitialResultList(C==null?void 0:C.result,i,v,y,L);if(r==null||r.launchOperation(),W&&((y==null?void 0:y.length)>0?r==null||r.setBasicInfo(K.tool,y[p]):(r==null||r.setBasicInfo(K.tool),r==null||r.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),l.tool!=="check"){const $=(V=(G=y[p])==null?void 0:G.id)!=null?V:"",Y=W?j.filter(J=>lbAnnotation.CommonToolUtils.isSameSourceID(J.sourceID,$)):j;i==null||i.history.initRecord(j,!0),i==null||i.setResult(Y)}return __spreadProps(__spreadValues({},e),{imgIndex:N,basicIndex:p,basicResultList:y,resultList:j})}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_CONFIG:return __spreadProps(__spreadValues({},e),{config:(M=t.payload.config)!=null?M:"{}"});case Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST:{const{stepList:n}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n})}case Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG:{const{stepList:n,step:o}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n,step:o})}case Actions.ANNOTATION_ACTIONS.INIT_TOOL:{const{imgNode:n}=e,o=updateToolInstance(e,n);if(o){const{toolInstance:i,annotationEngine:r}=o;return __spreadProps(__spreadValues({},e),{toolInstance:i,annotationEngine:r})}return __spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SET_TOOL:{const n=(q=t.payload)==null?void 0:q.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.SET_PREDICT_RESULT:return __spreadProps(__spreadValues({},e),{predictionResult:t.payload.result});case Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE:return __spreadProps(__spreadValues({},e),{predictionResultVisible:t.payload.visible});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.UPDATE_BEFORE_ROTATE:return __spreadProps(__spreadValues({},e),{beforeRotate:t.payload.beforeRotate});case Actions.ANNOTATION_ACTIONS.UPDATE_PRE_DATA_PROCESS:return __spreadProps(__spreadValues({},e),{preDataProcess:t.payload.preDataProcess});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:o}=t.payload,{imgList:i}=e,r=[...i];return r[o]=__spreadValues(__spreadValues({},r[o]),n),__spreadProps(__spreadValues({},e),{imgList:r})}case Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:o}=e;return o&&o()===!1||n==null||n.updateRotate(),e}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=e,o=(k=n==null?void 0:n.valid)!=null?k:!0;return antd.Modal.destroyAll(),antd.Modal.confirm({content:lbUtils.i18n.t(o?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!o)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")}),e}case Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:o,imgList:i,step:r}=e;if(!n)return e;if(o===0||o>=i.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),e;const a=i[o-1].result;if(!a)return e;const l=AnnotationDataUtils.copyResultChange(a,r,(H=i[o].result)!=null?H:"");i[o]=__spreadProps(__spreadValues({},i[o]),{result:l});const d=index.jsonParser(l)[`step_${r}`],c=(d==null?void 0:d.result)||[];return n==null||n.setResult(c),n==null||n.history.pushHistory(c),(z=n==null?void 0:n.asyncData)==null||z.call(n,i[o]),__spreadProps(__spreadValues({},e),{imgList:[...i]})}case Actions.ANNOTATION_ACTIONS.SET_STEP:{const{stepList:n,annotationEngine:o}=e,{toStep:i}=t.payload;if(!o)return e;const r=getStepConfig(n,i);return o==null||o.setToolName(r.tool,r.config),__spreadProps(__spreadValues({},e),{step:i,toolInstance:o==null?void 0:o.toolInstance})}case Actions.ANNOTATION_ACTIONS.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loadPCDFileLoading:!!n})}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})}case Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE:{const{checkMode:n}=t.payload;return __spreadProps(__spreadValues({},e),{checkMode:!!n})}case Actions.ANNOTATION_ACTIONS.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=t.payload;return __spreadProps(__spreadValues({},e),{highlightAttribute:n})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:o,rangeIndex:i,imgList:r}=t.payload,{imgIndex:a,onSubmit:l}=e,N=[],d=r.map((c,T)=>{if(lbAnnotation.MathUtils.isInRange(T,i)){const p=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateTrackID({id:n,newID:o,result:c.result})});return N.push({imgIndex:T,newInfo:p}),p}return c});return l&&l([d[a]],index$1.ESubmitType.BatchUpdateTrackID,a,d,{updateImgList:N}),__spreadProps(__spreadValues({},e),{imgList:d})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:o,rangeIndex:i}=t.payload,{imgList:r,imgIndex:a,onSubmit:l}=e,N=[],d=r.map((c,T)=>{if(lbAnnotation.MathUtils.isInRange(T,i)){const p=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateResultByTrackID({id:n,newData:o,result:c.result})});return N.push({imgIndex:T,newInfo:p}),p}return c});return l&&l([d[a]],index$1.ESubmitType.BatchUpdateTrackID,a,d,{updateImgList:N}),__spreadProps(__spreadValues({},e),{imgList:d})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:o,stepList:i,step:r,predictionResult:a}=e,l={};a.forEach(T=>{const{index:p}=T;l[p]=___default.default.pick(T,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const N=`step_${r}`,d=[],c=o.map((T,p)=>{if(l[p]){const f=T.result==="{}"?index.jsonParser(data.composeResult("",{step:r,stepList:i},{rect:[]},{})):index.jsonParser(T.result);f[N].result.push(l[p]);const C=__spreadProps(__spreadValues({},T),{result:JSON.stringify(f)});return d.push({imgIndex:p,newInfo:C}),C}return T});return n==null||n(c,index$1.ESubmitType.BatchUpdateImgList,-1,c,{updateImgList:d}),__spreadProps(__spreadValues({},e),{imgList:c})}default:return e}};exports.LoadFileAndFileData=LoadFileAndFileData,exports.annotationReducer=annotationReducer,exports.composeResultByToolInstance=composeResultByToolInstance,exports.getStepConfig=getStepConfig,exports.getTotalPage=getTotalPage;
@@ -21,5 +21,5 @@ interface IProps extends IA2MapStateProps {
21
21
  thumbnailWidth?: number;
22
22
  isEnlargeTopView?: boolean;
23
23
  }
24
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, thumbnailWidth, isEnlargeTopView, highlightAttribute, }: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileProgress" | "currentData" | "stepInfo" | "configString">>;
24
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, thumbnailWidth, isEnlargeTopView, highlightAttribute, }: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
25
25
  export default _default;
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { IA2MapStateProps } from '@/store/annotation/map';
3
3
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IA2MapStateProps>, import("react-redux").Omit<IA2MapStateProps & {
4
4
  children?: React.ReactNode;
5
- }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileProgress" | "currentData" | "stepInfo" | "configString">>;
5
+ }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
6
6
  export default _default;
@@ -3,5 +3,5 @@ import { IA2MapStateProps } from '@/store/annotation/map';
3
3
  interface IProps {
4
4
  checkMode?: boolean;
5
5
  }
6
- declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, checkMode }: IA2MapStateProps & IProps) => React.JSX.Element, import("react-redux").Omit<IA2MapStateProps & IProps, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileProgress" | "currentData" | "stepInfo" | "configString">>;
6
+ declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, checkMode }: IA2MapStateProps & IProps) => React.JSX.Element, import("react-redux").Omit<IA2MapStateProps & IProps, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
7
7
  export default _default;
@@ -7,5 +7,5 @@ interface IProps extends IA2MapStateProps {
7
7
  }
8
8
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
9
9
  children?: React.ReactNode;
10
- }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileProgress" | "currentData" | "stepInfo" | "configString">>;
10
+ }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
11
11
  export default _default;
@@ -5,5 +5,5 @@ interface IProps extends IA2MapStateProps {
5
5
  }
6
6
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
7
7
  children?: React.ReactNode;
8
- }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileProgress" | "currentData" | "stepInfo" | "configString">>;
8
+ }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
9
9
  export default _default;
@@ -7,5 +7,5 @@ interface IProps extends IA2MapStateProps {
7
7
  }
8
8
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
9
9
  children?: React.ReactNode;
10
- }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileProgress" | "currentData" | "stepInfo" | "configString">>;
10
+ }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
11
11
  export default _default;
@@ -5,5 +5,5 @@ interface IProps {
5
5
  }
6
6
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IA2MapStateProps & IProps>, import("react-redux").Omit<IA2MapStateProps & IProps & {
7
7
  children?: React.ReactNode;
8
- }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileProgress" | "currentData" | "stepInfo" | "configString">>;
8
+ }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
9
9
  export default _default;
@@ -11,5 +11,5 @@ interface IProps extends IA2MapStateProps {
11
11
  }
12
12
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
13
13
  children?: React.ReactNode;
14
- }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileProgress" | "currentData" | "stepInfo" | "configString">>;
14
+ }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
15
15
  export default _default;
@@ -14,5 +14,5 @@ interface IProps extends IA2MapStateProps {
14
14
  }
15
15
  declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
16
16
  children?: React.ReactNode;
17
- }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileProgress" | "currentData" | "stepInfo" | "configString">>;
17
+ }, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "currentData" | "stepInfo" | "configString">>;
18
18
  export default _default;
@@ -28,7 +28,7 @@ export declare const ANNOTATION_ACTIONS: {
28
28
  SKIP_BEFORE_PAGE_TURNING: string;
29
29
  UPDATE_BEFORE_ROTATE: string;
30
30
  SET_LOADING: string;
31
- SET_LOADPCDFILE_PROGRESS: string;
31
+ SET_LOADPCDFILE_LOADING: string;
32
32
  SET_POINT_CLOUD_LOADING: string;
33
33
  SET_CHECK_MODE: string;
34
34
  SET_TASK_STEP_LIST: string;
@@ -92,7 +92,7 @@ export declare const DispatcherTurning: (dispatch: any, getState: any, pageTurni
92
92
  export declare const ChangeSave: (dispatch: Function) => void;
93
93
  export declare const SetAnnotationLoading: (dispatch: Function, loading: boolean) => void;
94
94
  export declare const SetPointCloudLoading: (dispatch: Function, loading: boolean) => void;
95
- export declare const SetLoadPcdFileProgress: (dispatch: Function, loadPCDFileProgress: boolean) => void;
95
+ export declare const SetLoadPCDFileLoading: (dispatch: Function, loadPCDFileLoading: boolean) => void;
96
96
  export declare const InitAnnotationState: (dispatch: Function) => void;
97
97
  export declare const SetPredictResult: (dispatch: Function, result: any) => void;
98
98
  export declare const SetPredictResultVisible: (dispatch: Function, visible: boolean) => void;
@@ -19,7 +19,7 @@ export interface IA2MapStateProps extends IAnnotationStateProps {
19
19
  imgIndex: number;
20
20
  configString: string;
21
21
  highlightAttribute: string;
22
- loadPCDFileProgress: boolean;
22
+ loadPCDFileLoading: boolean;
23
23
  }
24
24
  export declare const a2MapStateToProps: (state: AppState) => {
25
25
  currentData: any;
@@ -29,5 +29,5 @@ export declare const a2MapStateToProps: (state: AppState) => {
29
29
  config: any;
30
30
  configString: string;
31
31
  highlightAttribute: any;
32
- loadPCDFileProgress: any;
32
+ loadPCDFileLoading: any;
33
33
  };
@@ -44,7 +44,7 @@ export declare const annotationReducer: (state: {
44
44
  resultList: any[];
45
45
  stepProgress: number;
46
46
  loading: boolean;
47
- loadPCDFileProgress: boolean;
47
+ loadPCDFileLoading: boolean;
48
48
  triggerEventAfterIndexChanged: boolean;
49
49
  skipBeforePageTurning?: ((pageTurning: Function) => void) | undefined;
50
50
  beforeRotate?: (() => boolean) | undefined;
@@ -36,7 +36,7 @@ export interface AnnotationState {
36
36
  resultList: any[];
37
37
  stepProgress: number;
38
38
  loading: boolean;
39
- loadPCDFileProgress: boolean;
39
+ loadPCDFileLoading: boolean;
40
40
  /** 阻止文件切换后的事件 */
41
41
  triggerEventAfterIndexChanged: boolean;
42
42
  skipBeforePageTurning?: (pageTurning: Function) => void;
@@ -1 +1 @@
1
- import{getClassName as N}from"../../utils/dom.js";import n,{useState as E,useContext as J,useEffect as S}from"react";import{PointCloudContainer as Q}from"./PointCloudLayout.js";import{PointCloudContext as U}from"./PointCloudContext.js";import{connect as W}from"react-redux";import{cKeyCode as X,pointCloudLidar2image as Y}from"@labelbee/lb-annotation";import{LabelBeeContext as B}from"../../store/ctx.js";import{a2MapStateToProps as ee}from"../../store/annotation/map.js";import{toolStyleConverter as te}from"@labelbee/lb-utils";import ne from"./PointCloud2DSingleView.js";import V from"./components/TitleButton/index.js";import{LeftOutlined as oe}from"@ant-design/icons";import ie from"classnames";import le from"../../assets/annotation/common/icon_esc.svg.js";import re from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import se from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";var ae=Object.defineProperty,ce=Object.defineProperties,me=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,A=(e,o,t)=>o in e?ae(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,_=(e,o)=>{for(var t in o||(o={}))ue.call(o,t)&&A(e,t,o[t]);if(R)for(var t of R(o))pe.call(o,t)&&A(e,t,o[t]);return e},C=(e,o)=>ce(e,me(o));const x=X.default,de=({showEnlarge:e,isEnlargeTopView:o,data:t,setIsEnlarge:d,setCurIndex:m,curIndex:g=0,index:a,annotations2d:f})=>o?n.createElement(V,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?n.createElement("div",{style:{display:"flex",alignItems:"center"}},n.createElement(oe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{d(!1),m(void 0)}}),n.createElement("span",null,t==null?void 0:t.calName),n.createElement("span",{style:{marginLeft:"8px"}},g+1,"/",f==null?void 0:f.length)):n.createElement(V,{title:t==null?void 0:t.calName,onClick:()=>{d(!0),m(a)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),ge=({currentData:e,config:o,thumbnailWidth:t,isEnlargeTopView:d,highlightAttribute:m})=>{var g;const[a,f]=E([]),{topViewInstance:T,displayPointCloudList:h}=J(U),[w,K]=E(""),[v,b]=E(!1),[r,y]=E(void 0);S(()=>{var i;if(T&&(e==null?void 0:e.mappingImgList)&&((i=e==null?void 0:e.mappingImgList)==null?void 0:i.length)>0){const l={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(c=>{var u;const D=h.reduce((M,p)=>{var j;const Z=p.id===w||m===p.attribute,{transferViewData:G,viewRangePointList:P}=Y(p,c.calib,{createRange:Z}),k=(j=te.getColorFromConfig({attribute:p.attribute},C(_({},o),{attributeConfigurable:!0}),{}))==null?void 0:j.stroke,H=$({viewDataPointList:G,pointCloudBox:p,defaultViewStyle:l,stroke:k}),I=[...M,...H];return(P==null?void 0:P.length)>0&&I.push({type:"polygon",annotation:C(_({id:w,pointList:P},l),{stroke:k,fill:"rgba(255, 255, 255, 0.6)"})}),I},[]);s.push({annotations:D,url:c==null?void 0:c.url,calName:(u=c.calib)==null?void 0:u.calName,calib:c==null?void 0:c.calib})}),f(s)}},[h,e==null?void 0:e.mappingImgList,w,m]),S(()=>(window.addEventListener("keydown",L),()=>{window.removeEventListener("keydown",L)}),[r]);const L=i=>{const{keyCode:l}=i;switch(l){case x.Esc:v&&b(!1);break;case x.Left:F();break;case x.Right:O();break}},F=()=>{r===void 0||!v||Number(r)>0&&y(r-1)},O=()=>{r===void 0||!v||Number(r)<(a==null?void 0:a.length)-1&&y(r+1)},$=({viewDataPointList:i,pointCloudBox:l,defaultViewStyle:s,stroke:c})=>i.map(u=>({type:u.type,annotation:C(_({id:l.id,pointList:u.pointList},s),{stroke:c})})),q=!e||!(e==null?void 0:e.mappingImgList)||!(((g=e==null?void 0:e.mappingImgList)==null?void 0:g.length)>0),z=n.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},n.createElement("img",{src:re,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>F()}),n.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),n.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),n.createElement("img",{src:se,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>O()}),n.createElement("img",{src:le,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{b(!1),y(void 0)}}),n.createElement("span",null,"\u952E\u9000\u51FA"));return(a==null?void 0:a.length)>0?n.createElement(n.Fragment,null,a.map((i,l)=>{const s=v&&l===r;return n.createElement(Q,{className:ie({[N("point-cloud-2d-container")]:!0,[N("point-cloud-3d-containerZoom")]:s}),title:n.createElement(de,{showEnlarge:s,isEnlargeTopView:d,data:i,setIsEnlarge:b,setCurIndex:y,curIndex:r,index:l,annotations2d:a}),titleOnSurface:!s,style:{display:q?"none":"flex",width:s?"100%":t},key:l,toolbar:z},(i==null?void 0:i.annotations)&&(i==null?void 0:i.url)&&n.createElement(ne,{currentData:e,view2dData:i,setSelectedID:K}))})):null};var fe=W(ee,null,null,{context:B})(ge);export{fe as default};
1
+ import{getClassName as N}from"../../utils/dom.js";import n,{useState as E,useContext as Q,useEffect as S}from"react";import{PointCloudContainer as U}from"./PointCloudLayout.js";import{PointCloudContext as W}from"./PointCloudContext.js";import{connect as X}from"react-redux";import{cKeyCode as Y,pointCloudLidar2image as Z}from"@labelbee/lb-annotation";import{LabelBeeContext as B}from"../../store/ctx.js";import{a2MapStateToProps as ee}from"../../store/annotation/map.js";import{toolStyleConverter as te}from"@labelbee/lb-utils";import ne from"./PointCloud2DSingleView.js";import V from"./components/TitleButton/index.js";import{LeftOutlined as oe}from"@ant-design/icons";import ie from"classnames";import le from"../../assets/annotation/common/icon_esc.svg.js";import re from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import se from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";var ae=Object.defineProperty,ce=Object.defineProperties,me=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,A=(e,o,t)=>o in e?ae(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,_=(e,o)=>{for(var t in o||(o={}))ue.call(o,t)&&A(e,t,o[t]);if(R)for(var t of R(o))pe.call(o,t)&&A(e,t,o[t]);return e},C=(e,o)=>ce(e,me(o));const x=Y.default,de=({showEnlarge:e,isEnlargeTopView:o,data:t,setIsEnlarge:d,setCurIndex:m,curIndex:g=0,index:a,annotations2d:f})=>o?n.createElement(V,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?n.createElement("div",{style:{display:"flex",alignItems:"center"}},n.createElement(oe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{d(!1),m(void 0)}}),n.createElement("span",null,t==null?void 0:t.calName),n.createElement("span",{style:{marginLeft:"8px"}},g+1,"/",f==null?void 0:f.length)):n.createElement(V,{title:t==null?void 0:t.calName,onClick:()=>{d(!0),m(a)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),ge=({currentData:e,config:o,thumbnailWidth:t,isEnlargeTopView:d,highlightAttribute:m})=>{var g;const[a,f]=E([]),{topViewInstance:T,displayPointCloudList:h}=Q(W),[w,K]=E(""),[v,b]=E(!1),[r,y]=E(void 0);S(()=>{var i;if(T&&(e==null?void 0:e.mappingImgList)&&((i=e==null?void 0:e.mappingImgList)==null?void 0:i.length)>0){const l={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(c=>{var u;const D=h.reduce((M,p)=>{var j;const G=p.id===w||m===p.attribute,{transferViewData:H,viewRangePointList:P}=Z(p,c.calib,{createRange:G}),k=(j=te.getColorFromConfig({attribute:p.attribute},C(_({},o),{attributeConfigurable:!0}),{}))==null?void 0:j.stroke,J=$({viewDataPointList:H,pointCloudBox:p,defaultViewStyle:l,stroke:k}),I=[...M,...J];return(P==null?void 0:P.length)>0&&I.push({type:"polygon",annotation:C(_({id:w,pointList:P},l),{stroke:k,fill:"rgba(255, 255, 255, 0.6)"})}),I},[]);s.push({annotations:D,url:c==null?void 0:c.url,calName:(u=c.calib)==null?void 0:u.calName,calib:c==null?void 0:c.calib})}),f(s)}},[h,e==null?void 0:e.mappingImgList,w,m]),S(()=>(window.addEventListener("keydown",L),()=>{window.removeEventListener("keydown",L)}),[r]);const L=i=>{const{keyCode:l}=i;switch(l){case x.Esc:v&&b(!1);break;case x.Left:F();break;case x.Right:O();break}},F=()=>{r===void 0||!v||Number(r)>0&&y(r-1)},O=()=>{r===void 0||!v||Number(r)<(a==null?void 0:a.length)-1&&y(r+1)},$=({viewDataPointList:i,pointCloudBox:l,defaultViewStyle:s,stroke:c})=>i.map(u=>({type:u.type,annotation:C(_({id:l.id,pointList:u.pointList},s),{stroke:c})})),q=!e||!(e==null?void 0:e.mappingImgList)||!(((g=e==null?void 0:e.mappingImgList)==null?void 0:g.length)>0),z=n.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},n.createElement("img",{src:re,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>F()}),n.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),n.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),n.createElement("img",{src:se,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>O()}),n.createElement("img",{src:le,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{b(!1),y(void 0)}}),n.createElement("span",null,"\u952E\u9000\u51FA"));return(a==null?void 0:a.length)>0?n.createElement(n.Fragment,null,a.map((i,l)=>{const s=v&&l===r;return n.createElement(U,{className:ie({[N("point-cloud-2d-container")]:!0,[N("point-cloud-container","zoom")]:s}),title:n.createElement(de,{showEnlarge:s,isEnlargeTopView:d,data:i,setIsEnlarge:b,setCurIndex:y,curIndex:r,index:l,annotations2d:a}),titleOnSurface:!s,style:{display:q?"none":"flex",width:s?"100%":t},key:l,toolbar:z},(i==null?void 0:i.annotations)&&(i==null?void 0:i.url)&&n.createElement(ne,{currentData:e,view2dData:i,setSelectedID:K}))})):null};var fe=X(ee,null,null,{context:B})(ge);export{fe as default};
@@ -1 +1 @@
1
- import{getClassName as m}from"../../utils/dom.js";import{cKeyCode as Z,PointCloud as K}from"@labelbee/lb-annotation";import{PointCloudUtils as B,toolStyleConverter as M,EPerspectiveView as E}from"@labelbee/lb-utils";import j from"classnames";import e,{useContext as b,useState as O,useRef as H,useEffect as u,useMemo as U}from"react";import{PointCloudContainer as q}from"./PointCloudLayout.js";import{PointCloudContext as G}from"./PointCloudContext.js";import{a2MapStateToProps as J}from"../../store/annotation/map.js";import{connect as Q}from"react-redux";import{jsonParser as W}from"../../utils/index.js";import{useSingleBox as X}from"./hooks/useSingleBox.js";import{useSphere as Y}from"./hooks/useSphere.js";import{Switch as $,Tooltip as ee}from"antd";import te from"../../hooks/useSize.js";import{usePointCloudViews as oe}from"./hooks/usePointCloudViews.js";import{useTranslation as L}from"react-i18next";import{LabelBeeContext as ne}from"../../store/ctx.js";import ie from"./components/PointCloudSizeSlider/index.js";import re from"./components/TitleButton/index.js";import{LeftOutlined as ae}from"@ant-design/icons";var le=Object.defineProperty,se=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,z=(n,r,a)=>r in n?le(n,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[r]=a,N=(n,r)=>{for(var a in r||(r={}))me.call(r,a)&&z(n,a,r[a]);if(D)for(var a of D(r))ue.call(r,a)&&z(n,a,r[a]);return n},de=(n,r)=>se(n,ce(r));const pe=Z.default,we="LABELBEE-POINTCLOUD",P=e.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),d=({perspectiveView:n})=>{const{isActive:r,setTarget3DView:a}=b(P),o=p=>j({[m("point-cloud-3d-view",p)]:!0,active:r});return e.createElement("span",{onClick:()=>{a(E[n])},className:o(n.toLocaleLowerCase())})},k=({isEnlarge:n})=>{const{reset3DView:r,followTopView:a}=b(P),{t:o}=L(),p=e.createElement(e.Fragment,null,e.createElement(d,{perspectiveView:"Top"}),e.createElement(d,{perspectiveView:"Front"}),e.createElement(d,{perspectiveView:"Left"}),e.createElement(d,{perspectiveView:"Back"}),e.createElement(d,{perspectiveView:"Right"}),e.createElement(d,{perspectiveView:"LFT"}),e.createElement(d,{perspectiveView:"RBT"})),V=e.createElement(e.Fragment,null,e.createElement(ee,{title:o("CameraFollowTopView")},e.createElement("span",{onClick:()=>{a()},className:m("point-cloud-3d-view","followTop")})),e.createElement("span",{onClick:()=>{r()},className:m("point-cloud-3d-view","reset")}));return n?e.createElement("div",{className:m("point-cloud-3d-sidebarZoom")},V,p):e.createElement("div",{className:m("point-cloud-3d-sidebar")},p,V)},ve=({currentData:n,config:r,highlightAttribute:a})=>{const o=b(G),[p,V]=O(!0),[v,h]=O(!1),f=H(null),{initPointCloud3d:S}=oe(),C=te(f),{t:_}=L();u(()=>{!o.mainViewInstance||S==null||S(C)},[C]);const{selectedBox:w}=X(),{selectedSphere:g}=Y(),x=t=>{var i,l;const s=w==null?void 0:w.info;if(s){const c=N({},s.center);c.x=c.x-.01,c.z=1e3;const I=t===E.Top;(i=o.mainViewInstance)==null||i.updateCameraByBox(s,t,I?c:void 0)}g&&((l=o.mainViewInstance)==null||l.updateCameraBySphere(g,t))},R=()=>{var t;(t=o.mainViewInstance)==null||t.resetCamera()},F=()=>{var t,i;const l=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance.camera;l&&((i=o.mainViewInstance)==null||i.applyCameraTarget(l))};u(()=>{if(f.current&&(n==null?void 0:n.url)){let t=o.mainViewInstance;!t&&C.width&&(t=new K({container:f.current,isOrthographicCamera:!0,orthographicParams:B.getDefaultOrthographicParams(C),config:r}),o.setMainViewInstance(t))}},[C,n]),u(()=>{var t;if(f.current&&(n==null?void 0:n.url)&&n.result&&o.mainViewInstance){let i=o.mainViewInstance;const l=B.getBoxParamsFromResultList(n.result);l.forEach(s=>{var c;const I=(c=M.getColorFromConfig({attribute:s.attribute},de(N({},r),{attributeConfigurable:!0}),{}))==null?void 0:c.hex;i==null||i.addBoxToSense(s,I)}),i.render(),o.setPointCloudResult(l),o.setPointCloudValid((t=W(n.result))==null?void 0:t.valid)}},[n,o.mainViewInstance]),u(()=>{var t,i,l,s;if(w){x(E.Top);const c=(l=(i=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?l:1;(s=o.mainViewInstance)==null||s.updateCameraZoom(c)}},[w]),u(()=>{var t,i,l,s;if(g){x(E.Top);const c=(l=(i=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?l:1;(s=o.mainViewInstance)==null||s.updateCameraZoom(c)}},[g]),u(()=>(window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T)}),[]);const T=t=>{if(t.keyCode===pe.Esc){h(!1);return}},y=U(()=>({reset3DView:R,setTarget3DView:x,isActive:!!w,followTopView:F}),[w,o.mainViewInstance]);u(()=>{var t,i,l;const s=o.pointCloudBoxList.filter(c=>c.attribute===a);(s==null?void 0:s.length)>0&&((t=o.mainViewInstance)==null||t.clearHighlightBoxes(),(i=o.mainViewInstance)==null||i.highlightBoxes(s)),s.length===0&&((l=o.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[a,o.mainViewInstance]);const A=e.createElement(e.Fragment,null,e.createElement(ie,{onChange:t=>{var i;(i=o.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),e.createElement("span",{style:{marginRight:8}},_("ShowArrows")),e.createElement($,{size:"small",checked:p,onChange:t=>{var i;V(t),(i=o.mainViewInstance)==null||i.setShowDirection(t)}}),v&&e.createElement(P.Provider,{value:y},e.createElement(k,{isEnlarge:v})));return e.createElement(q,{className:j({[m("point-cloud-3d-container")]:!0,[m("point-cloud-3d-containerZoom")]:v}),title:v?e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement(ae,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{h(!1)}}),_("3DView")):e.createElement(re,{title:_("3DView"),onClick:()=>{h(!0)}}),toolbar:A},e.createElement("div",{className:m("point-cloud-3d-content")},!v&&e.createElement(P.Provider,{value:y},e.createElement(k,null)),e.createElement("div",{className:m("point-cloud-3d-view"),id:we,ref:f})))};var fe=Q(J,null,null,{context:ne})(ve);export{fe as default};
1
+ import{getClassName as m}from"../../utils/dom.js";import{cKeyCode as K,PointCloud as M}from"@labelbee/lb-annotation";import{PointCloudUtils as B,toolStyleConverter as Z,EPerspectiveView as E}from"@labelbee/lb-utils";import j from"classnames";import e,{useContext as b,useState as O,useRef as H,useEffect as u,useMemo as U}from"react";import{PointCloudContainer as q}from"./PointCloudLayout.js";import{PointCloudContext as G}from"./PointCloudContext.js";import{a2MapStateToProps as J}from"../../store/annotation/map.js";import{connect as Q}from"react-redux";import{jsonParser as W}from"../../utils/index.js";import{useSingleBox as X}from"./hooks/useSingleBox.js";import{useSphere as Y}from"./hooks/useSphere.js";import{Switch as $,Tooltip as ee}from"antd";import te from"../../hooks/useSize.js";import{usePointCloudViews as oe}from"./hooks/usePointCloudViews.js";import{useTranslation as L}from"react-i18next";import{LabelBeeContext as ne}from"../../store/ctx.js";import ie from"./components/PointCloudSizeSlider/index.js";import re from"./components/TitleButton/index.js";import{LeftOutlined as ae}from"@ant-design/icons";var le=Object.defineProperty,se=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,D=(n,r,a)=>r in n?le(n,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[r]=a,N=(n,r)=>{for(var a in r||(r={}))me.call(r,a)&&D(n,a,r[a]);if(z)for(var a of z(r))ue.call(r,a)&&D(n,a,r[a]);return n},de=(n,r)=>se(n,ce(r));const pe=K.default,we="LABELBEE-POINTCLOUD",P=e.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),d=({perspectiveView:n})=>{const{isActive:r,setTarget3DView:a}=b(P),o=p=>j({[m("point-cloud-3d-view",p)]:!0,active:r});return e.createElement("span",{onClick:()=>{a(E[n])},className:o(n.toLocaleLowerCase())})},k=({isEnlarge:n})=>{const{reset3DView:r,followTopView:a}=b(P),{t:o}=L(),p=e.createElement(e.Fragment,null,e.createElement(d,{perspectiveView:"Top"}),e.createElement(d,{perspectiveView:"Front"}),e.createElement(d,{perspectiveView:"Left"}),e.createElement(d,{perspectiveView:"Back"}),e.createElement(d,{perspectiveView:"Right"}),e.createElement(d,{perspectiveView:"LFT"}),e.createElement(d,{perspectiveView:"RBT"})),V=e.createElement(e.Fragment,null,e.createElement(ee,{title:o("CameraFollowTopView")},e.createElement("span",{onClick:()=>{a()},className:m("point-cloud-3d-view","followTop")})),e.createElement("span",{onClick:()=>{r()},className:m("point-cloud-3d-view","reset")}));return n?e.createElement("div",{className:m("point-cloud-3d-sidebarZoom")},V,p):e.createElement("div",{className:m("point-cloud-3d-sidebar")},p,V)},ve=({currentData:n,config:r,highlightAttribute:a})=>{const o=b(G),[p,V]=O(!0),[v,h]=O(!1),f=H(null),{initPointCloud3d:S}=oe(),C=te(f),{t:_}=L();u(()=>{!o.mainViewInstance||S==null||S(C)},[C]);const{selectedBox:w}=X(),{selectedSphere:g}=Y(),x=t=>{var i,l;const s=w==null?void 0:w.info;if(s){const c=N({},s.center);c.x=c.x-.01,c.z=1e3;const I=t===E.Top;(i=o.mainViewInstance)==null||i.updateCameraByBox(s,t,I?c:void 0)}g&&((l=o.mainViewInstance)==null||l.updateCameraBySphere(g,t))},R=()=>{var t;(t=o.mainViewInstance)==null||t.resetCamera()},F=()=>{var t,i;const l=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance.camera;l&&((i=o.mainViewInstance)==null||i.applyCameraTarget(l))};u(()=>{if(f.current&&(n==null?void 0:n.url)){let t=o.mainViewInstance;!t&&C.width&&(t=new M({container:f.current,isOrthographicCamera:!0,orthographicParams:B.getDefaultOrthographicParams(C),config:r}),o.setMainViewInstance(t))}},[C,n]),u(()=>{var t;if(f.current&&(n==null?void 0:n.url)&&n.result&&o.mainViewInstance){let i=o.mainViewInstance;const l=B.getBoxParamsFromResultList(n.result);l.forEach(s=>{var c;const I=(c=Z.getColorFromConfig({attribute:s.attribute},de(N({},r),{attributeConfigurable:!0}),{}))==null?void 0:c.hex;i==null||i.addBoxToSense(s,I)}),i.render(),o.setPointCloudResult(l),o.setPointCloudValid((t=W(n.result))==null?void 0:t.valid)}},[n,o.mainViewInstance]),u(()=>{var t,i,l,s;if(w){x(E.Top);const c=(l=(i=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?l:1;(s=o.mainViewInstance)==null||s.updateCameraZoom(c)}},[w]),u(()=>{var t,i,l,s;if(g){x(E.Top);const c=(l=(i=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?l:1;(s=o.mainViewInstance)==null||s.updateCameraZoom(c)}},[g]),u(()=>(window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T)}),[]);const T=t=>{if(t.keyCode===pe.Esc){h(!1);return}},y=U(()=>({reset3DView:R,setTarget3DView:x,isActive:!!w,followTopView:F}),[w,o.mainViewInstance]);u(()=>{var t,i,l;const s=o.pointCloudBoxList.filter(c=>c.attribute===a);(s==null?void 0:s.length)>0&&((t=o.mainViewInstance)==null||t.clearHighlightBoxes(),(i=o.mainViewInstance)==null||i.highlightBoxes(s)),s.length===0&&((l=o.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[a,o.mainViewInstance]);const A=e.createElement(e.Fragment,null,e.createElement(ie,{onChange:t=>{var i;(i=o.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),e.createElement("span",{style:{marginRight:8}},_("ShowArrows")),e.createElement($,{size:"small",checked:p,onChange:t=>{var i;V(t),(i=o.mainViewInstance)==null||i.setShowDirection(t)}}),v&&e.createElement(P.Provider,{value:y},e.createElement(k,{isEnlarge:v})));return e.createElement(q,{className:j({[m("point-cloud-3d-container")]:!0,[m("point-cloud-container","zoom")]:v}),title:v?e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement(ae,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{h(!1)}}),_("3DView")):e.createElement(re,{title:_("3DView"),onClick:()=>{h(!0)}}),toolbar:A},e.createElement("div",{className:m("point-cloud-3d-content")},!v&&e.createElement(P.Provider,{value:y},e.createElement(k,null)),e.createElement("div",{className:m("point-cloud-3d-view"),id:we,ref:f})))};var fe=Q(J,null,null,{context:ne})(ve);export{fe as default};
@@ -1 +1 @@
1
- import{PointCloudAnnotation as B}from"@labelbee/lb-annotation";import{getClassName as C}from"../../utils/dom.js";import{PointCloudContainer as y}from"./PointCloudLayout.js";import c,{useRef as k,useEffect as h}from"react";import{PointCloudContext as v}from"./PointCloudContext.js";import{EPerspectiveView as j}from"@labelbee/lb-utils";import{useSingleBox as V}from"./hooks/useSingleBox.js";import{useSphere as b}from"./hooks/useSphere.js";import{useZoom as S}from"./hooks/useZoom.js";import{SizeInfoForView as E}from"./PointCloudInfos.js";import{connect as I}from"react-redux";import{a2MapStateToProps as T}from"../../store/annotation/map.js";import{usePointCloudViews as D}from"./hooks/usePointCloudViews.js";import O from"../../hooks/useSize.js";import N from"./components/EmptyPage/index.js";import{useTranslation as M}from"react-i18next";import{LabelBeeContext as X}from"../../store/ctx.js";import U from"../../utils/ToolUtils.js";import Z from"./components/TitleButton/index.js";const A=(u,r,a=1)=>{const{width:e,height:o}=r,t={x:u.x+e*a/2,y:u.y+o*a/2},m={x:r.width/2,y:r.height/2};return{offsetX:(m.x-t.x)/a,offsetY:-(m.y-t.y)/a}},g=(u,r,a,e,o)=>{const{offsetX:t,offsetY:m}=A(u,a,r);if(o.camera.zoom=r,u){const d=Math.cos(e),f=Math.sin(e),x=t*d,w=t*f,{x:p,y:n,z:l}=o.initCameraPosition;o.camera.position.set(p+w,n-x,l+m)}o.camera.updateProjectionMatrix(),o.render()},L=({currentData:u,config:r,checkMode:a})=>{const e=c.useContext(v),o=k(null),t=O(o),{selectedBox:m}=V(),{selectedSphere:d}=b(),{syncBackviewToolZoom:f}=S(),{t:x}=M(),{backViewUpdateBox:w,backViewUpdatePoint:p}=D();return h(()=>{if(o.current){const n={width:o.current.clientWidth,height:o.current.clientHeight},l=new B({container:o.current,size:n,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:r,checkMode:a,toolName:U.getPointCloudToolList()});e.setBackViewInstance(l)}},[]),h(()=>{if(!t||!e.backViewInstance)return;const{toolInstance:n,pointCloudInstance:l}=e.backViewInstance;n.singleOn("renderZoom",(i,s)=>{if(e.selectedPointCloudBox){g(s,i,t,e.selectedPointCloudBox.rotation,l),f(s,i,t);return}if(d){g(s,i,t,0,l),f(s,i,t);return}}),n.singleOn("dragMove",({currentPos:i,zoom:s})=>{!e.selectedPointCloudBox&&!d||g(i,s,t,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,l)}),n.singleOn("updatePointByDrag",(i,s)=>{d&&(p==null||p(i,s[0]))}),n.singleOn("updatePolygonByDrag",i=>{if(e.selectedIDs.length===1&&i.length===1){const{newPolygon:s,originPolygon:P}=i[0];s&&P&&w(s,P)}})},[e,t]),h(()=>{var n;(n=e==null?void 0:e.backViewInstance)==null||n.initSize(t)},[t]),c.createElement(y,{className:C("point-cloud-container","back-view"),title:c.createElement(Z,{title:x("BackView")}),titleOnSurface:!0},c.createElement("div",{className:C("point-cloud-container","bottom-view-content")},c.createElement("div",{className:C("point-cloud-container","core-instance"),ref:o,style:{width:360}}),!m&&!d&&c.createElement(N,null),c.createElement(E,{perspectiveView:j.Back})))};var Y=I(T,null,null,{context:X})(L);export{Y as default};
1
+ import{PointCloudAnnotation as B}from"@labelbee/lb-annotation";import{getClassName as w}from"../../utils/dom.js";import{PointCloudContainer as y}from"./PointCloudLayout.js";import c,{useRef as k,useEffect as h}from"react";import{PointCloudContext as v}from"./PointCloudContext.js";import{EPerspectiveView as j}from"@labelbee/lb-utils";import{useSingleBox as V}from"./hooks/useSingleBox.js";import{useSphere as b}from"./hooks/useSphere.js";import{useZoom as S}from"./hooks/useZoom.js";import{SizeInfoForView as E}from"./PointCloudInfos.js";import{connect as I}from"react-redux";import{a2MapStateToProps as T}from"../../store/annotation/map.js";import{usePointCloudViews as D}from"./hooks/usePointCloudViews.js";import O from"../../hooks/useSize.js";import N from"./components/EmptyPage/index.js";import{useTranslation as M}from"react-i18next";import{LabelBeeContext as X}from"../../store/ctx.js";import U from"../../utils/ToolUtils.js";import Z from"./components/TitleButton/index.js";const A=(u,r,a=1)=>{const{width:e,height:o}=r,t={x:u.x+e*a/2,y:u.y+o*a/2},m={x:r.width/2,y:r.height/2};return{offsetX:(m.x-t.x)/a,offsetY:-(m.y-t.y)/a}},g=(u,r,a,e,o)=>{const{offsetX:t,offsetY:m}=A(u,a,r);if(o.camera.zoom=r,u){const d=Math.cos(e),f=Math.sin(e),x=t*d,C=t*f,{x:p,y:n,z:l}=o.initCameraPosition;o.camera.position.set(p+C,n-x,l+m)}o.camera.updateProjectionMatrix(),o.render()},L=({currentData:u,config:r,checkMode:a})=>{const e=c.useContext(v),o=k(null),t=O(o),{selectedBox:m}=V(),{selectedSphere:d}=b(),{syncBackviewToolZoom:f}=S(),{t:x}=M(),{backViewUpdateBox:C,backViewUpdatePoint:p}=D();return h(()=>{if(o.current){const n={width:o.current.clientWidth,height:o.current.clientHeight},l=new B({container:o.current,size:n,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:r,checkMode:a,toolName:U.getPointCloudToolList()});e.setBackViewInstance(l)}},[]),h(()=>{if(!t||!e.backViewInstance)return;const{toolInstance:n,pointCloudInstance:l}=e.backViewInstance;n.singleOn("renderZoom",(i,s)=>{if(e.selectedPointCloudBox){g(s,i,t,e.selectedPointCloudBox.rotation,l),f(s,i,t);return}if(d){g(s,i,t,0,l),f(s,i,t);return}}),n.singleOn("dragMove",({currentPos:i,zoom:s})=>{!e.selectedPointCloudBox&&!d||g(i,s,t,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,l)}),n.singleOn("updatePointByDrag",(i,s)=>{d&&(p==null||p(i,s[0]))}),n.singleOn("updatePolygonByDrag",i=>{if(e.selectedIDs.length===1&&i.length===1){const{newPolygon:s,originPolygon:P}=i[0];s&&P&&C(s,P)}})},[e,t]),h(()=>{var n;(n=e==null?void 0:e.backViewInstance)==null||n.initSize(t)},[t]),c.createElement(y,{className:w("point-cloud-container","back-view"),title:c.createElement(Z,{title:x("BackView")}),titleOnSurface:!0},c.createElement("div",{className:w("point-cloud-container","bottom-view-content")},c.createElement("div",{className:w("point-cloud-container","core-instance"),ref:o}),!m&&!d&&c.createElement(N,null),c.createElement(E,{perspectiveView:j.Back})))};var Y=I(T,null,null,{context:X})(L);export{Y as default};
@@ -1 +1 @@
1
- import c from"react";import{EyeFilled as d,EyeInvisibleFilled as p,LoadingOutlined as f}from"@ant-design/icons";var u=Object.defineProperty,n=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable,l=(t,e,r)=>e in t?u(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s=(t,e)=>{for(var r in e||(e={}))_.call(e,r)&&l(t,r,e[r]);if(n)for(var r of n(e))m.call(e,r)&&l(t,r,e[r]);return t};const g=({visible:t,style:e,onClick:r,loading:o})=>{const a={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16,zIndex:101};let i=t?d:p;return o&&(i=f,Object.assign(a,{borderRadius:100})),c.createElement(i,{style:s(s({},a),e),onClick:o?()=>{}:r})};export{g as default};
1
+ import c from"react";import{EyeFilled as d,EyeInvisibleFilled as p,LoadingOutlined as f}from"@ant-design/icons";import{getClassName as u}from"../../../../utils/dom.js";var m=Object.defineProperty,l=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,n=(t,e,r)=>e in t?m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s=(t,e)=>{for(var r in e||(e={}))g.call(e,r)&&n(t,r,e[r]);if(l)for(var r of l(e))_.call(e,r)&&n(t,r,e[r]);return t};const y=({visible:t,style:e,onClick:r,loading:o})=>{const i={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16,zIndex:101};let a=t?d:p;return o&&(a=f,Object.assign(i,{borderRadius:100})),c.createElement(a,{className:u("point-cloud-highlight-view"),style:s(s({},i),e),onClick:o?()=>{}:r})};export{y as default};
@@ -1 +1 @@
1
- import{EPointCloudName as J,MathUtils as B,getCuboidFromPointCloudBox as Rt}from"@labelbee/lb-annotation";import{EPerspectiveView as W,PointCloudUtils as I,DEFAULT_SPHERE_PARAMS as Nt}from"@labelbee/lb-utils";import{useContext as Et}from"react";import{PointCloudContext as Ht}from"../PointCloudContext.js";import{useSingleBox as lt}from"./useSingleBox.js";import{useSphere as Ft}from"./useSphere.js";import{useSelector as Zt,useDispatch as Wt}from"../../../store/ctx.js";import Mt from"../../../utils/StepUtils.js";import{jsonParser as dt}from"../../../utils/index.js";import{PreDataProcess as K,SetPointCloudLoading as at,SetLoadPcdFileProgress as ct}from"../../../store/annotation/actionCreators.js";import{message as Gt}from"antd";import{useTranslation as Qt}from"react-i18next";import{useHistory as Xt}from"./useHistory.js";import{usePolygon as Yt}from"./usePolygon.js";var qt=Object.defineProperty,Jt=Object.defineProperties,Kt=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertySymbols,$t=Object.prototype.hasOwnProperty,to=Object.prototype.propertyIsEnumerable,pt=(o,e,n)=>e in o?qt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,y=(o,e)=>{for(var n in e||(e={}))$t.call(e,n)&&pt(o,n,e[n]);if(ut)for(var n of ut(e))to.call(e,n)&&pt(o,n,e[n]);return o},k=(o,e)=>Jt(o,Kt(e)),$=(o,e,n)=>new Promise((l,t)=>{var d=u=>{try{a(n.next(u))}catch(g){t(g)}},f=u=>{try{a(n.throw(u))}catch(g){t(g)}},a=u=>u.done?l(u.value):Promise.resolve(u.value).then(d,f);a((n=n.apply(o,e)).next())});const Q=5,X=90,ft=.01,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},tt=(o,e,n,l,t)=>{const{x:d,y:f}=I.transferCanvas2World(o,e),{defaultZ:a}=Nt,u={center:{x:d,y:f,z:a},id:o.id},g=l?y(y({},l),u):k(y({},u),{attribute:"",valid:!0});return t&&Object.assign(g,t),g},ot=(o,e,n,l,t,d)=>{let f=o.pointList.map(h=>I.transferCanvas2World(h,e)),a=0,u=1,g={};if(n){const h=n.getSensesPointZAxisInPolygon(f,void 0,d);d&&h.fittedCoordinates.length>0&&(f=h.fittedCoordinates),a=(h.maxZ+h.minZ)/2,u=h.maxZ-h.minZ,g={count:h.zCount}}const[m,b,E]=f,V=B.getLineCenterPoint([m,E]),A=B.getLineLength(m,b),T=B.getLineLength(b,E),R=B.getRadiusFromQuadrangle(o.pointList);l&&(a=l.center.z,u=l.depth);const z={center:{x:V.x,y:V.y,z:a},width:d?T+ft:T,height:d?A+ft:A,depth:u,rotation:R,id:o.id},j=y(l?y(y({},l),z):k(y({},z),{attribute:"",valid:!0}),g);t&&Object.assign(j,t);const _=f.map(h=>I.transferWorld2Canvas(h,e));return{boxParams:j,newPointList:_}},Pt=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return k(y({},n),{center:{x:n.center.x-l.x,y:n.center.y,z:n.center.z-l.y}})},gt=(o,e,n,l)=>{const[t,d,f]=o.pointList,[a,u,g]=e.pointList,m=B.getLineCenterPoint([t,f]),b=B.getLineCenterPoint([a,g]),V={x:{x:m.x-b.x,y:m.y-b.y}.x,y:0,z:m.y-b.y},A=B.getLineLength(t,d),T=B.getLineLength(a,u),R=A-T,z=B.getLineLength(d,f),j=B.getLineLength(u,g),_=z-j,{newBoxParams:h}=l.getNewBoxBySideUpdate(V,_,R,n);return h},oo=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return k(y({},n),{center:{x:n.center.x,y:n.center.y-l.x,z:n.center.z-l.y}})},eo=(o,e,n,l)=>{const[t,d,f]=o.pointList,[a,u,g]=e.pointList,m=B.getLineCenterPoint([t,f]),b=B.getLineCenterPoint([a,g]),V={x:{x:m.x-b.x,y:m.y-b.y}.x,y:0,z:m.y-b.y},A=B.getLineLength(t,d),T=B.getLineLength(a,u),R=A-T,z=B.getLineLength(d,f),j=B.getLineLength(u,g),_=z-j;let{newBoxParams:h}=l.getNewBoxByBackUpdate(V,_,R,n);return h},Ct=(o,e,n,l,t)=>{var d;if(!n)return;const{toolInstance:f,pointCloudInstance:a}=n;a.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:X);const{cameraPositionVector:u}=a.updateOrthoCameraBySphere(o,W.Left);a.setInitCameraPosition(u);const{point2d:g,zoom:m}=a.getSphereSidePoint2DCoordinate(o);a.camera.zoom=m,a.camera.updateProjectionMatrix(),a.render(),f.initPosition(),f.zoomChangeOnCenter(m),f.setResult([k(y(y({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),f.setSelectedID(e.id)},mt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=n;d.loadPCDFileByBox(l,o,{width:Q,depth:Q});const{cameraPositionVector:f}=d.updateOrthoCamera(o,W.Left);d.setInitCameraPosition(f);const{polygon2d:a,zoom:u}=d.getBoxSidePolygon2DCoordinate(o);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(u),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:a,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},xt=(o,e,n,l,t)=>{var d;if(!n)return;const{toolInstance:f,pointCloudInstance:a}=n;a.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:X);const{cameraPositionVector:u}=a.updateOrthoCameraBySphere(o,W.Back);a.setInitCameraPosition(u);const{point2d:g,zoom:m}=a.getSphereBackPoint2DCoordinate(o);a.camera.zoom=m,a.camera.updateProjectionMatrix(),a.render(),f.initPosition(),f.zoomChangeOnCenter(m),f.setResult([k(y(y({},e),g),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),f.setSelectedID(e.id)},Lt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=n;d.loadPCDFileByBox(l,o,{height:Q,depth:Q});const{cameraPositionVector:f}=d.updateOrthoCamera(o,W.Back);d.setInitCameraPosition(f);const{polygon2d:a,zoom:u}=d.getBoxBackPolygon2DCoordinate(o);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(u),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:a,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},yt=(o,e,n,l)=>{if(!n||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,W.Top),l.render();const{toolInstance:t,pointCloudInstance:d}=n,{point2d:f}=d.getSphereTopPoint2DCoordinate(o),a=[...t.pointList].map(u=>u.id===e.id?k(y(y({},e),f),{valid:o.valid,textAttribute:"",attribute:o.attribute}):u);t.setResult(a),t.setSelectedID(e.id)},et=(o,e,n,l)=>{var t,d;if(!n||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:f,pointCloudInstance:a}=n,{polygon2d:u}=a.getBoxTopPolygon2DCoordinate(o),g=[...f.polygonList],m=g.find(b=>b.id===e.id);m?(m.pointList=u,m.valid=(t=o.valid)!=null?t:!0):g.push({id:e.id,pointList:u,textAttribute:"",isRect:!0,valid:(d=o.valid)!=null?d:!0}),f.setResultAndSelectedID(g,e.id)},no=()=>{const o=Et(Ht),{topViewInstance:e,sideViewInstance:n,backViewInstance:l,mainViewInstance:t,addPointCloudBox:d,addPointCloudSphere:f,setSelectedIDs:a,selectedIDs:u,pointCloudBoxList:g,pointCloudSphereList:m,hideAttributes:b,setHighlight2DDataList:E}=o,{addHistory:V,initHistory:A,pushHistoryUnderUpdatePolygon:T,pushHistoryUnderUpdateLine:R}=Xt(),{selectedPolygon:z}=Yt(),{updateSelectedBox:j,updateSelectedBoxes:_,getPointCloudByID:h}=lt(),{getPointCloudSphereByID:ht,updatePointCloudSphere:nt,selectedSphere:M}=Ft(),{currentData:H,config:w}=Zt(i=>{const{stepList:s,step:p,imgList:c,imgIndex:r}=i.annotation;return{currentData:c[r],config:dt(Mt.getCurrentStepInfo(p,s).config)}}),N=Wt(),{selectedBox:D}=lt(),{t:vt}=Qt(),it=D==null?void 0:D.info;if(!e||!n||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:Y}=e,Bt=i=>{t==null||t.generateBox(i),t==null||t.controls.update(),t==null||t.render()},wt=i=>{t==null||t.generateSphere(i),t==null||t.controls.update(),t==null||t.render()},bt=({newPoint:i,size:s,zoom:p,trackConfigurable:c})=>{var r;const P={attribute:(r=e.toolInstance.defaultAttribute)!=null?r:""};c===!0&&Object.assign(P,{trackID:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:m})});const C=tt(i,s,Y,void 0,P);a(i.id);const x=f(C);G(L.Top,i,C,p,x,w),V({newSphereParams:C})},St=({polygon:i,size:s,imgList:p,trackConfigurable:c,zoom:r,intelligentFit:P})=>{var C,x;const v={attribute:(C=e.toolInstance.defaultAttribute)!=null?C:""};c===!0&&Object.assign(v,{trackID:I.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:m})});const O=e==null?void 0:e.toolInstance,U=y({},i);let{boxParams:S,newPointList:Z}=ot(U,s,Y,void 0,v,P);if(S=N(K({tool:J.PointCloud,dataList:[S],stepConfig:w,action:"viewUpdateBox"}))[0],(w==null?void 0:w.lowerLimitPointsNumInBox)&&typeof S.count=="number"&&S.count<w.lowerLimitPointsNumInBox){Gt.info(vt("LowerLimitPointsNumInBox",{num:w.lowerLimitPointsNumInBox})),O.deletePolygon(S.id);return}P&&(Z==null?void 0:Z.length)&&(U.pointList=Z);const zt=b.includes(U.attribute),q=d(S),jt=(x=o==null?void 0:o.polygonList)!=null?x:[];e==null||e.updatePolygonList(q!=null?q:[],jt),zt?a([]):(a(S.id),O.selection.setSelectedIDs(U.id),F({omitView:L.Top,polygon:U,boxParams:S,zoom:r,newPointCloudBoxList:q}),P&&et(S,U,e,t)),V({newBoxParams:S})},It=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:p,newSphereList:c})=>{var r;const P=e==null?void 0:e.toolInstance;if(!(u.length===0||!P)){if(i||(D==null?void 0:D.info)){const C=i!=null?i:D==null?void 0:D.info;(r=P==null?void 0:P.selection)==null||r.setSelectedIDs(u[0]);const x=P.selectedPolygon;if(u.length===1&&C){F({omitView:L.Top,polygon:x,boxParams:C,newPointCloudBoxList:s});return}}if((p||M)&&u.length===1){const C=p!=null?p:M;P.setSelectedID(u[0]);const x=P.selectedPoint;C&&G(L.Top,x,C,void 0,c,w)}}},st=(i,s,p)=>{if(it){let c,r;switch(p){case L.Back:c=eo;break;case L.Side:c=gt;break;default:c=gt;break}r=c(i,s,it,n.pointCloudInstance);const C=N(K({tool:J.PointCloud,dataList:[r],stepConfig:w,action:"viewUpdateBox"}))[0],x=r.valid!==C.valid;if(r=C,t){const{count:O}=t.getSensesPointZAxisInPolygon(Rt(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=k(y({},r),{count:O})}const v=j(r);return r=v.find(O=>O.id===r.id),F({omitView:x?void 0:p,polygon:i,boxParams:r,newPointCloudBoxList:[r]}),v}},rt=(i,s,p)=>{if(M){let c,r;switch(p){case L.Back:c=oo;break;case L.Side:c=Pt;break;default:c=Pt;break}r=c(i,s,M);const P=nt(r);return G(p,i,r,void 0,P,w),P}},Dt=(i,s)=>{rt(i,s,L.Side)},Vt=(i,s)=>{rt(i,s,L.Back)},_t=(i,s)=>{st(i,s,L.Side)},Ot=(i,s)=>{st(i,s,L.Back)},Ut=(i,s)=>{R(i)},kt=(i,s)=>{const p=ht(i.id),c=tt(i,s,Y,p),r=nt(c);G(L.Top,i,c,void 0,r,w)},At=(i,s)=>{if(z){const c=i[0].newPolygon;c.pointList=c.pointList.map(r=>I.transferCanvas2World(r,s)),T(i[0].newPolygon);return}let p=i.map(({newPolygon:c})=>{const r=h(c.id),{boxParams:P}=ot(c,s,e.pointCloudInstance,r);return P});if(p=N(K({tool:J.PointCloud,dataList:p,stepConfig:w,action:"viewUpdateBox"})),p.length===1){const{newPolygon:c}=i[0],r=_(p);F({omitView:L.Top,polygon:c,boxParams:p[0],newPointCloudBoxList:r})}else{const c=_(p);c&&o.syncAllViewPointCloudColor(c)}},Tt=i=>{var s;if(D){const p=D==null?void 0:D.info.trackID,r=((s=e==null?void 0:e.toolInstance)==null?void 0:s.polygonList).find(x=>(x==null?void 0:x.trackID)===p),P=k(y({},D.info),{width:Number(i.widthDefault),depth:Number(i.depthDefault),height:Number(i.heightDefault)}),C=_([P]);F({omitView:L["3D"],polygon:r,boxParams:P,newPointCloudBoxList:C})}},G=(i,s,p,c,r,P)=>$(void 0,null,function*(){const C=H==null?void 0:H.url,x={[L.Side]:()=>{Ct(p,s,n,C,P)},[L.Back]:()=>{l&&xt(p,s,l,C,P)},[L.Top]:()=>{yt(p,s,e,t)}};Object.keys(x).forEach(v=>{v!==i&&x[v]()}),c&&(t==null||t.updateCameraZoom(c)),wt(p)}),F=i=>$(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:c,zoom:r,newPointCloudBoxList:P}=i,C=H==null?void 0:H.url;P&&(yield o.syncAllViewPointCloudColor(P));const x={[L.Side]:()=>{mt(c,p,n,C)},[L.Back]:()=>{l&&Lt(c,p,l,C)},[L.Top]:()=>{et(c,p,e,t)}};Object.keys(x).forEach(v=>{v!==s&&x[v]()}),r&&(t==null||t.updateCameraZoom(r)),Bt(c)});return{topViewAddSphere:bt,topViewAddBox:St,topViewSelectedChanged:It,topViewUpdatePoint:kt,sideViewUpdatePoint:Dt,backViewUpdatePoint:Vt,topViewUpdateBox:At,topViewUpdateLine:Ut,sideViewUpdateBox:_t,backViewUpdateBox:Ot,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),t==null||t.generateBoxes(i)},initPointCloud3d:i=>{if(!t)return;const s=I.getDefaultOrthographicParams(i);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...i)=>$(void 0,[...i],function*(s=H){var p,c,r,P,C,x;if(!(s==null?void 0:s.url)||!t)return;E([]),at(N,!0),ct(N,!0),yield t.loadPCDFile(s.url,(p=w==null?void 0:w.radius)!=null?p:X),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let v=[],O=[],U=[],S=[];t.updateTopCamera();const Z=(r=(c=dt(s.result))==null?void 0:c.valid)!=null?r:!0;o.setPointCloudValid(Z),(P=o.sideViewInstance)==null||P.clearAllData(),(C=o.backViewInstance)==null||C.clearAllData(),e.updateData(s.url,s.result,{radius:(x=w==null?void 0:w.radius)!=null?x:X}),s.result&&(v=I.getBoxParamsFromResultList(s.result),U=I.getPolygonListFromResultList(s.result),O=I.getLineListFromResultList(s.result),S=I.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(v),t==null||t.generateSpheres(S),yield o.syncAllViewPointCloudColor(v,[])),A({pointCloudBoxList:v,polygonList:U,lineList:O,pointCloudSphereList:S}),at(N,!1),ct(N,!1)}),updateViewsByDefaultSize:Tt}};export{xt as syncBackViewByPoint,Ct as syncSideViewByPoint,yt as syncTopViewByPoint,Lt as synchronizeBackView,mt as synchronizeSideView,et as synchronizeTopView,tt as topViewPoint2PointCloud,ot as topViewPolygon2PointCloud,no as usePointCloudViews};
1
+ import{EPointCloudName as J,MathUtils as B,getCuboidFromPointCloudBox as Rt}from"@labelbee/lb-annotation";import{EPerspectiveView as W,PointCloudUtils as I,DEFAULT_SPHERE_PARAMS as Nt}from"@labelbee/lb-utils";import{useContext as Et}from"react";import{PointCloudContext as Ht}from"../PointCloudContext.js";import{useSingleBox as lt}from"./useSingleBox.js";import{useSphere as Ft}from"./useSphere.js";import{useSelector as Zt,useDispatch as Wt}from"../../../store/ctx.js";import Mt from"../../../utils/StepUtils.js";import{jsonParser as dt}from"../../../utils/index.js";import{PreDataProcess as K,SetPointCloudLoading as at,SetLoadPCDFileLoading as ct}from"../../../store/annotation/actionCreators.js";import{message as Gt}from"antd";import{useTranslation as Qt}from"react-i18next";import{useHistory as Xt}from"./useHistory.js";import{usePolygon as Yt}from"./usePolygon.js";var qt=Object.defineProperty,Jt=Object.defineProperties,Kt=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertySymbols,$t=Object.prototype.hasOwnProperty,to=Object.prototype.propertyIsEnumerable,pt=(o,e,n)=>e in o?qt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,y=(o,e)=>{for(var n in e||(e={}))$t.call(e,n)&&pt(o,n,e[n]);if(ut)for(var n of ut(e))to.call(e,n)&&pt(o,n,e[n]);return o},k=(o,e)=>Jt(o,Kt(e)),$=(o,e,n)=>new Promise((l,t)=>{var d=u=>{try{a(n.next(u))}catch(C){t(C)}},f=u=>{try{a(n.throw(u))}catch(C){t(C)}},a=u=>u.done?l(u.value):Promise.resolve(u.value).then(d,f);a((n=n.apply(o,e)).next())});const Q=5,X=90,ft=.01,L={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},tt=(o,e,n,l,t)=>{const{x:d,y:f}=I.transferCanvas2World(o,e),{defaultZ:a}=Nt,u={center:{x:d,y:f,z:a},id:o.id},C=l?y(y({},l),u):k(y({},u),{attribute:"",valid:!0});return t&&Object.assign(C,t),C},ot=(o,e,n,l,t,d)=>{let f=o.pointList.map(h=>I.transferCanvas2World(h,e)),a=0,u=1,C={};if(n){const h=n.getSensesPointZAxisInPolygon(f,void 0,d);d&&h.fittedCoordinates.length>0&&(f=h.fittedCoordinates),a=(h.maxZ+h.minZ)/2,u=h.maxZ-h.minZ,C={count:h.zCount}}const[m,b,E]=f,V=B.getLineCenterPoint([m,E]),A=B.getLineLength(m,b),T=B.getLineLength(b,E),R=B.getRadiusFromQuadrangle(o.pointList);l&&(a=l.center.z,u=l.depth);const z={center:{x:V.x,y:V.y,z:a},width:d?T+ft:T,height:d?A+ft:A,depth:u,rotation:R,id:o.id},j=y(l?y(y({},l),z):k(y({},z),{attribute:"",valid:!0}),C);t&&Object.assign(j,t);const _=f.map(h=>I.transferWorld2Canvas(h,e));return{boxParams:j,newPointList:_}},gt=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return k(y({},n),{center:{x:n.center.x-l.x,y:n.center.y,z:n.center.z-l.y}})},Ct=(o,e,n,l)=>{const[t,d,f]=o.pointList,[a,u,C]=e.pointList,m=B.getLineCenterPoint([t,f]),b=B.getLineCenterPoint([a,C]),V={x:{x:m.x-b.x,y:m.y-b.y}.x,y:0,z:m.y-b.y},A=B.getLineLength(t,d),T=B.getLineLength(a,u),R=A-T,z=B.getLineLength(d,f),j=B.getLineLength(u,C),_=z-j,{newBoxParams:h}=l.getNewBoxBySideUpdate(V,_,R,n);return h},oo=(o,e,n)=>{const l={x:o.x-e.x,y:o.y-e.y};return k(y({},n),{center:{x:n.center.x,y:n.center.y-l.x,z:n.center.z-l.y}})},eo=(o,e,n,l)=>{const[t,d,f]=o.pointList,[a,u,C]=e.pointList,m=B.getLineCenterPoint([t,f]),b=B.getLineCenterPoint([a,C]),V={x:{x:m.x-b.x,y:m.y-b.y}.x,y:0,z:m.y-b.y},A=B.getLineLength(t,d),T=B.getLineLength(a,u),R=A-T,z=B.getLineLength(d,f),j=B.getLineLength(u,C),_=z-j;let{newBoxParams:h}=l.getNewBoxByBackUpdate(V,_,R,n);return h},Pt=(o,e,n,l,t)=>{var d;if(!n)return;const{toolInstance:f,pointCloudInstance:a}=n;a.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:X);const{cameraPositionVector:u}=a.updateOrthoCameraBySphere(o,W.Left);a.setInitCameraPosition(u);const{point2d:C,zoom:m}=a.getSphereSidePoint2DCoordinate(o);a.camera.zoom=m,a.camera.updateProjectionMatrix(),a.render(),f.initPosition(),f.zoomChangeOnCenter(m),f.setResult([k(y(y({},e),C),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),f.setSelectedID(e.id)},mt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=n;d.loadPCDFileByBox(l,o,{width:Q,depth:Q});const{cameraPositionVector:f}=d.updateOrthoCamera(o,W.Left);d.setInitCameraPosition(f);const{polygon2d:a,zoom:u}=d.getBoxSidePolygon2DCoordinate(o);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(u),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:a,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},xt=(o,e,n,l,t)=>{var d;if(!n)return;const{toolInstance:f,pointCloudInstance:a}=n;a.loadPCDFile(l,(d=t==null?void 0:t.radius)!=null?d:X);const{cameraPositionVector:u}=a.updateOrthoCameraBySphere(o,W.Back);a.setInitCameraPosition(u);const{point2d:C,zoom:m}=a.getSphereBackPoint2DCoordinate(o);a.camera.zoom=m,a.camera.updateProjectionMatrix(),a.render(),f.initPosition(),f.zoomChangeOnCenter(m),f.setResult([k(y(y({},e),C),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),f.setSelectedID(e.id)},Lt=(o,e,n,l)=>{if(!n)return;const{pointCloud2dOperation:t,pointCloudInstance:d}=n;d.loadPCDFileByBox(l,o,{height:Q,depth:Q});const{cameraPositionVector:f}=d.updateOrthoCamera(o,W.Back);d.setInitCameraPosition(f);const{polygon2d:a,zoom:u}=d.getBoxBackPolygon2DCoordinate(o);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),t.initPosition(),t.zoomChangeOnCenter(u),t.setResultAndSelectedID([{id:e.id,valid:o.valid,pointList:a,textAttribute:"",isRect:!0,attribute:o.attribute}],e.id)},yt=(o,e,n,l)=>{if(!n||!l)return;l.generateSphere(o),l.updateCameraBySphere(o,W.Top),l.render();const{toolInstance:t,pointCloudInstance:d}=n,{point2d:f}=d.getSphereTopPoint2DCoordinate(o),a=[...t.pointList].map(u=>u.id===e.id?k(y(y({},e),f),{valid:o.valid,textAttribute:"",attribute:o.attribute}):u);t.setResult(a),t.setSelectedID(e.id)},et=(o,e,n,l)=>{var t,d;if(!n||!l)return;l.generateBox(o,e.id),l.render();const{pointCloud2dOperation:f,pointCloudInstance:a}=n,{polygon2d:u}=a.getBoxTopPolygon2DCoordinate(o),C=[...f.polygonList],m=C.find(b=>b.id===e.id);m?(m.pointList=u,m.valid=(t=o.valid)!=null?t:!0):C.push({id:e.id,pointList:u,textAttribute:"",isRect:!0,valid:(d=o.valid)!=null?d:!0}),f.setResultAndSelectedID(C,e.id)},no=()=>{const o=Et(Ht),{topViewInstance:e,sideViewInstance:n,backViewInstance:l,mainViewInstance:t,addPointCloudBox:d,addPointCloudSphere:f,setSelectedIDs:a,selectedIDs:u,pointCloudBoxList:C,pointCloudSphereList:m,hideAttributes:b,setHighlight2DDataList:E}=o,{addHistory:V,initHistory:A,pushHistoryUnderUpdatePolygon:T,pushHistoryUnderUpdateLine:R}=Xt(),{selectedPolygon:z}=Yt(),{updateSelectedBox:j,updateSelectedBoxes:_,getPointCloudByID:h}=lt(),{getPointCloudSphereByID:ht,updatePointCloudSphere:nt,selectedSphere:M}=Ft(),{currentData:H,config:w}=Zt(i=>{const{stepList:s,step:p,imgList:c,imgIndex:r}=i.annotation;return{currentData:c[r],config:dt(Mt.getCurrentStepInfo(p,s).config)}}),N=Wt(),{selectedBox:D}=lt(),{t:vt}=Qt(),it=D==null?void 0:D.info;if(!e||!n||!l)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:Y}=e,Bt=i=>{t==null||t.generateBox(i),t==null||t.controls.update(),t==null||t.render()},wt=i=>{t==null||t.generateSphere(i),t==null||t.controls.update(),t==null||t.render()},bt=({newPoint:i,size:s,zoom:p,trackConfigurable:c})=>{var r;const g={attribute:(r=e.toolInstance.defaultAttribute)!=null?r:""};c===!0&&Object.assign(g,{trackID:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:m})});const P=tt(i,s,Y,void 0,g);a(i.id);const x=f(P);G(L.Top,i,P,p,x,w),V({newSphereParams:P})},St=({polygon:i,size:s,imgList:p,trackConfigurable:c,zoom:r,intelligentFit:g})=>{var P,x;const v={attribute:(P=e.toolInstance.defaultAttribute)!=null?P:""};c===!0&&Object.assign(v,{trackID:I.getNextTrackID({imgList:[],extraBoxList:C,extraSphereList:m})});const O=e==null?void 0:e.toolInstance,U=y({},i);let{boxParams:S,newPointList:Z}=ot(U,s,Y,void 0,v,g);if(S=N(K({tool:J.PointCloud,dataList:[S],stepConfig:w,action:"viewUpdateBox"}))[0],(w==null?void 0:w.lowerLimitPointsNumInBox)&&typeof S.count=="number"&&S.count<w.lowerLimitPointsNumInBox){Gt.info(vt("LowerLimitPointsNumInBox",{num:w.lowerLimitPointsNumInBox})),O.deletePolygon(S.id);return}g&&(Z==null?void 0:Z.length)&&(U.pointList=Z);const zt=b.includes(U.attribute),q=d(S),jt=(x=o==null?void 0:o.polygonList)!=null?x:[];e==null||e.updatePolygonList(q!=null?q:[],jt),zt?a([]):(a(S.id),O.selection.setSelectedIDs(U.id),F({omitView:L.Top,polygon:U,boxParams:S,zoom:r,newPointCloudBoxList:q}),g&&et(S,U,e,t)),V({newBoxParams:S})},It=({newSelectedBox:i,newPointCloudList:s,newSelectedSphere:p,newSphereList:c})=>{var r;const g=e==null?void 0:e.toolInstance;if(!(u.length===0||!g)){if(i||(D==null?void 0:D.info)){const P=i!=null?i:D==null?void 0:D.info;(r=g==null?void 0:g.selection)==null||r.setSelectedIDs(u[0]);const x=g.selectedPolygon;if(u.length===1&&P){F({omitView:L.Top,polygon:x,boxParams:P,newPointCloudBoxList:s});return}}if((p||M)&&u.length===1){const P=p!=null?p:M;g.setSelectedID(u[0]);const x=g.selectedPoint;P&&G(L.Top,x,P,void 0,c,w)}}},st=(i,s,p)=>{if(it){let c,r;switch(p){case L.Back:c=eo;break;case L.Side:c=Ct;break;default:c=Ct;break}r=c(i,s,it,n.pointCloudInstance);const P=N(K({tool:J.PointCloud,dataList:[r],stepConfig:w,action:"viewUpdateBox"}))[0],x=r.valid!==P.valid;if(r=P,t){const{count:O}=t.getSensesPointZAxisInPolygon(Rt(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=k(y({},r),{count:O})}const v=j(r);return r=v.find(O=>O.id===r.id),F({omitView:x?void 0:p,polygon:i,boxParams:r,newPointCloudBoxList:v}),v}},rt=(i,s,p)=>{if(M){let c,r;switch(p){case L.Back:c=oo;break;case L.Side:c=gt;break;default:c=gt;break}r=c(i,s,M);const g=nt(r);return G(p,i,r,void 0,g,w),g}},Dt=(i,s)=>{rt(i,s,L.Side)},Vt=(i,s)=>{rt(i,s,L.Back)},_t=(i,s)=>{st(i,s,L.Side)},Ot=(i,s)=>{st(i,s,L.Back)},Ut=(i,s)=>{R(i)},kt=(i,s)=>{const p=ht(i.id),c=tt(i,s,Y,p),r=nt(c);G(L.Top,i,c,void 0,r,w)},At=(i,s)=>{if(z){const c=i[0].newPolygon;c.pointList=c.pointList.map(r=>I.transferCanvas2World(r,s)),T(i[0].newPolygon);return}let p=i.map(({newPolygon:c})=>{const r=h(c.id),{boxParams:g}=ot(c,s,e.pointCloudInstance,r);return g});if(p=N(K({tool:J.PointCloud,dataList:p,stepConfig:w,action:"viewUpdateBox"})),p.length===1){const{newPolygon:c}=i[0],r=_(p);F({omitView:L.Top,polygon:c,boxParams:p[0],newPointCloudBoxList:r})}else{const c=_(p);c&&o.syncAllViewPointCloudColor(c)}},Tt=i=>{var s;if(D){const p=D==null?void 0:D.info.trackID,r=((s=e==null?void 0:e.toolInstance)==null?void 0:s.polygonList).find(x=>(x==null?void 0:x.trackID)===p),g=k(y({},D.info),{width:Number(i.widthDefault),depth:Number(i.depthDefault),height:Number(i.heightDefault)}),P=_([g]);F({omitView:L["3D"],polygon:r,boxParams:g,newPointCloudBoxList:P})}},G=(i,s,p,c,r,g)=>$(void 0,null,function*(){const P=H==null?void 0:H.url,x={[L.Side]:()=>{Pt(p,s,n,P,g)},[L.Back]:()=>{l&&xt(p,s,l,P,g)},[L.Top]:()=>{yt(p,s,e,t)}};Object.keys(x).forEach(v=>{v!==i&&x[v]()}),c&&(t==null||t.updateCameraZoom(c)),wt(p)}),F=i=>$(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:c,zoom:r,newPointCloudBoxList:g}=i,P=H==null?void 0:H.url;g&&(yield o.syncAllViewPointCloudColor(g));const x={[L.Side]:()=>{mt(c,p,n,P)},[L.Back]:()=>{l&&Lt(c,p,l,P)},[L.Top]:()=>{et(c,p,e,t)}};Object.keys(x).forEach(v=>{v!==s&&x[v]()}),r&&(t==null||t.updateCameraZoom(r)),Bt(c)});return{topViewAddSphere:bt,topViewAddBox:St,topViewSelectedChanged:It,topViewUpdatePoint:kt,sideViewUpdatePoint:Dt,backViewUpdatePoint:Vt,topViewUpdateBox:At,topViewUpdateLine:Ut,sideViewUpdateBox:_t,backViewUpdateBox:Ot,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),t==null||t.generateBoxes(i)},initPointCloud3d:i=>{if(!t)return;const s=I.getDefaultOrthographicParams(i);t.initOrthographicCamera(s),t.initRenderer(),t.render()},updatePointCloudData:(...i)=>$(void 0,[...i],function*(s=H){var p,c,r,g,P,x;if(!(s==null?void 0:s.url)||!t)return;E([]),at(N,!0),ct(N,!0),yield t.loadPCDFile(s.url,(p=w==null?void 0:w.radius)!=null?p:X),t==null||t.clearAllBox(),t==null||t.clearAllSphere();let v=[],O=[],U=[],S=[];t.updateTopCamera();const Z=(r=(c=dt(s.result))==null?void 0:c.valid)!=null?r:!0;o.setPointCloudValid(Z),(g=o.sideViewInstance)==null||g.clearAllData(),(P=o.backViewInstance)==null||P.clearAllData(),e.updateData(s.url,s.result,{radius:(x=w==null?void 0:w.radius)!=null?x:X}),s.result&&(v=I.getBoxParamsFromResultList(s.result),U=I.getPolygonListFromResultList(s.result),O=I.getLineListFromResultList(s.result),S=I.getSphereParamsFromResultList(s.result),t==null||t.generateBoxes(v),t==null||t.generateSpheres(S),yield o.syncAllViewPointCloudColor(v,[])),A({pointCloudBoxList:v,polygonList:U,lineList:O,pointCloudSphereList:S}),at(N,!1),ct(N,!1)}),updateViewsByDefaultSize:Tt}};export{xt as syncBackViewByPoint,Pt as syncSideViewByPoint,yt as syncTopViewByPoint,Lt as synchronizeBackView,mt as synchronizeSideView,et as synchronizeTopView,tt as topViewPoint2PointCloud,ot as topViewPolygon2PointCloud,no as usePointCloudViews};
@@ -1 +1 @@
1
- import{getClassName as n}from"../../utils/dom.js";import t,{useContext as N,useState as T,useEffect as p}from"react";import h from"./PointCloud3DView.js";import I from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import D from"./PointCloudSideView.js";import F from"./PointCloud2DView.js";import R from"./PointCloudListener.js";import _ from"./PointCloudSegmentListener.js";import y from"./PointCloudSegment.js";import G from"./PointCloudSegmentStatus.js";import O from"./PointCloudSegmentToolbar.js";import{connect as Z}from"react-redux";import{LabelBeeContext as U}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as W,AnnotatedAttributesPanelFixedRight as $}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as k}from"./PointCloudContext.js";import{PointCloudUtils as q,EPointCloudPattern as z}from"@labelbee/lb-utils";import{useCustomToolInstance as H}from"../../hooks/annotation.js";import{jsonParser as J}from"../../utils/index.js";import{a2MapStateToProps as K}from"../../store/annotation/map.js";import g from"classnames";import Q from"./components/sideAndBackOverView/index.js";const X=({currentData:s,imgList:E,drawLayerSlot:d,checkMode:l,intelligentFit:L,imgIndex:x,loadPCDFileProgress:b})=>{const e=N(k),{globalPattern:c,setGlobalPattern:v,selectedIDs:C}=e,[i,P]=T(!1),S=(C==null?void 0:C.length)>0&&i,j=J(s.result),{toolInstanceRef:r,clearToolInstance:w}=H({basicInfo:j});if(p(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==c&&(v(o),e.clearAllDetectionInstance(),w())}},[c]),p(()=>{var o;if(s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:V,segmentation:A}=q.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(V),e.setSegmentation(A)}},[x]),p(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),E.length===0)return null;if(c===z.Segmentation)return t.createElement(t.Fragment,null,t.createElement(_,{checkMode:l,toolInstanceRef:r}),t.createElement(O,null),t.createElement(y,{checkMode:l}),t.createElement(G,null),d==null?void 0:d({direct:!0}));let f=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(I,{checkMode:l}),t.createElement(D,{checkMode:l}));return i&&(f=t.createElement(Q,{selectAndEnlarge:S,checkMode:l})),t.createElement(t.Fragment,null,t.createElement(R,{checkMode:l,toolInstanceRef:r}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(W,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(h,null),f),t.createElement("div",{className:g({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:i})},t.createElement(B,{drawLayerSlot:d,checkMode:l,intelligentFit:L,setIsEnlargeTopView:P,onExitZoom:()=>{P(!1)},isEnlargeTopView:i}),t.createElement("div",{className:g({[n("point-cloud-container","right-bottom")]:!i,[n("point-cloud-container","right-bottom-floatLeft")]:i})},!b&&t.createElement(F,{isEnlargeTopView:i,thumbnailWidth:i?300:455})))),t.createElement($,null))))};var Y=Z(K,null,null,{context:U})(X);export{Y as default};
1
+ import{getClassName as n}from"../../utils/dom.js";import t,{useContext as N,useState as T,useEffect as p}from"react";import h from"./PointCloud3DView.js";import I from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import D from"./PointCloudSideView.js";import F from"./PointCloud2DView.js";import R from"./PointCloudListener.js";import _ from"./PointCloudSegmentListener.js";import y from"./PointCloudSegment.js";import G from"./PointCloudSegmentStatus.js";import O from"./PointCloudSegmentToolbar.js";import{connect as Z}from"react-redux";import{LabelBeeContext as U}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as W,AnnotatedAttributesPanelFixedRight as $}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as k}from"./PointCloudContext.js";import{PointCloudUtils as q,EPointCloudPattern as z}from"@labelbee/lb-utils";import{useCustomToolInstance as H}from"../../hooks/annotation.js";import{jsonParser as J}from"../../utils/index.js";import{a2MapStateToProps as K}from"../../store/annotation/map.js";import g from"classnames";import Q from"./components/sideAndBackOverView/index.js";const X=({currentData:s,imgList:E,drawLayerSlot:d,checkMode:l,intelligentFit:L,imgIndex:x,loadPCDFileLoading:b})=>{const e=N(k),{globalPattern:c,setGlobalPattern:v,selectedIDs:C}=e,[i,P]=T(!1),S=(C==null?void 0:C.length)>0&&i,j=J(s.result),{toolInstanceRef:r,clearToolInstance:w}=H({basicInfo:j});if(p(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==c&&(v(o),e.clearAllDetectionInstance(),w())}},[c]),p(()=>{var o;if(s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:V,segmentation:A}=q.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(V),e.setSegmentation(A)}},[x]),p(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),E.length===0)return null;if(c===z.Segmentation)return t.createElement(t.Fragment,null,t.createElement(_,{checkMode:l,toolInstanceRef:r}),t.createElement(O,null),t.createElement(y,{checkMode:l}),t.createElement(G,null),d==null?void 0:d({direct:!0}));let f=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(I,{checkMode:l}),t.createElement(D,{checkMode:l}));return i&&(f=t.createElement(Q,{selectAndEnlarge:S,checkMode:l})),t.createElement(t.Fragment,null,t.createElement(R,{checkMode:l,toolInstanceRef:r}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(W,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(h,null),f),t.createElement("div",{className:g({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:i})},t.createElement(B,{drawLayerSlot:d,checkMode:l,intelligentFit:L,setIsEnlargeTopView:P,onExitZoom:()=>{P(!1)},isEnlargeTopView:i}),t.createElement("div",{className:g({[n("point-cloud-container","right-bottom")]:!i,[n("point-cloud-container","right-bottom-floatLeft")]:i})},!b&&t.createElement(F,{isEnlargeTopView:i,thumbnailWidth:i?300:455})))),t.createElement($,null))))};var Y=Z(K,null,null,{context:U})(X);export{Y as default};
package/es/index.css CHANGED
@@ -1346,7 +1346,7 @@
1346
1346
  background-color: #fff;
1347
1347
  color: #000000;
1348
1348
  }
1349
- .bee-point-cloud-wrapper .bee-point-cloud-3d-containerZoom {
1349
+ .bee-point-cloud-wrapper .bee-point-cloud-container__zoom {
1350
1350
  position: absolute;
1351
1351
  top: 0px;
1352
1352
  left: 0px;
@@ -1354,7 +1354,7 @@
1354
1354
  height: 100%;
1355
1355
  z-index: 1001;
1356
1356
  }
1357
- .bee-point-cloud-wrapper .bee-point-cloud-3d-containerZoom .bee-point-cloud-container__header {
1357
+ .bee-point-cloud-wrapper .bee-point-cloud-container__zoom .bee-point-cloud-container__header {
1358
1358
  background-color: #4c4c4c;
1359
1359
  height: auto;
1360
1360
  line-height: normal;
@@ -1366,6 +1366,9 @@
1366
1366
  border-bottom: 1px solid;
1367
1367
  font-size: 14px;
1368
1368
  }
1369
+ .bee-point-cloud-wrapper .bee-point-cloud-container__zoom .bee-point-cloud-highlight-view {
1370
+ display: none;
1371
+ }
1369
1372
  .bee-point-cloud-wrapper .bee-point-cloud-container__left {
1370
1373
  width: 455px;
1371
1374
  display: flex;
@@ -1 +1 @@
1
- const T={INIT_ALL_STATE:"@@INIT_ALL_STATE",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",UPDATE_BEFORE_ROTATE:"@@UPDATE_BEFORE_ROTATE",SET_LOADING:"@@SET_LOADING",SET_LOADPCDFILE_PROGRESS:"@@SET_LOADPCDFILE_PROGRESS",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING",SET_CHECK_MODE:"@@SET_CHECK_MODE",SET_TASK_STEP_LIST:"@@SET_TASK_STEP_LIST",UPDATE_ANNOTATION_VALID:"@@UPDATE_ANNOTATION_VALID",BATCH_UPDATE_TRACK_ID:"@@BATCH_UPDATE_TRACK_ID",BATCH_UPDATE_RESULT_BY_TRACK_ID:"@@BATCH_UPDATE_RESULT_BY_TRACK_ID",BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:"@@BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT",SET_PREDICT_RESULT_VISIBLE:"@@SET_PREDICT_RESULT_VISIBLE",SET_PREDICT_RESULT:"@@SET_PREDICT_RESULT",SET_HIGHLIGHT_ATTRIBUTE:"@@SET_HIGHLIGHT_ATTRIBUTE",UPDATE_PRE_DATA_PROCESS:"@@UPDATE_PRE_DATA_PROCESS"},_={UPDATE_IMG_ATTRIBUTE:"@@UPDATE_IMG_ATTRIBUTE",INIT_IMG_ATTRIBUTE:"@@INIT_IMG_ATTRIBUTE"},E={INIT_TOOL_STYLE_CONFIG:"@@INIT_TOOL_STYLE_CONFIG",UPDATE_TOOL_STYLE_CONFIG:"@@UPDATE_TOOL_STYLE_CONFIG"};export{T as ANNOTATION_ACTIONS,_ as IMAGE_ATTRIBUTE_ACTIONS,E as TOOL_STYLE_ACTIONS};
1
+ const T={INIT_ALL_STATE:"@@INIT_ALL_STATE",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",UPDATE_BEFORE_ROTATE:"@@UPDATE_BEFORE_ROTATE",SET_LOADING:"@@SET_LOADING",SET_LOADPCDFILE_LOADING:"@@SET_LOADPCDFILE_LOADING",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING",SET_CHECK_MODE:"@@SET_CHECK_MODE",SET_TASK_STEP_LIST:"@@SET_TASK_STEP_LIST",UPDATE_ANNOTATION_VALID:"@@UPDATE_ANNOTATION_VALID",BATCH_UPDATE_TRACK_ID:"@@BATCH_UPDATE_TRACK_ID",BATCH_UPDATE_RESULT_BY_TRACK_ID:"@@BATCH_UPDATE_RESULT_BY_TRACK_ID",BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:"@@BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT",SET_PREDICT_RESULT_VISIBLE:"@@SET_PREDICT_RESULT_VISIBLE",SET_PREDICT_RESULT:"@@SET_PREDICT_RESULT",SET_HIGHLIGHT_ATTRIBUTE:"@@SET_HIGHLIGHT_ATTRIBUTE",UPDATE_PRE_DATA_PROCESS:"@@UPDATE_PRE_DATA_PROCESS"},_={UPDATE_IMG_ATTRIBUTE:"@@UPDATE_IMG_ATTRIBUTE",INIT_IMG_ATTRIBUTE:"@@INIT_IMG_ATTRIBUTE"},E={INIT_TOOL_STYLE_CONFIG:"@@INIT_TOOL_STYLE_CONFIG",UPDATE_TOOL_STYLE_CONFIG:"@@UPDATE_TOOL_STYLE_CONFIG"};export{T as ANNOTATION_ACTIONS,_ as IMAGE_ATTRIBUTE_ACTIONS,E as TOOL_STYLE_ACTIONS};
@@ -1 +1 @@
1
- import{ANNOTATION_ACTIONS as a}from"../Actions.js";import{LoadFileAndFileData as O,getStepConfig as M}from"./reducer.js";import{ESubmitType as _}from"../../constant/index.js";import{EPageTurningOperation as y}from"../../data/enums/AnnotationSize.js";import j from"../../utils/PageOperator.js";import{jsonParser as K}from"../../utils/index.js";import{getBoxesByTrackID as V}from"../../components/predictTracking/previewResult/util.js";var v=(t,e,n)=>new Promise((o,r)=>{var i=u=>{try{d(n.next(u))}catch(p){r(p)}},s=u=>{try{d(n.throw(u))}catch(p){r(p)}},d=u=>u.done?o(u.value):Promise.resolve(u.value).then(i,s);d((n=n.apply(t,e)).next())});const N=(t,e)=>e.map(n=>t(n)),J=t=>t===y.Forward?_.Forward:t===y.Backward?_.Backward:t===y.Jump?_.Jump:_.Forward,Y=(t,e)=>{var n,o;const{imgList:r,imgIndex:i}=t,{dataSourceStep:s}=M(t.stepList,t.step);return((o=(n=K(r[i-1].result)[`step_${s}`])==null?void 0:n.result)==null?void 0:o.length)-1||e};function W(t){return{type:a.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function x({stepList:t}){return{type:a.SET_TASK_STEP_LIST,payload:{stepList:t}}}function G({stepList:t,step:e}){return{type:a.SET_TASK_CONFIG,payload:{stepList:t,step:e}}}function P(t){return{type:a.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function U(t){return{type:a.UPDATE_ON_SAVE,payload:{onSave:t}}}function L(t){return{type:a.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function D(t){return{type:a.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function R(t){return{type:a.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function m(t){return{type:a.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function C(t){return{type:a.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function X(){return{type:a.UPDATE_ROTATE}}function w(t){return{type:a.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function g(t){return{type:a.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function h(t){return{type:a.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function q(){return{type:a.COPY_BACKWARD_RESULT}}function z({id:t,newID:e,rangeIndex:n,imgList:o}){return{type:a.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:e,rangeIndex:n,imgList:o}}}function Z(t,e,n){return{type:a.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:e,rangeIndex:n}}}function $(){return{type:a.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const F=t=>({type:a.SET_CHECK_MODE,payload:{checkMode:t}}),B=t=>({type:a.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function Q({onSubmit:t,onSave:e,onPageChange:n,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,step:d,stepList:u,skipBeforePageTurning:p,beforeRotate:T,checkMode:l,highlightAttribute:E,preDataProcess:A}){const c=[];return t&&c.push(P(t)),e&&c.push(U(e)),n&&c.push(L(n)),o&&c.push(D(o)),r&&c.push(R(r)),s&&c.push(C(s)),i&&c.push(m(i)),p&&c.push(w(p)),T&&c.push(g(T)),A&&c.push(h(A)),typeof l=="boolean"&&c.push(F(l)),c.push(B(E)),c.push(G({stepList:u,step:d})),c.push({type:a.CALC_STEP_PROGRESS}),c.push({type:a.INIT_TOOL}),H=>N(H,c)}function tt({onSubmit:t,onSave:e,onPageChange:n,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,stepList:d,beforeRotate:u,highlightAttribute:p,preDataProcess:T}){const l=[];return t&&l.push(P(t)),e&&l.push(U(e)),n&&l.push(L(n)),o&&l.push(D(o)),r&&l.push(R(r)),s&&l.push(C(s)),i&&l.push(m(i)),u&&l.push(g(u)),T&&l.push(h(T)),l.push(B(p)),l.push(x({stepList:d})),E=>N(E,l)}const et=(t,e)=>{var n;const o=e==null?void 0:e.findIndex(r=>(r==null?void 0:r.step)===t);return(n=e[o+1])==null?void 0:n.step},nt=t=>(e,n)=>{const{annotation:o}=n(),{step:r,stepList:i}=o,s=et(r,i);return[e(k(s,t))]},k=(t,e)=>(n,o)=>{var r,i;const{annotation:s}=o();(r=s==null?void 0:s.onStepChange)==null||r.call(s,t);const d=(i=s==null?void 0:s.imgIndex)!=null?i:0;return[n({type:a.SUBMIT_RESULT}),n({type:a.SUBMIT_FILE_DATA,payload:{submitType:_.StepChanged}}),n({type:a.SET_STEP,payload:{toStep:t}}),n({type:a.CALC_STEP_PROGRESS}),n(O(e!=null?e:d,0))]},f=t=>e=>[e({type:a.SUBMIT_RESULT}),e({type:a.SUBMIT_FILE_DATA,payload:{submitType:t}})],at=(t,e,n,o)=>[t(f(n)),t(O(e,o))],ot=(t,e)=>[t({type:a.SUBMIT_RESULT}),t({type:a.SET_BASIC_INDEX,payload:{basicIndex:e}})],rt=(t,e)=>{t({type:a.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:e}})},it=(t=!1)=>(e,n)=>S(e,n,y.Backward,t),st=(t=!1)=>(e,n)=>S(e,n,y.Forward,t),ut=(t,e=!1)=>(n,o)=>{if(t!==o().imgIndex)return S(n,o,y.Jump,e,t)},b=(t,e,n,o)=>v(void 0,null,function*(){var r;const{loadFileList:i,imgList:s,pageSize:d}=e().annotation,u=Math.floor(n/d);I(t,!0);try{const p=yield i(u,d);if(I(t,!1),!((r=p==null?void 0:p.fileList)==null?void 0:r.length)||!(p==null?void 0:p.total))throw new Error("fileList and total are required");const T=o?new Array(p.total):[...s];return T.splice(u*d,d,...p.fileList),t({type:a.UPDATE_IMG_LIST,payload:{imgList:T}}),!0}catch(p){I(t,!1),console.error(p)}}),S=(t,e,n,o=!1,r)=>v(void 0,null,function*(){var i;const s=e().annotation,{fileIndexChanged:d,fileIndex:u,basicIndexChanged:p,basicIndex:T}=j.getNextPageInfo(n,s,r),l=J(n);if(rt(t,o),d){if(s.loading||!s.imgList[u]&&!(yield b(t,e,u)))return;(i=s.onPageChange)==null||i.call(s,u);const E=l===_.Backward?Y(e().annotation,T):T;return at(t,u,l,E)}return p?ot(t,T):t(f(l))}),pt=t=>{t(f(_.Save)),t({type:a.SAVE_RESULT})},I=(t,e)=>{t({type:a.SET_LOADING,payload:{loading:e}})},lt=(t,e)=>{t({type:a.SET_LOADING,payload:{loading:e}})},dt=(t,e)=>{t({type:a.SET_LOADPCDFILE_PROGRESS,payload:{loadPCDFileProgress:e}})},ct=t=>{t({type:a.INIT_ALL_STATE,payload:{}})},Tt=(t,e)=>{t({type:a.SET_PREDICT_RESULT,payload:{result:e}})},_t=(t,e)=>{t({type:a.SET_PREDICT_RESULT_VISIBLE,payload:{visible:e}})},yt=(t,e)=>(n,o)=>{const{imgList:r,step:i}=o().annotation;return V(r,i,t,e)},Et=t=>(e,n)=>{var o,r;const{annotation:i}=n();return(r=(o=i==null?void 0:i.preDataProcess)==null?void 0:o.call(i,t))!=null?r:t.dataList};export{$ as BatchUpdateImgListResultByPredictResult,Z as BatchUpdateResultByTrackID,z as BatchUpdateTrackID,pt as ChangeSave,q as CopyBackWordResult,S as DispatcherTurning,yt as GetBoxesByID,ct as InitAnnotationState,Q as InitTaskData,it as PageBackward,st as PageForward,ut as PageJump,Et as PreDataProcess,I as SetAnnotationLoading,dt as SetLoadPcdFileProgress,lt as SetPointCloudLoading,Tt as SetPredictResult,_t as SetPredictResultVisible,G as SetTaskConfig,x as SetTaskStepList,nt as ToNextStep,f as ToSubmitFileData,g as UpdateBeforeRotate,F as UpdateCheckMode,R as UpdateGetFileData,C as UpdateGetFileList,B as UpdateHighlightAttribute,tt as UpdateInjectFunc,L as UpdateOnPageChange,U as UpdateOnSave,D as UpdateOnStepChange,P as UpdateOnSubmit,m as UpdatePageSize,h as UpdatePreDataProcess,k as UpdateProcessingStep,X as UpdateRotate,w as UpdateSkipBeforePageTurning,W as UpdateToolInstance,b as loadImgList};
1
+ import{ANNOTATION_ACTIONS as a}from"../Actions.js";import{LoadFileAndFileData as O,getStepConfig as M}from"./reducer.js";import{ESubmitType as _}from"../../constant/index.js";import{EPageTurningOperation as y}from"../../data/enums/AnnotationSize.js";import j from"../../utils/PageOperator.js";import{jsonParser as K}from"../../utils/index.js";import{getBoxesByTrackID as V}from"../../components/predictTracking/previewResult/util.js";var v=(t,e,n)=>new Promise((o,r)=>{var i=u=>{try{d(n.next(u))}catch(p){r(p)}},s=u=>{try{d(n.throw(u))}catch(p){r(p)}},d=u=>u.done?o(u.value):Promise.resolve(u.value).then(i,s);d((n=n.apply(t,e)).next())});const N=(t,e)=>e.map(n=>t(n)),J=t=>t===y.Forward?_.Forward:t===y.Backward?_.Backward:t===y.Jump?_.Jump:_.Forward,Y=(t,e)=>{var n,o;const{imgList:r,imgIndex:i}=t,{dataSourceStep:s}=M(t.stepList,t.step);return((o=(n=K(r[i-1].result)[`step_${s}`])==null?void 0:n.result)==null?void 0:o.length)-1||e};function W(t){return{type:a.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function x({stepList:t}){return{type:a.SET_TASK_STEP_LIST,payload:{stepList:t}}}function G({stepList:t,step:e}){return{type:a.SET_TASK_CONFIG,payload:{stepList:t,step:e}}}function P(t){return{type:a.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function U(t){return{type:a.UPDATE_ON_SAVE,payload:{onSave:t}}}function L(t){return{type:a.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function D(t){return{type:a.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function R(t){return{type:a.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function C(t){return{type:a.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function m(t){return{type:a.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function X(){return{type:a.UPDATE_ROTATE}}function w(t){return{type:a.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function g(t){return{type:a.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function h(t){return{type:a.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function q(){return{type:a.COPY_BACKWARD_RESULT}}function z({id:t,newID:e,rangeIndex:n,imgList:o}){return{type:a.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:e,rangeIndex:n,imgList:o}}}function Z(t,e,n){return{type:a.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:e,rangeIndex:n}}}function $(){return{type:a.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const F=t=>({type:a.SET_CHECK_MODE,payload:{checkMode:t}}),B=t=>({type:a.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function Q({onSubmit:t,onSave:e,onPageChange:n,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,step:d,stepList:u,skipBeforePageTurning:p,beforeRotate:T,checkMode:l,highlightAttribute:E,preDataProcess:A}){const c=[];return t&&c.push(P(t)),e&&c.push(U(e)),n&&c.push(L(n)),o&&c.push(D(o)),r&&c.push(R(r)),s&&c.push(m(s)),i&&c.push(C(i)),p&&c.push(w(p)),T&&c.push(g(T)),A&&c.push(h(A)),typeof l=="boolean"&&c.push(F(l)),c.push(B(E)),c.push(G({stepList:u,step:d})),c.push({type:a.CALC_STEP_PROGRESS}),c.push({type:a.INIT_TOOL}),H=>N(H,c)}function tt({onSubmit:t,onSave:e,onPageChange:n,onStepChange:o,getFileData:r,pageSize:i,loadFileList:s,stepList:d,beforeRotate:u,highlightAttribute:p,preDataProcess:T}){const l=[];return t&&l.push(P(t)),e&&l.push(U(e)),n&&l.push(L(n)),o&&l.push(D(o)),r&&l.push(R(r)),s&&l.push(m(s)),i&&l.push(C(i)),u&&l.push(g(u)),T&&l.push(h(T)),l.push(B(p)),l.push(x({stepList:d})),E=>N(E,l)}const et=(t,e)=>{var n;const o=e==null?void 0:e.findIndex(r=>(r==null?void 0:r.step)===t);return(n=e[o+1])==null?void 0:n.step},nt=t=>(e,n)=>{const{annotation:o}=n(),{step:r,stepList:i}=o,s=et(r,i);return[e(k(s,t))]},k=(t,e)=>(n,o)=>{var r,i;const{annotation:s}=o();(r=s==null?void 0:s.onStepChange)==null||r.call(s,t);const d=(i=s==null?void 0:s.imgIndex)!=null?i:0;return[n({type:a.SUBMIT_RESULT}),n({type:a.SUBMIT_FILE_DATA,payload:{submitType:_.StepChanged}}),n({type:a.SET_STEP,payload:{toStep:t}}),n({type:a.CALC_STEP_PROGRESS}),n(O(e!=null?e:d,0))]},f=t=>e=>[e({type:a.SUBMIT_RESULT}),e({type:a.SUBMIT_FILE_DATA,payload:{submitType:t}})],at=(t,e,n,o)=>[t(f(n)),t(O(e,o))],ot=(t,e)=>[t({type:a.SUBMIT_RESULT}),t({type:a.SET_BASIC_INDEX,payload:{basicIndex:e}})],rt=(t,e)=>{t({type:a.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:e}})},it=(t=!1)=>(e,n)=>S(e,n,y.Backward,t),st=(t=!1)=>(e,n)=>S(e,n,y.Forward,t),ut=(t,e=!1)=>(n,o)=>{if(t!==o().imgIndex)return S(n,o,y.Jump,e,t)},b=(t,e,n,o)=>v(void 0,null,function*(){var r;const{loadFileList:i,imgList:s,pageSize:d}=e().annotation,u=Math.floor(n/d);I(t,!0);try{const p=yield i(u,d);if(I(t,!1),!((r=p==null?void 0:p.fileList)==null?void 0:r.length)||!(p==null?void 0:p.total))throw new Error("fileList and total are required");const T=o?new Array(p.total):[...s];return T.splice(u*d,d,...p.fileList),t({type:a.UPDATE_IMG_LIST,payload:{imgList:T}}),!0}catch(p){I(t,!1),console.error(p)}}),S=(t,e,n,o=!1,r)=>v(void 0,null,function*(){var i;const s=e().annotation,{fileIndexChanged:d,fileIndex:u,basicIndexChanged:p,basicIndex:T}=j.getNextPageInfo(n,s,r),l=J(n);if(rt(t,o),d){if(s.loading||!s.imgList[u]&&!(yield b(t,e,u)))return;(i=s.onPageChange)==null||i.call(s,u);const E=l===_.Backward?Y(e().annotation,T):T;return at(t,u,l,E)}return p?ot(t,T):t(f(l))}),pt=t=>{t(f(_.Save)),t({type:a.SAVE_RESULT})},I=(t,e)=>{t({type:a.SET_LOADING,payload:{loading:e}})},lt=(t,e)=>{t({type:a.SET_LOADING,payload:{loading:e}})},dt=(t,e)=>{t({type:a.SET_LOADPCDFILE_LOADING,payload:{loadPCDFileLoading:e}})},ct=t=>{t({type:a.INIT_ALL_STATE,payload:{}})},Tt=(t,e)=>{t({type:a.SET_PREDICT_RESULT,payload:{result:e}})},_t=(t,e)=>{t({type:a.SET_PREDICT_RESULT_VISIBLE,payload:{visible:e}})},yt=(t,e)=>(n,o)=>{const{imgList:r,step:i}=o().annotation;return V(r,i,t,e)},Et=t=>(e,n)=>{var o,r;const{annotation:i}=n();return(r=(o=i==null?void 0:i.preDataProcess)==null?void 0:o.call(i,t))!=null?r:t.dataList};export{$ as BatchUpdateImgListResultByPredictResult,Z as BatchUpdateResultByTrackID,z as BatchUpdateTrackID,pt as ChangeSave,q as CopyBackWordResult,S as DispatcherTurning,yt as GetBoxesByID,ct as InitAnnotationState,Q as InitTaskData,it as PageBackward,st as PageForward,ut as PageJump,Et as PreDataProcess,I as SetAnnotationLoading,dt as SetLoadPCDFileLoading,lt as SetPointCloudLoading,Tt as SetPredictResult,_t as SetPredictResultVisible,G as SetTaskConfig,x as SetTaskStepList,nt as ToNextStep,f as ToSubmitFileData,g as UpdateBeforeRotate,F as UpdateCheckMode,R as UpdateGetFileData,m as UpdateGetFileList,B as UpdateHighlightAttribute,tt as UpdateInjectFunc,L as UpdateOnPageChange,U as UpdateOnSave,D as UpdateOnStepChange,P as UpdateOnSubmit,C as UpdatePageSize,h as UpdatePreDataProcess,k as UpdateProcessingStep,X as UpdateRotate,w as UpdateSkipBeforePageTurning,W as UpdateToolInstance,b as loadImgList};
@@ -1 +1 @@
1
- import p from"../../utils/StepUtils.js";import{jsonParser as u}from"../../utils/index.js";const c=n=>{var o,i,r;const{annotation:{imgList:s,imgIndex:l,highlightAttribute:e,loadPCDFileProgress:a}}=n,g=(o=s[l])!=null?o:{},t=p.getCurrentStepInfo((i=n.annotation)==null?void 0:i.step,(r=n.annotation)==null?void 0:r.stepList);return{currentData:g,imgIndex:l,imgList:s,stepInfo:t,config:u(t==null?void 0:t.config),configString:t==null?void 0:t.config,highlightAttribute:e,loadPCDFileProgress:a}};export{c as a2MapStateToProps};
1
+ import p from"../../utils/StepUtils.js";import{jsonParser as u}from"../../utils/index.js";const c=n=>{var o,i,l;const{annotation:{imgList:r,imgIndex:s,highlightAttribute:e,loadPCDFileLoading:a}}=n,g=(o=r[s])!=null?o:{},t=p.getCurrentStepInfo((i=n.annotation)==null?void 0:i.step,(l=n.annotation)==null?void 0:l.stepList);return{currentData:g,imgIndex:s,imgList:r,stepInfo:t,config:u(t==null?void 0:t.config),configString:t==null?void 0:t.config,highlightAttribute:e,loadPCDFileLoading:a}};export{c as a2MapStateToProps};
@@ -1 +1 @@
1
- import{getFormatSize as Et}from"../../components/customResizeHook/index.js";import{ESubmitType as K}from"../../constant/index.js";import St from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as b}from"../../utils/index.js";import W from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as Dt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as st,composeResult as Y}from"../../utils/data.js";import w from"../../utils/StepUtils.js";import lt from"../../utils/ToolUtils.js";import{MathUtils as it,CommonToolUtils as At,AnnotationEngine as vt,ImgUtils as yt}from"@labelbee/lb-annotation";import{PointCloudUtils as rt,i18n as x}from"@labelbee/lb-utils";import{Modal as ut}from"antd";import{message as at}from"antd/es";import ct from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as dt}from"../../data/enums/ToolType.js";var Rt=Object.defineProperty,Pt=Object.defineProperties,Ct=Object.getOwnPropertyDescriptors,pt=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,gt=(t,e,r)=>e in t?Rt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,o=(t,e)=>{for(var r in e||(e={}))ht.call(e,r)&&gt(t,r,e[r]);if(pt)for(var r of pt(e))Ot.call(e,r)&&gt(t,r,e[r]);return t},l=(t,e)=>Pt(t,Ct(e)),_t=(t,e,r)=>new Promise((E,p)=>{var f=m=>{try{D(r.next(m))}catch(y){p(y)}},S=m=>{try{D(r.throw(m))}catch(y){p(y)}},D=m=>m.done?E(m.value):Promise.resolve(m.value).then(f,S);D((r=r.apply(t,e)).next())});const U=(t,e)=>t.find(r=>r.step===e),It={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileProgress:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},bt=t=>{const{imgList:e,imgPageSize:r}=t;return Math.ceil(e.length/r)},mt=(t,e)=>t.reduce((r,E)=>{if(E){const p=E.result;if(b(p)[`step_${e}`])return r+1}return r},0)/t.length,Ut=(t,e)=>{const{step:r,stepList:E}=t,p=w.getCurrentStepInfo(r,E),f=Dt.jsonParser(p.config);if(lt.isVideoTool(p==null?void 0:p.tool)||lt.isPointCloudTool(p==null?void 0:p.tool)||dt.LLM===(p==null?void 0:p.tool))return;const S=document.getElementById("toolContainer");if(!S)throw"Not exist dom named id-toolContainer";const D=Et({width:window.innerWidth,height:window.innerHeight}),m=new vt({container:S,toolName:p.tool,size:D,imgNode:e,config:f,style:JSON.parse(St)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},Nt=(t,e)=>(r,E)=>_t(void 0,null,function*(){var p;const{stepList:f,step:S}=E().annotation,D=w.currentToolIsVideo(S,f),m=w.currentToolIsPointCloud(S,f),y=((p=w.getCurrentStepInfo(S,f))==null?void 0:p.tool)===dt.LLM;if($(r,!0),yield r(Bt(t)),D||m||y){r(wt(t));return}r(xt(t,e))}),Bt=t=>(e,r)=>_t(void 0,null,function*(){const{getFileData:E,imgList:p}=r().annotation;if(E){const f=yield E(p[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:f,index:t}})}}),wt=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},xt=(t,e)=>(r,E)=>{var p;const{toolInstance:f,imgList:S}=E().annotation,D=(p=S==null?void 0:S[t])==null?void 0:p.url;yt.load(D).then(m=>{$(r,!1),r({type:i.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(r,!1),f==null||f.setErrorImg(),r({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Ft=({toolInstance:t,imgList:e,imgIndex:r,stepList:E,step:p=1})=>{var f,S,D,m;const y=((f=e[r])==null?void 0:f.result)||"",[F,j,G]=(S=t==null?void 0:t.exportData())!=null?S:[],V=(m=(D=t==null?void 0:t.exportCustomData)==null?void 0:D.call(t))!=null?m:{},M=st(y,j),k=Y(M,{step:p,stepList:E},{rect:F},V);return e.map((N,H)=>H===r?o(l(o({},N),{result:k}),G):o({},N))},jt=(t=o({},It),e)=>{var r,E,p,f,S,D,m,y,F,j,G,V,M,k,N,H,J,X,q,Z,Q,tt,et;switch(e.type){case i.INIT_ALL_STATE:return o(o({},t),It);case i.UPDATE_TOOL_INSTANCE:return l(o({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return l(o({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:n,step:s}=t,u=mt(n,s);return l(o({},t),{stepProgress:u})}case i.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:s,step:u,stepList:a,toolInstance:d,onSubmit:c,resultList:T}=t;if(!d||!n[s])return t;const _=((r=n[s])==null?void 0:r.result)||"",[,g,I]=(E=d==null?void 0:d.exportData())!=null?E:[],L=(f=(p=d==null?void 0:d.exportCustomData)==null?void 0:p.call(d))!=null?f:{},A=st(_,g),R=Y(A,{step:u,stepList:a},{rect:T},L),v=t.imgList.map((C,P)=>{if(P===s){const B=W.dataCorrection(R,_,u,a);return o(l(o({},C),{result:B}),I)}return C});if(((S=e.payload)==null?void 0:S.submitType)===K.SyncImgList)return l(o({},t),{imgList:v});c&&c([v[s]],(D=e.payload)==null?void 0:D.submitType,s,v);const h=mt(v,u);return l(o({},t),{stepProgress:h,imgList:v})}case i.SAVE_RESULT:{const{imgList:n,imgIndex:s,onSave:u}=t;return u==null||u(n[s],s,n),o({},t)}case i.SUBMIT_RESULT:{const{imgList:n,basicIndex:s,resultList:u,toolInstance:a,basicResultList:d}=t;if(!a)return t;const[c]=(m=a==null?void 0:a.exportData())!=null?m:[];let T=c;if((d==null?void 0:d.length)>0){const _=(y=d[s])==null?void 0:y.id,g=c.map(I=>l(o({},I),{sourceID:_}));T=ct.cloneDeep(u).filter(I=>I.sourceID!==_),T.push(...g)}return l(o({},t),{resultList:T,imgList:n})}case i.SET_BASIC_INDEX:{const{toolInstance:n,step:s,imgList:u,imgIndex:a,stepList:d,annotationEngine:c,resultList:T,basicResultList:_}=t;if(!n||!c)return t;const g=e.payload.basicIndex,I=(F=_[g])==null?void 0:F.id,L=b((j=u[a])==null?void 0:j.result),A=(T||[]).filter(B=>B.sourceID===I),R=U(d,s),{dataSourceStep:v,tool:h}=R,C=U(d,v);let P=[];return v&&h&&(P=(G=L[`step_${v}`])==null?void 0:G.result,(P==null?void 0:P.length)>0?(c==null||c.setBasicInfo(C.tool,P[g]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),at.info(x.t("NoDependency")))),n==null||n.setResult(A),n==null||n.history.initRecord(A,!0),l(o({},t),{basicIndex:g})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=e.payload;return l(o({},t),{triggerEventAfterIndexChanged:!!n})}case i.LOAD_FILE_DATA:{const{imgList:n,step:s,toolInstance:u,annotationEngine:a,stepList:d}=t;if(!u)return l(o({},t),{imgIndex:e.payload.nextIndex});const c=w.getCurrentStepInfo(s,d),{nextIndex:T,imgNode:_,nextBasicIndex:g,imgError:I}=e.payload,L=g!=null?g:0,A=b((V=n[T])==null?void 0:V.result),R=A[`step_${c.step}`],v=!R,h={rotate:(M=A.rotate)!=null?M:0,valid:(k=A.valid)!=null?k:!0};_&&I!==!0?a==null||a.setImgNode(_,h):u==null||u.setValid(h.valid);const C=U(d,c.step),{dataSourceStep:P,tool:B}=C,nt=U(d,P),ot=P&&B,O=(H=(N=A[`step_${P}`])==null?void 0:N.result)!=null?H:[],z=W.getInitialResultList(R==null?void 0:R.result,u,C,O,v);if(a==null||a.launchOperation(),ot&&((O==null?void 0:O.length)>0?a==null||a.setBasicInfo(nt.tool,O[L]):(a==null||a.setBasicInfo(nt.tool),a==null||a.forbidOperation(),at.info(x.t("NoDependency")))),c.tool!=="check"){const ft=(X=(J=O[L])==null?void 0:J.id)!=null?X:"",Tt=ot?z.filter(Lt=>At.isSameSourceID(Lt.sourceID,ft)):z;u==null||u.history.initRecord(z,!0),u==null||u.setResult(Tt)}return l(o({},t),{imgIndex:T,basicIndex:L,basicResultList:O,resultList:z})}case i.UPDATE_ANNOTATION_CONFIG:return l(o({},t),{config:(q=e.payload.config)!=null?q:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:n}=e.payload;return l(o({},t),{stepList:n})}case i.SET_TASK_CONFIG:{const{stepList:n,step:s}=e.payload;return l(o({},t),{stepList:n,step:s})}case i.INIT_TOOL:{const{imgNode:n}=t,s=Ut(t,n);if(s){const{toolInstance:u,annotationEngine:a}=s;return l(o({},t),{toolInstance:u,annotationEngine:a})}return o({},t)}case i.SET_TOOL:{const n=(Z=e.payload)==null?void 0:Z.instance;return n?l(o({},t),{toolInstance:n}):o({},t)}case i.UPDATE_ON_SUBMIT:return l(o({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return l(o({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return l(o({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return l(o({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return l(o({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return l(o({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return l(o({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return l(o({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return l(o({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return l(o({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return l(o({},t),{preDataProcess:e.payload.preDataProcess});case i.SKIP_BEFORE_PAGE_TURNING:return l(o({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:n,index:s}=e.payload,{imgList:u}=t,a=[...u];return a[s]=o(o({},a[s]),n),l(o({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:s}=t;return s&&s()===!1||n==null||n.updateRotate(),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=t,s=(Q=n==null?void 0:n.valid)!=null?Q:!0;return ut.destroyAll(),ut.confirm({content:x.t(s?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!s)},okText:x.t("Confirm"),cancelText:x.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:s,imgList:u,step:a}=t;if(!n)return t;if(s===0||s>=u.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const d=u[s-1].result;if(!d)return t;const c=W.copyResultChange(d,a,(tt=u[s].result)!=null?tt:"");u[s]=l(o({},u[s]),{result:c});const _=b(c)[`step_${a}`],g=(_==null?void 0:_.result)||[];return n==null||n.setResult(g),n==null||n.history.pushHistory(g),(et=n==null?void 0:n.asyncData)==null||et.call(n,u[s]),l(o({},t),{imgList:[...u]})}case i.SET_STEP:{const{stepList:n,annotationEngine:s}=t,{toStep:u}=e.payload;if(!s)return t;const a=U(n,u);return s==null||s.setToolName(a.tool,a.config),l(o({},t),{step:u,toolInstance:s==null?void 0:s.toolInstance})}case i.SET_LOADING:{const{loadPCDFileProgress:n}=e.payload;return l(o({},t),{loadPCDFileProgress:!!n})}case i.SET_LOADPCDFILE_PROGRESS:{const{loading:n}=e.payload;return l(o({},t),{loading:!!n})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=e.payload;return l(o({},t),{pointCloudLoading:!!n})}case i.SET_CHECK_MODE:{const{checkMode:n}=e.payload;return l(o({},t),{checkMode:!!n})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=e.payload;return l(o({},t),{highlightAttribute:n})}case i.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:s,rangeIndex:u,imgList:a}=e.payload,{imgIndex:d,onSubmit:c}=t,T=[],_=a.map((g,I)=>{if(it.isInRange(I,u)){const L=l(o({},g),{result:rt.batchUpdateTrackID({id:n,newID:s,result:g.result})});return T.push({imgIndex:I,newInfo:L}),L}return g});return c&&c([_[d]],K.BatchUpdateTrackID,d,_,{updateImgList:T}),l(o({},t),{imgList:_})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:s,rangeIndex:u}=e.payload,{imgList:a,imgIndex:d,onSubmit:c}=t,T=[],_=a.map((g,I)=>{if(it.isInRange(I,u)){const L=l(o({},g),{result:rt.batchUpdateResultByTrackID({id:n,newData:s,result:g.result})});return T.push({imgIndex:I,newInfo:L}),L}return g});return c&&c([_[d]],K.BatchUpdateTrackID,d,_,{updateImgList:T}),l(o({},t),{imgList:_})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:s,stepList:u,step:a,predictionResult:d}=t,c={};d.forEach(I=>{const{index:L}=I;c[L]=ct.pick(I,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const T=`step_${a}`,_=[],g=s.map((I,L)=>{if(c[L]){const A=I.result==="{}"?b(Y("",{step:a,stepList:u},{rect:[]},{})):b(I.result);A[T].result.push(c[L]);const R=l(o({},I),{result:JSON.stringify(A)});return _.push({imgIndex:L,newInfo:R}),R}return I});return n==null||n(g,K.BatchUpdateImgList,-1,g,{updateImgList:_}),l(o({},t),{imgList:g})}default:return t}};export{Nt as LoadFileAndFileData,jt as annotationReducer,Ft as composeResultByToolInstance,U as getStepConfig,bt as getTotalPage};
1
+ import{getFormatSize as Et}from"../../components/customResizeHook/index.js";import{ESubmitType as K}from"../../constant/index.js";import St from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as b}from"../../utils/index.js";import W from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as Dt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as st,composeResult as Y}from"../../utils/data.js";import w from"../../utils/StepUtils.js";import lt from"../../utils/ToolUtils.js";import{MathUtils as it,CommonToolUtils as At,AnnotationEngine as vt,ImgUtils as yt}from"@labelbee/lb-annotation";import{PointCloudUtils as rt,i18n as x}from"@labelbee/lb-utils";import{Modal as ut}from"antd";import{message as at}from"antd/es";import ct from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as dt}from"../../data/enums/ToolType.js";var Rt=Object.defineProperty,Pt=Object.defineProperties,Ct=Object.getOwnPropertyDescriptors,pt=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,gt=(t,e,r)=>e in t?Rt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,o=(t,e)=>{for(var r in e||(e={}))ht.call(e,r)&&gt(t,r,e[r]);if(pt)for(var r of pt(e))Ot.call(e,r)&&gt(t,r,e[r]);return t},l=(t,e)=>Pt(t,Ct(e)),_t=(t,e,r)=>new Promise((E,p)=>{var f=m=>{try{D(r.next(m))}catch(y){p(y)}},S=m=>{try{D(r.throw(m))}catch(y){p(y)}},D=m=>m.done?E(m.value):Promise.resolve(m.value).then(f,S);D((r=r.apply(t,e)).next())});const U=(t,e)=>t.find(r=>r.step===e),It={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},bt=t=>{const{imgList:e,imgPageSize:r}=t;return Math.ceil(e.length/r)},mt=(t,e)=>t.reduce((r,E)=>{if(E){const p=E.result;if(b(p)[`step_${e}`])return r+1}return r},0)/t.length,Ut=(t,e)=>{const{step:r,stepList:E}=t,p=w.getCurrentStepInfo(r,E),f=Dt.jsonParser(p.config);if(lt.isVideoTool(p==null?void 0:p.tool)||lt.isPointCloudTool(p==null?void 0:p.tool)||dt.LLM===(p==null?void 0:p.tool))return;const S=document.getElementById("toolContainer");if(!S)throw"Not exist dom named id-toolContainer";const D=Et({width:window.innerWidth,height:window.innerHeight}),m=new vt({container:S,toolName:p.tool,size:D,imgNode:e,config:f,style:JSON.parse(St)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},Nt=(t,e)=>(r,E)=>_t(void 0,null,function*(){var p;const{stepList:f,step:S}=E().annotation,D=w.currentToolIsVideo(S,f),m=w.currentToolIsPointCloud(S,f),y=((p=w.getCurrentStepInfo(S,f))==null?void 0:p.tool)===dt.LLM;if($(r,!0),yield r(Bt(t)),D||m||y){r(wt(t));return}r(xt(t,e))}),Bt=t=>(e,r)=>_t(void 0,null,function*(){const{getFileData:E,imgList:p}=r().annotation;if(E){const f=yield E(p[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:f,index:t}})}}),wt=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},xt=(t,e)=>(r,E)=>{var p;const{toolInstance:f,imgList:S}=E().annotation,D=(p=S==null?void 0:S[t])==null?void 0:p.url;yt.load(D).then(m=>{$(r,!1),r({type:i.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(r,!1),f==null||f.setErrorImg(),r({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Ft=({toolInstance:t,imgList:e,imgIndex:r,stepList:E,step:p=1})=>{var f,S,D,m;const y=((f=e[r])==null?void 0:f.result)||"",[F,j,G]=(S=t==null?void 0:t.exportData())!=null?S:[],V=(m=(D=t==null?void 0:t.exportCustomData)==null?void 0:D.call(t))!=null?m:{},M=st(y,j),k=Y(M,{step:p,stepList:E},{rect:F},V);return e.map((N,H)=>H===r?o(l(o({},N),{result:k}),G):o({},N))},jt=(t=o({},It),e)=>{var r,E,p,f,S,D,m,y,F,j,G,V,M,k,N,H,J,X,q,Z,Q,tt,et;switch(e.type){case i.INIT_ALL_STATE:return o(o({},t),It);case i.UPDATE_TOOL_INSTANCE:return l(o({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return l(o({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:n,step:s}=t,u=mt(n,s);return l(o({},t),{stepProgress:u})}case i.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:s,step:u,stepList:a,toolInstance:d,onSubmit:c,resultList:T}=t;if(!d||!n[s])return t;const _=((r=n[s])==null?void 0:r.result)||"",[,g,I]=(E=d==null?void 0:d.exportData())!=null?E:[],L=(f=(p=d==null?void 0:d.exportCustomData)==null?void 0:p.call(d))!=null?f:{},A=st(_,g),R=Y(A,{step:u,stepList:a},{rect:T},L),v=t.imgList.map((C,P)=>{if(P===s){const B=W.dataCorrection(R,_,u,a);return o(l(o({},C),{result:B}),I)}return C});if(((S=e.payload)==null?void 0:S.submitType)===K.SyncImgList)return l(o({},t),{imgList:v});c&&c([v[s]],(D=e.payload)==null?void 0:D.submitType,s,v);const h=mt(v,u);return l(o({},t),{stepProgress:h,imgList:v})}case i.SAVE_RESULT:{const{imgList:n,imgIndex:s,onSave:u}=t;return u==null||u(n[s],s,n),o({},t)}case i.SUBMIT_RESULT:{const{imgList:n,basicIndex:s,resultList:u,toolInstance:a,basicResultList:d}=t;if(!a)return t;const[c]=(m=a==null?void 0:a.exportData())!=null?m:[];let T=c;if((d==null?void 0:d.length)>0){const _=(y=d[s])==null?void 0:y.id,g=c.map(I=>l(o({},I),{sourceID:_}));T=ct.cloneDeep(u).filter(I=>I.sourceID!==_),T.push(...g)}return l(o({},t),{resultList:T,imgList:n})}case i.SET_BASIC_INDEX:{const{toolInstance:n,step:s,imgList:u,imgIndex:a,stepList:d,annotationEngine:c,resultList:T,basicResultList:_}=t;if(!n||!c)return t;const g=e.payload.basicIndex,I=(F=_[g])==null?void 0:F.id,L=b((j=u[a])==null?void 0:j.result),A=(T||[]).filter(B=>B.sourceID===I),R=U(d,s),{dataSourceStep:v,tool:h}=R,C=U(d,v);let P=[];return v&&h&&(P=(G=L[`step_${v}`])==null?void 0:G.result,(P==null?void 0:P.length)>0?(c==null||c.setBasicInfo(C.tool,P[g]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),at.info(x.t("NoDependency")))),n==null||n.setResult(A),n==null||n.history.initRecord(A,!0),l(o({},t),{basicIndex:g})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=e.payload;return l(o({},t),{triggerEventAfterIndexChanged:!!n})}case i.LOAD_FILE_DATA:{const{imgList:n,step:s,toolInstance:u,annotationEngine:a,stepList:d}=t;if(!u)return l(o({},t),{imgIndex:e.payload.nextIndex});const c=w.getCurrentStepInfo(s,d),{nextIndex:T,imgNode:_,nextBasicIndex:g,imgError:I}=e.payload,L=g!=null?g:0,A=b((V=n[T])==null?void 0:V.result),R=A[`step_${c.step}`],v=!R,h={rotate:(M=A.rotate)!=null?M:0,valid:(k=A.valid)!=null?k:!0};_&&I!==!0?a==null||a.setImgNode(_,h):u==null||u.setValid(h.valid);const C=U(d,c.step),{dataSourceStep:P,tool:B}=C,nt=U(d,P),ot=P&&B,O=(H=(N=A[`step_${P}`])==null?void 0:N.result)!=null?H:[],z=W.getInitialResultList(R==null?void 0:R.result,u,C,O,v);if(a==null||a.launchOperation(),ot&&((O==null?void 0:O.length)>0?a==null||a.setBasicInfo(nt.tool,O[L]):(a==null||a.setBasicInfo(nt.tool),a==null||a.forbidOperation(),at.info(x.t("NoDependency")))),c.tool!=="check"){const ft=(X=(J=O[L])==null?void 0:J.id)!=null?X:"",Tt=ot?z.filter(Lt=>At.isSameSourceID(Lt.sourceID,ft)):z;u==null||u.history.initRecord(z,!0),u==null||u.setResult(Tt)}return l(o({},t),{imgIndex:T,basicIndex:L,basicResultList:O,resultList:z})}case i.UPDATE_ANNOTATION_CONFIG:return l(o({},t),{config:(q=e.payload.config)!=null?q:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:n}=e.payload;return l(o({},t),{stepList:n})}case i.SET_TASK_CONFIG:{const{stepList:n,step:s}=e.payload;return l(o({},t),{stepList:n,step:s})}case i.INIT_TOOL:{const{imgNode:n}=t,s=Ut(t,n);if(s){const{toolInstance:u,annotationEngine:a}=s;return l(o({},t),{toolInstance:u,annotationEngine:a})}return o({},t)}case i.SET_TOOL:{const n=(Z=e.payload)==null?void 0:Z.instance;return n?l(o({},t),{toolInstance:n}):o({},t)}case i.UPDATE_ON_SUBMIT:return l(o({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return l(o({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return l(o({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return l(o({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return l(o({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return l(o({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return l(o({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return l(o({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return l(o({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return l(o({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return l(o({},t),{preDataProcess:e.payload.preDataProcess});case i.SKIP_BEFORE_PAGE_TURNING:return l(o({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:n,index:s}=e.payload,{imgList:u}=t,a=[...u];return a[s]=o(o({},a[s]),n),l(o({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:s}=t;return s&&s()===!1||n==null||n.updateRotate(),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=t,s=(Q=n==null?void 0:n.valid)!=null?Q:!0;return ut.destroyAll(),ut.confirm({content:x.t(s?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!s)},okText:x.t("Confirm"),cancelText:x.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:s,imgList:u,step:a}=t;if(!n)return t;if(s===0||s>=u.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const d=u[s-1].result;if(!d)return t;const c=W.copyResultChange(d,a,(tt=u[s].result)!=null?tt:"");u[s]=l(o({},u[s]),{result:c});const _=b(c)[`step_${a}`],g=(_==null?void 0:_.result)||[];return n==null||n.setResult(g),n==null||n.history.pushHistory(g),(et=n==null?void 0:n.asyncData)==null||et.call(n,u[s]),l(o({},t),{imgList:[...u]})}case i.SET_STEP:{const{stepList:n,annotationEngine:s}=t,{toStep:u}=e.payload;if(!s)return t;const a=U(n,u);return s==null||s.setToolName(a.tool,a.config),l(o({},t),{step:u,toolInstance:s==null?void 0:s.toolInstance})}case i.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=e.payload;return l(o({},t),{loadPCDFileLoading:!!n})}case i.SET_LOADING:{const{loading:n}=e.payload;return l(o({},t),{loading:!!n})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=e.payload;return l(o({},t),{pointCloudLoading:!!n})}case i.SET_CHECK_MODE:{const{checkMode:n}=e.payload;return l(o({},t),{checkMode:!!n})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=e.payload;return l(o({},t),{highlightAttribute:n})}case i.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:s,rangeIndex:u,imgList:a}=e.payload,{imgIndex:d,onSubmit:c}=t,T=[],_=a.map((g,I)=>{if(it.isInRange(I,u)){const L=l(o({},g),{result:rt.batchUpdateTrackID({id:n,newID:s,result:g.result})});return T.push({imgIndex:I,newInfo:L}),L}return g});return c&&c([_[d]],K.BatchUpdateTrackID,d,_,{updateImgList:T}),l(o({},t),{imgList:_})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:s,rangeIndex:u}=e.payload,{imgList:a,imgIndex:d,onSubmit:c}=t,T=[],_=a.map((g,I)=>{if(it.isInRange(I,u)){const L=l(o({},g),{result:rt.batchUpdateResultByTrackID({id:n,newData:s,result:g.result})});return T.push({imgIndex:I,newInfo:L}),L}return g});return c&&c([_[d]],K.BatchUpdateTrackID,d,_,{updateImgList:T}),l(o({},t),{imgList:_})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:s,stepList:u,step:a,predictionResult:d}=t,c={};d.forEach(I=>{const{index:L}=I;c[L]=ct.pick(I,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const T=`step_${a}`,_=[],g=s.map((I,L)=>{if(c[L]){const A=I.result==="{}"?b(Y("",{step:a,stepList:u},{rect:[]},{})):b(I.result);A[T].result.push(c[L]);const R=l(o({},I),{result:JSON.stringify(A)});return _.push({imgIndex:L,newInfo:R}),R}return I});return n==null||n(g,K.BatchUpdateImgList,-1,g,{updateImgList:_}),l(o({},t),{imgList:g})}default:return t}};export{Nt as LoadFileAndFileData,jt as annotationReducer,Ft as composeResultByToolInstance,U as getStepConfig,bt as getTotalPage};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.14.0-alpha.4",
3
+ "version": "1.14.0-alpha.6",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.18.0-alpha.3",
46
+ "@labelbee/lb-annotation": "1.18.0-alpha.4",
47
47
  "@labelbee/lb-utils": "1.10.0-alpha.3",
48
48
  "ahooks": "^3.4.0",
49
49
  "classnames": "^2.3.0",