@labelbee/lb-components 1.24.0-alpha.5 → 1.24.0-alpha.50
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/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
- package/dist/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
- package/dist/components/DynamicResizer/DynamicResizer.js +1 -1
- package/dist/components/DynamicResizer/hooks/useDrag.js +1 -1
- package/dist/components/DynamicResizer/hooks/useDraggingAllowed.js +1 -0
- package/dist/components/DynamicResizer/hooks/useUpdateHeight.js +1 -1
- package/dist/components/DynamicResizer/utils/index.js +1 -0
- package/dist/components/LLMMultiWheelView/dialogView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -1
- package/dist/components/LLMToolView/index.js +1 -1
- package/dist/components/LLMToolView/modelAPIView/index.js +1 -1
- package/dist/components/LLMToolView/questionView/components/audioView/index.js +1 -0
- package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/dist/components/LLMToolView/questionView/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/dist/components/attributeList/index.js +1 -1
- package/dist/components/audioAnnotate/index.js +1 -1
- package/dist/components/audioPlayer/index.js +1 -1
- package/dist/components/longText/index.js +1 -1
- package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
- package/dist/components/pointCloudView/components/TitleButton/index.js +1 -1
- package/dist/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
- package/dist/components/pointCloudView/components/sideAndBackOverView/index.js +1 -1
- package/dist/components/pointCloudView/hooks/useHighlight.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/components/tagList/index.js +1 -1
- package/dist/components/videoPlayer/components/SpeedController/index.js +1 -1
- package/dist/components/videoPlayer/index.js +1 -1
- package/dist/constant/index.js +1 -1
- package/dist/index.css +112 -90
- package/dist/store/Actions.js +1 -1
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/store/toolConfig/pointCloudToolConfig.js +1 -1
- package/dist/types/components/DynamicResizer/DynamicResizer.d.ts +3 -3
- package/dist/types/components/DynamicResizer/hooks/useDrag.d.ts +24 -7
- package/dist/types/components/DynamicResizer/hooks/useDraggingAllowed.d.ts +12 -0
- package/dist/types/components/DynamicResizer/hooks/useUpdateHeight.d.ts +10 -21
- package/dist/types/components/DynamicResizer/types/interface.d.ts +14 -6
- package/dist/types/components/DynamicResizer/utils/index.d.ts +4 -0
- package/dist/types/components/LLMMultiWheelView/dialogView/index.d.ts +2 -0
- package/dist/types/components/LLMMultiWheelView/index.d.ts +2 -0
- package/dist/types/components/LLMToolView/questionView/components/audioView/index.d.ts +8 -0
- package/dist/types/components/LLMToolView/questionView/components/header/index.d.ts +3 -1
- package/dist/types/components/attributeList/components/limitPopover/index.d.ts +2 -2
- package/dist/types/components/longText/index.d.ts +1 -1
- package/dist/types/components/pointCloud2DRectOperationView/useUpdateRectList.d.ts +0 -1
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +4 -0
- package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -0
- package/dist/types/components/pointCloudView/hooks/usePointCloudAttribute.d.ts +3 -0
- package/dist/types/components/pointCloudView/hooks/useRotate.d.ts +1 -2
- package/dist/types/components/pointCloudView/hooks/useRotateEdge.d.ts +1 -2
- package/dist/types/components/pointCloudView/index.d.ts +2 -0
- package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +1 -1
- package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +1 -1
- package/dist/types/components/videoAnnotate/videoTextTool/index.d.ts +1 -1
- package/dist/types/components/videoPlayer/index.d.ts +1 -1
- package/dist/types/constant/index.d.ts +4 -2
- package/dist/types/store/Actions.d.ts +1 -0
- package/dist/types/store/annotation/actionCreators.d.ts +9 -1
- package/dist/types/store/annotation/map.d.ts +1 -0
- package/dist/types/store/annotation/reducer.d.ts +5 -1
- package/dist/types/store/annotation/types.d.ts +4 -2
- package/dist/types/store/toolConfig/types.d.ts +2 -0
- package/dist/types/utils/LLM.d.ts +6 -0
- package/dist/types/views/MainView/index.d.ts +2 -0
- package/dist/types/views/MainView/sidebar/GeneralOperation/ActionsConfirm.d.ts +3 -0
- package/dist/types/views/MainView/sidebar/GeneralOperation/index.d.ts +9 -0
- package/dist/types/views/MainView/sidebar/index.d.ts +2 -0
- package/dist/utils/LLM.js +1 -0
- package/dist/utils/ToolPointCloudBoxRenderHelper.js +1 -1
- package/dist/views/MainView/LLMMultiWheelLayout/index.js +1 -1
- package/dist/views/MainView/index.js +1 -1
- package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/dist/views/MainView/sidebar/GeneralOperation/index.js +1 -1
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/ToolIcons.js +1 -1
- package/dist/views/MainView/sidebar/index.js +1 -1
- package/es/_virtual/2DViewWorker.js +1 -1
- package/es/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
- package/es/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
- package/es/components/DynamicResizer/DynamicResizer.js +1 -1
- package/es/components/DynamicResizer/hooks/useDrag.js +1 -1
- package/es/components/DynamicResizer/hooks/useDraggingAllowed.js +1 -0
- package/es/components/DynamicResizer/hooks/useUpdateHeight.js +1 -1
- package/es/components/DynamicResizer/utils/index.js +1 -0
- package/es/components/LLMMultiWheelView/dialogView/index.js +1 -1
- package/es/components/LLMMultiWheelView/index.js +1 -1
- package/es/components/LLMMultiWheelView/sidebar/index.js +1 -1
- package/es/components/LLMToolView/index.js +1 -1
- package/es/components/LLMToolView/modelAPIView/index.js +1 -1
- package/es/components/LLMToolView/questionView/components/audioView/index.js +1 -0
- package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/es/components/LLMToolView/questionView/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/es/components/attributeList/index.js +1 -1
- package/es/components/audioAnnotate/index.js +1 -1
- package/es/components/audioPlayer/index.js +1 -1
- package/es/components/longText/index.js +1 -1
- package/es/components/pointCloud2DRectOperationView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/components/pointCloudView/PointCloudTopView.js +1 -1
- package/es/components/pointCloudView/components/TitleButton/index.js +1 -1
- package/es/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
- package/es/components/pointCloudView/components/sideAndBackOverView/index.js +1 -1
- package/es/components/pointCloudView/hooks/useHighlight.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/pointCloudView/index.js +1 -1
- package/es/components/tagList/index.js +1 -1
- package/es/components/videoPlayer/components/SpeedController/index.js +1 -1
- package/es/components/videoPlayer/index.js +1 -1
- package/es/constant/index.js +1 -1
- package/es/index.css +112 -90
- package/es/store/Actions.js +1 -1
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/store/toolConfig/pointCloudToolConfig.js +1 -1
- package/es/utils/LLM.js +1 -0
- package/es/utils/ToolPointCloudBoxRenderHelper.js +1 -1
- package/es/views/MainView/LLMMultiWheelLayout/index.js +1 -1
- package/es/views/MainView/index.js +1 -1
- package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/es/views/MainView/sidebar/GeneralOperation/index.js +1 -1
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/ToolIcons.js +1 -1
- package/es/views/MainView/sidebar/index.js +1 -1
- package/package.json +8 -8
- package/dist/components/DynamicResizer/assets/bottomToZero.svg.js +0 -1
- package/dist/components/DynamicResizer/assets/divider.svg.js +0 -1
- package/dist/components/DynamicResizer/assets/topToZero.svg.js +0 -1
- package/es/components/DynamicResizer/assets/bottomToZero.svg.js +0 -1
- package/es/components/DynamicResizer/assets/divider.svg.js +0 -1
- package/es/components/DynamicResizer/assets/topToZero.svg.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),util=require("./util.js"),useUpdateRectList=require("./useUpdateRectList.js"),_=require("lodash"),useToolStyle=require("../../hooks/useToolStyle.js"),index=require("../../store/toolConfig/index.js");function _interopDefaultLegacy(c){return c&&typeof c=="object"&&"default"in c?c:{default:c}}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=(c,l
|
|
1
|
+
"use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),util=require("./util.js"),useUpdateRectList=require("./useUpdateRectList.js"),_=require("lodash"),useToolStyle=require("../../hooks/useToolStyle.js"),index=require("../../store/toolConfig/index.js");function _interopDefaultLegacy(c){return c&&typeof c=="object"&&"default"in c?c:{default:c}}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=(c,s,l)=>s in c?__defProp(c,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):c[s]=l,__spreadValues=(c,s)=>{for(var l in s||(s={}))__hasOwnProp.call(s,l)&&__defNormalProp(c,l,s[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(s))__propIsEnum.call(s,l)&&__defNormalProp(c,l,s[l]);return c},__spreadProps=(c,s)=>__defProps(c,__getOwnPropDescs(s)),__async=(c,s,l)=>new Promise((f,p)=>{var m=a=>{try{D(l.next(a))}catch(g){p(g)}},S=a=>{try{D(l.throw(a))}catch(g){p(g)}},D=a=>a.done?f(a.value):Promise.resolve(a.value).then(m,S);D((l=l.apply(c,s)).next())});const PointCloud2DRectOperationView=c=>{var s,l;const{mappingData:f,size:p,config:m,checkMode:S,afterImgOnLoad:D,shouldExcludePointCloudBoxListUpdate:a}=c,{selectBoxVisibleSwitch:g,attrChangeTrigger:M}=index(),L=(s=f==null?void 0:f.url)!=null?s:"",b=(l=f==null?void 0:f.fallbackUrl)!=null?l:"",{pointCloudBoxList:E,setPointCloudResult:O,defaultAttribute:V,rectList:q,addRectIn2DView:Y,updateRectIn2DView:ee,removeRectIn2DView:te,updateRectListByReducer:re,selectedIDs:v,setSelectedIDs:j,selectedID:C}=React.useContext(PointCloudContext.PointCloudContext),{value:U}=useToolStyle.useToolStyleContext(),ne=ahooks.useLatest(v),{update2DViewRect:oe,remove2DViewRect:ue}=usePointCloudViews.usePointCloudViews(),k=React__default.default.useRef(null),n=React.useRef(null),T=ahooks.useMemoizedFn(oe),y=ahooks.useMemoizedFn(ue),x=React.useRef(null),[ie,F]=React.useState(!0),[H,Z]=React.useState(""),[ce,B]=React.useState(!1),[se,w]=React.useState(!0),R=React.useMemo(()=>q==null?void 0:q.filter(e=>e.imageName===(f==null?void 0:f.path)),[f==null?void 0:f.path,q]),J=React.useRef(R),P=ahooks.useLatest(f==null?void 0:f.path),N=React.useCallback(e=>__async(void 0,null,function*(){try{const o=ne.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(o.length){const r=new Set(o),u=t.filter(i=>r.has(i.id)).map(i=>i.id);j(u)}return t}catch(o){}}),[j]),$=e=>{const{boxID:o}=e;if(w(!1),!a&&o){N(()=>{const t=T==null?void 0:T(e);return t?(x.current=t,O(t),t):null});return}ee(e,!0)},G=e=>{P.current&&Y(__spreadProps(__spreadValues({},e),{imageName:P.current}))},K=e=>{if(e.length===0)return;if(!a){const t=e.find(r=>r.boxID);if(t){N(()=>{const r=y==null?void 0:y(t);return r?(x.current=r,O(r),I(),r):null});return}}const o=e.find(t=>t.extId);o&&N(()=>{const{imageName:t,extId:r}=o,u=y==null?void 0:y({boxID:r,imageName:t});return u?(x.current=u,O(u),u):null}),te(e)},le=ahooks.useMemoizedFn(()=>{let e=[];return E.forEach(o=>{const{rects:t=[],id:r,attribute:u,trackID:i}=o,d=t.find(A=>A.imageName===P.current),h=r+"_"+P.current;d&&(e=[...e,__spreadProps(__spreadValues({},d),{boxID:r,id:h,attribute:u,order:i})])}),e}),I=useUpdateRectList.useUpdateRectList(()=>{var e,o,t,r,u;const i=a?[]:le(),d=(e=n.current)==null?void 0:e.selectedRectID,h=v.slice(0),A=g?util.selectSpecifiedRectsFromTopViewSelectedIds(h,i,R):[...i,...R];let X=[];!g&&(v==null?void 0:v.length)&&(X=i.filter(z=>d?v.includes(z.boxID)&&!d.includes(z.boxID):v.includes(z.boxID))),(o=n.current)==null||o.setHighLightRectList(X),(t=n.current)==null||t.setResult(A),H?((r=n.current)==null||r.setSelectedRectID(H),Z("")):ce&&d&&((u=n.current)==null||u.setSelectedRectID(d),B(!1))}),Q=({targetId:e,id:o})=>{w(!1),ae(e),Z(o)},ae=e=>{(Array.isArray(v)?v:[]).includes(e)||j(e)},W=()=>{var e,o;const t=R.find(r=>r.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,V),t&&re(r=>{var u;const i=[];let d=null;return r.forEach(h=>{h.id!==n.current.selectedRectID?i.push(h):d=h}),t.extId===void 0&&(d=(u=n.current)==null?void 0:u.selectedRect),[...i,__spreadProps(__spreadValues({},d||{}),{attribute:V})]}),B(!0),I()};return React.useEffect(()=>{if(k.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:k.current,size:p,config:__spreadProps(__spreadValues({},m),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:S});return n.current=e,n.current.init(),n.current.on("updateDragResult",$),n.current.on("afterAddingDrawingRect",G),n.current.on("deleteSelectedRects",K),n.current.on("onRightClick",Q),()=>{var o,t,r,u,i;(o=n.current)==null||o.unbind("updateDragResult",$),(t=n.current)==null||t.unbind("afterAddingDrawingRect",G),(r=n.current)==null||r.unbind("deleteSelectedRects",K),(u=n.current)==null||u.unbind("onRightClick",Q),(i=n.current)==null||i.destroy()}}},[]),React.useEffect(()=>{const e=t=>__async(void 0,null,function*(){try{return yield lbAnnotation.ImgUtils.load(t)}catch(r){return console.error("Error loading image:",r),null}}),o=()=>__async(void 0,null,function*(){var t;F(!0);let r=yield e(L);!r&&b&&(r=yield e(b)),r&&((t=n.current)==null||t.setImgNode(r),D(r)),F(!1)});n.current&&(L||b)&&o()},[L,b]),React.useEffect(()=>{var e;(e=n.current)==null||e.setSize(p)},[p]),React.useEffect(()=>{E!==x.current&&I()},[E]),React.useEffect(()=>{W()},[V]),React.useEffect(()=>{M&&W()},[M]),React.useEffect(()=>{const e=J.current;___default.default.isEqual(e,R)||(B(!0),I(),J.current=R)},[R]),React.useEffect(()=>{I()},[a]),React.useEffect(()=>{var e,o,t,r;const u=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},i=__spreadProps(__spreadValues({},u),{attributeList:(t=m.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(i))},[m.attributeList]),React.useEffect(()=>{var e;(e=n.current)==null||e.setEnableAddRect(v.length===0),I()},[v]),ahooks.useDebounceEffect(()=>{if(!C||!se){w(!0),a&&(n.current.setHoverRectID(""),n.current.render());return}const{rectList:e,size:o,zoom:t,imgNode:r}=n.current,u=e.find(d=>d.boxID===C||d.extId===C),i=lbUtils.ImgPosUtils.getBasicRecPos(r,u,o,.5);if(!i){w(!0);return}a&&n.current.setHoverRectID(u.id),n.current.setCurrentPos(i.currentPos),n.current.setZoom(i.innerZoom),n.current.renderBasicCanvas(),n.current.render()},[C],{wait:200}),React.useEffect(()=>{const{hiddenText:e}=U||{};if(e===void 0)return;const o=n.current;if(!o)return;const t=__spreadValues(__spreadValues({},o.style),U);o.setStyle(t)},[U]),React.useEffect(()=>{I()},[g]),React__default.default.createElement(es.Spin,{spinning:ie},React__default.default.createElement("div",{ref:k,style:__spreadValues({position:"relative"},p)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_2DViewWorker=require("../../_virtual/2DViewWorker.js"),ahooks=require("ahooks");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:g,data:
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_2DViewWorker=require("../../_virtual/2DViewWorker.js"),ahooks=require("ahooks");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:g,data:l,setIsEnlarge:u,setCurIndex:s,curIndex:c=0,index:f,annotations2d:d})=>g?React__default.default.createElement(index,{title:l==null?void 0:l.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{u(!1),s(void 0)}}),React__default.default.createElement("span",null,l==null?void 0:l.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},c+1,"/",d==null?void 0:d.length)):React__default.default.createElement(index,{title:l==null?void 0:l.calName,onClick:()=>{u(!0),s(f)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:g,thumbnailWidth:l,isEnlargeTopView:u,highlightAttribute:s,loadPCDFileLoading:c,checkMode:f,measureVisible:d})=>{var x;const[i,b]=React.useState([]),{topViewInstance:w,displayPointCloudList:C,polygonList:y,imageSizes:_,selectedIDs:h,windowKeydownListenerHook:v,setIsLargeStatus:F}=React.useContext(PointCloudContext.PointCloudContext),[q,P]=React.useState(""),[m,I]=React.useState(!1),[a,p]=React.useState(void 0),E=React.useCallback(t=>{F(t),I(t),lbAnnotation.EventBus.emit("2d-image:enlarge",t)},[]),r=React.useRef();React.useEffect(()=>{var t;if(!c&&w&&(e==null?void 0:e.mappingImgList)&&((t=e==null?void 0:e.mappingImgList)==null?void 0:t.length)>0)return r.current&&r.current.terminate(),r.current=new _2DViewWorker,r.current.onmessage=n=>{var o;const R=n.data;b(R),(o=r.current)==null||o.terminate()},r.current.postMessage({currentData:e,displayPointCloudList:C,selectedID:q,highlightAttribute:s,imageSizes:_,config:g,polygonList:y,selectedIDs:h}),()=>{var n;(n=r.current)==null||n.terminate()}},[C,e==null?void 0:e.mappingImgList,q,s,c,y,_,h]);const S=ahooks.useLatest(t=>{if(!m)return;const n=()=>{t.stopImmediatePropagation()};switch(t.keyCode){case EKeyCode.Esc:{E(!1);break}case EKeyCode.Left:{k();break}case EKeyCode.Right:{L();break}}n()}),k=()=>{a===void 0||!m||Number(a)>0&&p(a-1)},L=()=>{a===void 0||!m||Number(a)<(i==null?void 0:i.length)-1&&p(a+1)};React.useEffect(()=>{const t=o=>S.current(o);return v.preappendEventListener(t)},[v,v.preappendEventListener]);const j=!e||!(e==null?void 0:e.mappingImgList)||!(((x=e==null?void 0:e.mappingImgList)==null?void 0:x.length)>0),N=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>k()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>L()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{E(!1),p(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(i==null?void 0:i.length)>0?React__default.default.createElement(React__default.default.Fragment,null,i.map((t,n)=>{const o=m&&n===a;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:o}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:o,isEnlargeTopView:u,data:t,setIsEnlarge:E,setCurIndex:p,curIndex:a,index:n,annotations2d:i}),titleOnSurface:!o,style:{display:j?"none":"flex",width:o?"100%":l},key:n,toolbar:N},(t==null?void 0:t.annotations)&&(t==null?void 0:t.url)&&React__default.default.createElement(PointCloud2DSingleView,{key:t.url,currentData:e,view2dData:t,setSelectedID:P,showEnlarge:o,checkMode:f,measureVisible:d}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),classNames=require("classnames"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),index=require("../../utils/index.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),antd=require("antd"),useSize=require("../../hooks/useSize.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index$1=require("./components/PointCloudSizeSlider/index.js"),index$2=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),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,
|
|
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"),usePointCloudAttribute=require("./hooks/usePointCloudAttribute.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,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(n,i,a)=>i in n?__defProp(n,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[i]=a,__spreadValues=(n,i)=>{for(var a in i||(i={}))__hasOwnProp.call(i,a)&&__defNormalProp(n,a,i[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(i))__propIsEnum.call(i,a)&&__defNormalProp(n,a,i[a]);return n};const EKeyCode=lbAnnotation.cKeyCode.default,pointCloudID="LABELBEE-POINTCLOUD",PointCloud3DContext=React__default.default.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),PointCloudViewIcon=({perspectiveView:n})=>{const{isActive:i,setTarget3DView:a}=React.useContext(PointCloud3DContext),m=d=>classNames__default.default({[dom.getClassName("point-cloud-3d-view",d)]:!0,active:i});return React__default.default.createElement("span",{onClick:()=>{a(lbUtils.EPerspectiveView[n])},className:m(n.toLocaleLowerCase())})},PointCloud3DSideBar=({isEnlarge:n})=>{const{reset3DView:i,followTopView:a}=React.useContext(PointCloud3DContext),{t:m}=reactI18next.useTranslation(),d=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"})),e=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Tooltip,{title:m("CameraFollowTopView")},React__default.default.createElement("span",{onClick:()=>{a()},className:dom.getClassName("point-cloud-3d-view","followTop")})),React__default.default.createElement("span",{onClick:()=>{i()},className:dom.getClassName("point-cloud-3d-view","reset")}));return n?React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebarZoom")},e,d):React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-sidebar")},d,e)},PointCloud3D=({currentData:n,config:i,highlightAttribute:a,setResourceLoading:m})=>{var d;const e=React.useContext(PointCloudContext.PointCloudContext),{setIsLargeStatus:P}=e,[y,B]=React.useState(!0),[f,V]=React.useState(!1),v=React.useRef(null),{initPointCloud3d:x,generateRects:L}=usePointCloudViews.usePointCloudViews(),p=useSize(v),{t:g}=reactI18next.useTranslation(),{value:I}=useToolStyle.useToolStyleContext(),{hiddenText:h}=I||{},{updatePointCloudAttribute:N}=usePointCloudAttribute.usePointCloudAttribute(m,i),{updateSelectedBox:q}=useSingleBox.useSingleBox({generateRects:L});React.useEffect(()=>{let t=e.mainViewInstance;t&&t.updateHiddenTextAndRender(h,e.pointCloudBoxList)},[I]),React.useEffect(()=>{!e.mainViewInstance||x==null||x(p)},[p]);const{selectedBox:c}=useSingleBox.useSingleBox(),{selectedSphere:w}=useSphere.useSphere(),[j,_]=React.useState(!0),E=t=>{var o,l;const s=c==null?void 0:c.info;if(s){const r=__spreadValues({},s.center);r.x=r.x-.01,r.z=1e3;const u=t===lbUtils.EPerspectiveView.Top;(o=e.mainViewInstance)==null||o.updateCameraByBox(s,t,u?r:void 0)}w&&((l=e.mainViewInstance)==null||l.updateCameraBySphere(w,t))},D=()=>{var t;(t=e.mainViewInstance)==null||t.resetCamera()},R=()=>{var t,o;const l=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance.camera;l&&((o=e.mainViewInstance)==null||o.applyCameraTarget(l))};React.useEffect(()=>{if(v.current&&(n==null?void 0:n.url)){let t=e.mainViewInstance;!t&&p.width&&(t=new lbAnnotation.PointCloud({container:v.current,isOrthographicCamera:!0,orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(p),config:i,hiddenText:h,view:"3DView"}),t.setHandlerPipe({setSelectedIDs:e.setSelectedIDs,setNeedUpdateCenter:_}),e.setMainViewInstance(t))}},[p,n]),React.useEffect(()=>{var t,o;if(v.current&&(n==null?void 0:n.url)&&n.result&&e.mainViewInstance){let l=e.mainViewInstance;const s=lbUtils.PointCloudUtils.getRectParamsFromResultList(n.result),r=lbUtils.PointCloudUtils.getBoxParamsFromResultList(n.result),u=r.find(C=>C.id===e.selectedID);u&&((t=e.topViewInstance)==null||t.updatePolygonList(r,void 0),N(u.attribute),q(u),e.setSelectedIDs(u.id)),e.setPointCloudValid((o=index.jsonParser(n.result))==null?void 0:o.valid),e.setPointCloudResult(r),e.setRectList(s),l.generateBoxes(r)}},[n.result,e.mainViewInstance]),React.useEffect(()=>{var t,o,l,s,r,u,C;const b=(t=c==null?void 0:c.info)==null?void 0:t.id;if(!j){_(!0);return}if(b!==void 0){E(lbUtils.EPerspectiveView.Top);const z=(s=(l=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null?void 0:l.camera.zoom)!=null?s:1;(r=e.mainViewInstance)==null||r.updateCameraZoom(z)}(u=e.mainViewInstance)==null||u.setHighlightColor(b),(C=e.mainViewInstance)==null||C.render()},[(d=c==null?void 0:c.info)==null?void 0:d.id]),React.useEffect(()=>{var t,o,l,s;if(w){E(lbUtils.EPerspectiveView.Top);const r=(l=(o=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:o.camera.zoom)!=null?l:1;(s=e.mainViewInstance)==null||s.updateCameraZoom(r)}},[w]),React.useEffect(()=>(window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}),[]);const S=t=>{if(t.keyCode===EKeyCode.Esc){V(!1);return}},T=React.useMemo(()=>({reset3DView:D,setTarget3DView:E,isActive:!!c,followTopView:R}),[c,e.mainViewInstance]);React.useEffect(()=>{var t,o,l;const s=e.pointCloudBoxList.filter(r=>r.attribute===a);(s==null?void 0:s.length)>0&&((t=e.mainViewInstance)==null||t.clearHighlightBoxes(),(o=e.mainViewInstance)==null||o.highlightBoxes(s)),s.length===0&&((l=e.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[a,e.mainViewInstance]);const k=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$1,{onChange:t=>{var o;(o=e.mainViewInstance)==null||o.updatePointSize({customSize:t})}}),React__default.default.createElement("span",{style:{marginRight:8}},g("ShowArrows")),React__default.default.createElement(antd.Switch,{size:"small",checked:y,onChange:t=>{var o;B(t),(o=e.mainViewInstance)==null||o.setShowDirection(t)}}),f&&React__default.default.createElement(PointCloud3DContext.Provider,{value:T},React__default.default.createElement(PointCloud3DSideBar,{isEnlarge:f})));return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-3d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:f}),title:f?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{P(!1),V(!1)}}),g("3DView")):React__default.default.createElement(index$2,{title:g("3DView"),onClick:()=>{P(!0),V(!0)}}),toolbar:k},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-content")},!f&&React__default.default.createElement(PointCloud3DContext.Provider,{value:T},React__default.default.createElement(PointCloud3DSideBar,null)),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-3d-view"),id:pointCloudID,ref:v})))};var PointCloud3DView=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud3D);module.exports=PointCloud3DView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),ToolPointCloudBoxRenderHelper=require("../../utils/ToolPointCloudBoxRenderHelper.js"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js"),_=require("lodash"),map=require("./utils/map.js"),useTimeoutFunc=require("./hooks/useTimeoutFunc.js"),useWindowKeydownListener=require("./hooks/useWindowKeydownListener.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}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=(r,i,d)=>i in r?__defProp(r,i,{enumerable:!0,configurable:!0,writable:!0,value:d}):r[i]=d,__spreadValues=(r,i)=>{for(var d in i||(i={}))__hasOwnProp.call(i,d)&&__defNormalProp(r,d,i[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(i))__propIsEnum.call(i,d)&&__defNormalProp(r,d,i[d]);return r},__spreadProps=(r,i)=>__defProps(r,__getOwnPropDescs(i)),__async=(r,i,d)=>new Promise((x,D)=>{var A=u=>{try{I(d.next(u))}catch(R){D(R)}},O=u=>{try{I(d.throw(u))}catch(R){D(R)}},I=u=>u.done?x(u.value):Promise.resolve(u.value).then(A,O);I((d=d.apply(r,i)).next())});const pickRectObject=r=>___default.default.pick(r,["id","attribute","width","height","x","y","imageName"]),PointCloudContext=React__default.default.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:r=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:r=>!1,removeRectBySpecifyId:(r,i,d)=>!1,removeRectByPointCloudBoxId:r=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:useWindowKeydownListener.getEmptyUseWindowKeydownListener()}),PointCloudProvider=({children:r})=>{const[i,d]=React.useState([]),[x,D]=React.useState([]),[A,O]=React.useState([]),[I,u]=React.useState([]),[R,Re]=React.useState([]),[v,N]=React.useState([]),[B,j]=React.useState([]),[U,xe]=React.useState(!0),[Z,Le]=React.useState(2),[J,De]=React.useState(!0),[Q,Ae]=React.useState(1),[f,X]=React.useState(),[Y,$]=React.useState(),[ee,te]=React.useState(),[g,oe]=React.useState(),[ne,Be]=React.useState(""),[F,_e]=React.useState(lbAnnotation.EToolName.Rect),q=React.useRef(new lbAnnotation.ActionsHistory).current,[p,T]=React.useState([]),[ie,Ve]=React.useState(""),[z,Ne]=React.useState(lbUtils.EPointCloudPattern.Detection),[L,se]=React.useState(void 0),[W,He]=React.useState([]),[G,Me]=React.useState([]),[re,ke]=React.useState(!1),h=index(),[le,Ee]=React.useState({}),Oe=ctx.useDispatch(),je=o=>{const{imgNode:n,path:t}=o;t&&n&&Ee(a=>__spreadProps(__spreadValues({},a),{[t]:{width:n.width,height:n.height}}))},ae=React.useMemo(()=>v.length===1?v[0]:"",[v]),de=useWindowKeydownListener.default(),H=React.useCallback((o,n,t="extId")=>{const a=t||"id",l=new Set(n);return u(c=>{let S=!1;const P=c.filter(k=>{const K=k[a],E=l.has(K)?k.imageName!==o:!0;return E||(S=!0),E});return S?P:c}),!0},[]),ce=React.useCallback(o=>{const n=i.map(t=>t.id);return H(o,n,"extId")},[i,H]),ue=React.useCallback(o=>{if(!o)return!1;const n=i.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:a,attribute:l,trackID:c}=t,S=t.rects.find(P=>P.imageName===o);if(S){const P=___default.default.pick(S,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},P),{id:lbAnnotation.uuid(),attribute:l,order:c,extId:a,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(u(t=>{const a=new Set(t.filter(c=>o===c.imageName).map(c=>c.extId)),l=n.filter(c=>a.has(c.extId)===!1);return l.length?[...t,...l]:t}),!0):!1},[i]),ge=React.useMemo(()=>i.filter(n=>Array.isArray(n.rects)&&n.rects.length>0).reduce((n,t)=>{var a;return(a=t.rects)==null||a.forEach(l=>{const{imageName:c}=l;if(!c){console.warn("Missing image name"),console.trace(l,t);return}map.addMapIndirectWeakSetItem(n,c,t.id,t)}),n},new Map),[i]),fe=React.useCallback(o=>{u(n=>o(n,pickRectObject))},[pickRectObject]),pe=React.useMemo(()=>I.filter(o=>o.extId!==void 0&&o.id!==void 0).reduce((o,n)=>{const t=n.imageName;return t?(map.addMapIndirectWeakSetItem(o,t,n.extId,n),o):(console.warn("missing image name"),console.log(n,I),o)},new Map),[I]),{fn:Fe}=useTimeoutFunc.default(o=>{N(n=>{const t=o,a=new Set(t);let l=!1;const c=n.filter(S=>{const P=a.has(S);return P||(l=!0),P});return l?c:n})},200),he=React.useCallback(o=>{const n=o.map(t=>t.id);d(o),Fe(n)},[]),M=React.useMemo(()=>{const o=i.find(e=>e.id===ae),n=e=>{const s=i.concat(e);return he(s),s},t=e=>{const s=x.concat(e);return D(s),s},a=e=>{xe(e!==!1)},l=e=>{e===void 0&&N([]),typeof e=="string"&&N([e]),Array.isArray(e)&&N(Array.from(new Set(e)))},c=e=>{v.includes(e)?l(v.filter(s=>s!==e)):l([...v,e])},S=e=>{const s=pickRectObject(e);u(m=>[...m,s])},P=(e,s=!1)=>{const m=pickRectObject(e);u(C=>C.map(w=>w.id===e.id?s?__spreadValues(__spreadValues({},w),m):m:w))},k=e=>{u(s=>s.filter(m=>!e.find(C=>C.id===m.id)))},K=e=>{B.includes(e)?j([]):j([e])},E=()=>{if(F===lbAnnotation.EToolName.Rect){const e=i.map(s=>s.id);l(e),f==null||f.pointCloud2dOperation.setSelectedIDs(e)}},Te=e=>{l(i.filter(s=>s.attribute===e).map(s=>s.id))},me=i.filter(e=>!p.includes(e.attribute)),ve=x.filter(e=>!p.includes(e.attribute)),Pe=R.filter(e=>e.attribute&&!p.includes(e.attribute)),ze=e=>{if(p.includes(e))T(p.filter(s=>s!==e));else{const s=p.concat(e);T(s)}},We=(e=me,s=A,m=ve,C=Pe,w=W)=>{var V;g==null||g.clearAllBox(),g==null||g.clearAllSphere(),f==null||f.updatePolygonList(e,s),f==null||f.updatePointList(m),f==null||f.updateLineList(C),g==null||g.generateBoxes(e),g==null||g.generateSpheres(m),(V=L==null?void 0:L.store)==null||V.updateCurrentSegment(w),Ie(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,e)},Ge=()=>{X(void 0),$(void 0),te(void 0),oe(void 0)},Ie=(e,s,m)=>__async(void 0,null,function*(){var C,w,V;if(!g)return;const Se=g.pointCloudObject;if(!Se)return;let Ce=[],we=[];try{if(s&&q.record.length){const{record:y,recordIndex:b}=q;let ye=b;b>0&&(e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleToggleValid||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleRotate||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single&&s.length===((C=y[b])==null?void 0:C.pointCloudBoxList.length))&&(ye=b-1);let Ke=(w=y[ye])==null?void 0:w.pointCloudBoxList;const be=ToolPointCloudBoxRenderHelper.calcResetAreasAndBoxIds(e,s,Ke);Ce=be.modifiedBoxIds,we=be.resetAreas}}catch(y){console.error("call calcResetAreasAndBoxIds error",y)}try{const y=yield g.getHighlightIndexByMappingImgList({mappingImgList:m!=null?m:G,points:Se.geometry.attributes.position.array}),b=yield g==null?void 0:g.highlightOriginPointCloud(s,y,{modifiedBoxIds:Ce,resetAreas:we});return b&&((V=f==null?void 0:f.pointCloudInstance)==null||V.updateColor(b)),b}catch(y){console.error("call highlightOriginPointCloud error",y)}});return{selectedID:ae,pointCloudBoxList:i,pointCloudSphereList:x,displayPointCloudList:me,displaySphereList:ve,displayLineList:Pe,selectedIDs:v,setPointCloudResult:he,setSelectedIDs:l,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:D,valid:U,selectedPointCloudBox:o,setPointCloudValid:a,addSelectedID:c,addHighlightID:K,selectedAllBoxes:E,topViewInstance:f,setTopViewInstance:X,sideViewInstance:Y,setSideViewInstance:$,backViewInstance:ee,setBackViewInstance:te,mainViewInstance:g,setMainViewInstance:oe,polygonList:A,setPolygonList:O,rectList:I,setRectList:u,addRectIn2DView:S,removeRectIn2DView:k,updateRectIn2DView:P,lineList:R,setLineList:Re,zoom:Q,setZoom:Ae,history:q,toggleAttributesVisible:ze,hideAttributes:p,setHideAttributes:T,reRender:We,attrPanelLayout:ie,setAttrPanelLayout:Ve,syncAllViewPointCloudColor:Ie,defaultAttribute:ne,setDefaultAttribute:Be,pointCloudPattern:F,setPointCloudPattern:_e,selectSpecAttr:Te,globalPattern:z,setGlobalPattern:e=>{z!==e&&(Oe(actionCreators.ChangeSave),Ne(e),e===lbUtils.EPointCloudPattern.Detection&&se(void 0))},ptSegmentInstance:L,setPtSegmentInstance:se,segmentation:W,setSegmentation:He,clearAllDetectionInstance:Ge,highlight2DDataList:G,setHighlight2DDataList:Me,highlight2DLoading:re,setHighlight2DLoading:ke,cuboidBoxIn2DView:J,setCuboidBoxIn2DView:De,imageSizes:le,cacheImageNodeSize:je,highlightIDs:B,setHighlightIDs:j,removeRectByPointCloudBoxId:ce,removeRectBySpecifyId:H,addRectFromPointCloudBoxByImageName:ue,rectRotateSensitivity:Z,setRectRotateSensitivity:Le,imageNamePointCloudBoxMap:ge,linkageImageNameRectMap:pe,updateRectListByReducer:fe,windowKeydownListenerHook:de}},[U,v,i,x,A,R,I,f,Y,ee,g,Q,p,ie,ne,F,z,L,W,G,re,J,le,B,ce,H,ue,Z,ge,pe,fe,de]);React.useEffect(()=>{var o,n,t;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,i),(n=h==null?void 0:h.setHighlightIDs)==null||n.call(h,B),(t=h==null?void 0:h.setSelectedIDs)==null||t.call(h,v)},[i,v,B]),React.useEffect(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,M)},[M]);const qe=()=>{const o=i.filter(l=>p.includes(l.attribute)),{setSelectedIDs:n,reRender:t}=M,a=o.map(l=>l.id);a.length>0&&n(v.filter(l=>!a.includes(l))),t()};return React.useEffect(()=>{var o,n,t,a;qe(),(n=(o=f==null?void 0:f.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,p),(a=(t=L==null?void 0:L.store)==null?void 0:t.setHiddenAttributes)==null||a.call(t,p)},[p]),React__default.default.createElement(PointCloudContext.Provider,{value:M},r)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),ToolPointCloudBoxRenderHelper=require("../../utils/ToolPointCloudBoxRenderHelper.js"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../store/annotatedBox/index.js"),_=require("lodash"),map=require("./utils/map.js"),useTimeoutFunc=require("./hooks/useTimeoutFunc.js"),useWindowKeydownListener=require("./hooks/useWindowKeydownListener.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}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=(r,s,c)=>s in r?__defProp(r,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):r[s]=c,__spreadValues=(r,s)=>{for(var c in s||(s={}))__hasOwnProp.call(s,c)&&__defNormalProp(r,c,s[c]);if(__getOwnPropSymbols)for(var c of __getOwnPropSymbols(s))__propIsEnum.call(s,c)&&__defNormalProp(r,c,s[c]);return r},__spreadProps=(r,s)=>__defProps(r,__getOwnPropDescs(s)),__async=(r,s,c)=>new Promise((x,B)=>{var A=u=>{try{P(c.next(u))}catch(y){B(y)}},O=u=>{try{P(c.throw(u))}catch(y){B(y)}},P=u=>u.done?x(u.value):Promise.resolve(u.value).then(A,O);P((c=c.apply(r,s)).next())});const pickRectObject=r=>___default.default.pick(r,["id","attribute","width","height","x","y","imageName"]),PointCloudContext=React__default.default.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,visibleBatchSetValid:!1,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setBatchSetValidModal:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:lbUtils.EPointCloudPattern.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:r=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:r=>!1,removeRectBySpecifyId:(r,s,c)=>!1,removeRectByPointCloudBoxId:r=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:useWindowKeydownListener.getEmptyUseWindowKeydownListener(),isLargeStatus:!1,setIsLargeStatus:()=>{}}),PointCloudProvider=({children:r})=>{const[s,c]=React.useState([]),[x,B]=React.useState([]),[A,O]=React.useState([]),[P,u]=React.useState([]),[y,Be]=React.useState([]),[v,Z]=React.useState([]),[V,j]=React.useState([]),[J,Ae]=React.useState(!0),[Q,_e]=React.useState(2),[X,Ve]=React.useState(!0),[Y,Ne]=React.useState(1),[f,$]=React.useState(),[ee,te]=React.useState(),[oe,ne]=React.useState(),[g,ie]=React.useState(),[se,He]=React.useState(""),[F,Me]=React.useState(lbAnnotation.EToolName.Rect),q=React.useRef(new lbAnnotation.ActionsHistory).current,[h,T]=React.useState([]),[re,ke]=React.useState(""),[z,Ee]=React.useState(lbUtils.EPointCloudPattern.Detection),[L,ae]=React.useState(void 0),[W,Oe]=React.useState([]),[G,je]=React.useState([]),[le,Fe]=React.useState(!1),[de,ce]=React.useState(!1),p=index(),[ue,qe]=React.useState(!1),[ge,Te]=React.useState({}),ze=ctx.useDispatch(),We=o=>{const{imgNode:n,path:t}=o;t&&n&&Te(l=>__spreadProps(__spreadValues({},l),{[t]:{width:n.width,height:n.height}}))},fe=React.useMemo(()=>v.length===1?v[0]:"",[v]),he=useWindowKeydownListener.default(),H=React.useCallback((o,n,t="extId")=>{const l=t||"id",d=new Set(n);return u(a=>{let I=!1;const S=a.filter(k=>{const K=k[l],E=d.has(K)?k.imageName!==o:!0;return E||(I=!0),E});return I?S:a}),!0},[]),pe=React.useCallback(o=>{const n=s.map(t=>t.id);return H(o,n,"extId")},[s,H]),me=React.useCallback(o=>{if(!o)return!1;const n=s.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:l,attribute:d,trackID:a}=t,I=t.rects.find(S=>S.imageName===o);if(I){const S=___default.default.pick(I,["width","height","x","y","imageName"]);return __spreadProps(__spreadValues({},S),{id:lbAnnotation.uuid(),attribute:d,order:a,extId:l,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(u(t=>{const l=new Set(t.filter(a=>o===a.imageName).map(a=>a.extId)),d=n.filter(a=>l.has(a.extId)===!1);return d.length?[...t,...d]:t}),!0):!1},[s]),ve=React.useMemo(()=>s.filter(n=>Array.isArray(n.rects)&&n.rects.length>0).reduce((n,t)=>{var l;return(l=t.rects)==null||l.forEach(d=>{const{imageName:a}=d;if(!a){console.warn("Missing image name"),console.trace(d,t);return}map.addMapIndirectWeakSetItem(n,a,t.id,t)}),n},new Map),[s]),Se=React.useCallback(o=>{u(n=>o(n,pickRectObject))},[pickRectObject]),Pe=React.useMemo(()=>P.filter(o=>o.extId!==void 0&&o.id!==void 0).reduce((o,n)=>{const t=n.imageName;return t?(map.addMapIndirectWeakSetItem(o,t,n.extId,n),o):(console.warn("missing image name"),console.log(n,P),o)},new Map),[P]),{fn:Ge}=useTimeoutFunc.default(o=>{Z(n=>{const t=o,l=new Set(t);let d=!1;const a=n.filter(I=>{const S=l.has(I);return S||(d=!0),S});return d?a:n})},200),Ie=React.useCallback(o=>{const n=o.map(t=>t.id);c(o),Ge(n)},[]),M=React.useMemo(()=>{const o=s.find(e=>e.id===fe),n=e=>{const i=s.concat(e);return Ie(i),i},t=e=>{const i=x.concat(e);return B(i),i},l=e=>{Ae(e!==!1)},d=e=>{qe(e)},a=e=>{let i=[];e===void 0||e===""?i=[]:typeof e=="string"?i=[e]:Array.isArray(e)&&(i=e.length>1?Array.from(new Set(e)):e),Z(i)},I=e=>{v.includes(e)?a(v.filter(i=>i!==e)):a([...v,e])},S=e=>{const i=pickRectObject(e);u(m=>[...m,i])},k=(e,i=!1)=>{const m=pickRectObject(e);u(C=>C.map(w=>w.id===e.id?i?__spreadValues(__spreadValues({},w),m):m:w))},K=e=>{u(i=>i.filter(m=>!e.find(C=>C.id===m.id)))},E=e=>{V.includes(e)?j([]):j([e])},Ue=()=>{if(F===lbAnnotation.EToolName.Rect){const e=s.map(i=>i.id);a(e),f==null||f.pointCloud2dOperation.setSelectedIDs(e)}},Ze=e=>{a(s.filter(i=>i.attribute===e).map(i=>i.id))},Ce=s.filter(e=>!h.includes(e.attribute)),we=x.filter(e=>!h.includes(e.attribute)),be=y.filter(e=>e.attribute&&!h.includes(e.attribute)),Je=e=>{if(h.includes(e))T(h.filter(i=>i!==e));else{const i=h.concat(e);T(i)}},Qe=(e=Ce,i=A,m=we,C=be,w=W)=>{var N;g==null||g.clearAllBox(),g==null||g.clearAllSphere(),f==null||f.updatePolygonList(e,i),f==null||f.updatePointList(m),f==null||f.updateLineList(C),g==null||g.generateBoxes(e),g==null||g.generateSpheres(m),(N=L==null?void 0:L.store)==null||N.updateCurrentSegment(w),ye(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,e)},Xe=()=>{$(void 0),te(void 0),ne(void 0),ie(void 0)},ye=(e,i,m)=>__async(void 0,null,function*(){var C,w,N;if(!g)return;const Re=g.pointCloudObject;if(!Re)return;let xe=[],Le=[];try{if(i&&q.record.length){const{record:b,recordIndex:R}=q;let D=R;R>0&&(e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleToggleValid||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.SingleRotate||e===ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single&&i.length===((C=b[R])==null?void 0:C.pointCloudBoxList.length))&&(D=R-1);let U=(w=b[D])==null?void 0:w.pointCloudBoxList;const De=ToolPointCloudBoxRenderHelper.calcResetAreasAndBoxIds(e,i,U);xe=De.modifiedBoxIds,Le=De.resetAreas}}catch(b){console.error("call calcResetAreasAndBoxIds error",b)}try{const b=yield g.getHighlightIndexByMappingImgList({mappingImgList:m!=null?m:G,points:Re.geometry.attributes.position.array}),R=yield g==null?void 0:g.highlightOriginPointCloud(i,b,{modifiedBoxIds:xe,resetAreas:Le}),{color:D,currentPCDSrc:U}=R!=null?R:{};return D&&((N=f==null?void 0:f.pointCloudInstance)==null||N.updateColor(D,U)),D}catch(b){console.error("call highlightOriginPointCloud error",b)}});return{selectedID:fe,pointCloudBoxList:s,pointCloudSphereList:x,displayPointCloudList:Ce,displaySphereList:we,displayLineList:be,selectedIDs:v,setPointCloudResult:Ie,setSelectedIDs:a,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:B,valid:J,visibleBatchSetValid:ue,selectedPointCloudBox:o,setPointCloudValid:l,setBatchSetValidModal:d,addSelectedID:I,addHighlightID:E,selectedAllBoxes:Ue,topViewInstance:f,setTopViewInstance:$,sideViewInstance:ee,setSideViewInstance:te,backViewInstance:oe,setBackViewInstance:ne,mainViewInstance:g,setMainViewInstance:ie,polygonList:A,setPolygonList:O,rectList:P,setRectList:u,addRectIn2DView:S,removeRectIn2DView:K,updateRectIn2DView:k,lineList:y,setLineList:Be,zoom:Y,setZoom:Ne,history:q,toggleAttributesVisible:Je,hideAttributes:h,setHideAttributes:T,reRender:Qe,attrPanelLayout:re,setAttrPanelLayout:ke,syncAllViewPointCloudColor:ye,defaultAttribute:se,setDefaultAttribute:He,pointCloudPattern:F,setPointCloudPattern:Me,selectSpecAttr:Ze,globalPattern:z,setGlobalPattern:e=>{z!==e&&(ze(actionCreators.ChangeSave),Ee(e),e===lbUtils.EPointCloudPattern.Detection&&ae(void 0))},ptSegmentInstance:L,setPtSegmentInstance:ae,segmentation:W,setSegmentation:Oe,clearAllDetectionInstance:Xe,highlight2DDataList:G,setHighlight2DDataList:je,highlight2DLoading:le,setHighlight2DLoading:Fe,cuboidBoxIn2DView:X,setCuboidBoxIn2DView:Ve,imageSizes:ge,cacheImageNodeSize:We,highlightIDs:V,setHighlightIDs:j,removeRectByPointCloudBoxId:pe,removeRectBySpecifyId:H,addRectFromPointCloudBoxByImageName:me,rectRotateSensitivity:Q,setRectRotateSensitivity:_e,imageNamePointCloudBoxMap:ve,linkageImageNameRectMap:Pe,updateRectListByReducer:Se,windowKeydownListenerHook:he,isLargeStatus:de,setIsLargeStatus:ce}},[J,ue,v,s,x,A,y,P,f,ee,oe,g,Y,h,re,se,F,z,L,W,G,le,X,ge,V,pe,H,me,Q,ve,Pe,Se,he,de,ce]);React.useEffect(()=>{var o,n,t;(o=p==null?void 0:p.setPointCloudBoxList)==null||o.call(p,s),(n=p==null?void 0:p.setHighlightIDs)==null||n.call(p,V),(t=p==null?void 0:p.setSelectedIDs)==null||t.call(p,v)},[s,v,V]),React.useEffect(()=>{var o;(o=p==null?void 0:p.setPtCtx)==null||o.call(p,M)},[M]);const Ke=()=>{const o=s.filter(d=>h.includes(d.attribute)),{setSelectedIDs:n,reRender:t}=M,l=o.map(d=>d.id);l.length>0&&n(v.filter(d=>!l.includes(d))),t()};return React.useEffect(()=>{var o,n,t,l;Ke(),(n=(o=f==null?void 0:f.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,h),(l=(t=L==null?void 0:L.store)==null?void 0:t.setHiddenAttributes)==null||l.call(t,h)},[h]),React__default.default.createElement(PointCloudContext.Provider,{value:M},r)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -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"),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=(
|
|
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=(a,r,u)=>r in a?__defProp(a,r,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[r]=u,__spreadValues=(a,r)=>{for(var u in r||(r={}))__hasOwnProp.call(r,u)&&__defNormalProp(a,u,r[u]);if(__getOwnPropSymbols)for(var u of __getOwnPropSymbols(r))__propIsEnum.call(r,u)&&__defNormalProp(a,u,r[u]);return a},__spreadProps=(a,r)=>__defProps(a,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:a,config:r,checkMode:u,configString:x,imgIndex:g,toolInstanceRef:i,setResourceLoading:w,isBatchSetValid:k})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:V,selectNextBox:_,selectPrevBox:E,updateSelectedBox:B,deleteSelectedPointCloudBoxAndPolygon:I}=useSingleBox.useSingleBox(),{selectedSphere:v,updatePointCloudSphere:q}=useSphere.useSphere(),{clearAllResult:b,updatePointCloudPattern:L}=useStatus.useStatus(),{copySelectedBoxes:O,pasteSelectedBoxes:j,copiedBoxes:Y}=useBoxes.useBoxes({config:r,currentData:a}),{updateRotate:C}=useRotate.useRotate({currentData:a}),{updateRotateEdge:A}=useRotateEdge.useRotateEdge({currentData:a}),{updatePointCloudData:d,topViewSelectedChanged:T}=usePointCloudViews.usePointCloudViews({setResourceLoading:w}),{redo:y,undo:h,pushHistoryWithList:D,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:N}=useHistory.useHistory(),{syncThreeViewsAttribute:f}=useAttribute.useAttribute(),{syncAllViewsConfig:K,reRenderTopViewRange:R}=useConfig.useConfig(),{selectedPolygon:m}=usePolygon.usePolygon(),{selectedLine:S}=useLine.useLine(),{t:P}=reactI18next.useTranslation(),{updatePointCloudColor:U}=useUpdatePointCloudColor.useUpdatePointCloudColor(w,r),z=ahooks.useLatest(a),p=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},F=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{C(e.rectRotateSensitivity);break}case"e":C(-Number(e.rectRotateSensitivity));break;case"g":A(-90);break;case"u":{const c=l.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;L(c);const W={[lbAnnotation.EToolName.Polygon]:P("PolygonPattern"),[lbAnnotation.EToolName.Rect]:P("RectPattern")};antd.message.success(P("ChangePatternMsg",{pattern:W[c]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":k?(antd.Modal.destroyAll(),e.setBatchSetValidModal(!e.visibleBatchSetValid)):e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){E();break}_(),o.preventDefault();break;case"f":V();break;case"arrowup":p({y:-1});break;case"arrowdown":p({y:1});break;case"arrowleft":p({x:-1});break;case"arrowright":p({x:1});break;case"delete":I(z.current);break}},M=(t,o)=>{switch(t){case"c":O();break;case"v":j();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?y():h();break}}},G=ahooks.useLatest(t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||u===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){M(o,t);return}F(o,t)});return React.useEffect(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>G.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),React.useEffect(()=>{K(r)},[x]),React.useEffect(()=>{(r==null?void 0:r.radius)&&R(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{d==null||d()},[g,e.mainViewInstance]),React.useEffect(()=>{e.setHideAttributes([])},[g]),React.useEffect(()=>{i.current.setAttrChangeTrigger=t=>{var o;(o=e.topViewInstance)==null||o.toolInstance.setAttrChangeTrigger(t)},i.current.setDefaultAttribute=t=>{var o;if(f(t),U(t),m&&H(__spreadProps(__spreadValues({},m),{attribute:t})),S&&N(__spreadProps(__spreadValues({},S),{attribute:t})),v){const s=q(__spreadProps(__spreadValues({},v),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),T({newSelectedSphere:v,newSphereList:s}))}},i.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=__spreadProps(__spreadValues({},l),{[t]:o}),B(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},i.current.clearResult=()=>{b==null||b()},i.current.redo=()=>{y()},i.current.undo=()=>{h()},i.current.setValid=t=>{i.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t)})},i.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)},i.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},i.current.asyncData=t=>{setTimeout(()=>{d==null||d(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),React.useEffect(()=>{i.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},i.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),React.useEffect(()=>{i.current.history={pushHistory:t=>{D({pointCloudBoxList:t})},initRecord:()=>{}}},[]),React.useEffect(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||u)return;const s=c=>{f(c)},n=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[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 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
|
+
"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"),ahooks=require("ahooks");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}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=(n,s,r)=>s in n?__defProp(n,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[s]=r,__spreadValues=(n,s)=>{for(var r in s||(s={}))__hasOwnProp.call(s,r)&&__defNormalProp(n,r,s[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(s))__propIsEnum.call(s,r)&&__defNormalProp(n,r,s[r]);return n},__spreadProps=(n,s)=>__defProps(n,__getOwnPropDescs(s));const{EPolygonPattern,EToolName}=lbAnnotation.cTool,{ESortDirection}=lbAnnotation.cAnnotation,EKeyCode=lbAnnotation.cKeyCode.default,TransferCanvas2WorldOffset=(n,s,r=1)=>{const{width:v,height:c}=s,w={x:n.x+v*r/2,y:n.y+c*r/2},P={x:s.width/2,y:s.height/2};return{offsetX:(P.x-w.x)/r,offsetY:-(P.y-w.y)/r}},TopViewToolbar=({currentData:n})=>{var s,r;const{zoom:v,zoomIn:c,zoomOut:w,initialPosition:P}=useZoom.useZoom(),{selectNextBox:E,selectPrevBox:L}=useSingleBox.useSingleBox(),{switchToNextSphere:h}=useSphere.useSphere(),{updateRotate:S}=useRotate.useRotate({currentData:n}),{updateRotateEdge:b}=useRotateEdge.useRotateEdge({currentData:n}),g=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:x}=g,p=(r=(s=g==null?void 0:g.topViewInstance)==null?void 0:s.toolScheduler)==null?void 0:r.getCurrentToolName(),t=()=>{S(-Number(g.rectRotateSensitivity))},a=()=>{S(g.rectRotateSensitivity)},f=()=>{b(-90)};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(index$2,{onChange:O=>{var I;(I=x==null?void 0:x.pointCloudInstance)==null||I.updatePointSize({customSize:O})}}),React__default.default.createElement("span",{onClick:a,className:dom.getClassName("point-cloud","rotate-reserve")}),React__default.default.createElement("span",{onClick:t,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){h(ESortDirection.descend);return}L(!0)},className:dom.getClassName("point-cloud","prev")}),React__default.default.createElement(icons.DownSquareOutlined,{onClick:()=>{if(p===EToolName.Point){h(ESortDirection.ascend);return}E(!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:v}))},ZAxisSlider=({setZAxisLimit:n,zAxisLimit:s,checkMode:r})=>r?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:v=>{n(v)}})),PointCloudTopView=({currentData:n,imgList:s,stepInfo:r,drawLayerSlot:v,checkMode:c,intelligentFit:w,setIsEnlargeTopView:P,isEnlargeTopView:E,onExitZoom:L,highlightAttribute:h})=>{var S,b;const[g,x]=React.useState({zoom:1,currentPos:{x:0,y:0}}),p=React.useRef(null),t=React.useContext(PointCloudContext.PointCloudContext),a=useSize(p),f=index.jsonParser(r.config),{setZoom:O,syncTopviewToolZoom:I}=useZoom.useZoom(),{run:k}=ahooks.useDebounceFn(O,{wait:500}),{hideAttributes:A,setIsLargeStatus:U,selectedID:Z,pointCloudBoxList:z}=t,{addPolygon:H,deletePolygon:F}=usePolygon.usePolygon(),{deletePointCloudSphere:W}=useSphere.useSphere(),{deletePointCloudBox:$,changeValidByID:M}=useSingleBox.useSingleBox(),[j,K]=React.useState(10),{t:T}=reactI18next.useTranslation(),C=usePointCloudViews.usePointCloudViews(),{pushHistoryWithList:X}=useHistory.useHistory(),[Y,q]=React.useState(!0),[D,B]=React.useState(!1);React.useLayoutEffect(()=>{if(!t.topViewInstance&&p.current&&(n==null?void 0:n.url)&&(n==null?void 0:n.result)){const o={width:p.current.clientWidth,height:p.current.clientHeight},l=new lbAnnotation.PointCloudAnnotation({container:p.current,size:o,pcdPath:n.url,config:__spreadProps(__spreadValues({},f),{pointCloudPattern:t.pointCloudPattern}),checkMode:c,toolName:ToolUtils.getPointCloudToolList(),proxyMode:c,view:"topView"});t.setTopViewInstance(l)}},[n]),React.useEffect(()=>{D&&Z&&(t.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single,z),B(!1))},[D]),React.useEffect(()=>{if(!a||!t.topViewInstance||!t.sideViewInstance)return;const{toolInstance:o}=t.topViewInstance;o.singleOn("dataUpdated",(e,i)=>{const u=___default.default.cloneDeep(e).map(d=>__spreadProps(__spreadValues({},d),{pointList:lbUtils.PointCloudUtils.pointListTransferCanvas2World(d.pointList,a)}));t.setSelectedIDs(i),t.setLineList(u),X({lineList:u})}),o.singleOn("pointCreated",(e,i)=>{C.topViewAddSphere({newPoint:e,size:a,trackConfigurable:f.trackConfigurable,zoom:i})}),o.singleOn("pointDeleted",e=>{W(e)}),o.singleOn("pointSelected",e=>{t.setSelectedIDs([e])}),o.singleOn("updatePointByDrag",(e,i)=>{var u;(u=C.topViewUpdatePoint)==null||u.call(C,e,a)}),o.singleOn("polygonCreated",(e,i)=>{if(o.pattern===EPolygonPattern.Normal||!(n==null?void 0:n.url)){const u=__spreadProps(__spreadValues({},e),{pointList:e.pointList.map(d=>lbUtils.PointCloudUtils.transferCanvas2World(d,a))});H(u),t.setSelectedIDs(A.includes(e.attribute)?"":e.id);return}q(!1),C.topViewAddBox({polygon:e,size:a,imgList:s,trackConfigurable:f.trackConfigurable,zoom:i,intelligentFit:w}),B(!0)}),o.singleOn("deletedObject",({id:e})=>{$(e),F(e)}),o.singleOn("deleteSelectedIDs",()=>{t.setSelectedIDs([])}),o.singleOn("addSelectedIDs",e=>{t.addSelectedID(e)}),o.singleOn("setSelectedIDs",e=>{q(!1),t.setSelectedIDs(e)}),o.singleOn("updatePolygonByDrag",e=>{var i;(i=C.topViewUpdateBox)==null||i.call(C,e,a)});const l=e=>{var i;const u=M(e);u&&t.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,u),t.polygonList.find(d=>d.id===e)&&((i=t.topViewInstance)==null||i.toolInstance.setPolygonValidAndRender(e,!0))};return o.on("validUpdate",l),()=>{o.unbind("validUpdate",l)}},[t,a,n,C,t.polygonList,t.lineList,(S=t.topViewInstance)==null?void 0:S.toolInstance]),React.useEffect(()=>{var o,l;if(!t.topViewInstance)return;const e=(l=(o=f==null?void 0:f.attributeList)==null?void 0:o[0])==null?void 0:l.value;e&&t.topViewInstance.toolInstance.setDefaultAttribute(e)},[t.topViewInstance]),React.useEffect(()=>{if(!(a==null?void 0:a.width)||!t.topViewInstance)return;t.topViewInstance.initSize(a),t.topViewInstance.updatePolygonList(t.displayPointCloudList,t.polygonList),t.topViewInstance.updatePointList(t.displaySphereList),t.topViewInstance.updateLineList(t.displayLineList);const{topViewInstance:{pointCloudInstance:o,toolInstance:l}}=t;l.singleOn("renderZoom",(e,i)=>{const{offsetX:u,offsetY:d}=TransferCanvas2WorldOffset(i,a,e);if(o.camera.zoom=e,i){const{x:m,y,z:V}=o.initCameraPosition;o.camera.position.set(m+d,y-u,V)}o.camera.updateProjectionMatrix(),o.render(),k(e),I(i,e,a),x({zoom:e,currentPos:i})}),l.singleOn("dragMove",({currentPos:e,zoom:i})=>{const{offsetX:u,offsetY:d}=TransferCanvas2WorldOffset(e,a,i);o.camera.zoom=i;const{x:m,y,z:V}=o.initCameraPosition;o.camera.position.set(m+d,y-u,V),o.render(),I(e,i,a),x({zoom:i,currentPos:e})})},[a,t.topViewInstance,(b=t.topViewInstance)==null?void 0:b.toolInstance]),React.useEffect(()=>{var o,l;(l=(o=t.topViewInstance)==null?void 0:o.pointCloudInstance)==null||l.applyZAxisPoints(j)},[j]),React.useEffect(()=>{var o,l,e,i;C.topViewSelectedChanged({}),(i=(e=(l=(o=t.topViewInstance)==null?void 0:o.toolInstance)==null?void 0:l.selection)==null?void 0:e.hardSetSelectedIDs)==null||i.call(e,t.selectedIDs)},[t.selectedIDs]),React.useEffect(()=>{const{topViewInstance:o,selectedID:l,selectedPointCloudBox:e,zoom:i}=t;if(!o||!l||!e||!Y){q(!0);return}const{center:u}=e,{pointCloudInstance:d,toolInstance:m}=o,y=m.polygonList.find(J=>J.id===t.selectedID);if(!y){q(!0);return}const V=lbAnnotation.MathUtils.getRectCenterPoint(y.pointList),R=lbAnnotation.MathUtils.getCurrentPosFromRectCenter(m.size,V,i);m.setCurrentPos(R),m.render();const{x:Q,y:ee,z:G}=d.initCameraPosition;d.camera.position.set(u.x,u.y,G),d.render(),I(R,i,a),x({zoom:i,currentPos:R})},[t.selectedID]),React.useEffect(()=>(window.addEventListener("keydown",N),()=>{window.removeEventListener("keydown",N)}),[]);const N=o=>{const{keyCode:l}=o;l===EKeyCode.Esc&&L()};return React.useEffect(()=>{var o,l,e;(e=(l=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:l.setHighlightAttribute)==null||e.call(l,h)},[t.topViewInstance,h]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","top-view"),title:E?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{L()}}),React__default.default.createElement("span",null,T("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:T("TopView"),onClick:()=>{U(!0),P(!0)}}),toolbar:React__default.default.createElement(TopViewToolbar,{currentData:n})},React__default.default.createElement("div",{style:{position:"relative",flex:1}},React__default.default.createElement("div",{style:{width:"100%",height:"100%"},ref:p},v==null?void 0:v(g)),!E&&React__default.default.createElement(PointCloudInfos.BoxInfos,{checkMode:c,config:f}),React__default.default.createElement(ZAxisSlider,{checkMode:c,zAxisLimit:j,setZAxisLimit:K}),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";var React=require("react"),icons=require("@ant-design/icons"),dom=require("../../../../utils/dom.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const TitleButton=({title:e,onClick:t,style:a})=>!t&&!e?null:React__default.default.createElement("span",{className:dom.getClassName("point-cloud-container","title-button"),style:a},e,t&&React__default.default.createElement(icons.ExpandAltOutlined,{
|
|
1
|
+
"use strict";var React=require("react"),icons=require("@ant-design/icons"),dom=require("../../../../utils/dom.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const TitleButton=({title:e,onClick:t,style:a})=>!t&&!e?null:React__default.default.createElement("span",{className:dom.getClassName("point-cloud-container","title-button"),style:a,onClick:t},e,t&&React__default.default.createElement(icons.ExpandAltOutlined,{style:{marginLeft:4}}));module.exports=TitleButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var actionCreators=require("../../../../store/annotation/actionCreators.js"),ctx=require("../../../../store/ctx.js"),antd=require("antd"),React=require("react"),reactI18next=require("react-i18next"),icons=require("@ant-design/icons"),lbUtils=require("@labelbee/lb-utils"),reactRedux=require("react-redux"),useSingleBox=require("../../hooks/useSingleBox.js"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,a,r)=>a in e?__defProp(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r,__spreadValues=(e,a)=>{for(var r in a||(a={}))__hasOwnProp.call(a,r)&&__defNormalProp(e,r,a[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(a))__propIsEnum.call(a,r)&&__defNormalProp(e,r,a[r]);return e},__spreadProps=(e,a)=>__defProps(e,__getOwnPropDescs(a));const layout={labelCol:{span:8},wrapperCol:{span:16}},defaultNumberRules=[{required:!0,message:"\u8BF7\u586B\u5199\u4E00\u4E2A\u6570\u5B57"}],defaultSelectedAttribute=[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u5C5E\u6027"}],DECIMAL_PLACES=2,PrefixTag=({text:e})=>React__default.default.createElement("span",{style:{borderRadius:"4px 0px 0px 4px",padding:"0px 12px",background:"#FAFAFA",border:"1px solid rgb(217 217 217)",borderRight:"0",display:"flex",alignItems:"center",height:32}},e),SizeShow=e=>{const{t:a}=reactI18next.useTranslation(),{size:r,isMax:i,selectedBox:s}=e;if(!r||!s)return null;const m={marginRight:16},b=__spreadValues(__spreadValues({},s),i&&r),{length:l,width:c,height:f}=lbUtils.PointCloudUtils.transferBox2Kitti(b);return React__default.default.createElement("div",null,React__default.default.createElement("span",{style:m},a("Length"),": ",l.toFixed(DECIMAL_PLACES)),React__default.default.createElement("span",{style:m},a("Width"),": ",c.toFixed(DECIMAL_PLACES)),React__default.default.createElement("span",{style:m},a("Height"),": ",f.toFixed(DECIMAL_PLACES)),React__default.default.createElement(antd.Popover,{placement:"rightBottom",content:`\u7EDF\u4E00\u5C3A\u5BF8\u4E3A\u8BE5ID\u7684\u6240\u6709\u6807\u6CE8\u6846${i?"\u4E2D\u6700\u5927\u7684\u5C3A\u5BF8":"\u4EE5\u5F53\u524D\u5E27\u6846\u5C3A\u5BF8\u4E3A\u6807\u51C6"}`},React__default.default.createElement(icons.QuestionCircleOutlined,null)))},sizeOptions=[{value:"current",label:"\u5F53\u524D\u5E27\u5C3A\u5BF8"},{value:"max",label:"\u6700\u5927\u5C3A\u5BF8"},{value:"ignore",label:"\u5FFD\u7565"}],UnifyParamsModal=({id:e,visible:a,onCancel:r,config:i,imgList:s,imgIndex:m})=>{const b=ctx.useDispatch(),{selectedBox:l}=useSingleBox.useSingleBox(),[c,f]=React.useState(),[p]=antd.Form.useForm(),{t:o}=reactI18next.useTranslation();React.useEffect(()=>{a===!1?(p.resetFields(),f(void 0)):v()},[a]);const _=t=>{var n,u,d,g;if(!e)return;if(!c){antd.message.info("\u8BE5\u8303\u56F4\u4E0D\u5B58\u5728\u66F4\u6539\u6570\u636E, \u8BF7\u66F4\u6539\u7EDF\u4E00\u8303\u56F4");return}const E={attribute:t.attribute};if(i.secondaryAttributeConfigurable){const h={};(n=i.inputList)==null||n.forEach(P=>{const y=t[P.value];if(y!==void 0){const I=Array.isArray(y)?y.join(";"):y;Object.assign(h,{[P.value]:I})}}),Object.keys(h).length>0&&Object.assign(E,{subAttribute:h})}const{UnifySize:x}=t;t.UnifySize!=="ignore"&&Object.assign(E,c&&x==="max"?c:{width:(u=l==null?void 0:l.info)==null?void 0:u.width,height:(d=l==null?void 0:l.info)==null?void 0:d.height,depth:(g=l==null?void 0:l.info)==null?void 0:g.depth}),b(actionCreators.BatchUpdateResultByTrackID(e,E,[t.prevPage-1,t.nextPage-1],s)),r()},v=React.useCallback(()=>{var t;const{prevPage:n,nextPage:u}=p.getFieldsValue(["prevPage","nextPage"]),d=s.filter((E,x)=>lbAnnotation.MathUtils.isInRange(x,[n-1,u-1]));if(!((d==null?void 0:d.length)>0)||!(l==null?void 0:l.info)||((t=l==null?void 0:l.info)==null?void 0:t.trackID)===void 0){f(void 0);return}const g=lbUtils.PointCloudUtils.getMaxSizeFromBox({trackID:l.info.trackID,imgList:d});f(g)},[s,l,m]),B=()=>p.submit(),F={width:"200px"},S={marginBottom:"24px",display:"flex",alignItems:"center"};return React__default.default.createElement(antd.Modal,{title:o("UnifyParams"),visible:a,onCancel:r,onOk:B,wrapClassName:"labelbee-custom-modal"},React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{style:{marginBottom:"20px",color:"#f00"}},o("UnifyParamsTips")),React__default.default.createElement(antd.Form,__spreadProps(__spreadValues({},layout),{form:p,onFinish:_}),React__default.default.createElement(antd.Form.Item,{name:"id",label:o("UnifyTrackID")},e),React__default.default.createElement(antd.Form.Item,{label:o("UnifyAttributeRange"),required:!0},React__default.default.createElement(antd.Form.Item,{style:{display:"inline-block"},rules:defaultNumberRules,name:"prevPage",noStyle:!0,initialValue:1},React__default.default.createElement(antd.InputNumber,{precision:0,min:1,style:{width:"80px"},onChange:()=>v()})),React__default.default.createElement("span",{style:{display:"inline-block",width:"24px",textAlign:"center"}},"-"),React__default.default.createElement(antd.Form.Item,{style:{display:"inline-block"},rules:defaultNumberRules,name:"nextPage",noStyle:!0,initialValue:s.length},React__default.default.createElement(antd.InputNumber,{precision:0,min:1,style:{width:"80px"},onChange:()=>v()})),React__default.default.createElement("span",{style:{display:"inline-block",width:"40x",marginLeft:"10px",textAlign:"center"}},o("Page"))),React__default.default.createElement(antd.Form.Item,{name:"UnifySize",label:o("UnifySize"),required:!0,initialValue:"current"},React__default.default.createElement(antd.Radio.Group,{onChange:t=>{p.setFieldValue("UnifySize",t.target.value)}},sizeOptions.map(t=>{const{value:n,label:u}=t;return React__default.default.createElement(antd.Radio,{value:n,key:n},React__default.default.createElement("div",null,u),n!=="ignore"&&React__default.default.createElement(SizeShow,{selectedBox:l==null?void 0:l.info,size:c,isMax:n==="max"}))}))),React__default.default.createElement(antd.Form.Item,{label:o("UnifyTag"),required:!0},React__default.default.createElement("div",{style:S},React__default.default.createElement(PrefixTag,{text:o("Attribute")}),React__default.default.createElement(antd.Form.Item,{name:"attribute",noStyle:!0,rules:defaultSelectedAttribute},React__default.default.createElement(antd.Select,{style:F},i.attributeList.map(t=>React__default.default.createElement(antd.Select.Option,{key:t.value,value:t.value},t.key))))),i.secondaryAttributeConfigurable&&i.inputList.map(t=>{var n;return React__default.default.createElement("div",{key:t.value,style:S},React__default.default.createElement(PrefixTag,{text:t.key}),React__default.default.createElement(antd.Form.Item,{name:t.value,noStyle:!0,required:!1},React__default.default.createElement(antd.Select,{style:F,mode:t.isMulti?"multiple":void 0},(n=t.subSelected)==null?void 0:n.map(u=>React__default.default.createElement(antd.Select.Option,{key:u.value,value:u.value},u.key)))))})))))},mapStateToProps=e=>({imgIndex:e.annotation.imgIndex});var UnifyParamsModal$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(UnifyParamsModal);module.exports=UnifyParamsModal$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var classNames=require("classnames"),React=require("react"),PointCloudBackView=require("../../PointCloudBackView.js"),PointCloudSideView=require("../../PointCloudSideView.js"),dom=require("../../../../utils/dom.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React);const SideAndBackOverView=t=>{const{t:
|
|
1
|
+
"use strict";var classNames=require("classnames"),React=require("react"),PointCloudBackView=require("../../PointCloudBackView.js"),PointCloudSideView=require("../../PointCloudSideView.js"),dom=require("../../../../utils/dom.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React);const SideAndBackOverView=t=>{const{t:w}=reactI18next.useTranslation(),{selectAndEnlarge:s,checkMode:c}=t,l=360,d=400,u=window.innerWidth-l,f=window.innerHeight-d,[i,o]=React.useState({x:u,y:f}),[r,m]=React.useState({x:0,y:0});React.useEffect(()=>(window.addEventListener("resize",v),()=>{window.removeEventListener("resize",v),o({x:u,y:f}),m({x:0,y:0})}),[]);const v=()=>{const e=window.innerWidth-l,n=window.innerHeight-d;o({x:e,y:n})};return React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","left-bottom")]:!0,[dom.getClassName("point-cloud-container","left-bottom-float")]:!0}),style:{top:i.y,left:i.x,width:360,height:400,zIndex:s?1003:-1}},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom-floatHeader"),draggable:"true",onDragStart:e=>{s&&m({x:e.clientX-i.x,y:e.clientY-i.y})},onDragOver:e=>{e.preventDefault()},onDrag:e=>{if(e.clientX===0&&e.clientY===0)return;const n=e.clientX-r.x,a=e.clientY-r.y;o({x:n,y:a})},onDragEnd:e=>{if(e.clientX===0&&e.clientY===0)return;const n=e.clientX-r.x,a=e.clientY-r.y;o({x:n,y:a})}},w("DragAndDrop")),React__default.default.createElement(PointCloudBackView,{checkMode:c}),React__default.default.createElement(PointCloudSideView,{checkMode:c}))};module.exports=SideAndBackOverView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__async=(s,u,t)=>new Promise((g,a)=>{var n=i=>{try{o(t.next(i))}catch(l){a(l)}},d=i=>{try{o(t.throw(i))}catch(l){a(l)}},o=i=>i.done?g(i.value):Promise.resolve(i.value).then(n,d);o((t=t.apply(s,u)).next())});const useHighlight=({currentData:s})=>{var u;const{mainViewInstance:t,topViewInstance:g,pointCloudBoxList:a,highlight2DDataList:n,setHighlight2DDataList:d}=React.useContext(PointCloudContext.PointCloudContext),o=(u=s==null?void 0:s.mappingImgList)!=null?u:[],i=(r,c,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__async=(s,u,t)=>new Promise((g,a)=>{var n=i=>{try{o(t.next(i))}catch(l){a(l)}},d=i=>{try{o(t.throw(i))}catch(l){a(l)}},o=i=>i.done?g(i.value):Promise.resolve(i.value).then(n,d);o((t=t.apply(s,u)).next())});const useHighlight=({currentData:s})=>{var u;const{mainViewInstance:t,topViewInstance:g,pointCloudBoxList:a,highlight2DDataList:n,setHighlight2DDataList:d}=React.useContext(PointCloudContext.PointCloudContext),o=(u=s==null?void 0:s.mappingImgList)!=null?u:[],i=(r,c,f)=>__async(void 0,null,function*(){var p;let h=[...n];if(n.find(e=>e.url===r)?h=n.filter(e=>e.url!==r):h.push({url:r,fallbackUrl:c,calib:f}),d(h),!t||(o==null?void 0:o.length)===0)return;const v=t.pointCloudObject;if(!v)return;const m=yield t.getHighlightIndexByMappingImgList({mappingImgList:h,points:v.geometry.attributes.position.array});try{const e=yield t.highlightOriginPointCloud(a,m),{color:C}=e!=null?e:{};C&&((p=g==null?void 0:g.pointCloudInstance)==null||p.updateColor(C))}catch(e){console.error("toggle2dVisible highlightOriginPointCloud error:",e)}}),l=React.useCallback(r=>n.findIndex(c=>c.url===r)>=0,[n]);return{toggle2dVisible:i,isHighlightVisible:l}};exports.useHighlight=useHighlight;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useUpdatePointCloudColor=require("./useUpdatePointCloudColor.js"),useAttribute=require("./useAttribute.js"),usePolygon=require("./usePolygon.js"),useLine=require("./useLine.js"),useSphere=require("./useSphere.js"),useHistory=require("./useHistory.js"),usePointCloudViews=require("./usePointCloudViews.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,e,t)=>e in r?__defProp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,__spreadValues=(r,e)=>{for(var t in e||(e={}))__hasOwnProp.call(e,t)&&__defNormalProp(r,t,e[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))__propIsEnum.call(e,t)&&__defNormalProp(r,t,e[t]);return r},__spreadProps=(r,e)=>__defProps(r,__getOwnPropDescs(e));const usePointCloudAttribute=(r,e)=>{const{updatePointCloudColor:t}=useUpdatePointCloudColor.useUpdatePointCloudColor(r,e),{syncThreeViewsAttribute:l}=useAttribute.useAttribute(),{selectedPolygon:u}=usePolygon.usePolygon(),{selectedLine:i}=useLine.useLine(),{selectedSphere:s}=useSphere.useSphere(),{updatePointCloudSphere:d}=useSphere.useSphere(),{pushHistoryUnderUpdatePolygon:c,pushHistoryUnderUpdateLine:P}=useHistory.useHistory(),{topViewSelectedChanged:C}=usePointCloudViews.usePointCloudViews(),n=React.useContext(PointCloudContext.PointCloudContext);return{updatePointCloudAttribute:o=>{var a;if(l(o),t(o),u&&c(__spreadProps(__spreadValues({},u),{attribute:o})),i&&P(__spreadProps(__spreadValues({},i),{attribute:o})),s){const p=d(__spreadProps(__spreadValues({},s),{attribute:o}));n.mainViewInstance&&((a=n.mainViewInstance)==null||a.generateSpheres(p),C({newSelectedSphere:s,newSphereList:p}))}}}};exports.usePointCloudAttribute=usePointCloudAttribute;
|
|
@@ -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=(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((a,p)=>{var e=d=>{try{c(t.next(d))}catch(x){p(x)}},P=d=>{try{c(t.throw(d))}catch(x){p(x)}},c=d=>d.done?a(d.value):Promise.resolve(d.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,a,p)=>{const{x:e,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,n),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:e,y:P,z:c},id:o.id},x=a?__spreadValues(__spreadValues({},a),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return p&&Object.assign(x,p),x},topViewPolygon2PointCloud=(o,n,t,a,p,e)=>{let P=o.pointList.map(B=>lbUtils.PointCloudUtils.transferCanvas2World(B,n)),c=0,d=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,d=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);a&&(c=a.center.z,d=a.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:d,rotation:T,id:o.id},O=__spreadValues(a?__spreadValues(__spreadValues({},a),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 a={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x-a.x,y:t.center.y,z:t.center.z-a.y}})},sideViewPolygon2PointCloud=(o,n,t,a)=>{const[p,e,P]=o.pointList,[c,d,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,d),T=w-V,k=lbAnnotation.MathUtils.getLineLength(e,P),O=lbAnnotation.MathUtils.getLineLength(d,x),M=k-O,{newBoxParams:B}=a.getNewBoxBySideUpdate(D,M,T,t);return B},backViewPoint2PointCloud=(o,n,t)=>{const a={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x,y:t.center.y-a.x,z:t.center.z-a.y}})},backViewPolygon2PointCloud=(o,n,t,a)=>{const[p,e,P]=o.pointList,[c,d,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,d),T=w-V,k=lbAnnotation.MathUtils.getLineLength(e,P),O=lbAnnotation.MathUtils.getLineLength(d,x),M=k-O;let{newBoxParams:B}=a.getNewBoxByBackUpdate(D,M,T,t);return B},syncSideViewByPoint=(o,n,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(d);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,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxSidePolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncBackViewByPoint=(o,n,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(d);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,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxBackPolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncTopViewByPoint=(o,n,t,a)=>{if(!t||!a)return;a.generateSphere(o),a.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:p,pointCloudInstance:e}=t,{point2d:P}=e.getSphereTopPoint2DCoordinate(o),c=[...p.pointList].map(d=>d.id===n.id?__spreadProps(__spreadValues(__spreadValues({},n),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):d);p.setResult(c),p.setSelectedID(n.id)},synchronizeTopView=(o,n,t,a)=>{var p,e;if(!t||!a)return;a.generateBox(o),a.setHighlightColor(o.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=t,{polygon2d:d}=c.getBoxTopPolygon2DCoordinate(o),x=[...P.polygonList],f=x.find(L=>L.id===n.id);f?(f.pointList=d,f.valid=(p=o.valid)!=null?p:!0):x.push({id:n.id,pointList:d,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:a,backViewInstance:p,mainViewInstance:e,addPointCloudBox:P,addPointCloudSphere:c,setSelectedIDs:d,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:u,imgList:l,imgIndex:r}=s.annotation;return{currentData:l[r],config:index.jsonParser(StepUtils.getCurrentStepInfo(u,i).config)}}),z=ctx.useDispatch(),it=ahooks.useLatest(w),st=ahooks.useLatest(k),lt=React.useCallback((s,i)=>{const u=st.current,l=i.id;return s.filter(g=>{if(!g)return!1;const C=u.get(g.imageName);return C===void 0?!0:Boolean(C.get(l))})},[]),J=s=>{const{enableAutoMap2DRect:i=!1}=y;if(!it.current||i){const{mappingImgList:u=[]}=j;index.generatePointCloudBoxRects({pointCloudBox:s,mappingImgList:u,imageSizes:V},{prepareRectsFn:lt})}},{selectedBox:U,updateSelectedBox:rt,updateSelectedBoxes:Q,getPointCloudByID:at}=useSingleBox.useSingleBox({generateRects:J}),K=U==null?void 0:U.info;if(!t||!a||!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:u,trackConfigurable:l})=>{var r;const g={attribute:(r=t.toolInstance.defaultAttribute)!=null?r:""};l===!0&&Object.assign(g,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:L})});const C=topViewPoint2PointCloud(s,i,X,void 0,g);d(s.id);const h=c(C);H(PointCloudView.Top,s,C,u,h,y),O({newSphereParams:C})},ct=({polygon:s,size:i,imgList:u,trackConfigurable:l,zoom:r,intelligentFit:g})=>{var C,h,m;const b={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};l===!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?d([]):(d(v.id),S.selection.setSelectedIDs(I.id),N({omitView:PointCloudView.Top,polygon:I,boxParams:v,zoom:r,newPointCloudBoxList:F}),g&&synchronizeTopView(v,I,t,e)),O({newBoxParams:v})},pt=s=>{const{boxID:i,imageName:u,width:l,height:r,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===u))return;const b=h.rects.map(v=>v.imageName===u?__spreadProps(__spreadValues({},v),{width:l,height:r,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:u}=s,l=f.find(h=>h.id===i);if(!(l==null?void 0:l.rects))return;const r=l.rects.filter(h=>h.imageName!==u),g=__spreadProps(__spreadValues({},l),{rects:r}),C=f.map(h=>h.id===i?g:h);return t==null||t.updatePolygonList(C!=null?C:[]),C},Pt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:u,newSphereList:l})=>{var r;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;(r=g==null?void 0:g.selection)==null||r.setSelectedIDs(x[0]);const h=g.selectedPolygon;if(x.length===1&&C){N({omitView:PointCloudView.Top,polygon:h,boxParams:C,newPointCloudBoxList:i});return}}if((u||W)&&x.length===1){const C=u!=null?u:W;g.setSelectedID(x[0]);const h=g.selectedPoint;C&&H(PointCloudView.Top,h,C,void 0,l,y)}}},$=(s,i,u)=>{if(K){let l,r;switch(u){case PointCloudView.Back:l=backViewPolygon2PointCloud;break;case PointCloudView.Side:l=sideViewPolygon2PointCloud;break;default:l=sideViewPolygon2PointCloud;break}if(r=l(s,i,K,a.pointCloudInstance),e){const{count:b}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:b})}const C=z(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:y,action:"viewUpdateBox"}))[0],h=r.valid!==C.valid;r=C;const m=rt(r);return r=m.find(b=>b.id===r.id),N({omitView:h?void 0:u,polygon:s,boxParams:r,newPointCloudBoxList:m}),m}},tt=(s,i,u)=>{if(W){let l,r;switch(u){case PointCloudView.Back:l=backViewPoint2PointCloud;break;case PointCloudView.Side:l=sideViewPoint2PointCloud;break;default:l=sideViewPoint2PointCloud;break}r=l(s,i,W);const g=Y(r);return H(u,s,r,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 u=nt(s.id),l=topViewPoint2PointCloud(s,i,X,u),r=Y(l);H(PointCloudView.Top,s,l,void 0,r,y)},Lt=(s,i)=>{if(ot){const l=__spreadValues({},s[0].newPolygon);l.pointList=l.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,i)),B(l);return}let u=s.map(({newPolygon:l})=>{const r=at(l.id),{boxParams:g}=topViewPolygon2PointCloud(l,i,t.pointCloudInstance,r);return g});if(u=z(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:u,stepConfig:y,action:"viewUpdateBox"})),u.length===1){const{newPolygon:l}=s[0],r=Q(u);N({polygon:l,boxParams:u[0],newPointCloudBoxList:r})}else{const l=Q(u);l&&n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiMove,l)}},yt=s=>{var i,u,l,r,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:(l=(u=t==null?void 0:t.toolInstance)==null?void 0:u.basicImgInfo)==null?void 0:l.width,height:(g=(r=t==null?void 0:t.toolInstance)==null?void 0:r.basicImgInfo)==null?void 0:g.height},A=I.pointList.map(G=>lbUtils.PointCloudUtils.transferCanvas2World(G,v)),q=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(A,m,C),E=q[0],F=q[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})}},H=(s,i,u,l,r,g)=>__async(void 0,null,function*(){const C=j==null?void 0:j.url,h={[PointCloudView.Side]:()=>{syncSideViewByPoint(u,i,a,C,g)},[PointCloudView.Back]:()=>{p&&syncBackViewByPoint(u,i,p,C,g)},[PointCloudView.Top]:()=>{syncTopViewByPoint(u,i,t,e)}};Object.keys(h).forEach(m=>{m!==s&&h[m]()}),l&&(e==null||e.updateCameraZoom(l)),dt(u)}),N=(s,i=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{const{omitView:u,polygon:l,boxParams:r,zoom:g,newPointCloudBoxList:C}=s,h=j==null?void 0:j.url;C&&n.syncAllViewPointCloudColor(i,C);const m={[PointCloudView.Side]:()=>{synchronizeSideView(r,l,a,h)},[PointCloudView.Back]:()=>{p&&synchronizeBackView(r,l,p,h)},[PointCloudView.Top]:()=>{synchronizeTopView(r,l,t,e)}};Object.keys(m).forEach(b=>{b!==u&&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:H,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 u,l,r,g,C,h,m,b;if(!(i==null?void 0:i.url)||!e)return;D([]),actionCreators.SetAnnotationLoading(z,!0),actionCreators.SetLoadPCDFileLoading(z,!0),(u=o==null?void 0:o.setResourceLoading)==null||u.call(o,!0),yield e.loadPCDFile(i.url,(l=y==null?void 0:y.radius)!=null?l:DEFAULT_RADIUS),e==null||e.clearAllBox(),e==null||e.clearAllSphere();let S=[],I=[],v=[],A=[];e.updateTopCamera();const q=(g=(r=index.jsonParser(i.result))==null?void 0:r.valid)!=null?g:!0;if(n.setPointCloudValid(q),(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),a=ahooks.useLatest(o),p=ahooks.useLatest(n);return{syncToPointCloudBoxList:React.useCallback(()=>{const P=a.current,c=p.current;if(c.length===0)return null;const d=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=d.get(L);w||(w=new Map,d.set(L,w)),w.set(R,D),x.add(L)}),d.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=d.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;
|
|
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((a,p)=>{var e=d=>{try{c(t.next(d))}catch(x){p(x)}},P=d=>{try{c(t.throw(d))}catch(x){p(x)}},c=d=>d.done?a(d.value):Promise.resolve(d.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,a,p)=>{const{x:e,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,n),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:e,y:P,z:c},id:o.id},x=a?__spreadValues(__spreadValues({},a),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return p&&Object.assign(x,p),x},topViewPolygon2PointCloud=(o,n,t,a,p,e)=>{let P=o.pointList.map(w=>lbUtils.PointCloudUtils.transferCanvas2World(w,n)),c=0,d=1,x={};if(t){const w=t.getSensesPointZAxisInPolygon(P,void 0,e);e&&w.fittedCoordinates.length>0&&(P=w.fittedCoordinates),c=(w.maxZ+w.minZ)/2,d=w.maxZ-w.minZ,x={count:w.zCount}}const[f,v,R]=P,I=lbAnnotation.MathUtils.getLineCenterPoint([f,R]),S=lbAnnotation.MathUtils.getLineLength(f,v),V=lbAnnotation.MathUtils.getLineLength(v,R),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(o.pointList);a&&(c=a.center.z,d=a.depth);const T={center:{x:I.x,y:I.y,z:c},width:e?V+INTELLIGENT_FIT_MARGIN:V,height:e?S+INTELLIGENT_FIT_MARGIN:S,depth:d,rotation:k,id:o.id},A=__spreadValues(a?__spreadValues(__spreadValues({},a),T):__spreadProps(__spreadValues({},T),{attribute:"",valid:!0}),x);p&&Object.assign(A,p);const O=P.map(w=>lbUtils.PointCloudUtils.transferWorld2Canvas(w,n));return{boxParams:A,newPointList:O}},sideViewPoint2PointCloud=(o,n,t)=>{const a={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x-a.x,y:t.center.y,z:t.center.z-a.y}})},sideViewPolygon2PointCloud=(o,n,t,a)=>{const[p,e,P]=o.pointList,[c,d,x]=n.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),v=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),I={x:{x:f.x-v.x,y:f.y-v.y}.x,y:0,z:f.y-v.y},S=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,d),k=S-V,T=lbAnnotation.MathUtils.getLineLength(e,P),A=lbAnnotation.MathUtils.getLineLength(d,x),O=T-A,{newBoxParams:w}=a.getNewBoxBySideUpdate(I,O,k,t);return w},backViewPoint2PointCloud=(o,n,t)=>{const a={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x,y:t.center.y-a.x,z:t.center.z-a.y}})},backViewPolygon2PointCloud=(o,n,t,a)=>{const[p,e,P]=o.pointList,[c,d,x]=n.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),v=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),I={x:{x:f.x-v.x,y:f.y-v.y}.x,y:0,z:f.y-v.y},S=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,d),k=S-V,T=lbAnnotation.MathUtils.getLineLength(e,P),A=lbAnnotation.MathUtils.getLineLength(d,x),O=T-A;let{newBoxParams:w}=a.getNewBoxByBackUpdate(I,O,k,t);return w},syncSideViewByPoint=(o,n,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(d);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,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxSidePolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncBackViewByPoint=(o,n,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(d);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,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxBackPolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncTopViewByPoint=(o,n,t,a)=>{if(!t||!a)return;a.generateSphere(o),a.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:p,pointCloudInstance:e}=t,{point2d:P}=e.getSphereTopPoint2DCoordinate(o),c=[...p.pointList].map(d=>d.id===n.id?__spreadProps(__spreadValues(__spreadValues({},n),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):d);p.setResult(c),p.setSelectedID(n.id)},synchronizeTopView=(o,n,t,a)=>{var p,e;if(!t||!a)return;a.generateBox(o),a.setHighlightColor(o.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=t,{polygon2d:d}=c.getBoxTopPolygon2DCoordinate(o),x=[...P.polygonList],f=x.find(v=>v.id===n.id);f?(f.pointList=d,f.valid=(p=o.valid)!=null?p:!0):x.push({id:n.id,pointList:d,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:a,backViewInstance:p,mainViewInstance:e,addPointCloudBox:P,addPointCloudSphere:c,setSelectedIDs:d,selectedIDs:x,pointCloudBoxList:f,pointCloudSphereList:v,hideAttributes:R,setHighlight2DDataList:I,cuboidBoxIn2DView:S,imageSizes:V,history:k,linkageImageNameRectMap:T}=n,{addHistory:A,initHistory:O,pushHistoryUnderUpdatePolygon:w}=useHistory.useHistory(),{selectedPolygon:ot}=usePolygon.usePolygon(),{getPointCloudSphereByID:nt,updatePointCloudSphere:X,selectedSphere:F}=useSphere.useSphere(),{currentData:E,config:y}=ctx.useSelector(s=>{const{stepList:i,step:u,imgList:l,imgIndex:g}=s.annotation;return{currentData:l[g],config:index.jsonParser(StepUtils.getCurrentStepInfo(u,i).config)}}),M=ctx.useDispatch(),it=ahooks.useLatest(S),st=ahooks.useLatest(T),rt=React.useCallback((s,i)=>{const u=st.current,l=i.id;return s.filter(r=>{if(!r)return!1;const h=u.get(r.imageName);return h===void 0?!0:Boolean(h.get(l))})},[]),Z=s=>{const{enableAutoMap2DRect:i=!1}=y;if(!it.current||i){const{mappingImgList:u=[]}=E;index.generatePointCloudBoxRects({pointCloudBox:s,mappingImgList:u,imageSizes:V},{prepareRectsFn:rt})}},{selectedBox:U,updateSelectedBox:lt,updateSelectedBoxes:G,getPointCloudByID:at}=useSingleBox.useSingleBox({generateRects:Z}),Y=U==null?void 0:U.info;if(!t||!a||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:J}=t,dt=s=>{e==null||e.generateSphere(s),e==null||e.controls.update(),e==null||e.render()},ut=({newPoint:s,size:i,zoom:u,trackConfigurable:l})=>{var g;const r={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};l===!0&&Object.assign(r,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const h=topViewPoint2PointCloud(s,i,J,void 0,r);d(s.id);const C=c(h);H(PointCloudView.Top,s,h,u,C,y),A({newSphereParams:h})},ct=({polygon:s,size:i,imgList:u,trackConfigurable:l,zoom:g,intelligentFit:r})=>{var h,C,b;const D={attribute:(h=t.toolInstance.defaultAttribute)!=null?h:""};l===!0&&Object.assign(D,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:f,extraSphereList:v})}),t==null||t.toolInstance;const L=__spreadValues({},s);let{boxParams:B,newPointList:m}=topViewPolygon2PointCloud(L,i,J,void 0,D,r);B=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[B],stepConfig:y,action:"viewUpdateBox"}))[0],r&&(m==null?void 0:m.length)&&(L.pointList=m);const N=R.includes(L.attribute);Z(B);const z=P(B),Q=(C=n==null?void 0:n.polygonList)!=null?C:[];B.subAttribute=lbAnnotation.TagUtils.getDefaultResultByConfig((y==null?void 0:y.secondaryAttributeConfigurable)?(b=y==null?void 0:y.inputList)!=null?b:[]:[]),t==null||t.updatePolygonList(z!=null?z:[],Q,!1),N?d([]):(d(B.id),r&&synchronizeTopView(B,L,t,e)),A({newBoxParams:B})},pt=s=>{const{boxID:i,imageName:u,width:l,height:g,x:r,y:h}=s,C=f.find(m=>m.id===i);if(!(C==null?void 0:C.rects)||!C.rects.find(m=>m.imageName===u))return;const D=C.rects.map(m=>m.imageName===u?__spreadProps(__spreadValues({},m),{width:l,height:g,x:r,y:h}):m),L=__spreadProps(__spreadValues({},C),{rects:D}),B=f.map(m=>m.id===i?L:m);return t==null||t.updatePolygonList(B!=null?B:[]),B},gt=s=>{const{boxID:i,imageName:u}=s,l=f.find(C=>C.id===i);if(!(l==null?void 0:l.rects))return;const g=l.rects.filter(C=>C.imageName!==u),r=__spreadProps(__spreadValues({},l),{rects:g}),h=f.map(C=>C.id===i?r:C);return t==null||t.updatePolygonList(h!=null?h:[]),h},Pt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:u,newSphereList:l})=>{var g;const r=t==null?void 0:t.toolInstance;if(!(x.length===0||!r)){if(s||(U==null?void 0:U.info)){const h=s!=null?s:U==null?void 0:U.info;(g=r==null?void 0:r.selection)==null||g.setSelectedIDs(x[0]);const C=r.selectedPolygon;if(x.length===1&&h){q({omitView:PointCloudView.Top,polygon:C,boxParams:h,newPointCloudBoxList:i});return}}if((u||F)&&x.length===1){const h=u!=null?u:F;r.setSelectedID(x[0]);const C=r.selectedPoint;h&&H(PointCloudView.Top,C,h,void 0,l,y)}}},K=(s,i,u,l=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{if(Y){let g,r;switch(u){case PointCloudView.Back:g=backViewPolygon2PointCloud;break;case PointCloudView.Side:g=sideViewPolygon2PointCloud;break;default:g=sideViewPolygon2PointCloud;break}if(r=g(s,i,Y,a.pointCloudInstance),e){const{count:L}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:L})}const C=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:y,action:"viewUpdateBox"}))[0],b=r.valid!==C.valid;r=C;const D=lt(r);return r=D.find(L=>L.id===r.id),q({omitView:b?void 0:u,polygon:s,boxParams:r,newPointCloudBoxList:D},l),D}},$=(s,i,u)=>{if(F){let l,g;switch(u){case PointCloudView.Back:l=backViewPoint2PointCloud;break;case PointCloudView.Side:l=sideViewPoint2PointCloud;break;default:l=sideViewPoint2PointCloud;break}g=l(s,i,F);const r=X(g);return H(u,s,g,void 0,r,y),r}},Ct=(s,i)=>{$(s,i,PointCloudView.Side)},ft=(s,i)=>{$(s,i,PointCloudView.Back)},ht=(s,i)=>{K(s,i,PointCloudView.Side,ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)},xt=(s,i)=>{K(s,i,PointCloudView.Back,ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)},vt=(s,i)=>{const u=nt(s.id),l=topViewPoint2PointCloud(s,i,J,u),g=X(l);H(PointCloudView.Top,s,l,void 0,g,y)},Lt=(s,i)=>{if(ot){const l=__spreadValues({},s[0].newPolygon);l.pointList=l.pointList.map(g=>lbUtils.PointCloudUtils.transferCanvas2World(g,i)),w(l);return}let u=s.map(({newPolygon:l})=>{const g=at(l.id),{boxParams:r}=topViewPolygon2PointCloud(l,i,t.pointCloudInstance,g);return r});if(u=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:u,stepConfig:y,action:"viewUpdateBox"})),u.length===1){const{newPolygon:l}=s[0],g=G(u);q({polygon:l,boxParams:u[0],newPointCloudBoxList:g},ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)}else{const l=G(u);l&&n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiMove,l)}},yt=s=>{var i,u,l,g,r;if(U){const h=Number(s.widthDefault),C=Number(s.depthDefault),b=Number(s.heightDefault),D=U==null?void 0:U.info.trackID,B=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(W=>(W==null?void 0:W.trackID)===D),m={width:(l=(u=t==null?void 0:t.toolInstance)==null?void 0:u.basicImgInfo)==null?void 0:l.width,height:(r=(g=t==null?void 0:t.toolInstance)==null?void 0:g.basicImgInfo)==null?void 0:r.height},j=B.pointList.map(W=>lbUtils.PointCloudUtils.transferCanvas2World(W,m)),N=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(j,b,h),z=N[0],Q=N[2],tt=lbAnnotation.MathUtils.getLineCenterPoint([z,Q]),mt=U.info.center.z-U.info.depth/2,et=__spreadProps(__spreadValues({},U.info),{center:{x:tt.x,y:tt.y,z:mt+C/2},width:h,height:b,depth:C,valid:!0}),Bt=G([et]);q({omitView:PointCloudView["3D"],polygon:B,boxParams:et,newPointCloudBoxList:Bt})}},H=(s,i,u,l,g,r)=>__async(void 0,null,function*(){const h=E==null?void 0:E.url,C={[PointCloudView.Side]:()=>{syncSideViewByPoint(u,i,a,h,r)},[PointCloudView.Back]:()=>{p&&syncBackViewByPoint(u,i,p,h,r)},[PointCloudView.Top]:()=>{syncTopViewByPoint(u,i,t,e)}};Object.keys(C).forEach(b=>{b!==s&&C[b]()}),l&&(e==null||e.updateCameraZoom(l)),dt(u)}),q=(s,i=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{const{omitView:u,polygon:l,boxParams:g,zoom:r,newPointCloudBoxList:h}=s,C=E==null?void 0:E.url;h&&n.syncAllViewPointCloudColor(i,h);const b={[PointCloudView.Side]:()=>{synchronizeSideView(g,l,a,C)},[PointCloudView.Back]:()=>{p&&synchronizeBackView(g,l,p,C)},[PointCloudView.Top]:()=>{synchronizeTopView(g,l,t,e)}};Object.keys(b).forEach(D=>{D!==u&&b[D]()}),r&&(e==null||e.updateCameraZoom(r))};return{topViewAddSphere:ut,topViewAddBox:ct,topViewSelectedChanged:Pt,topViewUpdatePoint:vt,sideViewUpdatePoint:Ct,backViewUpdatePoint:ft,topViewUpdateBox:Lt,sideViewUpdateBox:ht,backViewUpdateBox:xt,syncPointCloudViews:q,syncPointCloudPoint:H,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=E){var u,l,g,r,h,C,b,D;if(!(i==null?void 0:i.url)||!e)return;I([]),actionCreators.SetAnnotationLoading(M,!0),actionCreators.SetLoadPCDFileLoading(M,!0),(u=o==null?void 0:o.setResourceLoading)==null||u.call(o,!0),yield e.loadPCDFile(i.url,(l=y==null?void 0:y.radius)!=null?l:DEFAULT_RADIUS),e==null||e.clearAllBox(),e==null||e.clearAllSphere();let L=[],B=[],m=[],j=[];e.updateTopCamera();const N=(r=(g=index.jsonParser(i.result))==null?void 0:g.valid)!=null?r:!0;if(n.setPointCloudValid(N),(h=n.sideViewInstance)==null||h.clearAllData(),(C=n.backViewInstance)==null||C.clearAllData(),i.result){if(L=lbUtils.PointCloudUtils.getBoxParamsFromResultList(i.result),(L==null?void 0:L.length)>0&&i.isPreResult&&(y==null?void 0:y.lowerLimitPointsNumInBox)>0){L=yield e==null?void 0:e.filterPreResult(i.url,y,L);const z=index.jsonParser(i.result);z[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=L,i.result=JSON.stringify(z),n.setPointCloudResult(L)}m=lbUtils.PointCloudUtils.getPolygonListFromResultList(i.result),B=lbUtils.PointCloudUtils.getLineListFromResultList(i.result),j=lbUtils.PointCloudUtils.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(b=y==null?void 0:y.radius)!=null?b:DEFAULT_RADIUS}),e==null||e.generateBoxes(L),e==null||e.generateSpheres(j),yield n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,L,[])}O({pointCloudBoxList:L,polygonList:m,lineList:B,pointCloudSphereList:j}),actionCreators.SetAnnotationLoading(M,!1),actionCreators.SetLoadPCDFileLoading(M,!1),(D=o==null?void 0:o.setResourceLoading)==null||D.call(o,!1)}),updateViewsByDefaultSize:yt,generateRects:Z,update2DViewRect:pt,remove2DViewRect:gt}},useSyncRectPositionDimensionToPointCloudList=()=>{const{pointCloudBoxList:o,rectList:n,setPointCloudResult:t}=React.useContext(PointCloudContext.PointCloudContext),a=ahooks.useLatest(o),p=ahooks.useLatest(n);return{syncToPointCloudBoxList:React.useCallback(()=>{const P=a.current,c=p.current;if(c.length===0)return null;const d=new Map,x=new Set;if(c.filter(f=>f.extId!==void 0).forEach(f=>{const v=f.extId,R=f.imageName,I=_.pick(f,["x","y","width","height"]);let S=d.get(v);S||(S=new Map,d.set(v,S)),S.set(R,I),x.add(v)}),d.size){const f=P.map(v=>{var R;const I=v.id;if(x.has(I)){const S=__spreadValues({},v);return(R=S.rects)==null||R.forEach(V=>{var k;const T=V.imageName;Object.assign(V,(k=d.get(I))==null?void 0:k.get(T))}),S}return v});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;
|
|
@@ -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(
|
|
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"),DynamicResizer=require("../DynamicResizer/DynamicResizer.js");function _interopDefaultLegacy(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=i=>{const{currentData:s,imgList:S,drawLayerSlot:f,checkMode:n,intelligentFit:b,imgIndex:x,config:V,measureVisible:q,setResourceLoading:p,stepInfo:t,setBatchSetValid:g}=i,e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:v,setGlobalPattern:w,selectedIDs:P,isLargeStatus:u,setIsLargeStatus:j}=e,D=ctx.useDispatch(),C=React.useRef(null),L=React.useRef(null),[N,y]=React.useState(0),[a,h]=React.useState(!1),R=(P==null?void 0:P.length)>0&&a,I=index.jsonParser(s.result),{toolInstanceRef:r,clearToolInstance:A}=annotation.useCustomToolInstance({basicInfo:I});if(React.useEffect(()=>{r.current.setPointCloudGlobalPattern=l=>{l!==v&&(w(l),e.clearAllDetectionInstance(),A())}},[v]),React.useEffect(()=>{var l;if(actionCreators.SetLoadPCDFileLoading(D,!0),s){const{boxParamsList:o,polygonList:d,lineList:c,sphereParamsList:m,segmentation:B,rectList:_}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((l=s==null?void 0:s.result)!=null?l:"");e.setPointCloudResult(o),e.setPolygonList(d),e.setLineList(c),e.setPointCloudSphereList(m),e.setRectList(_),e.setSegmentation(B)}},[x]),React.useEffect(()=>{var l;if(C.current){const o=((l=C.current)==null?void 0:l.offsetHeight)-233;y(o)}},[L.current]),React.useEffect(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var l,o,d,c,m;return{resultPolygon:(l=e.polygonList)!=null?l:[],resultLine:(o=e.lineList)!=null?o:[],resultPoint:(d=e.pointCloudSphereList)!=null?d:[],resultRect:(c=e.rectList)!=null?c:[],segmentation:(m=e.segmentation)!=null?m:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),S.length===0)return null;if(v===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:n,toolInstanceRef:r}),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:V}),f==null?void 0:f({direct:!0}));let E=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 a&&(E=React__default.default.createElement(index$2,{selectAndEnlarge:R,checkMode:n})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:n,toolInstanceRef:r,setResourceLoading:p,isBatchSetValid:!!g}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:l=>l.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content"),ref:L},React__default.default.createElement(DynamicResizer,{direction:"horizontal",localKey:"leftAllViewid:"+(t==null?void 0:t.id)+"taskID:"+(t==null?void 0:t.taskID)+"step:"+(t==null?void 0:t.step)+"type:"+(t==null?void 0:t.type),defaultWidth:360,minLeftWidth:244,minRightWidth:"50%",disabled:u},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container",u?"left-large":"left-noLarge")},React__default.default.createElement(PointCloud3DView,{setResourceLoading:p}),E),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:a}),ref:C},React__default.default.createElement(DynamicResizer,{localKey:"rightAllViewid:"+(t==null?void 0:t.id)+"taskID:"+(t==null?void 0:t.taskID)+"step:"+(t==null?void 0:t.step)+"type:"+(t==null?void 0:t.type),defaultHeight:300,minTopHeight:N,minBottomHeight:160,disabled:u},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:f,checkMode:n,intelligentFit:b,setIsEnlargeTopView:h,onExitZoom:()=>{j(!1),h(!1)},isEnlargeTopView:a}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container",u?"right-bottom-large":"right-bottom-noLarge")]:!a,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:a})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:a,thumbnailWidth:a?300:455,checkMode:n,measureVisible:q})))))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))),e.visibleBatchSetValid&&(g==null?void 0:g({valid:e.valid,isModal:!0,visibleModal:e.visibleBatchSetValid,onClose:()=>e.setBatchSetValidModal(!1),singleSetQuestionImg:()=>e.setPointCloudValid(!e.valid)})))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),antd=require("antd"),index_module=require("./index.module.scss.js"),index=require("../longText/index.js"),classNames=require("classnames");function _interopDefaultLegacy(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const{CheckableTag}=antd.Tag,CheckBoxList=({tagItem:a,selectedTags:r,handleChange:c,disabeledAll:o})=>{var d;const s=o,{isMulti:u,subSelected:n=[],value:i}=a,t=i;return u?React__default.default.createElement(React__default.default.Fragment,null,n.map(e=>{var l,v;return React__default.default.createElement(CheckableTag,{key:e==null?void 0:e.value,checked:(l=r[t])==null?void 0:l.includes(e==null?void 0:e.value),onChange:m=>{s||c({key:t,tag:e==null?void 0:e.value,checked:m})},className:classNames__default.default({[`${index_module.disabled}`]:s,[`${index_module.active}`]:s&&((v=r[t])==null?void 0:v.includes(e==null?void 0:e.value))})},React__default.default.createElement("span",{className:index_module.tagItem},React__default.default.createElement(index,{text:e==null?void 0:e.key,openByText:!0})))})):React__default.default.createElement(antd.Radio.Group,{onChange:e=>{c({key:t,tag:e.target.value,checked:e.target.checked,isRadio:!0})},value:(d=r[t])==null?void 0:d[0]},n.map(e=>React__default.default.createElement(antd.Radio,{value:e==null?void 0:e.value,key:e==null?void 0:e.value,disabled:s},React__default.default.createElement("span",{className:index_module.tagItem},React__default.default.createElement(index,{text:e==null?void 0:e.key,openByText:!0})))))},TagList=a=>{const{selectedTags:r,updateValue:c,disabeledAll:o,inputList:d=[]}=a,s=u=>{const{key:n,checked:i,tag:t,isRadio:e}=u;let l=r[n]||[];if(e&&(l=[]),i){if(l==null?void 0:l.includes(t))return;l.push(t)}else!i&&(l==null?void 0:l.includes(t))&&(l=l.filter(m=>m!==t));c({key:n,value:l})};return(d==null?void 0:d.length)>0?React__default.default.createElement("div",{className:index_module.tagList},d.map((u,n)=>React__default.default.createElement(antd.Row,{key:n,className:index_module.content},React__default.default.createElement(antd.Col,{span:4,className:index_module.left},React__default.default.createElement(index,{text:u==null?void 0:u.key,openByText:!0})),React__default.default.createElement(antd.Col,{span:20,className:index_module.right},React__default.default.createElement(CheckBoxList,{selectedTags:r,handleChange:s,tagItem:u,disabeledAll:o}))))):null};module.exports=TagList;
|
|
1
|
+
"use strict";var React=require("react"),antd=require("antd"),index_module=require("./index.module.scss.js"),index=require("../longText/index.js"),classNames=require("classnames");function _interopDefaultLegacy(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const{CheckableTag}=antd.Tag,CheckBoxList=({tagItem:a,selectedTags:r,handleChange:c,disabeledAll:o})=>{var d;const s=o,{isMulti:u,subSelected:n=[],value:i}=a,t=i;return u?React__default.default.createElement(React__default.default.Fragment,null,n.map(e=>{var l,v;return React__default.default.createElement(CheckableTag,{key:e==null?void 0:e.value,checked:(l=r[t])==null?void 0:l.includes(e==null?void 0:e.value),onChange:m=>{s||c({key:t,tag:e==null?void 0:e.value,checked:m})},className:classNames__default.default({[`${index_module.disabled}`]:s,[`${index_module.active}`]:s&&((v=r[t])==null?void 0:v.includes(e==null?void 0:e.value))})},React__default.default.createElement("span",{className:index_module.tagItem},React__default.default.createElement(index,{text:e==null?void 0:e.key,openByText:!0,maxWordCount:10})))})):React__default.default.createElement(antd.Radio.Group,{onChange:e=>{c({key:t,tag:e.target.value,checked:e.target.checked,isRadio:!0})},value:(d=r[t])==null?void 0:d[0]},n.map(e=>React__default.default.createElement(antd.Radio,{value:e==null?void 0:e.value,key:e==null?void 0:e.value,disabled:s},React__default.default.createElement("span",{className:index_module.tagItem},React__default.default.createElement(index,{text:e==null?void 0:e.key,openByText:!0,maxWordCount:10})))))},TagList=a=>{const{selectedTags:r,updateValue:c,disabeledAll:o,inputList:d=[]}=a,s=u=>{const{key:n,checked:i,tag:t,isRadio:e}=u;let l=r[n]||[];if(e&&(l=[]),i){if(l==null?void 0:l.includes(t))return;l.push(t)}else!i&&(l==null?void 0:l.includes(t))&&(l=l.filter(m=>m!==t));c({key:n,value:l})};return(d==null?void 0:d.length)>0?React__default.default.createElement("div",{className:index_module.tagList},d.map((u,n)=>React__default.default.createElement(antd.Row,{key:n,className:index_module.content},React__default.default.createElement(antd.Col,{span:4,className:index_module.left},React__default.default.createElement(index,{text:u==null?void 0:u.key,openByText:!0})),React__default.default.createElement(antd.Col,{span:20,className:index_module.right},React__default.default.createElement(CheckBoxList,{selectedTags:r,handleChange:s,tagItem:u,disabeledAll:o}))))):null};module.exports=TagList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var icons=require("@ant-design/icons"),React=require("react"),index_module=require("./index.module.scss.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const EKeyCode=lbAnnotation.cKeyCode.default,VIDEO_PLAYBACK_RATE_SPEED=[.5,1,1.5,2,4,6,8,16],AUDIO_PLAYBACK_RATE_SPEED=[.5,.75,1,1.25,1.5,1.75,2];exports.EPlayerType=void 0,function(e){e[e.Video=0]="Video",e[e.Audio=1]="Audio"}(exports.EPlayerType||(exports.EPlayerType={}));var ESpeedChange;(function(e){e[e.Increase=0]="Increase",e[e.Reduce=1]="Reduce"})(ESpeedChange||(ESpeedChange={}));const PLAYER_TYPE_RATE_SPEED={[0]:VIDEO_PLAYBACK_RATE_SPEED,[1]:AUDIO_PLAYBACK_RATE_SPEED},SpeedController=e=>{const{onChange:l,playerType:i}=e,{t:d}=reactI18next.useTranslation(),n=PLAYER_TYPE_RATE_SPEED[i],u=n.slice(-1)[0],E=n[0],[o,_]=React.useState(1),r=t=>{const a=t===0?1:-1;if(a===1&&o===u||a===-1&&o===E)return;const A=n.findIndex(f=>f===o)+a,c=n[A];_(c),l(c)},s=t=>{!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||(t.keyCode===EKeyCode.Up&&r(0),t.keyCode===EKeyCode.Down&&r(1))};return React.useEffect(()=>(window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s))),React__default.default.createElement("div",{className:index_module.speedControllerWrap},React__default.default.createElement("span",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement("span",{style:{fontSize:12}},d("Speed")),o,"x"),React__default.default.createElement("span",{className:index_module.speedController},React__default.default.createElement(icons.CaretUpOutlined,{onClick:()=>r(0)}),React__default.default.createElement(icons.CaretDownOutlined,{onClick:()=>r(1)})))};exports.AUDIO_PLAYBACK_RATE_SPEED=AUDIO_PLAYBACK_RATE_SPEED,exports.PLAYER_TYPE_RATE_SPEED=PLAYER_TYPE_RATE_SPEED,exports.VIDEO_PLAYBACK_RATE_SPEED=VIDEO_PLAYBACK_RATE_SPEED,exports.default=SpeedController;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var icons=require("@ant-design/icons"),React=require("react"),index_module=require("./index.module.scss.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const EKeyCode=lbAnnotation.cKeyCode.default,VIDEO_PLAYBACK_RATE_SPEED=[.1,.2,.3,.4,.5,1,1.5,2,4,6,8,16],AUDIO_PLAYBACK_RATE_SPEED=[.5,.75,1,1.25,1.5,1.75,2];exports.EPlayerType=void 0,function(e){e[e.Video=0]="Video",e[e.Audio=1]="Audio"}(exports.EPlayerType||(exports.EPlayerType={}));var ESpeedChange;(function(e){e[e.Increase=0]="Increase",e[e.Reduce=1]="Reduce"})(ESpeedChange||(ESpeedChange={}));const PLAYER_TYPE_RATE_SPEED={[0]:VIDEO_PLAYBACK_RATE_SPEED,[1]:AUDIO_PLAYBACK_RATE_SPEED},SpeedController=e=>{const{onChange:l,playerType:i}=e,{t:d}=reactI18next.useTranslation(),n=PLAYER_TYPE_RATE_SPEED[i],u=n.slice(-1)[0],E=n[0],[o,_]=React.useState(1),r=t=>{const a=t===0?1:-1;if(a===1&&o===u||a===-1&&o===E)return;const A=n.findIndex(f=>f===o)+a,c=n[A];_(c),l(c)},s=t=>{!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||(t.keyCode===EKeyCode.Up&&r(0),t.keyCode===EKeyCode.Down&&r(1))};return React.useEffect(()=>(window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s))),React__default.default.createElement("div",{className:index_module.speedControllerWrap},React__default.default.createElement("span",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement("span",{style:{fontSize:12}},d("Speed")),o,"x"),React__default.default.createElement("span",{className:index_module.speedController},React__default.default.createElement(icons.CaretUpOutlined,{onClick:()=>r(0)}),React__default.default.createElement(icons.CaretDownOutlined,{onClick:()=>r(1)})))};exports.AUDIO_PLAYBACK_RATE_SPEED=AUDIO_PLAYBACK_RATE_SPEED,exports.PLAYER_TYPE_RATE_SPEED=PLAYER_TYPE_RATE_SPEED,exports.VIDEO_PLAYBACK_RATE_SPEED=VIDEO_PLAYBACK_RATE_SPEED,exports.default=SpeedController;
|