@labelbee/lb-components 1.23.0-alpha.98 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/2DViewWorker.js +1 -1
- package/dist/components/AnnotationView/hooks/useFilterAnnotations.js +1 -0
- package/dist/components/AnnotationView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/dialogView/index.js +1 -0
- package/dist/components/LLMMultiWheelView/index.js +1 -0
- package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -0
- package/dist/components/LLMToolView/index.js +1 -1
- package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/dist/components/LLMToolView/questionView/components/imgView/index.js +1 -1
- package/dist/components/LLMToolView/questionView/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/answerSort/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/modelAnswerSort/index.js +1 -0
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/index.js +1 -1
- package/dist/components/attributeList/index.js +1 -1
- package/dist/components/audioPlayer/index.js +1 -1
- package/dist/components/audioPlayer/useAudioScroll/index.js +1 -1
- package/dist/components/markdownView/index.js +1 -1
- package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudSegmentListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
- package/dist/components/pointCloudView/hooks/useBoxes.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -0
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/components/predictTracking/predictTrackingIcon/index.js +1 -1
- package/dist/components/predictTracking/previewResult/index.js +1 -1
- package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/dist/data/enums/ToolType.js +1 -1
- package/dist/index.css +71 -4
- package/dist/index.js +1 -1
- package/dist/store/LLMMultiWheel/index.js +1 -0
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/store/ctx.js +1 -1
- package/dist/store/toolConfig/baseToolConfig.js +1 -0
- package/dist/store/toolConfig/index.js +1 -0
- package/dist/store/toolConfig/pointCloudToolConfig.js +1 -0
- package/dist/types/App.d.ts +1 -0
- package/dist/types/components/AnnotationView/hooks/useFilterAnnotations.d.ts +2 -0
- package/dist/types/components/AnnotationView/index.d.ts +9 -0
- package/dist/types/components/LLMMultiWheelView/dialogView/index.d.ts +15 -0
- package/dist/types/components/LLMMultiWheelView/index.d.ts +21 -0
- package/dist/types/components/LLMMultiWheelView/sidebar/index.d.ts +8 -0
- package/dist/types/components/LLMMultiWheelView/types.d.ts +62 -0
- package/dist/types/components/LLMToolView/questionView/components/header/index.d.ts +15 -0
- package/dist/types/components/LLMToolView/questionView/index.d.ts +7 -0
- package/dist/types/components/LLMToolView/sidebar/components/answerSort/index.d.ts +3 -0
- package/dist/types/components/LLMToolView/sidebar/components/modelAnswerSort/index.d.ts +30 -0
- package/dist/types/components/LLMToolView/sidebar/components/textInputBox/index.d.ts +2 -2
- package/dist/types/components/LLMToolView/sidebar/index.d.ts +10 -0
- package/dist/types/components/LLMToolView/types.d.ts +6 -2
- package/dist/types/components/LLMToolView/utils/data.d.ts +1 -0
- package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -0
- package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +23 -1
- package/dist/types/components/pointCloudView/hooks/useUpdatePointCloudColor.d.ts +4 -0
- package/dist/types/components/pointCloudView/index.d.ts +1 -0
- package/dist/types/data/enums/ToolType.d.ts +2 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/store/LLMMultiWheel/index.d.ts +15 -0
- package/dist/types/store/annotation/actionCreators.d.ts +1 -1
- package/dist/types/store/ctx.d.ts +7 -0
- package/dist/types/store/toolConfig/baseToolConfig.d.ts +4 -0
- package/dist/types/store/toolConfig/index.d.ts +3 -0
- package/dist/types/store/toolConfig/pointCloudToolConfig.d.ts +4 -0
- package/dist/types/store/toolConfig/types.d.ts +10 -0
- package/dist/types/utils/ToolPointCloudBoxRenderHelper.d.ts +2 -1
- package/dist/types/views/MainView/LLMMultiWheelLayout/index.d.ts +9 -0
- package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.d.ts +3 -0
- package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.d.ts +3 -0
- package/dist/utils/ToolPointCloudBoxRenderHelper.js +1 -1
- package/dist/views/MainView/LLMMultiWheelLayout/index.js +1 -0
- package/dist/views/MainView/index.js +1 -1
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.module.scss.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss.js +1 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/index.js +1 -1
- package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
- package/es/_virtual/2DViewWorker.js +1 -1
- package/es/components/AnnotationView/hooks/useFilterAnnotations.js +1 -0
- package/es/components/AnnotationView/index.js +1 -1
- package/es/components/LLMMultiWheelView/dialogView/index.js +1 -0
- package/es/components/LLMMultiWheelView/index.js +1 -0
- package/es/components/LLMMultiWheelView/sidebar/index.js +1 -0
- package/es/components/LLMToolView/index.js +1 -1
- package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/es/components/LLMToolView/questionView/components/imgView/index.js +1 -1
- package/es/components/LLMToolView/questionView/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/answerSort/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/modelAnswerSort/index.js +1 -0
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/es/components/LLMToolView/sidebar/index.js +1 -1
- package/es/components/attributeList/index.js +1 -1
- package/es/components/audioPlayer/index.js +1 -1
- package/es/components/audioPlayer/useAudioScroll/index.js +1 -1
- package/es/components/markdownView/index.js +1 -1
- package/es/components/pointCloud2DRectOperationView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/components/pointCloudView/PointCloudSegmentListener.js +1 -1
- package/es/components/pointCloudView/PointCloudTopView.js +1 -1
- package/es/components/pointCloudView/hooks/useBoxes.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -0
- package/es/components/pointCloudView/index.js +1 -1
- package/es/components/predictTracking/predictTrackingIcon/index.js +1 -1
- package/es/components/predictTracking/previewResult/index.js +1 -1
- package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/es/data/enums/ToolType.js +1 -1
- package/es/index.css +71 -4
- package/es/index.js +1 -1
- package/es/store/LLMMultiWheel/index.js +1 -0
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/store/ctx.js +1 -1
- package/es/store/toolConfig/baseToolConfig.js +1 -0
- package/es/store/toolConfig/index.js +1 -0
- package/es/store/toolConfig/pointCloudToolConfig.js +1 -0
- package/es/utils/ToolPointCloudBoxRenderHelper.js +1 -1
- package/es/views/MainView/LLMMultiWheelLayout/index.js +1 -0
- package/es/views/MainView/index.js +1 -1
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.module.scss.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss.js +1 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/index.js +1 -1
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),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(
|
|
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"),useToolStyle=require("../../hooks/useToolStyle.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}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=(n,a,i)=>a in n?__defProp(n,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[a]=i,__spreadValues=(n,a)=>{for(var i in a||(a={}))__hasOwnProp.call(a,i)&&__defNormalProp(n,i,a[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(a))__propIsEnum.call(a,i)&&__defNormalProp(n,i,a[i]);return n},__spreadProps=(n,a)=>__defProps(n,__getOwnPropDescs(a));const EKeyCode=lbAnnotation.cKeyCode.default,pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:n})=>{const{isActive:a,setTarget3DView:i}=React.useContext(PointCloud3DContext),c=t=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",t)]:!0,active:a});return React__default.default.createElement("span",{onClick:()=>{i(lbUtils.EPerspectiveView[n])},className:c(n.toLocaleLowerCase())})},PointCloud3DSideBar=({isEnlarge:n})=>{const{reset3DView:a,followTopView:i}=React.useContext(PointCloud3DContext),{t:c}=reactI18next.useTranslation(),t=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:c("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{i()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{a()},className:dom.getClassName("point-cloud-3d-view","reset")}));return n?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebarZoom")},p,t):React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},t,p)},PointCloud3D=({currentData:n,config:a,highlightAttribute:i})=>{var c;const t=React.useContext(PointCloudContext.PointCloudContext),[p,T]=React.useState(!0),[m,C]=React.useState(!1),f=React.useRef(null),{initPointCloud3d:P}=usePointCloudViews.usePointCloudViews(),v=useSize(f),{t:V}=reactI18next.useTranslation(),{value:x}=useToolStyle.useToolStyleContext(),{hiddenText:_}=x||{};React.useEffect(()=>{let e=t.mainViewInstance;e&&e.updateHiddenTextAndRender(_,t.pointCloudBoxList)},[x]),React.useEffect(()=>{!t.mainViewInstance||P==null||P(v)},[v]);const{selectedBox:u}=useSingleBox.useSingleBox(),{selectedSphere:w}=useSphere.useSphere(),[y,h]=React.useState(!0),g=e=>{var o,l;const r=u==null?void 0:u.info;if(r){const s=__spreadValues({},r.center);s.x=s.x-.01,s.z=1e3;const d=e===lbUtils.EPerspectiveView.Top;(o=t.mainViewInstance)==null||o.updateCameraByBox(r,e,d?s:void 0)}w&&((l=t.mainViewInstance)==null||l.updateCameraBySphere(w,e))},b=()=>{var e;(e=t.mainViewInstance)==null||e.resetCamera()},N=()=>{var e,o;const l=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance.camera;l&&((o=t.mainViewInstance)==null||o.applyCameraTarget(l))};React.useEffect(()=>{if(f.current&&(n==null?void 0:n.url)){let e=t.mainViewInstance;!e&&v.width&&(e=new lbAnnotation.PointCloud({container:f.current,isOrthographicCamera:!0,orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(v),config:a,hiddenText:_}),e.setHandlerPipe({setSelectedIDs:t.setSelectedIDs,setNeedUpdateCenter:h}),t.setMainViewInstance(e))}},[v,n]),React.useEffect(()=>{var e;if(f.current&&(n==null?void 0:n.url)&&n.result&&t.mainViewInstance){let o=t.mainViewInstance;const l=lbUtils.PointCloudUtils.getBoxParamsFromResultList(n.result);l.forEach(s=>{var d;const E=(d=lbUtils.toolStyleConverter.getColorFromConfig({attribute:s.attribute},__spreadProps(__spreadValues({},a),{attributeConfigurable:!0}),{}))==null?void 0:d.hex;o==null||o.addBoxToSense(s,E)}),o.render(),t.setPointCloudResult(l);const r=lbUtils.PointCloudUtils.getRectParamsFromResultList(n.result);t.setRectList(r),t.setPointCloudValid((e=index.jsonParser(n.result))==null?void 0:e.valid)}},[n,t.mainViewInstance]),React.useEffect(()=>{var e,o,l,r,s;const d=(e=u==null?void 0:u.info)==null?void 0:e.id;if(!y){h(!0);return}if(d!==void 0){g(lbUtils.EPerspectiveView.Top);const E=(r=(l=(o=t.topViewInstance)==null?void 0:o.pointCloudInstance)==null?void 0:l.camera.zoom)!=null?r:1;(s=t.mainViewInstance)==null||s.updateCameraZoom(E)}},[(c=u==null?void 0:u.info)==null?void 0:c.id]),React.useEffect(()=>{var e,o,l,r;if(w){g(lbUtils.EPerspectiveView.Top);const s=(l=(o=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:o.camera.zoom)!=null?l:1;(r=t.mainViewInstance)==null||r.updateCameraZoom(s)}},[w]),React.useEffect(()=>(window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I)}),[]);const I=e=>{if(e.keyCode===EKeyCode.Esc){C(!1);return}},S=React.useMemo(()=>({reset3DView:b,setTarget3DView:g,isActive:!!u,followTopView:N}),[u,t.mainViewInstance]);React.useEffect(()=>{var e,o,l;const r=t.pointCloudBoxList.filter(s=>s.attribute===i);(r==null?void 0:r.length)>0&&((e=t.mainViewInstance)==null||e.clearHighlightBoxes(),(o=t.mainViewInstance)==null||o.highlightBoxes(r)),r.length===0&&((l=t.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[i,t.mainViewInstance]);const B=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{onChange:e=>{var o;(o=t.mainViewInstance)==null||o.updatePointSize({customSize:e})}}),React__default.default.createElement("span",{style:{marginRight:8}},V("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:p,onChange:e=>{var o;T(e),(o=t.mainViewInstance)==null||o.setShowDirection(e)}}),m&&React__default.default.createElement(PointCloud3DContext.Provider,{value:S},React__default.default.createElement(PointCloud3DSideBar,{isEnlarge:m})));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-3d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:m}),title:m?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{C(!1)}}),V("3DView")):React__default.default.createElement(index$2,{title:V("3DView"),onClick:()=>{C(!0)}}),toolbar:B},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},!m&&React__default.default.createElement(PointCloud3DContext.Provider,{value:S},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:f})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),
|
|
1
|
+
"use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),useUpdatePointCloudColor=require("./hooks/useUpdatePointCloudColor.js"),reactI18next=require("react-i18next"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(n,r,i)=>r in n?__defProp(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i,__spreadValues=(n,r)=>{for(var i in r||(r={}))__hasOwnProp.call(r,i)&&__defNormalProp(n,i,r[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(r))__propIsEnum.call(r,i)&&__defNormalProp(n,i,r[i]);return n},__spreadProps=(n,r)=>__defProps(n,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:n,config:r,checkMode:i,configString:_,imgIndex:w,toolInstanceRef:a,setResourceLoading:f})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:V,selectNextBox:E,selectPrevBox:B,updateSelectedBox:L,deleteSelectedPointCloudBoxAndPolygon:q}=useSingleBox.useSingleBox(),{selectedSphere:b,updatePointCloudSphere:I}=useSphere.useSphere(),{clearAllResult:P,updatePointCloudPattern:O}=useStatus.useStatus(),{copySelectedBoxes:j,pasteSelectedBoxes:A,copiedBoxes:$}=useBoxes.useBoxes({config:r,currentData:n}),{updateRotate:g}=useRotate.useRotate({currentData:n}),{updateRotateEdge:T}=useRotateEdge.useRotateEdge({currentData:n}),{updatePointCloudData:p,topViewSelectedChanged:D}=usePointCloudViews.usePointCloudViews({setResourceLoading:f}),{redo:h,undo:m,pushHistoryWithList:N,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:K}=useHistory.useHistory(),{syncThreeViewsAttribute:S}=useAttribute.useAttribute(),{syncAllViewsConfig:U,reRenderTopViewRange:R}=useConfig.useConfig(),{selectedPolygon:k}=usePolygon.usePolygon(),{selectedLine:x}=useLine.useLine(),{t:y}=reactI18next.useTranslation(),{updatePointCloudColor:z}=useUpdatePointCloudColor.useUpdatePointCloudColor(f,r),F=ahooks.useLatest(n),v=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},G=(t,o)=>{var s,u;const{topViewInstance:c,mainViewInstance:l}=e;if(!c)return;const{pointCloud2dOperation:C}=c;switch(t){case"q":{g(e.rectRotateSensitivity);break}case"e":g(-Number(e.rectRotateSensitivity));break;case"g":T(-90);break;case"u":{const d=C.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;O(d);const Y={[lbAnnotation.EToolName.Polygon]:y("PolygonPattern"),[lbAnnotation.EToolName.Rect]:y("RectPattern")};antd.message.success(y("ChangePatternMsg",{pattern:Y[d]})),C.clearActiveStatus(),C.clearDrawingStatus()}break;case"+":l==null||l.updatePointSize({zoomIn:!0});break;case"-":l==null||l.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){B();break}E(),o.preventDefault();break;case"f":V();break;case"arrowup":v({y:-1});break;case"arrowdown":v({y:1});break;case"arrowleft":v({x:-1});break;case"arrowright":v({x:1});break;case"delete":q(F.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const d=lbAnnotation.AttributeUtils.getAttributeByKeycode(o.keyCode,r.attributeList);d!==void 0&&((u=a.current)==null||u.setDefaultAttribute(d))}return}}},M=(t,o)=>{switch(t){case"c":j();break;case"v":A();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?h():m();break}}},W=ahooks.useLatest(t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||i===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){M(o,t);return}G(o,t)});return React.useEffect(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(c=>W.current(c))},[e,e.topViewInstance,e.windowKeydownListenerHook]),React.useEffect(()=>{U(r)},[_]),React.useEffect(()=>{(r==null?void 0:r.radius)&&R(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{p==null||p()},[w,e.mainViewInstance]),React.useEffect(()=>{e.setHideAttributes([])},[w]),React.useEffect(()=>{a.current.setDefaultAttribute=t=>{var o;if(S(t),z(t),k&&H(__spreadProps(__spreadValues({},k),{attribute:t})),x&&K(__spreadProps(__spreadValues({},x),{attribute:t})),b){const s=I(__spreadProps(__spreadValues({},b),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),D({newSelectedSphere:b,newSphereList:s}))}},a.current.setSubAttribute=(t,o)=>{var s;const u=e.selectedPointCloudBox;if(u){const c=(s=u==null?void 0:u.subAttribute)!=null?s:{};u.subAttribute=__spreadProps(__spreadValues({},c),{[t]:o}),L(u),e.mainViewInstance&&e.selectedPointCloudBox&&e.mainViewInstance.generateBox(e.selectedPointCloudBox)}},a.current.clearResult=()=>{P==null||P()},a.current.redo=()=>{h()},a.current.undo=()=>{m()},a.current.setValid=t=>{a.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&P()})},a.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},a.current.asyncData=t=>{setTimeout(()=>{p==null||p(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),React.useEffect(()=>{a.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},a.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),React.useEffect(()=>{a.current.history={pushHistory:t=>{N({pointCloudBoxList:t})},initRecord:()=>{}}},[]),React.useEffect(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||i)return;const s=l=>{S(l)},u=l=>{antd.message.error(l)},c=l=>{antd.message.info(l)};return o.on("syncAttribute",s),o.on("messageError",u),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",u),o.unbind("messageInfo",c)}},[e.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),useAttribute=require("./hooks/useAttribute.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../utils/index.js");const PointCloudSegmentListener=({checkMode:v,currentData:l,imgIndex:S,highlightAttribute:a,config:p,toolInstanceRef:
|
|
1
|
+
"use strict";var React=require("react"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),useAttribute=require("./hooks/useAttribute.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../utils/index.js");const PointCloudSegmentListener=({checkMode:v,currentData:l,imgIndex:S,highlightAttribute:a,config:p,toolInstanceRef:s,configString:u})=>{const d=ctx.useDispatch(),{updateSegmentAttribute:b,updateSegmentSubAttribute:g}=useAttribute.useAttribute(),n=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:e,setSegmentation:c}=n;React.useEffect(()=>{var t;if(e&&l.url)return actionCreators.SetAnnotationLoading(d,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var o,r;const i=lbUtils.PointCloudUtils.getSegmentFromResultList((o=l==null?void 0:l.result)!=null?o:"");(r=e==null?void 0:e.store)==null||r.updateCurrentSegment(i),actionCreators.SetAnnotationLoading(d,!1)}),e.on("syncSegmentData",c),()=>{e.unbind("syncSegmentData",c)}},[S,e]),React.useEffect(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(a!=null?a:"")},[a,e]),React.useEffect(()=>{e==null||e.setConfig(index.jsonParser(u))},[u]);const C=(t,o)=>{var r,i;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Add);break;case"i":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(i=(r=e.store)==null?void 0:r.cacheSegData)==null?void 0:i.id);break}},m=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||v===!0)return;const o=t.key.toLocaleLowerCase();C(o)};return React.useEffect(()=>(window.addEventListener("keydown",m),s.current.setDefaultAttribute=t=>{b(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},s.current.setSubAttribute=(t,o)=>{g(t,o)},()=>{window.removeEventListener("keydown",m)}),[e]),React.useEffect(()=>{s.current.clearResult=()=>{!n.ptSegmentInstance||(n.ptSegmentInstance.emit("clearStash"),n.ptSegmentInstance.emit("clearAllSegmentData"))}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var PointCloudSegmentListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegmentListener);module.exports=PointCloudSegmentListener$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),index$3=require("../../views/MainView/toolFooter/index.js"),index$4=require("../../views/MainView/toolFooter/ZoomController/index.js"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),ToolPointCloudBoxRenderHelper=require("../../utils/ToolPointCloudBoxRenderHelper.js"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useSingleBox=require("./hooks/useSingleBox.js"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudInfos=require("./PointCloudInfos.js"),usePolygon=require("./hooks/usePolygon.js"),useSphere=require("./hooks/useSphere.js"),useZoom=require("./hooks/useZoom.js"),antd=require("antd"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js"),ToolUtils=require("../../utils/ToolUtils.js"),_=require("lodash"),index$2=require("./components/PointCloudSizeSlider/index.js"),useHistory=require("./hooks/useHistory.js"),index$1=require("./components/TitleButton/index.js");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,l,s)=>l in o?__defProp(o,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[l]=s,__spreadValues=(o,l)=>{for(var s in l||(l={}))__hasOwnProp.call(l,s)&&__defNormalProp(o,s,l[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(l))__propIsEnum.call(l,s)&&__defNormalProp(o,s,l[s]);return o},__spreadProps=(o,l)=>__defProps(o,__getOwnPropDescs(l));const{EPolygonPattern,EToolName}=lbAnnotation.cTool,{ESortDirection}=lbAnnotation.cAnnotation,EKeyCode=lbAnnotation.cKeyCode.default,TransferCanvas2WorldOffset=(o,l,s=1)=>{const{width:C,height:c}=l,w={x:o.x+C*s/2,y:o.y+c*s/2},P={x:l.width/2,y:l.height/2};return{offsetX:(P.x-w.x)/s,offsetY:-(P.y-w.y)/s}},TopViewToolbar=({currentData:o})=>{var l,s;const{zoom:C,zoomIn:c,zoomOut:w,initialPosition:P}=useZoom.useZoom(),{selectNextBox:S,selectPrevBox:V}=useSingleBox.useSingleBox(),{switchToNextSphere:x}=useSphere.useSphere(),{updateRotate:y}=useRotate.useRotate({currentData:o}),{updateRotateEdge:E}=useRotateEdge.useRotateEdge({currentData:o}),g=React__default.default.useContext(PointCloudContext.PointCloudContext),{topViewInstance:I}=g,p=(s=(l=g==null?void 0:g.topViewInstance)==null?void 0:l.toolScheduler)==null?void 0:s.getCurrentToolName(),e=()=>{y(-Number(g.rectRotateSensitivity))},r=()=>{y(g.rectRotateSensitivity)},f=()=>{E(-90)};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$2,{onChange:b=>{var h;(h=I==null?void 0:I.pointCloudInstance)==null||h.updatePointSize({customSize:b})}}),React__default.default.createElement("span",{onClick:r,className:dom.getClassName("point-cloud","rotate-reserve")}),React__default.default.createElement("span",{onClick:e,className:dom.getClassName("point-cloud","rotate")}),React__default.default.createElement("span",{onClick:f,className:dom.getClassName("point-cloud","rotate-90")}),React__default.default.createElement(index$3.FooterDivider,null),React__default.default.createElement(icons.UpSquareOutlined,{onClick:()=>{if(p===EToolName.Point){x(ESortDirection.descend);return}V(!0)},className:dom.getClassName("point-cloud","prev")}),React__default.default.createElement(icons.DownSquareOutlined,{onClick:()=>{if(p===EToolName.Point){x(ESortDirection.ascend);return}S(!0)},className:dom.getClassName("point-cloud","next")}),React__default.default.createElement(index$3.FooterDivider,null),React__default.default.createElement(index$4.ZoomController,{initialPosition:P,zoomIn:c,zoomOut:w,zoom:C}))},ZAxisSlider=({setZAxisLimit:o,zAxisLimit:l,checkMode:s})=>s?null:React__default.default.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},React__default.default.createElement(antd.Slider,{vertical:!0,step:.5,max:10,min:.5,defaultValue:l,onAfterChange:C=>{o(C)}})),PointCloudTopView=({currentData:o,imgList:l,stepInfo:s,drawLayerSlot:C,checkMode:c,intelligentFit:w,setIsEnlargeTopView:P,isEnlargeTopView:S,onExitZoom:V,highlightAttribute:x})=>{var y,E;const[g,I]=React.useState({zoom:1,currentPos:{x:0,y:0}}),p=React.useRef(null),e=React__default.default.useContext(PointCloudContext.PointCloudContext),r=useSize(p),f=index.jsonParser(s.config),{setZoom:b,syncTopviewToolZoom:h}=useZoom.useZoom(),{hideAttributes:B}=e,{addPolygon:A,deletePolygon:D}=usePolygon.usePolygon(),{deletePointCloudSphere:U}=useSphere.useSphere(),{deletePointCloudBox:Z,changeValidByID:H}=useSingleBox.useSingleBox(),[L,z]=React.useState(10),{t:N}=reactI18next.useTranslation(),m=usePointCloudViews.usePointCloudViews(),{pushHistoryWithList:F}=useHistory.useHistory();React.useLayoutEffect(()=>{if(!e.topViewInstance&&p.current&&(o==null?void 0:o.url)&&(o==null?void 0:o.result)){const n={width:p.current.clientWidth,height:p.current.clientHeight},a=new lbAnnotation.PointCloudAnnotation({container:p.current,size:n,pcdPath:o.url,config:__spreadProps(__spreadValues({},f),{pointCloudPattern:e.pointCloudPattern}),checkMode:c,toolName:ToolUtils.getPointCloudToolList(),proxyMode:c});e.setTopViewInstance(a)}},[o]),React.useEffect(()=>{if(!r||!e.topViewInstance||!e.sideViewInstance)return;const{toolInstance:n}=e.topViewInstance;n.singleOn("dataUpdated",(t,i)=>{const d=___default.default.cloneDeep(t).map(u=>__spreadProps(__spreadValues({},u),{pointList:lbUtils.PointCloudUtils.pointListTransferCanvas2World(u.pointList,r)}));e.setSelectedIDs(i),e.setLineList(d),F({lineList:d})}),n.singleOn("pointCreated",(t,i)=>{m.topViewAddSphere({newPoint:t,size:r,trackConfigurable:f.trackConfigurable,zoom:i})}),n.singleOn("pointDeleted",t=>{U(t)}),n.singleOn("pointSelected",t=>{e.setSelectedIDs([t])}),n.singleOn("updatePointByDrag",(t,i)=>{var d;(d=m.topViewUpdatePoint)==null||d.call(m,t,r)}),n.singleOn("polygonCreated",(t,i)=>{if(n.pattern===EPolygonPattern.Normal||!(o==null?void 0:o.url)){const d=__spreadProps(__spreadValues({},t),{pointList:t.pointList.map(u=>lbUtils.PointCloudUtils.transferCanvas2World(u,r))});A(d),e.setSelectedIDs(B.includes(t.attribute)?"":t.id);return}m.topViewAddBox({polygon:t,size:r,imgList:l,trackConfigurable:f.trackConfigurable,zoom:i,intelligentFit:w})}),n.singleOn("deletedObject",({id:t})=>{Z(t),D(t)}),n.singleOn("deleteSelectedIDs",()=>{e.setSelectedIDs([])}),n.singleOn("addSelectedIDs",t=>{e.addSelectedID(t)}),n.singleOn("setSelectedIDs",t=>{e.setSelectedIDs(t)}),n.singleOn("updatePolygonByDrag",t=>{var i;(i=m.topViewUpdateBox)==null||i.call(m,t,r)});const a=t=>{var i;const d=H(t);d&&e.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,d),e.polygonList.find(u=>u.id===t)&&((i=e.topViewInstance)==null||i.toolInstance.setPolygonValidAndRender(t,!0))};return n.on("validUpdate",a),()=>{n.unbind("validUpdate",a)}},[e,r,o,m,e.polygonList,e.lineList,(y=e.topViewInstance)==null?void 0:y.toolInstance]),React.useEffect(()=>{var n,a;if(!(r==null?void 0:r.width)||!e.topViewInstance)return;const t=(a=(n=f==null?void 0:f.attributeList)==null?void 0:n[0])==null?void 0:a.value;t&&e.topViewInstance.toolInstance.setDefaultAttribute(t),e.topViewInstance.initSize(r),e.topViewInstance.updatePolygonList(e.displayPointCloudList,e.polygonList),e.topViewInstance.updatePointList(e.displaySphereList),e.topViewInstance.updateLineList(e.displayLineList);const{topViewInstance:{pointCloudInstance:i,toolInstance:d}}=e;d.singleOn("renderZoom",(u,v)=>{const{offsetX:O,offsetY:q}=TransferCanvas2WorldOffset(v,r,u);if(i.camera.zoom=u,v){const{x:j,y:T,z:R}=i.initCameraPosition;i.camera.position.set(j+q,T-O,R)}i.camera.updateProjectionMatrix(),i.render(),b(u),h(v,u,r),I({zoom:u,currentPos:v})}),d.singleOn("dragMove",({currentPos:u,zoom:v})=>{const{offsetX:O,offsetY:q}=TransferCanvas2WorldOffset(u,r,v);i.camera.zoom=v;const{x:j,y:T,z:R}=i.initCameraPosition;i.camera.position.set(j+q,T-O,R),i.render(),h(u,v,r),I({zoom:v,currentPos:u})})},[r,e.topViewInstance,(E=e.topViewInstance)==null?void 0:E.toolInstance]),React.useEffect(()=>{var n,a;(a=(n=e.topViewInstance)==null?void 0:n.pointCloudInstance)==null||a.applyZAxisPoints(L)},[L]),React.useEffect(()=>{var n,a,t,i;m.topViewSelectedChanged({}),(i=(t=(a=(n=e.topViewInstance)==null?void 0:n.toolInstance)==null?void 0:a.selection)==null?void 0:t.hardSetSelectedIDs)==null||i.call(t,e.selectedIDs)},[e.selectedIDs]),React.useEffect(()=>(window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}),[]);const k=n=>{const{keyCode:a}=n;a===EKeyCode.Esc&&V()};return React.useEffect(()=>{var n,a,t;(t=(a=(n=e.topViewInstance)==null?void 0:n.pointCloud2dOperation)==null?void 0:a.setHighlightAttribute)==null||t.call(a,x)},[e.topViewInstance,x]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","top-view"),title:S?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{V()}}),React__default.default.createElement("span",null,N("TopView")),React__default.default.createElement(PointCloudInfos.BoxInfos,{checkMode:c,config:f,style:{display:"flex",position:"initial",margin:"0px 20px"}})):React__default.default.createElement(index$1,{title:N("TopView"),onClick:()=>{P(!0)}}),toolbar:React__default.default.createElement(TopViewToolbar,{currentData:o})},React__default.default.createElement("div",{style:{position:"relative",flex:1}},React__default.default.createElement("div",{style:{width:"100%",height:"100%"},ref:p},C==null?void 0:C(g)),!S&&React__default.default.createElement(PointCloudInfos.BoxInfos,{checkMode:c,config:f}),React__default.default.createElement(ZAxisSlider,{checkMode:c,zAxisLimit:L,setZAxisLimit:z}),React__default.default.createElement(PointCloudInfos.PointCloudValidity,null)))};var PointCloudTopView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudTopView);module.exports=PointCloudTopView$1;
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),index$3=require("../../views/MainView/toolFooter/index.js"),index$4=require("../../views/MainView/toolFooter/ZoomController/index.js"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),ToolPointCloudBoxRenderHelper=require("../../utils/ToolPointCloudBoxRenderHelper.js"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useSingleBox=require("./hooks/useSingleBox.js"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudInfos=require("./PointCloudInfos.js"),usePolygon=require("./hooks/usePolygon.js"),useSphere=require("./hooks/useSphere.js"),useZoom=require("./hooks/useZoom.js"),antd=require("antd"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js"),ToolUtils=require("../../utils/ToolUtils.js"),_=require("lodash"),index$2=require("./components/PointCloudSizeSlider/index.js"),useHistory=require("./hooks/useHistory.js"),index$1=require("./components/TitleButton/index.js");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,s,l)=>s in o?__defProp(o,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[s]=l,__spreadValues=(o,s)=>{for(var l in s||(s={}))__hasOwnProp.call(s,l)&&__defNormalProp(o,l,s[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(s))__propIsEnum.call(s,l)&&__defNormalProp(o,l,s[l]);return o},__spreadProps=(o,s)=>__defProps(o,__getOwnPropDescs(s));const{EPolygonPattern,EToolName}=lbAnnotation.cTool,{ESortDirection}=lbAnnotation.cAnnotation,EKeyCode=lbAnnotation.cKeyCode.default,TransferCanvas2WorldOffset=(o,s,l=1)=>{const{width:C,height:p}=s,w={x:o.x+C*l/2,y:o.y+p*l/2},x={x:s.width/2,y:s.height/2};return{offsetX:(x.x-w.x)/l,offsetY:-(x.y-w.y)/l}},TopViewToolbar=({currentData:o})=>{var s,l;const{zoom:C,zoomIn:p,zoomOut:w,initialPosition:x}=useZoom.useZoom(),{selectNextBox:L,selectPrevBox:b}=useSingleBox.useSingleBox(),{switchToNextSphere:S}=useSphere.useSphere(),{updateRotate:V}=useRotate.useRotate({currentData:o}),{updateRotateEdge:O}=useRotateEdge.useRotateEdge({currentData:o}),g=React__default.default.useContext(PointCloudContext.PointCloudContext),{topViewInstance:y}=g,f=(l=(s=g==null?void 0:g.topViewInstance)==null?void 0:s.toolScheduler)==null?void 0:l.getCurrentToolName(),e=()=>{V(-Number(g.rectRotateSensitivity))},u=()=>{V(g.rectRotateSensitivity)},v=()=>{O(-90)};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$2,{onChange:T=>{var I;(I=y==null?void 0:y.pointCloudInstance)==null||I.updatePointSize({customSize:T})}}),React__default.default.createElement("span",{onClick:u,className:dom.getClassName("point-cloud","rotate-reserve")}),React__default.default.createElement("span",{onClick:e,className:dom.getClassName("point-cloud","rotate")}),React__default.default.createElement("span",{onClick:v,className:dom.getClassName("point-cloud","rotate-90")}),React__default.default.createElement(index$3.FooterDivider,null),React__default.default.createElement(icons.UpSquareOutlined,{onClick:()=>{if(f===EToolName.Point){S(ESortDirection.descend);return}b(!0)},className:dom.getClassName("point-cloud","prev")}),React__default.default.createElement(icons.DownSquareOutlined,{onClick:()=>{if(f===EToolName.Point){S(ESortDirection.ascend);return}L(!0)},className:dom.getClassName("point-cloud","next")}),React__default.default.createElement(index$3.FooterDivider,null),React__default.default.createElement(index$4.ZoomController,{initialPosition:x,zoomIn:p,zoomOut:w,zoom:C}))},ZAxisSlider=({setZAxisLimit:o,zAxisLimit:s,checkMode:l})=>l?null:React__default.default.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},React__default.default.createElement(antd.Slider,{vertical:!0,step:.5,max:10,min:.5,defaultValue:s,onAfterChange:C=>{o(C)}})),PointCloudTopView=({currentData:o,imgList:s,stepInfo:l,drawLayerSlot:C,checkMode:p,intelligentFit:w,setIsEnlargeTopView:x,isEnlargeTopView:L,onExitZoom:b,highlightAttribute:S})=>{var V,O;const[g,y]=React.useState({zoom:1,currentPos:{x:0,y:0}}),f=React.useRef(null),e=React__default.default.useContext(PointCloudContext.PointCloudContext),u=useSize(f),v=index.jsonParser(l.config),{setZoom:T,syncTopviewToolZoom:I}=useZoom.useZoom(),{hideAttributes:k}=e,{addPolygon:A,deletePolygon:U}=usePolygon.usePolygon(),{deletePointCloudSphere:Z}=useSphere.useSphere(),{deletePointCloudBox:z,changeValidByID:H}=useSingleBox.useSingleBox(),[N,F]=React.useState(10),{t:B}=reactI18next.useTranslation(),m=usePointCloudViews.usePointCloudViews(),{pushHistoryWithList:W}=useHistory.useHistory(),[$,q]=React.useState(!0);React.useLayoutEffect(()=>{if(!e.topViewInstance&&f.current&&(o==null?void 0:o.url)&&(o==null?void 0:o.result)){const n={width:f.current.clientWidth,height:f.current.clientHeight},a=new lbAnnotation.PointCloudAnnotation({container:f.current,size:n,pcdPath:o.url,config:__spreadProps(__spreadValues({},v),{pointCloudPattern:e.pointCloudPattern}),checkMode:p,toolName:ToolUtils.getPointCloudToolList(),proxyMode:p});e.setTopViewInstance(a)}},[o]),React.useEffect(()=>{if(!u||!e.topViewInstance||!e.sideViewInstance)return;const{toolInstance:n}=e.topViewInstance;n.singleOn("dataUpdated",(t,i)=>{const d=___default.default.cloneDeep(t).map(r=>__spreadProps(__spreadValues({},r),{pointList:lbUtils.PointCloudUtils.pointListTransferCanvas2World(r.pointList,u)}));e.setSelectedIDs(i),e.setLineList(d),W({lineList:d})}),n.singleOn("pointCreated",(t,i)=>{m.topViewAddSphere({newPoint:t,size:u,trackConfigurable:v.trackConfigurable,zoom:i})}),n.singleOn("pointDeleted",t=>{Z(t)}),n.singleOn("pointSelected",t=>{e.setSelectedIDs([t])}),n.singleOn("updatePointByDrag",(t,i)=>{var d;(d=m.topViewUpdatePoint)==null||d.call(m,t,u)}),n.singleOn("polygonCreated",(t,i)=>{if(n.pattern===EPolygonPattern.Normal||!(o==null?void 0:o.url)){const d=__spreadProps(__spreadValues({},t),{pointList:t.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,u))});A(d),e.setSelectedIDs(k.includes(t.attribute)?"":t.id);return}q(!1),m.topViewAddBox({polygon:t,size:u,imgList:s,trackConfigurable:v.trackConfigurable,zoom:i,intelligentFit:w})}),n.singleOn("deletedObject",({id:t})=>{z(t),U(t)}),n.singleOn("deleteSelectedIDs",()=>{e.setSelectedIDs([])}),n.singleOn("addSelectedIDs",t=>{e.addSelectedID(t)}),n.singleOn("setSelectedIDs",t=>{q(!1),e.setSelectedIDs(t)}),n.singleOn("updatePolygonByDrag",t=>{var i;(i=m.topViewUpdateBox)==null||i.call(m,t,u)});const a=t=>{var i;const d=H(t);d&&e.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,d),e.polygonList.find(r=>r.id===t)&&((i=e.topViewInstance)==null||i.toolInstance.setPolygonValidAndRender(t,!0))};return n.on("validUpdate",a),()=>{n.unbind("validUpdate",a)}},[e,u,o,m,e.polygonList,e.lineList,(V=e.topViewInstance)==null?void 0:V.toolInstance]),React.useEffect(()=>{var n,a;if(!(u==null?void 0:u.width)||!e.topViewInstance)return;const t=(a=(n=v==null?void 0:v.attributeList)==null?void 0:n[0])==null?void 0:a.value;t&&e.topViewInstance.toolInstance.setDefaultAttribute(t),e.topViewInstance.initSize(u),e.topViewInstance.updatePolygonList(e.displayPointCloudList,e.polygonList),e.topViewInstance.updatePointList(e.displaySphereList),e.topViewInstance.updateLineList(e.displayLineList);const{topViewInstance:{pointCloudInstance:i,toolInstance:d}}=e;d.singleOn("renderZoom",(r,c)=>{const{offsetX:h,offsetY:E}=TransferCanvas2WorldOffset(c,u,r);if(i.camera.zoom=r,c){const{x:P,y:j,z:R}=i.initCameraPosition;i.camera.position.set(P+E,j-h,R)}i.camera.updateProjectionMatrix(),i.render(),T(r),I(c,r,u),y({zoom:r,currentPos:c})}),d.singleOn("dragMove",({currentPos:r,zoom:c})=>{const{offsetX:h,offsetY:E}=TransferCanvas2WorldOffset(r,u,c);i.camera.zoom=c;const{x:P,y:j,z:R}=i.initCameraPosition;i.camera.position.set(P+E,j-h,R),i.render(),I(r,c,u),y({zoom:c,currentPos:r})})},[u,e.topViewInstance,(O=e.topViewInstance)==null?void 0:O.toolInstance]),React.useEffect(()=>{var n,a;(a=(n=e.topViewInstance)==null?void 0:n.pointCloudInstance)==null||a.applyZAxisPoints(N)},[N]),React.useEffect(()=>{var n,a,t,i;m.topViewSelectedChanged({}),(i=(t=(a=(n=e.topViewInstance)==null?void 0:n.toolInstance)==null?void 0:a.selection)==null?void 0:t.hardSetSelectedIDs)==null||i.call(t,e.selectedIDs)},[e.selectedIDs]),React.useEffect(()=>{const{topViewInstance:n,selectedID:a,selectedPointCloudBox:t,zoom:i}=e;if(!n||!a||!t||!$){q(!0);return}const{center:d}=t,{pointCloudInstance:r,toolInstance:c}=n,h=c.polygonList.find(K=>K.id===e.selectedID);if(!h){q(!0);return}const E=lbAnnotation.MathUtils.getRectCenterPoint(h.pointList),P=lbAnnotation.MathUtils.getCurrentPosFromRectCenter(c.size,E,i);c.setCurrentPos(P),c.render();const{x:j,y:R,z:M}=r.initCameraPosition;r.camera.position.set(d.x,d.y,M),r.render(),I(P,i,u),y({zoom:i,currentPos:P})},[e.selectedID]),React.useEffect(()=>(window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D)}),[]);const D=n=>{const{keyCode:a}=n;a===EKeyCode.Esc&&b()};return React.useEffect(()=>{var n,a,t;(t=(a=(n=e.topViewInstance)==null?void 0:n.pointCloud2dOperation)==null?void 0:a.setHighlightAttribute)==null||t.call(a,S)},[e.topViewInstance,S]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","top-view"),title:L?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{b()}}),React__default.default.createElement("span",null,B("TopView")),React__default.default.createElement(PointCloudInfos.BoxInfos,{checkMode:p,config:v,style:{display:"flex",position:"initial",margin:"0px 20px"}})):React__default.default.createElement(index$1,{title:B("TopView"),onClick:()=>{x(!0)}}),toolbar:React__default.default.createElement(TopViewToolbar,{currentData:o})},React__default.default.createElement("div",{style:{position:"relative",flex:1}},React__default.default.createElement("div",{style:{width:"100%",height:"100%"},ref:f},C==null?void 0:C(g)),!L&&React__default.default.createElement(PointCloudInfos.BoxInfos,{checkMode:p,config:v}),React__default.default.createElement(ZAxisSlider,{checkMode:p,zAxisLimit:N,setZAxisLimit:F}),React__default.default.createElement(PointCloudInfos.PointCloudValidity,null)))};var PointCloudTopView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudTopView);module.exports=PointCloudTopView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),antd=require("antd"),usePointCloudViews=require("./usePointCloudViews.js"),PointCloudContext=require("../PointCloudContext.js"),reactI18next=require("react-i18next"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),AnnotationDataUtils=require("../../../utils/AnnotationDataUtils.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const updateBoxRects=(t,e=[],o=[])=>{const{rects:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),antd=require("antd"),usePointCloudViews=require("./usePointCloudViews.js"),PointCloudContext=require("../PointCloudContext.js"),reactI18next=require("react-i18next"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),AnnotationDataUtils=require("../../../utils/AnnotationDataUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),useHistory=require("./useHistory.js"),index=require("../../../utils/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const updateBoxRects=(t,e=[],o=[])=>{const{rects:l=[]}=t,s=l.map(n=>{var d;return __spreadProps(__spreadValues({},n),{imageName:(d=AnnotationDataUtils.getNextPath({prePath:n.imageName,preMappingImgList:o,nextMappingImgList:e}))!=null?d:""})}).filter(n=>n.imageName!=="");return __spreadProps(__spreadValues({},t),{rects:s})},updateCopiedBoxesId=(t,e)=>{const o=new Set(t.map(n=>n.trackID||0));let l=Math.max(...o,0);const s=.2;return e.map((n,d)=>{const{width:y,height:g,center:m,rotation:r,trackID:x=0}=n,{x:f,y:P,z:I}=m,u=y*s,C=g*s,h=u*Math.cos(r)-C*Math.sin(r),i=u*Math.sin(r)+C*Math.cos(r),c=f-Math.abs(h),v=P-Math.abs(i);let p=x;return o.has(x)?p=++l:l=Math.max(l,p),o.add(p),__spreadProps(__spreadValues({},n),{id:lbAnnotation.uuid(),uuid:lbAnnotation.uuid(),center:{x:c,y:v,z:I},trackID:p})})},useBoxes=({config:t,currentData:e})=>{const{selectedIDs:o,pointCloudBoxList:l,displayPointCloudList:s,setPointCloudResult:n,syncAllViewPointCloudColor:d,imageSizes:y}=React.useContext(PointCloudContext.PointCloudContext),[g,m]=React.useState({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:r}=g,{pointCloudBoxListUpdated:x}=usePointCloudViews.usePointCloudViews(),{t:f,i18n:P}=reactI18next.useTranslation(),{pushHistoryWithList:I}=useHistory.useHistory(),u=React.useMemo(()=>s.filter(i=>o.includes(i.id)),[o,s]),C=React.useCallback(()=>{var i;if(u.length>0){const c=(i=e==null?void 0:e.mappingImgList)!=null?i:[];m({copiedBoxes:___default.default.cloneDeep(u),copiedMappingImgList:c})}else m({copiedBoxes:[],copiedMappingImgList:[]}),antd.message.error(f("CopyEmptyInPointCloud"));antd.message.success(f("CopySuccess"))},[o,s,P.language,e]),h=React.useCallback(()=>{var i,c;if(r.length===0){antd.message.error(f("PasteEmptyInPointCloud"));return}const v=(i=e==null?void 0:e.mappingImgList)!=null?i:[],p=(c=g==null?void 0:g.copiedMappingImgList)!=null?c:[],M=r.map(a=>updateBoxRects(a,v,p)),B=updateCopiedBoxesId(s,M),w=a=>{n(a),x==null||x(a),m({copiedBoxes:[],copiedMappingImgList:[]}),I({pointCloudBoxList:a}),d(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiPaste,a)};B.forEach(a=>index.generatePointCloudBoxRects({pointCloudBox:a,mappingImgList:v,imageSizes:y}));const O=[...s,...B];w(O)},[r,s,P.language,e]);return{copySelectedBoxes:C,pasteSelectedBoxes:h,copiedBoxes:r,selectedBoxes:u}};exports.useBoxes=useBoxes;
|
|
@@ -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"),_=require("lodash"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,n)=>new Promise((c,o)=>{var p=a=>{try{u(n.next(a))}catch(x){o(x)}},g=a=>{try{u(n.throw(a))}catch(x){o(x)}},u=a=>a.done?c(a.value):Promise.resolve(a.value).then(p,g);u((n=n.apply(e,t)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,t,n,c,o)=>{const{x:p,y:g}=lbUtils.PointCloudUtils.transferCanvas2World(e,t),{defaultZ:u}=lbUtils.DEFAULT_SPHERE_PARAMS,a={center:{x:p,y:g,z:u},id:e.id},x=c?__spreadValues(__spreadValues({},c),a):__spreadProps(__spreadValues({},a),{attribute:"",valid:!0});return o&&Object.assign(x,o),x},topViewPolygon2PointCloud=(e,t,n,c,o,p)=>{let g=e.pointList.map(B=>lbUtils.PointCloudUtils.transferCanvas2World(B,t)),u=0,a=1,x={};if(n){const B=n.getSensesPointZAxisInPolygon(g,void 0,p);p&&B.fittedCoordinates.length>0&&(g=B.fittedCoordinates),u=(B.maxZ+B.minZ)/2,a=B.maxZ-B.minZ,x={count:B.zCount}}const[h,L,U]=g,I=lbAnnotation.MathUtils.getLineCenterPoint([h,U]),b=lbAnnotation.MathUtils.getLineLength(h,L),V=lbAnnotation.MathUtils.getLineLength(L,U),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);c&&(u=c.center.z,a=c.depth);const R={center:{x:I.x,y:I.y,z:u},width:p?V+INTELLIGENT_FIT_MARGIN:V,height:p?b+INTELLIGENT_FIT_MARGIN:b,depth:a,rotation:k,id:e.id},T=__spreadValues(c?__spreadValues(__spreadValues({},c),R):__spreadProps(__spreadValues({},R),{attribute:"",valid:!0}),x);o&&Object.assign(T,o);const A=g.map(B=>lbUtils.PointCloudUtils.transferWorld2Canvas(B,t));return{boxParams:T,newPointList:A}},sideViewPoint2PointCloud=(e,t,n)=>{const c={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x-c.x,y:n.center.y,z:n.center.z-c.y}})},sideViewPolygon2PointCloud=(e,t,n,c)=>{const[o,p,g]=e.pointList,[u,a,x]=t.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([o,g]),L=lbAnnotation.MathUtils.getLineCenterPoint([u,x]),I={x:{x:h.x-L.x,y:h.y-L.y}.x,y:0,z:h.y-L.y},b=lbAnnotation.MathUtils.getLineLength(o,p),V=lbAnnotation.MathUtils.getLineLength(u,a),k=b-V,R=lbAnnotation.MathUtils.getLineLength(p,g),T=lbAnnotation.MathUtils.getLineLength(a,x),A=R-T,{newBoxParams:B}=c.getNewBoxBySideUpdate(I,A,k,n);return B},backViewPoint2PointCloud=(e,t,n)=>{const c={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x,y:n.center.y-c.x,z:n.center.z-c.y}})},backViewPolygon2PointCloud=(e,t,n,c)=>{const[o,p,g]=e.pointList,[u,a,x]=t.pointList,h=lbAnnotation.MathUtils.getLineCenterPoint([o,g]),L=lbAnnotation.MathUtils.getLineCenterPoint([u,x]),I={x:{x:h.x-L.x,y:h.y-L.y}.x,y:0,z:h.y-L.y},b=lbAnnotation.MathUtils.getLineLength(o,p),V=lbAnnotation.MathUtils.getLineLength(u,a),k=b-V,R=lbAnnotation.MathUtils.getLineLength(p,g),T=lbAnnotation.MathUtils.getLineLength(a,x),A=R-T;let{newBoxParams:B}=c.getNewBoxByBackUpdate(I,A,k,n);return B},syncSideViewByPoint=(e,t,n,c,o)=>{var p;if(!n)return;const{toolInstance:g,pointCloudInstance:u}=n;u.loadPCDFile(c,(p=o==null?void 0:o.radius)!=null?p:DEFAULT_RADIUS);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);u.setInitCameraPosition(a);const{point2d:x,zoom:h}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=h,u.camera.updateProjectionMatrix(),u.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([__spreadProps(__spreadValues(__spreadValues({},t),x),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},synchronizeSideView=(e,t,n,c)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:p}=n;p.loadPCDFileByBox(c,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:g}=p.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);p.setInitCameraPosition(g);const{polygon2d:u,zoom:a}=p.getBoxSidePolygon2DCoordinate(e);p.camera.zoom=a,p.camera.updateProjectionMatrix(),p.render(),o.initPosition(),o.zoomChangeOnCenter(a),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncBackViewByPoint=(e,t,n,c,o)=>{var p;if(!n)return;const{toolInstance:g,pointCloudInstance:u}=n;u.loadPCDFile(c,(p=o==null?void 0:o.radius)!=null?p:DEFAULT_RADIUS);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);u.setInitCameraPosition(a);const{point2d:x,zoom:h}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=h,u.camera.updateProjectionMatrix(),u.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([__spreadProps(__spreadValues(__spreadValues({},t),x),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},synchronizeBackView=(e,t,n,c)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:p}=n;p.loadPCDFileByBox(c,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:g}=p.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);p.setInitCameraPosition(g);const{polygon2d:u,zoom:a}=p.getBoxBackPolygon2DCoordinate(e);p.camera.zoom=a,p.camera.updateProjectionMatrix(),p.render(),o.initPosition(),o.zoomChangeOnCenter(a),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncTopViewByPoint=(e,t,n,c)=>{if(!n||!c)return;c.generateSphere(e),c.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),c.render();const{toolInstance:o,pointCloudInstance:p}=n,{point2d:g}=p.getSphereTopPoint2DCoordinate(e),u=[...o.pointList].map(a=>a.id===t.id?__spreadProps(__spreadValues(__spreadValues({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):a);o.setResult(u),o.setSelectedID(t.id)},synchronizeTopView=(e,t,n,c)=>{var o,p;if(!n||!c)return;c.generateBox(e,t.id),c.render();const{pointCloud2dOperation:g,pointCloudInstance:u}=n,{polygon2d:a}=u.getBoxTopPolygon2DCoordinate(e),x=[...g.polygonList],h=x.find(L=>L.id===t.id);h?(h.pointList=a,h.valid=(o=e.valid)!=null?o:!0):x.push({id:t.id,pointList:a,textAttribute:"",isRect:!0,valid:(p=e.valid)!=null?p:!0}),g.setResultAndSelectedID(x,t.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:n,backViewInstance:c,mainViewInstance:o,addPointCloudBox:p,addPointCloudSphere:g,setSelectedIDs:u,selectedIDs:a,pointCloudBoxList:x,pointCloudSphereList:h,hideAttributes:L,setHighlight2DDataList:U,cuboidBoxIn2DView:I,imageSizes:b,history:V,linkageImageNameRectMap:k}=e,{addHistory:R,initHistory:T,pushHistoryUnderUpdatePolygon:A}=useHistory.useHistory(),{selectedPolygon:B}=usePolygon.usePolygon(),{getPointCloudSphereByID:ot,updatePointCloudSphere:Y,selectedSphere:q}=useSphere.useSphere(),{currentData:j,config:m}=ctx.useSelector(s=>{const{stepList:i,step:d,imgList:r,imgIndex:l}=s.annotation;return{currentData:r[l],config:index.jsonParser(StepUtils.getCurrentStepInfo(d,i).config)}}),M=ctx.useDispatch(),it=ahooks.useLatest(I),nt=ahooks.useLatest(k),st=React.useCallback((s,i)=>{const d=nt.current,r=i.id;return s.filter(P=>{if(!P)return!1;const C=d.get(P.imageName);return C===void 0?!0:Boolean(C.get(r))})},[]),Z=s=>{const{enableAutoMap2DRect:i=!1}=m;if(!it.current||i){const{mappingImgList:d=[]}=j;index.generatePointCloudBoxRects({pointCloudBox:s,mappingImgList:d,imageSizes:b},{prepareRectsFn:st})}},{selectedBox:D,updateSelectedBox:rt,updateSelectedBoxes:G,getPointCloudByID:lt}=useSingleBox.useSingleBox({generateRects:Z}),K=D==null?void 0:D.info;if(!t||!n||!c)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:J}=t,at=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},dt=({newPoint:s,size:i,zoom:d,trackConfigurable:r})=>{var l;const P={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(P,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const C=topViewPoint2PointCloud(s,i,J,void 0,P);u(s.id);const f=g(C);H(PointCloudView.Top,s,C,d,f,m),R({newSphereParams:C})},ut=({polygon:s,size:i,imgList:d,trackConfigurable:r,zoom:l,intelligentFit:P})=>{var C,f,v;const S={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(S,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:x,extraSphereList:h})});const z=t==null?void 0:t.toolInstance,w=__spreadValues({},s);let{boxParams:y,newPointList:O}=topViewPolygon2PointCloud(w,i,J,void 0,S,P);y=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[y],stepConfig:m,action:"viewUpdateBox"}))[0],P&&(O==null?void 0:O.length)&&(w.pointList=O);const X=L.includes(w.attribute);Z(y);const E=p(y),F=(f=e==null?void 0:e.polygonList)!=null?f:[];y.subAttribute=lbAnnotation.TagUtils.getDefaultResultByConfig((m==null?void 0:m.secondaryAttributeConfigurable)?(v=m==null?void 0:m.inputList)!=null?v:[]:[]),t==null||t.updatePolygonList(E!=null?E:[],F),X?u([]):(u(y.id),z.selection.setSelectedIDs(w.id),N({omitView:PointCloudView.Top,polygon:w,boxParams:y,zoom:l,newPointCloudBoxList:E}),P&&synchronizeTopView(y,w,t,o)),R({newBoxParams:y})},ct=s=>{const{boxID:i,imageName:d,width:r,height:l,x:P,y:C}=s,f=x.find(y=>y.id===i);if(!(f==null?void 0:f.rects)||!f.rects.find(y=>y.imageName===d))return;const S=f.rects.map(y=>y.imageName===d?__spreadProps(__spreadValues({},y),{width:r,height:l,x:P,y:C}):y),z=__spreadProps(__spreadValues({},f),{rects:S}),w=x.map(y=>y.id===i?z:y);return t==null||t.updatePolygonList(w!=null?w:[]),w},pt=s=>{const{boxID:i,imageName:d}=s,r=x.find(f=>f.id===i);if(!(r==null?void 0:r.rects))return;const l=r.rects.filter(f=>f.imageName!==d),P=__spreadProps(__spreadValues({},r),{rects:l}),C=x.map(f=>f.id===i?P:f);return t==null||t.updatePolygonList(C!=null?C:[]),C},Pt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:d,newSphereList:r})=>{var l;const P=t==null?void 0:t.toolInstance;if(!(a.length===0||!P)){if(s||(D==null?void 0:D.info)){const C=s!=null?s:D==null?void 0:D.info;(l=P==null?void 0:P.selection)==null||l.setSelectedIDs(a[0]);const f=P.selectedPolygon;if(a.length===1&&C){N({omitView:PointCloudView.Top,polygon:f,boxParams:C,newPointCloudBoxList:i});return}}if((d||q)&&a.length===1){const C=d!=null?d:q;P.setSelectedID(a[0]);const f=P.selectedPoint;C&&H(PointCloudView.Top,f,C,void 0,r,m)}}},$=(s,i,d)=>{if(K){let r,l;switch(d){case PointCloudView.Back:r=backViewPolygon2PointCloud;break;case PointCloudView.Side:r=sideViewPolygon2PointCloud;break;default:r=sideViewPolygon2PointCloud;break}if(l=r(s,i,K,n.pointCloudInstance),o){const{count:S}=o.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=__spreadProps(__spreadValues({},l),{count:S})}const C=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[l],stepConfig:m,action:"viewUpdateBox"}))[0],f=l.valid!==C.valid;l=C;const v=rt(l);return l=v.find(S=>S.id===l.id),N({omitView:f?void 0:d,polygon:s,boxParams:l,newPointCloudBoxList:v}),v}},tt=(s,i,d)=>{if(q){let r,l;switch(d){case PointCloudView.Back:r=backViewPoint2PointCloud;break;case PointCloudView.Side:r=sideViewPoint2PointCloud;break;default:r=sideViewPoint2PointCloud;break}l=r(s,i,q);const P=Y(l);return H(d,s,l,void 0,P,m),P}},gt=(s,i)=>{tt(s,i,PointCloudView.Side)},Ct=(s,i)=>{tt(s,i,PointCloudView.Back)},ft=(s,i)=>{$(s,i,PointCloudView.Side)},xt=(s,i)=>{$(s,i,PointCloudView.Back)},ht=(s,i)=>{const d=ot(s.id),r=topViewPoint2PointCloud(s,i,J,d),l=Y(r);H(PointCloudView.Top,s,r,void 0,l,m)},vt=(s,i)=>{if(B){const r=__spreadValues({},s[0].newPolygon);r.pointList=r.pointList.map(l=>lbUtils.PointCloudUtils.transferCanvas2World(l,i)),A(r);return}let d=s.map(({newPolygon:r})=>{const l=lt(r.id),{boxParams:P}=topViewPolygon2PointCloud(r,i,t.pointCloudInstance,l);return P});if(d=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:d,stepConfig:m,action:"viewUpdateBox"})),d.length===1){const{newPolygon:r}=s[0],l=G(d);N({polygon:r,boxParams:d[0],newPointCloudBoxList:l})}else{const r=G(d);r&&e.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiMove,r)}},yt=s=>{var i,d,r,l,P;if(D){const C=Number(s.widthDefault),f=Number(s.depthDefault),v=Number(s.heightDefault),S=D==null?void 0:D.info.trackID,w=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(W=>(W==null?void 0:W.trackID)===S),y={width:(r=(d=t==null?void 0:t.toolInstance)==null?void 0:d.basicImgInfo)==null?void 0:r.width,height:(P=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:P.height},O=w.pointList.map(W=>lbUtils.PointCloudUtils.transferCanvas2World(W,y)),Q=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(O,v,C),X=Q[0],E=Q[2],F=lbAnnotation.MathUtils.getLineCenterPoint([X,E]),Lt=D.info.center.z-D.info.depth/2,et=__spreadProps(__spreadValues({},D.info),{center:{x:F.x,y:F.y,z:Lt+f/2},width:C,height:v,depth:f,valid:!0}),mt=G([et]);N({omitView:PointCloudView["3D"],polygon:w,boxParams:et,newPointCloudBoxList:mt})}},H=(s,i,d,r,l,P)=>__async(void 0,null,function*(){const C=j==null?void 0:j.url,f={[PointCloudView.Side]:()=>{syncSideViewByPoint(d,i,n,C,P)},[PointCloudView.Back]:()=>{c&&syncBackViewByPoint(d,i,c,C,P)},[PointCloudView.Top]:()=>{syncTopViewByPoint(d,i,t,o)}};Object.keys(f).forEach(v=>{v!==s&&f[v]()}),r&&(o==null||o.updateCameraZoom(r)),at(d)}),N=s=>{const{omitView:i,polygon:d,boxParams:r,zoom:l,newPointCloudBoxList:P}=s,C=j==null?void 0:j.url;P&&e.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single,P);const f={[PointCloudView.Side]:()=>{synchronizeSideView(r,d,n,C)},[PointCloudView.Back]:()=>{c&&synchronizeBackView(r,d,c,C)},[PointCloudView.Top]:()=>{synchronizeTopView(r,d,t,o)}};Object.keys(f).forEach(v=>{v!==i&&f[v]()}),l&&(o==null||o.updateCameraZoom(l))};return{topViewAddSphere:dt,topViewAddBox:ut,topViewSelectedChanged:Pt,topViewUpdatePoint:ht,sideViewUpdatePoint:gt,backViewUpdatePoint:Ct,topViewUpdateBox:vt,sideViewUpdateBox:ft,backViewUpdateBox:xt,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=lbUtils.PointCloudUtils.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>__async(void 0,[...s],function*(i=j){var d,r,l,P,C,f;if(!(i==null?void 0:i.url)||!o)return;U([]),actionCreators.SetPointCloudLoading(M,!0),actionCreators.SetLoadPCDFileLoading(M,!0),yield o.loadPCDFile(i.url,(d=m==null?void 0:m.radius)!=null?d:DEFAULT_RADIUS),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let v=[],S=[],z=[],w=[];o.updateTopCamera();const y=(l=(r=index.jsonParser(i.result))==null?void 0:r.valid)!=null?l:!0;if(e.setPointCloudValid(y),(P=e.sideViewInstance)==null||P.clearAllData(),(C=e.backViewInstance)==null||C.clearAllData(),i.result){if(v=lbUtils.PointCloudUtils.getBoxParamsFromResultList(i.result),(v==null?void 0:v.length)>0&&i.isPreResult&&(m==null?void 0:m.lowerLimitPointsNumInBox)>0){v=yield o==null?void 0:o.filterPreResult(i.url,m,v);const O=index.jsonParser(i.result);O[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=v,i.result=JSON.stringify(O),e.setPointCloudResult(v)}z=lbUtils.PointCloudUtils.getPolygonListFromResultList(i.result),S=lbUtils.PointCloudUtils.getLineListFromResultList(i.result),w=lbUtils.PointCloudUtils.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(f=m==null?void 0:m.radius)!=null?f:DEFAULT_RADIUS}),o==null||o.generateBoxes(v),o==null||o.generateSpheres(w),yield e.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,v,[])}T({pointCloudBoxList:v,polygonList:z,lineList:S,pointCloudSphereList:w}),actionCreators.SetPointCloudLoading(M,!1),actionCreators.SetLoadPCDFileLoading(M,!1)}),updateViewsByDefaultSize:yt,generateRects:Z,update2DViewRect:ct,remove2DViewRect:pt}},useSyncRectPositionDimensionToPointCloudList=()=>{const{pointCloudBoxList:e,rectList:t,setPointCloudResult:n}=React.useContext(PointCloudContext.PointCloudContext),c=ahooks.useLatest(e),o=ahooks.useLatest(t);return{syncToPointCloudBoxList:React.useCallback(()=>{const g=c.current,u=o.current;if(u.length===0)return null;const a=new Map,x=new Set;if(u.filter(h=>h.extId!==void 0).forEach(h=>{const L=h.extId,U=h.imageName,I=_.pick(h,["x","y","width","height"]);let b=a.get(L);b||(b=new Map,a.set(L,b)),b.set(U,I),x.add(L)}),a.size){const h=g.map(L=>{var U;const I=L.id;if(x.has(I)){const b=__spreadValues({},L);return(U=b.rects)==null||U.forEach(V=>{var k;const R=V.imageName;Object.assign(V,(k=a.get(I))==null?void 0:k.get(R))}),b}return L});return n(h),h}return null},[])}};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,exports.useSyncRectPositionDimensionToPointCloudList=useSyncRectPositionDimensionToPointCloudList;
|
|
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"),_=require("lodash"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,n,t)=>n in o?__defProp(o,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[n]=t,__spreadValues=(o,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(o,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(o,t,n[t]);return o},__spreadProps=(o,n)=>__defProps(o,__getOwnPropDescs(n)),__async=(o,n,t)=>new Promise((u,p)=>{var e=a=>{try{c(t.next(a))}catch(x){p(x)}},P=a=>{try{c(t.throw(a))}catch(x){p(x)}},c=a=>a.done?u(a.value):Promise.resolve(a.value).then(e,P);c((t=t.apply(o,n)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(o,n,t,u,p)=>{const{x:e,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,n),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,a={center:{x:e,y:P,z:c},id:o.id},x=u?__spreadValues(__spreadValues({},u),a):__spreadProps(__spreadValues({},a),{attribute:"",valid:!0});return p&&Object.assign(x,p),x},topViewPolygon2PointCloud=(o,n,t,u,p,e)=>{let P=o.pointList.map(B=>lbUtils.PointCloudUtils.transferCanvas2World(B,n)),c=0,a=1,x={};if(t){const B=t.getSensesPointZAxisInPolygon(P,void 0,e);e&&B.fittedCoordinates.length>0&&(P=B.fittedCoordinates),c=(B.maxZ+B.minZ)/2,a=B.maxZ-B.minZ,x={count:B.zCount}}const[f,L,R]=P,D=lbAnnotation.MathUtils.getLineCenterPoint([f,R]),w=lbAnnotation.MathUtils.getLineLength(f,L),V=lbAnnotation.MathUtils.getLineLength(L,R),T=lbAnnotation.MathUtils.getRadiusFromQuadrangle(o.pointList);u&&(c=u.center.z,a=u.depth);const k={center:{x:D.x,y:D.y,z:c},width:e?V+INTELLIGENT_FIT_MARGIN:V,height:e?w+INTELLIGENT_FIT_MARGIN:w,depth:a,rotation:T,id:o.id},O=__spreadValues(u?__spreadValues(__spreadValues({},u),k):__spreadProps(__spreadValues({},k),{attribute:"",valid:!0}),x);p&&Object.assign(O,p);const M=P.map(B=>lbUtils.PointCloudUtils.transferWorld2Canvas(B,n));return{boxParams:O,newPointList:M}},sideViewPoint2PointCloud=(o,n,t)=>{const u={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x-u.x,y:t.center.y,z:t.center.z-u.y}})},sideViewPolygon2PointCloud=(o,n,t,u)=>{const[p,e,P]=o.pointList,[c,a,x]=n.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),L=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),D={x:{x:f.x-L.x,y:f.y-L.y}.x,y:0,z:f.y-L.y},w=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,a),T=w-V,k=lbAnnotation.MathUtils.getLineLength(e,P),O=lbAnnotation.MathUtils.getLineLength(a,x),M=k-O,{newBoxParams:B}=u.getNewBoxBySideUpdate(D,M,T,t);return B},backViewPoint2PointCloud=(o,n,t)=>{const u={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x,y:t.center.y-u.x,z:t.center.z-u.y}})},backViewPolygon2PointCloud=(o,n,t,u)=>{const[p,e,P]=o.pointList,[c,a,x]=n.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),L=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),D={x:{x:f.x-L.x,y:f.y-L.y}.x,y:0,z:f.y-L.y},w=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,a),T=w-V,k=lbAnnotation.MathUtils.getLineLength(e,P),O=lbAnnotation.MathUtils.getLineLength(a,x),M=k-O;let{newBoxParams:B}=u.getNewBoxByBackUpdate(D,M,T,t);return B},syncSideViewByPoint=(o,n,t,u,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(u,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:a}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(a);const{point2d:x,zoom:f}=c.getSphereSidePoint2DCoordinate(o);c.camera.zoom=f,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(f),P.setResult([__spreadProps(__spreadValues(__spreadValues({},n),x),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(n.id)},synchronizeSideView=(o,n,t,u)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(u,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);e.setInitCameraPosition(P);const{polygon2d:c,zoom:a}=e.getBoxSidePolygon2DCoordinate(o);e.camera.zoom=a,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncBackViewByPoint=(o,n,t,u,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(u,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:a}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(a);const{point2d:x,zoom:f}=c.getSphereBackPoint2DCoordinate(o);c.camera.zoom=f,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(f),P.setResult([__spreadProps(__spreadValues(__spreadValues({},n),x),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(n.id)},synchronizeBackView=(o,n,t,u)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(u,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);e.setInitCameraPosition(P);const{polygon2d:c,zoom:a}=e.getBoxBackPolygon2DCoordinate(o);e.camera.zoom=a,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncTopViewByPoint=(o,n,t,u)=>{if(!t||!u)return;u.generateSphere(o),u.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),u.render();const{toolInstance:p,pointCloudInstance:e}=t,{point2d:P}=e.getSphereTopPoint2DCoordinate(o),c=[...p.pointList].map(a=>a.id===n.id?__spreadProps(__spreadValues(__spreadValues({},n),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):a);p.setResult(c),p.setSelectedID(n.id)},synchronizeTopView=(o,n,t,u)=>{var p,e;if(!t||!u)return;u.generateBox(o,n.id),u.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=t,{polygon2d:a}=c.getBoxTopPolygon2DCoordinate(o),x=[...P.polygonList],f=x.find(L=>L.id===n.id);f?(f.pointList=a,f.valid=(p=o.valid)!=null?p:!0):x.push({id:n.id,pointList:a,textAttribute:"",isRect:!0,valid:(e=o.valid)!=null?e:!0}),P.setResultAndSelectedID(x,n.id)},usePointCloudViews=o=>{const n=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:u,backViewInstance:p,mainViewInstance:e,addPointCloudBox:P,addPointCloudSphere:c,setSelectedIDs:a,selectedIDs:x,pointCloudBoxList:f,pointCloudSphereList:L,hideAttributes:R,setHighlight2DDataList:D,cuboidBoxIn2DView:w,imageSizes:V,history:T,linkageImageNameRectMap:k}=n,{addHistory:O,initHistory:M,pushHistoryUnderUpdatePolygon:B}=useHistory.useHistory(),{selectedPolygon:ot}=usePolygon.usePolygon(),{getPointCloudSphereByID:nt,updatePointCloudSphere:Y,selectedSphere:W}=useSphere.useSphere(),{currentData:j,config:y}=ctx.useSelector(s=>{const{stepList:i,step:d,imgList:r,imgIndex:l}=s.annotation;return{currentData:r[l],config:index.jsonParser(StepUtils.getCurrentStepInfo(d,i).config)}}),z=ctx.useDispatch(),it=ahooks.useLatest(w),st=ahooks.useLatest(k),rt=React.useCallback((s,i)=>{const d=st.current,r=i.id;return s.filter(g=>{if(!g)return!1;const C=d.get(g.imageName);return C===void 0?!0:Boolean(C.get(r))})},[]),J=s=>{const{enableAutoMap2DRect:i=!1}=y;if(!it.current||i){const{mappingImgList:d=[]}=j;index.generatePointCloudBoxRects({pointCloudBox:s,mappingImgList:d,imageSizes:V},{prepareRectsFn:rt})}},{selectedBox:U,updateSelectedBox:lt,updateSelectedBoxes:Q,getPointCloudByID:at}=useSingleBox.useSingleBox({generateRects:J}),K=U==null?void 0:U.info;if(!t||!u||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:X}=t,dt=s=>{e==null||e.generateSphere(s),e==null||e.controls.update(),e==null||e.render()},ut=({newPoint:s,size:i,zoom:d,trackConfigurable:r})=>{var l;const g={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(g,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:L})});const C=topViewPoint2PointCloud(s,i,X,void 0,g);a(s.id);const h=c(C);q(PointCloudView.Top,s,C,d,h,y),O({newSphereParams:C})},ct=({polygon:s,size:i,imgList:d,trackConfigurable:r,zoom:l,intelligentFit:g})=>{var C,h,m;const b={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(b,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:f,extraSphereList:L})});const S=t==null?void 0:t.toolInstance,I=__spreadValues({},s);let{boxParams:v,newPointList:A}=topViewPolygon2PointCloud(I,i,X,void 0,b,g);v=z(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[v],stepConfig:y,action:"viewUpdateBox"}))[0],g&&(A==null?void 0:A.length)&&(I.pointList=A);const E=R.includes(I.attribute);J(v);const F=P(v),Z=(h=n==null?void 0:n.polygonList)!=null?h:[];v.subAttribute=lbAnnotation.TagUtils.getDefaultResultByConfig((y==null?void 0:y.secondaryAttributeConfigurable)?(m=y==null?void 0:y.inputList)!=null?m:[]:[]),t==null||t.updatePolygonList(F!=null?F:[],Z),E?a([]):(a(v.id),S.selection.setSelectedIDs(I.id),N({omitView:PointCloudView.Top,polygon:I,boxParams:v,zoom:l,newPointCloudBoxList:F}),g&&synchronizeTopView(v,I,t,e)),O({newBoxParams:v})},pt=s=>{const{boxID:i,imageName:d,width:r,height:l,x:g,y:C}=s,h=f.find(v=>v.id===i);if(!(h==null?void 0:h.rects)||!h.rects.find(v=>v.imageName===d))return;const b=h.rects.map(v=>v.imageName===d?__spreadProps(__spreadValues({},v),{width:r,height:l,x:g,y:C}):v),S=__spreadProps(__spreadValues({},h),{rects:b}),I=f.map(v=>v.id===i?S:v);return t==null||t.updatePolygonList(I!=null?I:[]),I},gt=s=>{const{boxID:i,imageName:d}=s,r=f.find(h=>h.id===i);if(!(r==null?void 0:r.rects))return;const l=r.rects.filter(h=>h.imageName!==d),g=__spreadProps(__spreadValues({},r),{rects:l}),C=f.map(h=>h.id===i?g:h);return t==null||t.updatePolygonList(C!=null?C:[]),C},Pt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:d,newSphereList:r})=>{var l;const g=t==null?void 0:t.toolInstance;if(!(x.length===0||!g)){if(s||(U==null?void 0:U.info)){const C=s!=null?s:U==null?void 0:U.info;(l=g==null?void 0:g.selection)==null||l.setSelectedIDs(x[0]);const h=g.selectedPolygon;if(x.length===1&&C){N({omitView:PointCloudView.Top,polygon:h,boxParams:C,newPointCloudBoxList:i});return}}if((d||W)&&x.length===1){const C=d!=null?d:W;g.setSelectedID(x[0]);const h=g.selectedPoint;C&&q(PointCloudView.Top,h,C,void 0,r,y)}}},$=(s,i,d)=>{if(K){let r,l;switch(d){case PointCloudView.Back:r=backViewPolygon2PointCloud;break;case PointCloudView.Side:r=sideViewPolygon2PointCloud;break;default:r=sideViewPolygon2PointCloud;break}if(l=r(s,i,K,u.pointCloudInstance),e){const{count:b}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=__spreadProps(__spreadValues({},l),{count:b})}const C=z(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[l],stepConfig:y,action:"viewUpdateBox"}))[0],h=l.valid!==C.valid;l=C;const m=lt(l);return l=m.find(b=>b.id===l.id),N({omitView:h?void 0:d,polygon:s,boxParams:l,newPointCloudBoxList:m}),m}},tt=(s,i,d)=>{if(W){let r,l;switch(d){case PointCloudView.Back:r=backViewPoint2PointCloud;break;case PointCloudView.Side:r=sideViewPoint2PointCloud;break;default:r=sideViewPoint2PointCloud;break}l=r(s,i,W);const g=Y(l);return q(d,s,l,void 0,g,y),g}},Ct=(s,i)=>{tt(s,i,PointCloudView.Side)},ft=(s,i)=>{tt(s,i,PointCloudView.Back)},ht=(s,i)=>{$(s,i,PointCloudView.Side)},xt=(s,i)=>{$(s,i,PointCloudView.Back)},vt=(s,i)=>{const d=nt(s.id),r=topViewPoint2PointCloud(s,i,X,d),l=Y(r);q(PointCloudView.Top,s,r,void 0,l,y)},Lt=(s,i)=>{if(ot){const r=__spreadValues({},s[0].newPolygon);r.pointList=r.pointList.map(l=>lbUtils.PointCloudUtils.transferCanvas2World(l,i)),B(r);return}let d=s.map(({newPolygon:r})=>{const l=at(r.id),{boxParams:g}=topViewPolygon2PointCloud(r,i,t.pointCloudInstance,l);return g});if(d=z(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:d,stepConfig:y,action:"viewUpdateBox"})),d.length===1){const{newPolygon:r}=s[0],l=Q(d);N({polygon:r,boxParams:d[0],newPointCloudBoxList:l})}else{const r=Q(d);r&&n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiMove,r)}},yt=s=>{var i,d,r,l,g;if(U){const C=Number(s.widthDefault),h=Number(s.depthDefault),m=Number(s.heightDefault),b=U==null?void 0:U.info.trackID,I=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(G=>(G==null?void 0:G.trackID)===b),v={width:(r=(d=t==null?void 0:t.toolInstance)==null?void 0:d.basicImgInfo)==null?void 0:r.width,height:(g=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:g.height},A=I.pointList.map(G=>lbUtils.PointCloudUtils.transferCanvas2World(G,v)),H=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(A,m,C),E=H[0],F=H[2],Z=lbAnnotation.MathUtils.getLineCenterPoint([E,F]),mt=U.info.center.z-U.info.depth/2,et=__spreadProps(__spreadValues({},U.info),{center:{x:Z.x,y:Z.y,z:mt+h/2},width:C,height:m,depth:h,valid:!0}),Bt=Q([et]);N({omitView:PointCloudView["3D"],polygon:I,boxParams:et,newPointCloudBoxList:Bt})}},q=(s,i,d,r,l,g)=>__async(void 0,null,function*(){const C=j==null?void 0:j.url,h={[PointCloudView.Side]:()=>{syncSideViewByPoint(d,i,u,C,g)},[PointCloudView.Back]:()=>{p&&syncBackViewByPoint(d,i,p,C,g)},[PointCloudView.Top]:()=>{syncTopViewByPoint(d,i,t,e)}};Object.keys(h).forEach(m=>{m!==s&&h[m]()}),r&&(e==null||e.updateCameraZoom(r)),dt(d)}),N=(s,i=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{const{omitView:d,polygon:r,boxParams:l,zoom:g,newPointCloudBoxList:C}=s,h=j==null?void 0:j.url;C&&n.syncAllViewPointCloudColor(i,C);const m={[PointCloudView.Side]:()=>{synchronizeSideView(l,r,u,h)},[PointCloudView.Back]:()=>{p&&synchronizeBackView(l,r,p,h)},[PointCloudView.Top]:()=>{synchronizeTopView(l,r,t,e)}};Object.keys(m).forEach(b=>{b!==d&&m[b]()}),g&&(e==null||e.updateCameraZoom(g))};return{topViewAddSphere:ut,topViewAddBox:ct,topViewSelectedChanged:Pt,topViewUpdatePoint:vt,sideViewUpdatePoint:Ct,backViewUpdatePoint:ft,topViewUpdateBox:Lt,sideViewUpdateBox:ht,backViewUpdateBox:xt,syncPointCloudViews:N,syncPointCloudPoint:q,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),e==null||e.generateBoxes(s)},initPointCloud3d:s=>{if(!e)return;const i=lbUtils.PointCloudUtils.getDefaultOrthographicParams(s);e.initOrthographicCamera(i),e.initRenderer(),e.render()},updatePointCloudData:(...s)=>__async(void 0,[...s],function*(i=j){var d,r,l,g,C,h,m,b;if(!(i==null?void 0:i.url)||!e)return;D([]),actionCreators.SetAnnotationLoading(z,!0),actionCreators.SetLoadPCDFileLoading(z,!0),(d=o==null?void 0:o.setResourceLoading)==null||d.call(o,!0),yield e.loadPCDFile(i.url,(r=y==null?void 0:y.radius)!=null?r:DEFAULT_RADIUS),e==null||e.clearAllBox(),e==null||e.clearAllSphere();let S=[],I=[],v=[],A=[];e.updateTopCamera();const H=(g=(l=index.jsonParser(i.result))==null?void 0:l.valid)!=null?g:!0;if(n.setPointCloudValid(H),(C=n.sideViewInstance)==null||C.clearAllData(),(h=n.backViewInstance)==null||h.clearAllData(),i.result){if(S=lbUtils.PointCloudUtils.getBoxParamsFromResultList(i.result),(S==null?void 0:S.length)>0&&i.isPreResult&&(y==null?void 0:y.lowerLimitPointsNumInBox)>0){S=yield e==null?void 0:e.filterPreResult(i.url,y,S);const E=index.jsonParser(i.result);E[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=S,i.result=JSON.stringify(E),n.setPointCloudResult(S)}v=lbUtils.PointCloudUtils.getPolygonListFromResultList(i.result),I=lbUtils.PointCloudUtils.getLineListFromResultList(i.result),A=lbUtils.PointCloudUtils.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(m=y==null?void 0:y.radius)!=null?m:DEFAULT_RADIUS}),e==null||e.generateBoxes(S),e==null||e.generateSpheres(A),yield n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,S,[])}M({pointCloudBoxList:S,polygonList:v,lineList:I,pointCloudSphereList:A}),actionCreators.SetAnnotationLoading(z,!1),actionCreators.SetLoadPCDFileLoading(z,!1),(b=o==null?void 0:o.setResourceLoading)==null||b.call(o,!1)}),updateViewsByDefaultSize:yt,generateRects:J,update2DViewRect:pt,remove2DViewRect:gt}},useSyncRectPositionDimensionToPointCloudList=()=>{const{pointCloudBoxList:o,rectList:n,setPointCloudResult:t}=React.useContext(PointCloudContext.PointCloudContext),u=ahooks.useLatest(o),p=ahooks.useLatest(n);return{syncToPointCloudBoxList:React.useCallback(()=>{const P=u.current,c=p.current;if(c.length===0)return null;const a=new Map,x=new Set;if(c.filter(f=>f.extId!==void 0).forEach(f=>{const L=f.extId,R=f.imageName,D=_.pick(f,["x","y","width","height"]);let w=a.get(L);w||(w=new Map,a.set(L,w)),w.set(R,D),x.add(L)}),a.size){const f=P.map(L=>{var R;const D=L.id;if(x.has(D)){const w=__spreadValues({},L);return(R=w.rects)==null||R.forEach(V=>{var T;const k=V.imageName;Object.assign(V,(T=a.get(D))==null?void 0:T.get(k))}),w}return L});return t(f),f}return null},[])}};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,exports.useSyncRectPositionDimensionToPointCloudList=useSyncRectPositionDimensionToPointCloudList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),ctx=require("../../../store/ctx.js"),useSingleBox=require("./useSingleBox.js"),PointCloudContext=require("../PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),actionCreators=require("../../../store/annotation/actionCreators.js"),usePointCloudViews=require("./usePointCloudViews.js"),useSphere=require("./useSphere.js"),useHistory=require("./useHistory.js"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js");const PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},useUpdatePointCloudColor=(v,a)=>{const l=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:u,selectedIDs:t,pointCloudBoxList:s,mainViewInstance:c,selectedID:g}=l,f=ctx.useDispatch(),{selectedSphere:C}=useSphere.useSphere(),{syncPointCloudViews:p,syncPointCloudPoint:P,generateRects:h}=usePointCloudViews.usePointCloudViews({setResourceLoading:v}),{selectedBox:d,updateSelectedBox:x}=useSingleBox.useSingleBox({generateRects:h}),{pushHistoryWithList:V}=useHistory.useHistory(),q=({newSelectedSphere:i,newSphereList:o})=>{const n=u==null?void 0:u.toolInstance;if((i||C)&&t.length===1){const e=i!=null?i:C;n.setSelectedID(t[0]);const r=n.selectedPoint;e&&(P==null||P(PointCloudView.Top,r,e,void 0,o,a))}},y=({trigger:i,newSelectedBox:o})=>{const n=u==null?void 0:u.toolInstance;if(!(t.length===0||!n)&&(o||(d==null?void 0:d.info))){const e=o!=null?o:d==null?void 0:d.info,r=o;if(e){p==null||p({omitView:PointCloudView.Top,polygon:r,boxParams:e},i);return}}};return{updatePointCloudColor:i=>{if(s.forEach(o=>{var n,e,r;if(o&&t.includes(o.id)){o.attribute=i;const S=f(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[o],stepConfig:a,action:"viewUpdateBox"}));o.valid=S[0].valid,x(o),(r=(e=(n=l==null?void 0:l.topViewInstance)==null?void 0:n.pointCloud2dOperation)==null?void 0:e.setPolygonValidAndRender)==null||r.call(e,o.id,!0,o.valid),q({})}}),c){const o=t&&t.length>1?ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MulitSelect:ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single;if(l.syncAllViewPointCloudColor(o,s),t&&t.length===1){const n=s.find(e=>e.id===t[0]);y({trigger:o,newSelectedBox:n})}c.generateBoxes(s)}g||V({pointCloudBoxList:s})}}};exports.useUpdatePointCloudColor=useUpdatePointCloudColor;
|
|
@@ -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"),PointCloudSegment2DView=require("./PointCloudSegment2DView.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"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=a=>{const{currentData:i,imgList:P,drawLayerSlot:c,checkMode:n,intelligentFit:v,imgIndex:p,config:L,measureVisible:E}=a,e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:m,setGlobalPattern:
|
|
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"),PointCloudSegment2DView=require("./PointCloudSegment2DView.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"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=a=>{const{currentData:i,imgList:P,drawLayerSlot:c,checkMode:n,intelligentFit:v,imgIndex:p,config:L,measureVisible:E,setResourceLoading:x}=a,e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:m,setGlobalPattern:S,selectedIDs:C}=e,q=ctx.useDispatch(),[l,f]=React.useState(!1),b=(C==null?void 0:C.length)>0&&l,j=index.jsonParser(i.result),{toolInstanceRef:o,clearToolInstance:w}=annotation.useCustomToolInstance({basicInfo:j});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=t=>{t!==m&&(S(t),e.clearAllDetectionInstance(),w())}},[m]),React.useEffect(()=>{var t;if(actionCreators.SetLoadPCDFileLoading(q,!0),i){const{boxParamsList:r,polygonList:s,lineList:u,sphereParamsList:d,segmentation:N,rectList:V}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((t=i==null?void 0:i.result)!=null?t:"");e.setPointCloudResult(r),e.setPolygonList(s),e.setLineList(u),e.setPointCloudSphereList(d),e.setRectList(V),e.setSegmentation(N)}},[p]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var t,r,s,u,d;return{resultPolygon:(t=e.polygonList)!=null?t:[],resultLine:(r=e.lineList)!=null?r:[],resultPoint:(s=e.pointCloudSphereList)!=null?s:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(d=e.segmentation)!=null?d:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),P.length===0)return null;if(m===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:n,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout")},React__default.default.createElement(PointCloudSegment,{checkMode:n}),React__default.default.createElement(PointCloudSegment2DView,null)),React__default.default.createElement(PointCloudSegmentStatus,{config:L}),c==null?void 0:c({direct:!0}));let g=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:n}),React__default.default.createElement(PointCloudSideView,{checkMode:n}));return l&&(g=React__default.default.createElement(index$2,{selectAndEnlarge:b,checkMode:n})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:n,toolInstanceRef:o,setResourceLoading:x}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:t=>t.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),g),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:c,checkMode:n,intelligentFit:v,setIsEnlargeTopView:f,onExitZoom:()=>{f(!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})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:n,measureVisible:E})))),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 +1 @@
|
|
|
1
|
-
"use strict";var antd=require("antd"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),icon=require("../../../assets/predictTracking/icon.svg.js"),useSingleBox=require("../../pointCloudView/hooks/useSingleBox.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),util=require("../previewResult/util.js"),useStatus=require("../../pointCloudView/hooks/useStatus.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,
|
|
1
|
+
"use strict";var antd=require("antd"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),icon=require("../../../assets/predictTracking/icon.svg.js"),useSingleBox=require("../../pointCloudView/hooks/useSingleBox.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),util=require("../previewResult/util.js"),useStatus=require("../../pointCloudView/hooks/useStatus.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,r,t)=>new Promise((l,s)=>{var u=n=>{try{a(t.next(n))}catch(o){s(o)}},i=n=>{try{a(t.throw(n))}catch(o){s(o)}},a=n=>n.done?l(n.value):Promise.resolve(n.value).then(u,i);a((t=t.apply(e,r)).next())});const PredictTrackingIcon=e=>{const r=ctx.useDispatch(),{t}=reactI18next.useTranslation(),{isPointCloudSegmentationPattern:l}=useStatus.useStatus(),{loading:s,predictionResultVisible:u}=e,{selectedBox:i}=useSingleBox.useSingleBox(),a=()=>__async(void 0,null,function*(){if(s||u)return;const n=i==null?void 0:i.info.trackID;if(!n){antd.message.error(t("BeforePredictStarting"));return}yield r(actionCreators.ChangeSave);const o=i==null?void 0:i.info.id,c=yield r(actionCreators.GetBoxesByID(n,o));if(c.length<2){antd.message.error(t("MarkOnlyOne"));return}const g=c.findIndex(p=>p.id===o),d=c[g-1],f=c[g],x=f.index-d.index;if(x<2){antd.message.error(t("HaveNoNeed"));return}if(x>8){antd.message.error(t("ThePredictedPointCloud"));return}antd.message.success(t("PredictingDataFrom",{startPage:d.index+1,endPage:f.index+1,selectedBoxTrackID:n})),actionCreators.SetAnnotationLoading(r,!0);const v=util.predict(d,f);actionCreators.SetPredictResult(r,v),actionCreators.SetPredictResultVisible(r,!0)});return l?null:React__default.default.createElement(antd.Button,{type:"link",onClick:a,style:{display:"flex",flexDirection:"column",height:"auto",alignItems:"center"}},React__default.default.createElement("img",{src:icon,style:{alignSelf:"center"}}),React__default.default.createElement("span",{style:{color:"#797979"}},t("ComplementaryTracking")))},mapStateToProps=e=>({loading:e.annotation.loading,predictionResultVisible:e.annotation.predictionResultVisible});var PredictTrackingIcon$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PredictTrackingIcon);module.exports=PredictTrackingIcon$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var classNames=require("classnames"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),PointCloudContext=require("../../pointCloudView/PointCloudContext.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),dom=require("../../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),util=require("./util.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,a)=>new Promise((c,n)=>{var o=i=>{try{l(a.next(i))}catch(s){n(s)}},r=i=>{try{l(a.throw(i))}catch(s){n(s)}},l=i=>i.done?c(i.value):Promise.resolve(i.value).then(o,r);l((a=a.apply(e,t)).next())});const PreviewResult=e=>{const{predictionResult:t,predictionResultVisible:a,imgList:c}=e,[n,o]=React.useState([]),r=ctx.useDispatch(),{t:l}=reactI18next.useTranslation(),i=()=>{actionCreators.SetPredictResultVisible(r,!1),actionCreators.SetPredictResult(r,[]),o([])},s=()=>__async(void 0,null,function*(){actionCreators.
|
|
1
|
+
"use strict";var classNames=require("classnames"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),PointCloudContext=require("../../pointCloudView/PointCloudContext.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),ctx=require("../../../store/ctx.js"),dom=require("../../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),util=require("./util.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,a)=>new Promise((c,n)=>{var o=i=>{try{l(a.next(i))}catch(s){n(s)}},r=i=>{try{l(a.throw(i))}catch(s){n(s)}},l=i=>i.done?c(i.value):Promise.resolve(i.value).then(o,r);l((a=a.apply(e,t)).next())});const PreviewResult=e=>{const{predictionResult:t,predictionResultVisible:a,imgList:c}=e,[n,o]=React.useState([]),r=ctx.useDispatch(),{t:l}=reactI18next.useTranslation(),i=()=>{actionCreators.SetPredictResultVisible(r,!1),actionCreators.SetPredictResult(r,[]),o([])},s=()=>__async(void 0,null,function*(){actionCreators.SetAnnotationLoading(r,!0),yield r(actionCreators.BatchUpdateImgListResultByPredictResult()),actionCreators.SetAnnotationLoading(r,!1),i()});return a?React__default.default.createElement(React__default.default.Fragment,null,n.length>0&&React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","bar")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","title")},React__default.default.createElement("div",null,l("ComplementaryTrackingPrediction"),n.length>0?`\uFF08${n.length}\uFF09`:""),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","option")},React__default.default.createElement("div",{className:classNames__default.default([dom.getClassName("point-cloud-predict-tracking-container","cancelOption"),dom.getClassName("point-cloud-predict-tracking-container","button")]),onClick:i},l("Cancel")),React__default.default.createElement("div",{className:classNames__default.default([dom.getClassName("point-cloud-predict-tracking-container","okOption"),dom.getClassName("point-cloud-predict-tracking-container","button")]),onClick:s},l("Apply")))),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","content")},React__default.default.createElement(Result,{list:n})))),t.length>0&&React__default.default.createElement(GenerateViewsDataUrl,{result:t,imgList:c,setList:o})):null},Result=e=>{const{list:t}=e,{t:a}=reactI18next.useTranslation(),c=[a("TopView"),a("SideView"),a("BackView")];return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","left")},c.map(n=>React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","title"),key:n},n))),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","right")},t.map(n=>React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","item"),key:n.id},util.views.map(o=>{const r=n[o];return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-predict-tracking-container","view"),key:`${n.id}-${o}`},React__default.default.createElement("img",{src:r}))})))))},GenerateViewsDataUrl=e=>{const t=React__default.default.useContext(PointCloudContext.PointCloudContext),a=ctx.useDispatch(),{result:c,imgList:n,setList:o}=e,r=React.useRef(null),l={width:600,height:600};return React.useEffect(()=>{(()=>__async(void 0,null,function*(){var s,f,g,v,C,y;const p=(s=t.mainViewInstance)==null?void 0:s.config;if(p&&r.current){const N=lbUtils.PointCloudUtils.getDefaultOrthographicParams(l),u=new lbAnnotation.PointCloud({container:r.current,isOrthographicCamera:!0,orthographicParams:N,config:p});u.setShowDirection(!1);for(const d of c){const{index:m}=d,P=n[m].url?n[m].url:(C=(v=(g=(f=n[m])==null?void 0:f.webPointCloudFile)==null?void 0:g.lidar)==null?void 0:v.url)!=null?C:"";yield u.loadPCDFileByBox(P,d,{width:2,height:2,depth:2}),yield u.updateCameraZoom(t.zoom);const _=(y=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},p),{attributeConfigurable:!0}),{}))==null?void 0:y.fill;u.generateBox(d,_),yield util.sleep(500),yield util.getViewsDataUrl(u,d,t.zoom),yield u.removeObjectByName(d.id,"box"),yield u.clearPointCloudAndRender()}o(c),actionCreators.SetAnnotationLoading(a,!1)}}))()},[]),React__default.default.createElement("div",{style:l,ref:r,className:"generate-view"})},mapStateToProps=e=>({predictionResult:e.annotation.predictionResult,predictionResultVisible:e.annotation.predictionResultVisible,imgList:e.annotation.imgList});var PreviewResult$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PreviewResult);module.exports=PreviewResult$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),VideoTagLayer=require("../../videoPlayer/VideoTagLayer.js"),_=require("lodash"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class TagToolInstanceAdaptor extends React__default.default.Component{constructor(e){super(e);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,s)=>{const n=s?this.state.tagResult.map(i=>((i==null?void 0:i.result[s])&&delete i.result[s],i)):[];this.setState({tagResult:n},()=>this.emitEvent("render"))},this.exportData=()=>{var t,s;const n=(s=(t=this.videoPlayer)==null?void 0:t.duration)!=null?s:0;return[this.state.tagResult,{valid:this.state.valid,duration:n}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,s={})=>{var n,i;const l=_.cloneDeep(s),{isMulti:o}=t,{key:a,value:u}=t.value;if(o){let r=(i=(n=l[a])==null?void 0:n.split(";"))!=null?i:[];r.includes(u)?r=r.filter(c=>c!==u):r.push(u);const d=new Set(r);return l[a]=Array.from(d).join(";"),___default.default.pickBy(l,c=>c)}return l[a]=l[a]===u?void 0:u,___default.default.pickBy(l,r=>r)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,s)=>{this.setLabelBySelectedList(t,s)},this.keydown=t=>{var s;const n=utils.getKeyCodeNumber(t.keyCode);if(n){const i=n-1;if(((s=this.config.inputList)==null?void 0:s.length)===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{const{imgList:s,imgIndex:n,stepInfo:i}=t;if(!s[n])return;const l=index.jsonParser(s[n].result),o=l[`step_${i.step}`],a=this.getInitResultList();this.setState({tagResult:o?o==null?void 0:o.result:a,valid:(l==null?void 0:l.valid)===void 0?!0:l.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return lbAnnotation.TagUtils.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var e;return index.jsonParser((e=this.props.stepInfo)==null?void 0:e.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var e;return(e=this.state.tagResult[0])!=null?e:{}}get valid(){return this.state.valid}singleOn(e,t){this.fns[e]=t}on(e,t){this.singleOn(e,t)}unbindAll(e){delete this.fns[e]}getTagResultByCode(e,t){var s,n,i;try{const l=(n=(s=this.config)==null?void 0:s.inputList)!=null?n:[],o=(l==null?void 0:l.length)>1,a=t!==void 0?e:0,u=t!==void 0?t:e,r=o?l[a]:l[0],d=((i=r.subSelected)!=null?i:[])[u];if(r&&d)return{value:{key:r.value,value:d.value},isMulti:r.isMulti}}catch(l){return}}setLabelBySelectedList(e,t){var s,n,i,l,o,a;const u=this.getTagResultByCode(e,t);if(u){const r=this.combineResult(u,(n=(s=this.state.tagResult[0])==null?void 0:s.result)!=null?n:{}),d=[{sourceID:lbAnnotation.CommonToolUtils.getSourceID(),id:(l=(i=this.currentTagResult)==null?void 0:i.id)!=null?l:lbAnnotation.uuid(8,62),result:r}];if(typeof((o=this.props)==null?void 0:o.annotationBefore)=="function"){(a=this.props)==null||a.annotationBefore(()=>this.setState({tagResult:d},()=>this.emitEvent("render")));return}this.setState({tagResult:d},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),VideoTagLayer=require("../../videoPlayer/VideoTagLayer.js"),_=require("lodash"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class TagToolInstanceAdaptor extends React__default.default.Component{constructor(e){super(e);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,s)=>{const n=s?this.state.tagResult.map(i=>((i==null?void 0:i.result[s])&&delete i.result[s],i)):[];this.setState({tagResult:n},()=>this.emitEvent("render"))},this.exportData=()=>{var t,s;const n=(s=(t=this.videoPlayer)==null?void 0:t.duration)!=null?s:0;return[this.state.tagResult,{valid:this.state.valid,duration:n}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,s={})=>{var n,i;const l=_.cloneDeep(s),{isMulti:o}=t,{key:a,value:u}=t.value;if(o){let r=(i=(n=l[a])==null?void 0:n.split(";"))!=null?i:[];r.includes(u)?r=r.filter(c=>c!==u):r.push(u);const d=new Set(r);return l[a]=Array.from(d).join(";"),___default.default.pickBy(l,c=>c)}return l[a]=l[a]===u?void 0:u,___default.default.pickBy(l,r=>r)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,s)=>{this.setLabelBySelectedList(t,s)},this.keydown=t=>{var s;const n=utils.getKeyCodeNumber(t.keyCode);if(n){const i=n-1;if(((s=this.config.inputList)==null?void 0:s.length)===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{const{imgList:s,imgIndex:n,stepInfo:i}=t;if(!s[n])return;const l=index.jsonParser(s[n].result),o=l[`step_${i.step}`],a=this.getInitResultList();this.setState({tagResult:o?o==null?void 0:o.result:a,valid:(l==null?void 0:l.valid)===void 0?!0:l.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return lbAnnotation.TagUtils.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var e;return index.jsonParser((e=this.props.stepInfo)==null?void 0:e.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var e;return(e=this.state.tagResult[0])!=null?e:{}}get valid(){return this.state.valid}singleOn(e,t){this.fns[e]=t}on(e,t){this.singleOn(e,t)}unbindAll(e){delete this.fns[e]}getTagResultByCode(e,t){var s,n,i;try{const l=(n=(s=this.config)==null?void 0:s.inputList)!=null?n:[],o=(l==null?void 0:l.length)>1,a=t!==void 0?e:0,u=t!==void 0?t:e,r=o?l[a]:l[0],d=((i=r.subSelected)!=null?i:[])[u];if(r&&d)return{value:{key:r.value,value:d.value},isMulti:r.isMulti}}catch(l){return}}setLabelBySelectedList(e,t){var s,n,i,l,o,a;const u=this.getTagResultByCode(e,t);if(u){const r=this.combineResult(u,(n=(s=this.state.tagResult[0])==null?void 0:s.result)!=null?n:{}),d=[{sourceID:lbAnnotation.CommonToolUtils.getSourceID(),id:(l=(i=this.currentTagResult)==null?void 0:i.id)!=null?l:lbAnnotation.uuid(8,62),result:r}];if(typeof((o=this.props)==null?void 0:o.annotationBefore)=="function"){(a=this.props)==null||a.annotationBefore(()=>this.setState({tagResult:d},()=>this.emitEvent("render")));return}this.setState({tagResult:d},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.removeEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(e){return e.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(e),!0}render(){var e;const{imgIndex:t,imgList:s,pageForward:n,pageJump:i,pageBackward:l}=this.props,{tagResult:o,valid:a}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},React__default.default.createElement(index$1.VideoPlayer,{imgIndex:t,imgList:s,pageBackward:l,pageForward:n,pageJump:i,valid:a,setVideoRef:u=>{this.videoPlayer=u},dataLoaded:this.props.onVideoLoaded,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),React__default.default.createElement(VideoTagLayer.VideoTagLayer,{result:o,inputList:(e=this.config)==null?void 0:e.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}exports.TagToolInstanceAdaptor=TagToolInstanceAdaptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EScribblePattern=void 0,function(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EScribblePattern=void 0,function(t){t[t.Scribble=1]="Scribble",t[t.Erase=2]="Erase"}(exports.EScribblePattern||(exports.EScribblePattern={})),exports.EToolName=void 0,function(t){t.Rect="rectTool",t.Tag="tagTool",t.Point="pointTool",t.PointMarker="pointMarkerTool",t.Segmentation="segmentationTool",t.Filter="filterTool",t.Text="textTool",t.Polygon="polygonTool",t.Line="lineTool",t.LineMarker="lineMarkerTool",t.Empty="emptyTool",t.FolderTag="folderTagTool",t.RectTrack="rectTrackTool",t.ScribbleTool="scribbleTool",t.Face="faceTool",t.ClientAttribute="clientAttributeTool",t.OCRRelation="OCRRelationTool",t.SegmentByRect="segmentByRectTool",t.Cuboid="cuboidTool",t.PointCloudPolygon="pointCloudPolygon",t.LLM="LLMTool",t.NLP="NLPTool",t.LLMMultiWheel="LLMMultiWheelTool"}(exports.EToolName||(exports.EToolName={})),exports.ETextType=void 0,function(t){t[t.AnyString=0]="AnyString",t[t.Order=1]="Order",t[t.EnglishOnly=2]="EnglishOnly",t[t.NumberOnly=3]="NumberOnly",t[t.CustomFormat=4]="CustomFormat"}(exports.ETextType||(exports.ETextType={}));const TEXT_ATTRIBUTE_MAX_LENGTH=1e3;exports.TEXT_ATTRIBUTE_MAX_LENGTH=TEXT_ATTRIBUTE_MAX_LENGTH;
|
package/dist/index.css
CHANGED
|
@@ -8,13 +8,9 @@
|
|
|
8
8
|
}
|
|
9
9
|
.index-module_imgView__wmxDk .index-module_item__-80YI {
|
|
10
10
|
margin: 0px 40px 40px 0px;
|
|
11
|
-
width: 400px;
|
|
12
11
|
display: flex;
|
|
13
|
-
height: 300px;
|
|
14
12
|
}
|
|
15
13
|
.index-module_imgView__wmxDk .index-module_item__-80YI .index-module_image__V49oW {
|
|
16
|
-
height: 260px;
|
|
17
|
-
min-width: 300px;
|
|
18
14
|
flex: 1;
|
|
19
15
|
background: #E9EBF1;
|
|
20
16
|
display: flex;
|
|
@@ -63,6 +59,27 @@
|
|
|
63
59
|
justify-content: space-between;
|
|
64
60
|
margin-top: 16px;
|
|
65
61
|
}
|
|
62
|
+
.index-module_switchBox__6DlnW {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
padding: 12px 20px;
|
|
67
|
+
}
|
|
68
|
+
.index-module_switchBox__mLSzh {
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: space-between;
|
|
71
|
+
align-items: center;
|
|
72
|
+
padding: 12px 20px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.index-module_switchLeft__7qd-2 {
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.index-module_switchTitle__de9li {
|
|
81
|
+
margin-right: 8px;
|
|
82
|
+
}
|
|
66
83
|
.dynamic-resizer-content {
|
|
67
84
|
width: 100%;
|
|
68
85
|
height: 100%;
|
|
@@ -3346,4 +3363,54 @@
|
|
|
3346
3363
|
|
|
3347
3364
|
.bee-audio-combined {
|
|
3348
3365
|
cursor: url("../dist/assets/icons/ad8081bf.svg") 10 12, default;
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
/** LLMMultiWheel style */
|
|
3369
|
+
.bee-LLMMultiWheelView {
|
|
3370
|
+
display: flex;
|
|
3371
|
+
flex: 1;
|
|
3372
|
+
flex-direction: column;
|
|
3373
|
+
overflow: hidden;
|
|
3374
|
+
background-color: #fff;
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
.bee-LLMMultiWheelView-container {
|
|
3378
|
+
flex: auto;
|
|
3379
|
+
display: flex;
|
|
3380
|
+
overflow: auto;
|
|
3381
|
+
}
|
|
3382
|
+
.bee-LLMMultiWheelView-container .dialog {
|
|
3383
|
+
min-width: 50%;
|
|
3384
|
+
padding: 8px;
|
|
3385
|
+
border: 1px solid transparent;
|
|
3386
|
+
overflow: auto;
|
|
3387
|
+
}
|
|
3388
|
+
.bee-LLMMultiWheelView-container .dialog.selected {
|
|
3389
|
+
border-color: #69b1ff;
|
|
3390
|
+
}
|
|
3391
|
+
.bee-LLMMultiWheelView-container .dialog .header {
|
|
3392
|
+
position: relative;
|
|
3393
|
+
}
|
|
3394
|
+
.bee-LLMMultiWheelView-container .dialog .header .order {
|
|
3395
|
+
position: absolute;
|
|
3396
|
+
left: 0;
|
|
3397
|
+
top: 0;
|
|
3398
|
+
width: 32px;
|
|
3399
|
+
height: 32px;
|
|
3400
|
+
line-height: 32px;
|
|
3401
|
+
text-align: center;
|
|
3402
|
+
background: #d4cbcb;
|
|
3403
|
+
border-radius: 4px;
|
|
3404
|
+
}
|
|
3405
|
+
.bee-LLMMultiWheelView-container .dialog .header .name {
|
|
3406
|
+
display: flex;
|
|
3407
|
+
flex-direction: column;
|
|
3408
|
+
align-items: center;
|
|
3409
|
+
justify-content: center;
|
|
3410
|
+
}
|
|
3411
|
+
.bee-LLMMultiWheelView-container .dialog .header .name .show-name {
|
|
3412
|
+
font-size: 16px;
|
|
3413
|
+
}
|
|
3414
|
+
.bee-LLMMultiWheelView-container .dialog .header .name .tips {
|
|
3415
|
+
color: #d4cbcb;
|
|
3349
3416
|
}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),index$
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),index$4=require("./components/NLPToolView/textContent/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$6=require("./components/predictTracking/predictTrackingIcon/index.js"),index$5=require("./components/LLMToolView/index.js"),index$7=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),BatchSwitchConnectIn2DView=require("./views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js"),index$8=require("./components/measureCanvas/index.js"),index$9=require("./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js"),index$a=require("./views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js"),index$b=require("./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js"),index$c=require("./components/audioPlayer/index.js"),index$d=require("./utils/index.js"),index$e=require("./components/subAttributeList/index.js"),useToolStyle=require("./hooks/useToolStyle.js"),reducer=require("./store/annotation/reducer.js"),index$f=require("./store/toolConfig/index.js"),index$3=require("./components/LLMMultiWheelView/index.js"),index$g=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore();lbUtils.i18n.use(reactI18next.initReactI18next),lbUtils.i18n.options.react={useSuspense:!1};const OutputApp=(e,t)=>{const[r,a]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:(o,n)=>{const i=~~o-1;store.dispatch(actionCreators.PageJump(i)),n&&store.dispatch(reducer.LoadFileAndFileData(i))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(useToolStyle.ToolStyleProvider,{value:e.toolStyle},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:o=>{var n;a(o),(n=e.onLoad)==null||n.call(e,{toolInstance:o})}}))))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2.default,exports.TextContent=index$4,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$6,exports.LLMToolView=index$5,exports.SwitchCuboidBoxIn2DView=index$7.default,Object.defineProperty(exports,"SwitchCuboidBoxIn2DViewStateMode",{enumerable:!0,get:function(){return index$7.SwitchCuboidBoxIn2DViewStateMode}}),exports.BatchSwitchConnectIn2DView=BatchSwitchConnectIn2DView.default,exports.MeasureCanvas=index$8,exports.AnnotatedBox=index$9,exports.RectRotateSensitivitySlider=index$a,exports.FindTrackIDIndex=index$b.FindTrackIDIndexInCheckMode,exports.AudioPlayer=index$c.WrapAudioPlayer,exports.generatePointCloudBoxRects=index$d.generatePointCloudBoxRects,exports.SubAttributeList=index$e,exports.useToolConfigStore=index$f,exports.LLMMultiWheelSourceView=index$3.LLMMultiWheelSourceView,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$g.EDataFormatType}}),Object.defineProperty(exports,"ELLMDataType",{enumerable:!0,get:function(){return index$g.ELLMDataType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$g.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$g.ESubmitType}}),exports.componentCls=index$g.componentCls,exports.prefix=index$g.prefix,exports.default=index,exports.store=store;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var index=require("../../constant/index.js"),zustand=require("zustand");const useLLMMultiWheelStore=zustand.create(t=>({dataFormatType:index.EDataFormatType.Default,setDataFormatType:e=>t(a=>({dataFormatType:e})),selectedID:"",setSelectedID:e=>t(a=>({selectedID:e})),newAnswerListMap:{},setNewAnswerListMap:e=>t(a=>({newAnswerListMap:e}))}));module.exports=useLLMMultiWheelStore;
|