@labelbee/lb-components 1.24.0-alpha.5 → 1.24.0-alpha.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/_virtual/2DViewWorker.js +1 -1
  2. package/dist/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
  3. package/dist/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
  4. package/dist/components/DynamicResizer/DynamicResizer.js +1 -1
  5. package/dist/components/DynamicResizer/hooks/useDrag.js +1 -1
  6. package/dist/components/DynamicResizer/hooks/useDraggingAllowed.js +1 -0
  7. package/dist/components/DynamicResizer/hooks/useUpdateHeight.js +1 -1
  8. package/dist/components/DynamicResizer/utils/index.js +1 -0
  9. package/dist/components/LLMMultiWheelView/dialogView/index.js +1 -1
  10. package/dist/components/LLMMultiWheelView/index.js +1 -1
  11. package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -1
  12. package/dist/components/LLMToolView/index.js +1 -1
  13. package/dist/components/LLMToolView/modelAPIView/index.js +1 -1
  14. package/dist/components/LLMToolView/questionView/components/audioView/index.js +1 -0
  15. package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
  16. package/dist/components/LLMToolView/questionView/index.js +1 -1
  17. package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
  18. package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
  19. package/dist/components/attributeList/index.js +1 -1
  20. package/dist/components/audioAnnotate/index.js +1 -1
  21. package/dist/components/audioPlayer/index.js +1 -1
  22. package/dist/components/longText/index.js +1 -1
  23. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  24. package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
  25. package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
  26. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  27. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  28. package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
  29. package/dist/components/pointCloudView/components/TitleButton/index.js +1 -1
  30. package/dist/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
  31. package/dist/components/pointCloudView/components/sideAndBackOverView/index.js +1 -1
  32. package/dist/components/pointCloudView/hooks/useConfig.js +1 -1
  33. package/dist/components/pointCloudView/hooks/useHighlight.js +1 -1
  34. package/dist/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
  35. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  36. package/dist/components/pointCloudView/index.js +1 -1
  37. package/dist/components/tagList/index.js +1 -1
  38. package/dist/components/videoPlayer/components/SpeedController/index.js +1 -1
  39. package/dist/components/videoPlayer/index.js +1 -1
  40. package/dist/constant/index.js +1 -1
  41. package/dist/index.css +112 -90
  42. package/dist/store/Actions.js +1 -1
  43. package/dist/store/annotation/actionCreators.js +1 -1
  44. package/dist/store/annotation/reducer.js +1 -1
  45. package/dist/store/toolConfig/pointCloudToolConfig.js +1 -1
  46. package/dist/types/components/DynamicResizer/DynamicResizer.d.ts +3 -3
  47. package/dist/types/components/DynamicResizer/hooks/useDrag.d.ts +24 -7
  48. package/dist/types/components/DynamicResizer/hooks/useDraggingAllowed.d.ts +12 -0
  49. package/dist/types/components/DynamicResizer/hooks/useUpdateHeight.d.ts +10 -21
  50. package/dist/types/components/DynamicResizer/types/interface.d.ts +14 -6
  51. package/dist/types/components/DynamicResizer/utils/index.d.ts +4 -0
  52. package/dist/types/components/LLMMultiWheelView/dialogView/index.d.ts +2 -0
  53. package/dist/types/components/LLMMultiWheelView/index.d.ts +2 -0
  54. package/dist/types/components/LLMToolView/questionView/components/audioView/index.d.ts +8 -0
  55. package/dist/types/components/LLMToolView/questionView/components/header/index.d.ts +3 -1
  56. package/dist/types/components/attributeList/components/limitPopover/index.d.ts +2 -2
  57. package/dist/types/components/longText/index.d.ts +1 -1
  58. package/dist/types/components/pointCloud2DRectOperationView/useUpdateRectList.d.ts +0 -1
  59. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +4 -0
  60. package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -0
  61. package/dist/types/components/pointCloudView/hooks/useConfig.d.ts +2 -1
  62. package/dist/types/components/pointCloudView/hooks/usePointCloudAttribute.d.ts +3 -0
  63. package/dist/types/components/pointCloudView/hooks/useRotate.d.ts +1 -2
  64. package/dist/types/components/pointCloudView/hooks/useRotateEdge.d.ts +1 -2
  65. package/dist/types/components/pointCloudView/index.d.ts +2 -0
  66. package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +1 -1
  67. package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +1 -1
  68. package/dist/types/components/videoAnnotate/videoTextTool/index.d.ts +1 -1
  69. package/dist/types/components/videoPlayer/index.d.ts +1 -1
  70. package/dist/types/constant/index.d.ts +4 -2
  71. package/dist/types/store/Actions.d.ts +1 -0
  72. package/dist/types/store/annotation/actionCreators.d.ts +9 -1
  73. package/dist/types/store/annotation/map.d.ts +1 -0
  74. package/dist/types/store/annotation/reducer.d.ts +5 -1
  75. package/dist/types/store/annotation/types.d.ts +4 -2
  76. package/dist/types/store/toolConfig/types.d.ts +2 -0
  77. package/dist/types/utils/LLM.d.ts +6 -0
  78. package/dist/types/views/MainView/index.d.ts +2 -0
  79. package/dist/types/views/MainView/sidebar/GeneralOperation/ActionsConfirm.d.ts +3 -0
  80. package/dist/types/views/MainView/sidebar/GeneralOperation/index.d.ts +9 -0
  81. package/dist/types/views/MainView/sidebar/index.d.ts +2 -0
  82. package/dist/utils/LLM.js +1 -0
  83. package/dist/utils/ToolPointCloudBoxRenderHelper.js +1 -1
  84. package/dist/views/MainView/LLMMultiWheelLayout/index.js +1 -1
  85. package/dist/views/MainView/index.js +1 -1
  86. package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
  87. package/dist/views/MainView/sidebar/GeneralOperation/index.js +1 -1
  88. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  89. package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
  90. package/dist/views/MainView/sidebar/ToolIcons.js +1 -1
  91. package/dist/views/MainView/sidebar/index.js +1 -1
  92. package/es/_virtual/2DViewWorker.js +1 -1
  93. package/es/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
  94. package/es/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
  95. package/es/components/DynamicResizer/DynamicResizer.js +1 -1
  96. package/es/components/DynamicResizer/hooks/useDrag.js +1 -1
  97. package/es/components/DynamicResizer/hooks/useDraggingAllowed.js +1 -0
  98. package/es/components/DynamicResizer/hooks/useUpdateHeight.js +1 -1
  99. package/es/components/DynamicResizer/utils/index.js +1 -0
  100. package/es/components/LLMMultiWheelView/dialogView/index.js +1 -1
  101. package/es/components/LLMMultiWheelView/index.js +1 -1
  102. package/es/components/LLMMultiWheelView/sidebar/index.js +1 -1
  103. package/es/components/LLMToolView/index.js +1 -1
  104. package/es/components/LLMToolView/modelAPIView/index.js +1 -1
  105. package/es/components/LLMToolView/questionView/components/audioView/index.js +1 -0
  106. package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
  107. package/es/components/LLMToolView/questionView/index.js +1 -1
  108. package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
  109. package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
  110. package/es/components/attributeList/index.js +1 -1
  111. package/es/components/audioAnnotate/index.js +1 -1
  112. package/es/components/audioPlayer/index.js +1 -1
  113. package/es/components/longText/index.js +1 -1
  114. package/es/components/pointCloud2DRectOperationView/index.js +1 -1
  115. package/es/components/pointCloudView/PointCloud2DView.js +1 -1
  116. package/es/components/pointCloudView/PointCloud3DView.js +1 -1
  117. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  118. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  119. package/es/components/pointCloudView/PointCloudTopView.js +1 -1
  120. package/es/components/pointCloudView/components/TitleButton/index.js +1 -1
  121. package/es/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
  122. package/es/components/pointCloudView/components/sideAndBackOverView/index.js +1 -1
  123. package/es/components/pointCloudView/hooks/useConfig.js +1 -1
  124. package/es/components/pointCloudView/hooks/useHighlight.js +1 -1
  125. package/es/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
  126. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  127. package/es/components/pointCloudView/index.js +1 -1
  128. package/es/components/tagList/index.js +1 -1
  129. package/es/components/videoPlayer/components/SpeedController/index.js +1 -1
  130. package/es/components/videoPlayer/index.js +1 -1
  131. package/es/constant/index.js +1 -1
  132. package/es/index.css +112 -90
  133. package/es/store/Actions.js +1 -1
  134. package/es/store/annotation/actionCreators.js +1 -1
  135. package/es/store/annotation/reducer.js +1 -1
  136. package/es/store/toolConfig/pointCloudToolConfig.js +1 -1
  137. package/es/utils/LLM.js +1 -0
  138. package/es/utils/ToolPointCloudBoxRenderHelper.js +1 -1
  139. package/es/views/MainView/LLMMultiWheelLayout/index.js +1 -1
  140. package/es/views/MainView/index.js +1 -1
  141. package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
  142. package/es/views/MainView/sidebar/GeneralOperation/index.js +1 -1
  143. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  144. package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
  145. package/es/views/MainView/sidebar/ToolIcons.js +1 -1
  146. package/es/views/MainView/sidebar/index.js +1 -1
  147. package/package.json +8 -8
  148. package/dist/components/DynamicResizer/assets/bottomToZero.svg.js +0 -1
  149. package/dist/components/DynamicResizer/assets/divider.svg.js +0 -1
  150. package/dist/components/DynamicResizer/assets/topToZero.svg.js +0 -1
  151. package/es/components/DynamicResizer/assets/bottomToZero.svg.js +0 -1
  152. package/es/components/DynamicResizer/assets/divider.svg.js +0 -1
  153. package/es/components/DynamicResizer/assets/topToZero.svg.js +0 -1
@@ -1 +1 @@
1
- import{getClassName as _}from"../../utils/dom.js";import t,{useState as f,useContext as z,useCallback as $,useRef as q,useEffect as j}from"react";import{PointCloudContainer as D}from"./PointCloudLayout.js";import{PointCloudContext as M}from"./PointCloudContext.js";import{connect as W}from"react-redux";import{cKeyCode as H,EventBus as G}from"@labelbee/lb-annotation";import{LabelBeeContext as J}from"../../store/ctx.js";import{a2MapStateToProps as Q}from"../../store/annotation/map.js";import U from"./PointCloud2DSingleView.js";import S from"./components/TitleButton/index.js";import{LeftOutlined as X}from"@ant-design/icons";import Y from"classnames";import Z from"../../assets/annotation/common/icon_esc.svg.js";import ee from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import te from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import ne from"../../_virtual/2DViewWorker.js";import{useLatest as oe}from"ahooks";const C=H.default,ie=({showEnlarge:n,isEnlargeTopView:v,data:l,setIsEnlarge:c,setCurIndex:m,curIndex:u=0,index:E,annotations2d:p})=>v?t.createElement(S,{title:l==null?void 0:l.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):n?t.createElement("div",{style:{display:"flex",alignItems:"center"}},t.createElement(X,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{c(!1),m(void 0)}}),t.createElement("span",null,l==null?void 0:l.calName),t.createElement("span",{style:{marginLeft:"8px"}},u+1,"/",p==null?void 0:p.length)):t.createElement(S,{title:l==null?void 0:l.calName,onClick:()=>{c(!0),m(E)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),le=({currentData:n,config:v,thumbnailWidth:l,isEnlargeTopView:c,highlightAttribute:m,loadPCDFileLoading:u,checkMode:E,measureVisible:p})=>{var h;const[a,N]=f([]),{topViewInstance:R,displayPointCloudList:k,polygonList:w,imageSizes:F,selectedIDs:b,windowKeydownListenerHook:x}=z(M),[L,A]=f(""),[d,V]=f(!1),[r,g]=f(void 0),y=$(e=>{V(e),G.emit("2d-image:enlarge",e)},[]),s=q();j(()=>{var e;if(!u&&R&&(n==null?void 0:n.mappingImgList)&&((e=n==null?void 0:n.mappingImgList)==null?void 0:e.length)>0)return s.current&&s.current.terminate(),s.current=new ne,s.current.onmessage=o=>{var i;const O=o.data;N(O),(i=s.current)==null||i.terminate()},s.current.postMessage({currentData:n,displayPointCloudList:k,selectedID:L,highlightAttribute:m,imageSizes:F,config:v,polygonList:w,selectedIDs:b}),()=>{var o;(o=s.current)==null||o.terminate()}},[k,n==null?void 0:n.mappingImgList,L,m,u,w,F,b]);const T=oe(e=>{if(!d)return;const o=()=>{e.stopImmediatePropagation()};switch(e.keyCode){case C.Esc:{y(!1);break}case C.Left:{I();break}case C.Right:{P();break}}o()}),I=()=>{r===void 0||!d||Number(r)>0&&g(r-1)},P=()=>{r===void 0||!d||Number(r)<(a==null?void 0:a.length)-1&&g(r+1)};j(()=>{const e=i=>T.current(i);return x.preappendEventListener(e)},[x,x.preappendEventListener]);const B=!n||!(n==null?void 0:n.mappingImgList)||!(((h=n==null?void 0:n.mappingImgList)==null?void 0:h.length)>0),K=t.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},t.createElement("img",{src:ee,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>I()}),t.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),t.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),t.createElement("img",{src:te,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>P()}),t.createElement("img",{src:Z,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{y(!1),g(void 0)}}),t.createElement("span",null,"\u952E\u9000\u51FA"));return(a==null?void 0:a.length)>0?t.createElement(t.Fragment,null,a.map((e,o)=>{const i=d&&o===r;return t.createElement(D,{className:Y({[_("point-cloud-2d-container")]:!0,[_("point-cloud-container","zoom")]:i}),title:t.createElement(ie,{showEnlarge:i,isEnlargeTopView:c,data:e,setIsEnlarge:y,setCurIndex:g,curIndex:r,index:o,annotations2d:a}),titleOnSurface:!i,style:{display:B?"none":"flex",width:i?"100%":l},key:o,toolbar:K},(e==null?void 0:e.annotations)&&(e==null?void 0:e.url)&&t.createElement(U,{key:e.url,currentData:n,view2dData:e,setSelectedID:A,showEnlarge:i,checkMode:E,measureVisible:p}))})):null};var re=W(Q,null,null,{context:J})(le);export{re as default};
1
+ import{getClassName as _}from"../../utils/dom.js";import t,{useState as f,useContext as $,useCallback as q,useRef as D,useEffect as j}from"react";import{PointCloudContainer as M}from"./PointCloudLayout.js";import{PointCloudContext as W}from"./PointCloudContext.js";import{connect as H}from"react-redux";import{cKeyCode as G,EventBus as J}from"@labelbee/lb-annotation";import{LabelBeeContext as Q}from"../../store/ctx.js";import{a2MapStateToProps as U}from"../../store/annotation/map.js";import X from"./PointCloud2DSingleView.js";import S from"./components/TitleButton/index.js";import{LeftOutlined as Y}from"@ant-design/icons";import Z from"classnames";import ee from"../../assets/annotation/common/icon_esc.svg.js";import te from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import ne from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import oe from"../../_virtual/2DViewWorker.js";import{useLatest as ie}from"ahooks";const C=G.default,le=({showEnlarge:n,isEnlargeTopView:v,data:l,setIsEnlarge:u,setCurIndex:m,curIndex:c=0,index:E,annotations2d:p})=>v?t.createElement(S,{title:l==null?void 0:l.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):n?t.createElement("div",{style:{display:"flex",alignItems:"center"}},t.createElement(Y,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{u(!1),m(void 0)}}),t.createElement("span",null,l==null?void 0:l.calName),t.createElement("span",{style:{marginLeft:"8px"}},c+1,"/",p==null?void 0:p.length)):t.createElement(S,{title:l==null?void 0:l.calName,onClick:()=>{u(!0),m(E)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),se=({currentData:n,config:v,thumbnailWidth:l,isEnlargeTopView:u,highlightAttribute:m,loadPCDFileLoading:c,checkMode:E,measureVisible:p})=>{var h;const[a,N]=f([]),{topViewInstance:R,displayPointCloudList:k,polygonList:w,imageSizes:F,selectedIDs:L,windowKeydownListenerHook:x,setIsLargeStatus:A}=$(W),[b,V]=f(""),[d,T]=f(!1),[s,g]=f(void 0),y=q(e=>{A(e),T(e),J.emit("2d-image:enlarge",e)},[]),r=D();j(()=>{var e;if(!c&&R&&(n==null?void 0:n.mappingImgList)&&((e=n==null?void 0:n.mappingImgList)==null?void 0:e.length)>0)return r.current&&r.current.terminate(),r.current=new oe,r.current.onmessage=o=>{var i;const z=o.data;N(z),(i=r.current)==null||i.terminate()},r.current.postMessage({currentData:n,displayPointCloudList:k,selectedID:b,highlightAttribute:m,imageSizes:F,config:v,polygonList:w,selectedIDs:L}),()=>{var o;(o=r.current)==null||o.terminate()}},[k,n==null?void 0:n.mappingImgList,b,m,c,w,F,L]);const B=ie(e=>{if(!d)return;const o=()=>{e.stopImmediatePropagation()};switch(e.keyCode){case C.Esc:{y(!1);break}case C.Left:{I();break}case C.Right:{P();break}}o()}),I=()=>{s===void 0||!d||Number(s)>0&&g(s-1)},P=()=>{s===void 0||!d||Number(s)<(a==null?void 0:a.length)-1&&g(s+1)};j(()=>{const e=i=>B.current(i);return x.preappendEventListener(e)},[x,x.preappendEventListener]);const K=!n||!(n==null?void 0:n.mappingImgList)||!(((h=n==null?void 0:n.mappingImgList)==null?void 0:h.length)>0),O=t.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},t.createElement("img",{src:te,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>I()}),t.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),t.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),t.createElement("img",{src:ne,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>P()}),t.createElement("img",{src:ee,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{y(!1),g(void 0)}}),t.createElement("span",null,"\u952E\u9000\u51FA"));return(a==null?void 0:a.length)>0?t.createElement(t.Fragment,null,a.map((e,o)=>{const i=d&&o===s;return t.createElement(M,{className:Z({[_("point-cloud-2d-container")]:!0,[_("point-cloud-container","zoom")]:i}),title:t.createElement(le,{showEnlarge:i,isEnlargeTopView:u,data:e,setIsEnlarge:y,setCurIndex:g,curIndex:s,index:o,annotations2d:a}),titleOnSurface:!i,style:{display:K?"none":"flex",width:i?"100%":l},key:o,toolbar:O},(e==null?void 0:e.annotations)&&(e==null?void 0:e.url)&&t.createElement(X,{key:e.url,currentData:n,view2dData:e,setSelectedID:V,showEnlarge:i,checkMode:E,measureVisible:p}))})):null};var re=H(U,null,null,{context:Q})(se);export{re as default};
@@ -1 +1 @@
1
- import{getClassName as d}from"../../utils/dom.js";import{cKeyCode as Q,PointCloud as W}from"@labelbee/lb-annotation";import{PointCloudUtils as T,toolStyleConverter as X,EPerspectiveView as h}from"@labelbee/lb-utils";import k from"classnames";import o,{useContext as b,useState as y,useRef as Y,useEffect as u,useMemo as $}from"react";import{PointCloudContainer as ee}from"./PointCloudLayout.js";import{PointCloudContext as te}from"./PointCloudContext.js";import{a2MapStateToProps as oe}from"../../store/annotation/map.js";import{connect as ne}from"react-redux";import{jsonParser as ie}from"../../utils/index.js";import{useSingleBox as le}from"./hooks/useSingleBox.js";import{useSphere as re}from"./hooks/useSphere.js";import{Switch as ae,Tooltip as se}from"antd";import ce from"../../hooks/useSize.js";import{usePointCloudViews as de}from"./hooks/usePointCloudViews.js";import{useTranslation as R}from"react-i18next";import{LabelBeeContext as me}from"../../store/ctx.js";import ue from"./components/PointCloudSizeSlider/index.js";import pe from"./components/TitleButton/index.js";import{LeftOutlined as ve}from"@ant-design/icons";import{useToolStyleContext as we}from"../../hooks/useToolStyle.js";var fe=Object.defineProperty,Ce=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,ge=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,A=(n,l,r)=>l in n?fe(n,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[l]=r,H=(n,l)=>{for(var r in l||(l={}))ge.call(l,r)&&A(n,r,l[r]);if(F)for(var r of F(l))Pe.call(l,r)&&A(n,r,l[r]);return n},_e=(n,l)=>Ce(n,Ve(l));const he=Q.default,Ee="LABELBEE-POINTCLOUD",E=o.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),v=({perspectiveView:n})=>{const{isActive:l,setTarget3DView:r}=b(E),w=e=>k({[d("point-cloud-3d-view",e)]:!0,active:l});return o.createElement("span",{onClick:()=>{r(h[n])},className:w(n.toLocaleLowerCase())})},U=({isEnlarge:n})=>{const{reset3DView:l,followTopView:r}=b(E),{t:w}=R(),e=o.createElement(o.Fragment,null,o.createElement(v,{perspectiveView:"Top"}),o.createElement(v,{perspectiveView:"Front"}),o.createElement(v,{perspectiveView:"Left"}),o.createElement(v,{perspectiveView:"Back"}),o.createElement(v,{perspectiveView:"Right"}),o.createElement(v,{perspectiveView:"LFT"}),o.createElement(v,{perspectiveView:"RBT"})),g=o.createElement(o.Fragment,null,o.createElement(se,{title:w("CameraFollowTopView")},o.createElement("span",{onClick:()=>{r()},className:d("point-cloud-3d-view","followTop")})),o.createElement("span",{onClick:()=>{l()},className:d("point-cloud-3d-view","reset")}));return n?o.createElement("div",{className:d("point-cloud-3d-sidebarZoom")},g,e):o.createElement("div",{className:d("point-cloud-3d-sidebar")},e,g)},Ie=({currentData:n,config:l,highlightAttribute:r})=>{var w;const e=b(te),[g,K]=y(!0),[f,I]=y(!1),C=Y(null),{initPointCloud3d:B}=de(),V=ce(C),{t:x}=R(),{value:L}=we(),{hiddenText:j}=L||{};u(()=>{let t=e.mainViewInstance;t&&t.updateHiddenTextAndRender(j,e.pointCloudBoxList)},[L]),u(()=>{!e.mainViewInstance||B==null||B(V)},[V]);const{selectedBox:m}=le(),{selectedSphere:P}=re(),[M,O]=y(!0),S=t=>{var i,a;const s=m==null?void 0:m.info;if(s){const c=H({},s.center);c.x=c.x-.01,c.z=1e3;const p=t===h.Top;(i=e.mainViewInstance)==null||i.updateCameraByBox(s,t,p?c:void 0)}P&&((a=e.mainViewInstance)==null||a.updateCameraBySphere(P,t))},Z=()=>{var t;(t=e.mainViewInstance)==null||t.resetCamera()},q=()=>{var t,i;const a=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance.camera;a&&((i=e.mainViewInstance)==null||i.applyCameraTarget(a))};u(()=>{if(C.current&&(n==null?void 0:n.url)){let t=e.mainViewInstance;!t&&V.width&&(t=new W({container:C.current,isOrthographicCamera:!0,orthographicParams:T.getDefaultOrthographicParams(V),config:l,hiddenText:j}),t.setHandlerPipe({setSelectedIDs:e.setSelectedIDs,setNeedUpdateCenter:O}),e.setMainViewInstance(t))}},[V,n]),u(()=>{var t;if(C.current&&(n==null?void 0:n.url)&&n.result&&e.mainViewInstance){let i=e.mainViewInstance;const a=T.getBoxParamsFromResultList(n.result);a.forEach(c=>{var p;const _=(p=X.getColorFromConfig({attribute:c.attribute},_e(H({},l),{attributeConfigurable:!0}),{}))==null?void 0:p.hex;i==null||i.addBoxToSense(c,_)}),i.render(),e.setPointCloudResult(a);const s=T.getRectParamsFromResultList(n.result);e.setRectList(s),e.setPointCloudValid((t=ie(n.result))==null?void 0:t.valid)}},[n,e.mainViewInstance]),u(()=>{var t,i,a,s,c,p,_;const N=(t=m==null?void 0:m.info)==null?void 0:t.id;if(!M){O(!0);return}if(N!==void 0){S(h.Top);const J=(s=(a=(i=e.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?s:1;(c=e.mainViewInstance)==null||c.updateCameraZoom(J)}(p=e.mainViewInstance)==null||p.setHighlightColor(N),(_=e.mainViewInstance)==null||_.render()},[(w=m==null?void 0:m.info)==null?void 0:w.id]),u(()=>{var t,i,a,s;if(P){S(h.Top);const c=(a=(i=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?a:1;(s=e.mainViewInstance)==null||s.updateCameraZoom(c)}},[P]),u(()=>(window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D)}),[]);const D=t=>{if(t.keyCode===he.Esc){I(!1);return}},z=$(()=>({reset3DView:Z,setTarget3DView:S,isActive:!!m,followTopView:q}),[m,e.mainViewInstance]);u(()=>{var t,i,a;const s=e.pointCloudBoxList.filter(c=>c.attribute===r);(s==null?void 0:s.length)>0&&((t=e.mainViewInstance)==null||t.clearHighlightBoxes(),(i=e.mainViewInstance)==null||i.highlightBoxes(s)),s.length===0&&((a=e.mainViewInstance)==null||a.clearHighlightBoxesAndRender())},[r,e.mainViewInstance]);const G=o.createElement(o.Fragment,null,o.createElement(ue,{onChange:t=>{var i;(i=e.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),o.createElement("span",{style:{marginRight:8}},x("ShowArrows")),o.createElement(ae,{size:"small",checked:g,onChange:t=>{var i;K(t),(i=e.mainViewInstance)==null||i.setShowDirection(t)}}),f&&o.createElement(E.Provider,{value:z},o.createElement(U,{isEnlarge:f})));return o.createElement(ee,{className:k({[d("point-cloud-3d-container")]:!0,[d("point-cloud-container","zoom")]:f}),title:f?o.createElement("div",{style:{display:"flex",alignItems:"center"}},o.createElement(ve,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{I(!1)}}),x("3DView")):o.createElement(pe,{title:x("3DView"),onClick:()=>{I(!0)}}),toolbar:G},o.createElement("div",{className:d("point-cloud-3d-content")},!f&&o.createElement(E.Provider,{value:z},o.createElement(U,null)),o.createElement("div",{className:d("point-cloud-3d-view"),id:Ee,ref:C})))};var xe=ne(oe,null,null,{context:me})(Ie);export{xe as default};
1
+ import{getClassName as u}from"../../utils/dom.js";import{cKeyCode as ee,PointCloud as te}from"@labelbee/lb-annotation";import{PointCloudUtils as T,EPerspectiveView as E}from"@labelbee/lb-utils";import O from"classnames";import o,{useContext as b,useState as y,useRef as oe,useEffect as p,useMemo as ne}from"react";import{PointCloudContainer as ie}from"./PointCloudLayout.js";import{PointCloudContext as le}from"./PointCloudContext.js";import{a2MapStateToProps as se}from"../../store/annotation/map.js";import{connect as re}from"react-redux";import{jsonParser as ae}from"../../utils/index.js";import{useSingleBox as A}from"./hooks/useSingleBox.js";import{useSphere as ce}from"./hooks/useSphere.js";import{Switch as de,Tooltip as ue}from"antd";import me from"../../hooks/useSize.js";import{usePointCloudViews as pe}from"./hooks/usePointCloudViews.js";import{useTranslation as F}from"react-i18next";import{LabelBeeContext as we}from"../../store/ctx.js";import ve from"./components/PointCloudSizeSlider/index.js";import fe from"./components/TitleButton/index.js";import{LeftOutlined as Ce}from"@ant-design/icons";import{useToolStyleContext as Ve}from"../../hooks/useToolStyle.js";import{usePointCloudAttribute as ge}from"./hooks/usePointCloudAttribute.js";var Ie=Object.defineProperty,H=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,U=(n,l,s)=>l in n?Ie(n,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[l]=s,he=(n,l)=>{for(var s in l||(l={}))Pe.call(l,s)&&U(n,s,l[s]);if(H)for(var s of H(l))Ee.call(l,s)&&U(n,s,l[s]);return n};const xe=ee.default,_e="LABELBEE-POINTCLOUD",h=o.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),v=({perspectiveView:n})=>{const{isActive:l,setTarget3DView:s}=b(h),f=w=>O({[u("point-cloud-3d-view",w)]:!0,active:l});return o.createElement("span",{onClick:()=>{s(E[n])},className:f(n.toLocaleLowerCase())})},K=({isEnlarge:n})=>{const{reset3DView:l,followTopView:s}=b(h),{t:f}=F(),w=o.createElement(o.Fragment,null,o.createElement(v,{perspectiveView:"Top"}),o.createElement(v,{perspectiveView:"Front"}),o.createElement(v,{perspectiveView:"Left"}),o.createElement(v,{perspectiveView:"Back"}),o.createElement(v,{perspectiveView:"Right"}),o.createElement(v,{perspectiveView:"LFT"}),o.createElement(v,{perspectiveView:"RBT"})),e=o.createElement(o.Fragment,null,o.createElement(ue,{title:f("CameraFollowTopView")},o.createElement("span",{onClick:()=>{s()},className:u("point-cloud-3d-view","followTop")})),o.createElement("span",{onClick:()=>{l()},className:u("point-cloud-3d-view","reset")}));return n?o.createElement("div",{className:u("point-cloud-3d-sidebarZoom")},e,w):o.createElement("div",{className:u("point-cloud-3d-sidebar")},w,e)},Se=({currentData:n,config:l,highlightAttribute:s,setResourceLoading:f})=>{var w;const e=b(le),{setIsLargeStatus:B}=e,[M,Z]=y(!0),[C,x]=y(!1),V=oe(null),{initPointCloud3d:L,generateRects:q}=pe(),g=me(V),{t:_}=F(),{value:j}=Ve(),{hiddenText:D}=j||{},{updatePointCloudAttribute:G}=ge(f,l),{updateSelectedBox:J}=A({generateRects:q});p(()=>{let t=e.mainViewInstance;t&&t.updateHiddenTextAndRender(D,e.pointCloudBoxList)},[j]),p(()=>{!e.mainViewInstance||L==null||L(g)},[g]);const{selectedBox:m}=A(),{selectedSphere:I}=ce(),[Q,z]=y(!0),S=t=>{var i,r;const a=m==null?void 0:m.info;if(a){const c=he({},a.center);c.x=c.x-.01,c.z=1e3;const d=t===E.Top;(i=e.mainViewInstance)==null||i.updateCameraByBox(a,t,d?c:void 0)}I&&((r=e.mainViewInstance)==null||r.updateCameraBySphere(I,t))},W=()=>{var t;(t=e.mainViewInstance)==null||t.resetCamera()},X=()=>{var t,i;const r=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance.camera;r&&((i=e.mainViewInstance)==null||i.applyCameraTarget(r))};p(()=>{if(V.current&&(n==null?void 0:n.url)){let t=e.mainViewInstance;!t&&g.width&&(t=new te({container:V.current,isOrthographicCamera:!0,orthographicParams:T.getDefaultOrthographicParams(g),config:l,hiddenText:D,view:"3DView"}),t.setHandlerPipe({setSelectedIDs:e.setSelectedIDs,setNeedUpdateCenter:z}),e.setMainViewInstance(t))}},[g,n]),p(()=>{var t,i;if(V.current&&(n==null?void 0:n.url)&&n.result&&e.mainViewInstance){let r=e.mainViewInstance;const a=T.getRectParamsFromResultList(n.result),c=T.getBoxParamsFromResultList(n.result),d=c.find(P=>P.id===e.selectedID);d&&((t=e.topViewInstance)==null||t.updatePolygonList(c,void 0),G(d.attribute),J(d),e.setSelectedIDs(d.id)),e.setPointCloudValid((i=ae(n.result))==null?void 0:i.valid),e.setPointCloudResult(c),e.setRectList(a),r.generateBoxes(c)}},[n.result,e.mainViewInstance]),p(()=>{var t,i,r,a,c,d,P;const R=(t=m==null?void 0:m.info)==null?void 0:t.id;if(!Q){z(!0);return}if(R!==void 0){S(E.Top);const $=(a=(r=(i=e.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:r.camera.zoom)!=null?a:1;(c=e.mainViewInstance)==null||c.updateCameraZoom($)}(d=e.mainViewInstance)==null||d.setHighlightColor(R),(P=e.mainViewInstance)==null||P.render()},[(w=m==null?void 0:m.info)==null?void 0:w.id]),p(()=>{var t,i,r,a;if(I){S(E.Top);const c=(r=(i=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?r:1;(a=e.mainViewInstance)==null||a.updateCameraZoom(c)}},[I]),p(()=>(window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}),[]);const k=t=>{if(t.keyCode===xe.Esc){x(!1);return}},N=ne(()=>({reset3DView:W,setTarget3DView:S,isActive:!!m,followTopView:X}),[m,e.mainViewInstance]);p(()=>{var t,i,r;const a=e.pointCloudBoxList.filter(c=>c.attribute===s);(a==null?void 0:a.length)>0&&((t=e.mainViewInstance)==null||t.clearHighlightBoxes(),(i=e.mainViewInstance)==null||i.highlightBoxes(a)),a.length===0&&((r=e.mainViewInstance)==null||r.clearHighlightBoxesAndRender())},[s,e.mainViewInstance]);const Y=o.createElement(o.Fragment,null,o.createElement(ve,{onChange:t=>{var i;(i=e.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),o.createElement("span",{style:{marginRight:8}},_("ShowArrows")),o.createElement(de,{size:"small",checked:M,onChange:t=>{var i;Z(t),(i=e.mainViewInstance)==null||i.setShowDirection(t)}}),C&&o.createElement(h.Provider,{value:N},o.createElement(K,{isEnlarge:C})));return o.createElement(ie,{className:O({[u("point-cloud-3d-container")]:!0,[u("point-cloud-container","zoom")]:C}),title:C?o.createElement("div",{style:{display:"flex",alignItems:"center"}},o.createElement(Ce,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{B(!1),x(!1)}}),_("3DView")):o.createElement(fe,{title:_("3DView"),onClick:()=>{B(!0),x(!0)}}),toolbar:Y},o.createElement("div",{className:u("point-cloud-3d-content")},!C&&o.createElement(h.Provider,{value:N},o.createElement(K,null)),o.createElement("div",{className:u("point-cloud-3d-view"),id:_e,ref:V})))};var Te=re(se,null,null,{context:we})(Se);export{Te as default};
@@ -1 +1 @@
1
- import{EPointCloudPattern as Y}from"@labelbee/lb-utils";import Ne,{useState as r,useRef as dt,useMemo as F,useCallback as N,useEffect as $}from"react";import{EPointCloudBoxRenderTrigger as E,calcResetAreasAndBoxIds as ct}from"../../utils/ToolPointCloudBoxRenderHelper.js";import{ActionsHistory as He,EToolName as ee,uuid as ut}from"@labelbee/lb-annotation";import{useDispatch as gt}from"../../store/ctx.js";import{ChangeSave as pt}from"../../store/annotation/actionCreators.js";import ft from"../../store/annotatedBox/index.js";import Oe from"lodash";import{addMapIndirectWeakSetItem as Me}from"./utils/map.js";import mt from"./hooks/useTimeoutFunc.js";import ht,{getEmptyUseWindowKeydownListener as It}from"./hooks/useWindowKeydownListener.js";var vt=Object.defineProperty,Pt=Object.defineProperties,wt=Object.getOwnPropertyDescriptors,je=Object.getOwnPropertySymbols,yt=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,ke=(d,i,c)=>i in d?vt(d,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[i]=c,z=(d,i)=>{for(var c in i||(i={}))yt.call(i,c)&&ke(d,c,i[c]);if(je)for(var c of je(i))Ct.call(i,c)&&ke(d,c,i[c]);return d},Fe=(d,i)=>Pt(d,wt(i)),Rt=(d,i,c)=>new Promise((x,A)=>{var B=g=>{try{w(c.next(g))}catch(L){A(L)}},K=g=>{try{w(c.throw(g))}catch(L){A(L)}},w=g=>g.done?x(g.value):Promise.resolve(g.value).then(B,K);w((c=c.apply(d,i)).next())});const G=d=>Oe.pick(d,["id","attribute","width","height","x","y","imageName"]),Ee=Ne.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 He,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:ee.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:Y.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:d=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:d=>!1,removeRectBySpecifyId:(d,i,c)=>!1,removeRectByPointCloudBoxId:d=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:It()}),St=({children:d})=>{const[i,c]=r([]),[x,A]=r([]),[B,K]=r([]),[w,g]=r([]),[L,ze]=r([]),[v,H]=r([]),[_,T]=r([]),[te,Ge]=r(!0),[oe,Ke]=r(2),[ne,Te]=r(!0),[ie,We]=r(1),[f,se]=r(),[re,le]=r(),[ae,de]=r(),[p,ce]=r(),[ue,Ze]=r(""),[W,Ue]=r(ee.Rect),Z=dt(new He).current,[m,U]=r([]),[ge,qe]=r(""),[q,Je]=r(Y.Detection),[D,pe]=r(void 0),[J,Qe]=r([]),[Q,Xe]=r([]),[fe,Ye]=r(!1),h=ft(),[me,$e]=r({}),et=gt(),tt=o=>{const{imgNode:n,path:t}=o;t&&n&&$e(a=>Fe(z({},a),{[t]:{width:n.width,height:n.height}}))},he=F(()=>v.length===1?v[0]:"",[v]),Ie=ht(),O=N((o,n,t="extId")=>{const a=t||"id",l=new Set(n);return g(u=>{let y=!1;const P=u.filter(j=>{const X=j[a],k=l.has(X)?j.imageName!==o:!0;return k||(y=!0),k});return y?P:u}),!0},[]),ve=N(o=>{const n=i.map(t=>t.id);return O(o,n,"extId")},[i,O]),Pe=N(o=>{if(!o)return!1;const n=i.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:a,attribute:l,trackID:u}=t,y=t.rects.find(P=>P.imageName===o);if(y){const P=Oe.pick(y,["width","height","x","y","imageName"]);return Fe(z({},P),{id:ut(),attribute:l,order:u,extId:a,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(g(t=>{const a=new Set(t.filter(u=>o===u.imageName).map(u=>u.extId)),l=n.filter(u=>a.has(u.extId)===!1);return l.length?[...t,...l]:t}),!0):!1},[i]),we=F(()=>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:u}=l;if(!u){console.warn("Missing image name"),console.trace(l,t);return}Me(n,u,t.id,t)}),n},new Map),[i]),ye=N(o=>{g(n=>o(n,G))},[G]),Ce=F(()=>w.filter(o=>o.extId!==void 0&&o.id!==void 0).reduce((o,n)=>{const t=n.imageName;return t?(Me(o,t,n.extId,n),o):(console.warn("missing image name"),console.log(n,w),o)},new Map),[w]),{fn:ot}=mt(o=>{H(n=>{const t=o,a=new Set(t);let l=!1;const u=n.filter(y=>{const P=a.has(y);return P||(l=!0),P});return l?u:n})},200),Re=N(o=>{const n=o.map(t=>t.id);c(o),ot(n)},[]),M=F(()=>{const o=i.find(e=>e.id===he),n=e=>{const s=i.concat(e);return Re(s),s},t=e=>{const s=x.concat(e);return A(s),s},a=e=>{Ge(e!==!1)},l=e=>{e===void 0&&H([]),typeof e=="string"&&H([e]),Array.isArray(e)&&H(Array.from(new Set(e)))},u=e=>{v.includes(e)?l(v.filter(s=>s!==e)):l([...v,e])},y=e=>{const s=G(e);g(I=>[...I,s])},P=(e,s=!1)=>{const I=G(e);g(C=>C.map(R=>R.id===e.id?s?z(z({},R),I):I:R))},j=e=>{g(s=>s.filter(I=>!e.find(C=>C.id===I.id)))},X=e=>{_.includes(e)?T([]):T([e])},k=()=>{if(W===ee.Rect){const e=i.map(s=>s.id);l(e),f==null||f.pointCloud2dOperation.setSelectedIDs(e)}},it=e=>{l(i.filter(s=>s.attribute===e).map(s=>s.id))},Se=i.filter(e=>!m.includes(e.attribute)),be=x.filter(e=>!m.includes(e.attribute)),Le=L.filter(e=>e.attribute&&!m.includes(e.attribute)),st=e=>{if(m.includes(e))U(m.filter(s=>s!==e));else{const s=m.concat(e);U(s)}},rt=(e=Se,s=B,I=be,C=Le,R=J)=>{var V;p==null||p.clearAllBox(),p==null||p.clearAllSphere(),f==null||f.updatePolygonList(e,s),f==null||f.updatePointList(I),f==null||f.updateLineList(C),p==null||p.generateBoxes(e),p==null||p.generateSpheres(I),(V=D==null?void 0:D.store)==null||V.updateCurrentSegment(R),xe(E.Default,e)},lt=()=>{se(void 0),le(void 0),de(void 0),ce(void 0)},xe=(e,s,I)=>Rt(void 0,null,function*(){var C,R,V;if(!p)return;const De=p.pointCloudObject;if(!De)return;let Ae=[],Be=[];try{if(s&&Z.record.length){const{record:S,recordIndex:b}=Z;let _e=b;b>0&&(e===E.SingleToggleValid||e===E.SingleRotate||e===E.Single&&s.length===((C=S[b])==null?void 0:C.pointCloudBoxList.length))&&(_e=b-1);let at=(R=S[_e])==null?void 0:R.pointCloudBoxList;const Ve=ct(e,s,at);Ae=Ve.modifiedBoxIds,Be=Ve.resetAreas}}catch(S){console.error("call calcResetAreasAndBoxIds error",S)}try{const S=yield p.getHighlightIndexByMappingImgList({mappingImgList:I!=null?I:Q,points:De.geometry.attributes.position.array}),b=yield p==null?void 0:p.highlightOriginPointCloud(s,S,{modifiedBoxIds:Ae,resetAreas:Be});return b&&((V=f==null?void 0:f.pointCloudInstance)==null||V.updateColor(b)),b}catch(S){console.error("call highlightOriginPointCloud error",S)}});return{selectedID:he,pointCloudBoxList:i,pointCloudSphereList:x,displayPointCloudList:Se,displaySphereList:be,displayLineList:Le,selectedIDs:v,setPointCloudResult:Re,setSelectedIDs:l,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:A,valid:te,selectedPointCloudBox:o,setPointCloudValid:a,addSelectedID:u,addHighlightID:X,selectedAllBoxes:k,topViewInstance:f,setTopViewInstance:se,sideViewInstance:re,setSideViewInstance:le,backViewInstance:ae,setBackViewInstance:de,mainViewInstance:p,setMainViewInstance:ce,polygonList:B,setPolygonList:K,rectList:w,setRectList:g,addRectIn2DView:y,removeRectIn2DView:j,updateRectIn2DView:P,lineList:L,setLineList:ze,zoom:ie,setZoom:We,history:Z,toggleAttributesVisible:st,hideAttributes:m,setHideAttributes:U,reRender:rt,attrPanelLayout:ge,setAttrPanelLayout:qe,syncAllViewPointCloudColor:xe,defaultAttribute:ue,setDefaultAttribute:Ze,pointCloudPattern:W,setPointCloudPattern:Ue,selectSpecAttr:it,globalPattern:q,setGlobalPattern:e=>{q!==e&&(et(pt),Je(e),e===Y.Detection&&pe(void 0))},ptSegmentInstance:D,setPtSegmentInstance:pe,segmentation:J,setSegmentation:Qe,clearAllDetectionInstance:lt,highlight2DDataList:Q,setHighlight2DDataList:Xe,highlight2DLoading:fe,setHighlight2DLoading:Ye,cuboidBoxIn2DView:ne,setCuboidBoxIn2DView:Te,imageSizes:me,cacheImageNodeSize:tt,highlightIDs:_,setHighlightIDs:T,removeRectByPointCloudBoxId:ve,removeRectBySpecifyId:O,addRectFromPointCloudBoxByImageName:Pe,rectRotateSensitivity:oe,setRectRotateSensitivity:Ke,imageNamePointCloudBoxMap:we,linkageImageNameRectMap:Ce,updateRectListByReducer:ye,windowKeydownListenerHook:Ie}},[te,v,i,x,B,L,w,f,re,ae,p,ie,m,ge,ue,W,q,D,J,Q,fe,ne,me,_,ve,O,Pe,oe,we,Ce,ye,Ie]);$(()=>{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,_),(t=h==null?void 0:h.setSelectedIDs)==null||t.call(h,v)},[i,v,_]),$(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,M)},[M]);const nt=()=>{const o=i.filter(l=>m.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 $(()=>{var o,n,t,a;nt(),(n=(o=f==null?void 0:f.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,m),(a=(t=D==null?void 0:D.store)==null?void 0:t.setHiddenAttributes)==null||a.call(t,m)},[m]),Ne.createElement(Ee.Provider,{value:M},d)};export{Ee as PointCloudContext,St as PointCloudProvider};
1
+ import{EPointCloudPattern as $}from"@labelbee/lb-utils";import je,{useState as r,useRef as pt,useMemo as F,useCallback as H,useEffect as ee}from"react";import{EPointCloudBoxRenderTrigger as E,calcResetAreasAndBoxIds as mt}from"../../utils/ToolPointCloudBoxRenderHelper.js";import{ActionsHistory as ke,EToolName as te,uuid as ht}from"@labelbee/lb-annotation";import{useDispatch as It}from"../../store/ctx.js";import{ChangeSave as vt}from"../../store/annotation/actionCreators.js";import Pt from"../../store/annotatedBox/index.js";import Fe from"lodash";import{addMapIndirectWeakSetItem as Ee}from"./utils/map.js";import wt from"./hooks/useTimeoutFunc.js";import St,{getEmptyUseWindowKeydownListener as yt}from"./hooks/useWindowKeydownListener.js";var Ct=Object.defineProperty,Lt=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,ze=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable,Ge=(c,s,u)=>s in c?Ct(c,s,{enumerable:!0,configurable:!0,writable:!0,value:u}):c[s]=u,z=(c,s)=>{for(var u in s||(s={}))Rt.call(s,u)&&Ge(c,u,s[u]);if(ze)for(var u of ze(s))xt.call(s,u)&&Ge(c,u,s[u]);return c},Ke=(c,s)=>Lt(c,bt(s)),Dt=(c,s,u)=>new Promise((x,A)=>{var V=g=>{try{w(u.next(g))}catch(b){A(b)}},K=g=>{try{w(u.throw(g))}catch(b){A(b)}},w=g=>g.done?x(g.value):Promise.resolve(g.value).then(V,K);w((u=u.apply(c,s)).next())});const G=c=>Fe.pick(c,["id","attribute","width","height","x","y","imageName"]),Te=je.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 ke,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:te.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:$.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:c=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:c=>!1,removeRectBySpecifyId:(c,s,u)=>!1,removeRectByPointCloudBoxId:c=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:yt(),isLargeStatus:!1,setIsLargeStatus:()=>{}}),Bt=({children:c})=>{const[s,u]=r([]),[x,A]=r([]),[V,K]=r([]),[w,g]=r([]),[b,We]=r([]),[v,oe]=r([]),[_,T]=r([]),[ne,Ze]=r(!0),[ie,Ue]=r(2),[se,qe]=r(!0),[re,Je]=r(1),[p,le]=r(),[ae,de]=r(),[ce,ue]=r(),[f,ge]=r(),[fe,Qe]=r(""),[W,Xe]=r(te.Rect),Z=pt(new ke).current,[m,U]=r([]),[pe,Ye]=r(""),[q,$e]=r($.Detection),[D,me]=r(void 0),[J,et]=r([]),[Q,tt]=r([]),[he,ot]=r(!1),[Ie,ve]=r(!1),h=Pt(),[Pe,nt]=r(!1),[we,it]=r({}),st=It(),rt=o=>{const{imgNode:n,path:t}=o;t&&n&&it(a=>Ke(z({},a),{[t]:{width:n.width,height:n.height}}))},Se=F(()=>v.length===1?v[0]:"",[v]),ye=St(),O=H((o,n,t="extId")=>{const a=t||"id",d=new Set(n);return g(l=>{let S=!1;const P=l.filter(j=>{const X=j[a],k=d.has(X)?j.imageName!==o:!0;return k||(S=!0),k});return S?P:l}),!0},[]),Ce=H(o=>{const n=s.map(t=>t.id);return O(o,n,"extId")},[s,O]),Le=H(o=>{if(!o)return!1;const n=s.filter(t=>Array.isArray(t.rects)).map(t=>{const{id:a,attribute:d,trackID:l}=t,S=t.rects.find(P=>P.imageName===o);if(S){const P=Fe.pick(S,["width","height","x","y","imageName"]);return Ke(z({},P),{id:ht(),attribute:d,order:l,extId:a,lineDash:[]})}return null}).filter(t=>t!==null);return n.length?(g(t=>{const a=new Set(t.filter(l=>o===l.imageName).map(l=>l.extId)),d=n.filter(l=>a.has(l.extId)===!1);return d.length?[...t,...d]:t}),!0):!1},[s]),be=F(()=>s.filter(n=>Array.isArray(n.rects)&&n.rects.length>0).reduce((n,t)=>{var a;return(a=t.rects)==null||a.forEach(d=>{const{imageName:l}=d;if(!l){console.warn("Missing image name"),console.trace(d,t);return}Ee(n,l,t.id,t)}),n},new Map),[s]),Re=H(o=>{g(n=>o(n,G))},[G]),xe=F(()=>w.filter(o=>o.extId!==void 0&&o.id!==void 0).reduce((o,n)=>{const t=n.imageName;return t?(Ee(o,t,n.extId,n),o):(console.warn("missing image name"),console.log(n,w),o)},new Map),[w]),{fn:lt}=wt(o=>{oe(n=>{const t=o,a=new Set(t);let d=!1;const l=n.filter(S=>{const P=a.has(S);return P||(d=!0),P});return d?l:n})},200),De=H(o=>{const n=o.map(t=>t.id);u(o),lt(n)},[]),M=F(()=>{const o=s.find(e=>e.id===Se),n=e=>{const i=s.concat(e);return De(i),i},t=e=>{const i=x.concat(e);return A(i),i},a=e=>{Ze(e!==!1)},d=e=>{nt(e)},l=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),oe(i)},S=e=>{v.includes(e)?l(v.filter(i=>i!==e)):l([...v,e])},P=e=>{const i=G(e);g(I=>[...I,i])},j=(e,i=!1)=>{const I=G(e);g(y=>y.map(C=>C.id===e.id?i?z(z({},C),I):I:C))},X=e=>{g(i=>i.filter(I=>!e.find(y=>y.id===I.id)))},k=e=>{_.includes(e)?T([]):T([e])},dt=()=>{if(W===te.Rect){const e=s.map(i=>i.id);l(e),p==null||p.pointCloud2dOperation.setSelectedIDs(e)}},ct=e=>{l(s.filter(i=>i.attribute===e).map(i=>i.id))},Be=s.filter(e=>!m.includes(e.attribute)),Ae=x.filter(e=>!m.includes(e.attribute)),Ve=b.filter(e=>e.attribute&&!m.includes(e.attribute)),ut=e=>{if(m.includes(e))U(m.filter(i=>i!==e));else{const i=m.concat(e);U(i)}},gt=(e=Be,i=V,I=Ae,y=Ve,C=J)=>{var N;f==null||f.clearAllBox(),f==null||f.clearAllSphere(),p==null||p.updatePolygonList(e,i),p==null||p.updatePointList(I),p==null||p.updateLineList(y),f==null||f.generateBoxes(e),f==null||f.generateSpheres(I),(N=D==null?void 0:D.store)==null||N.updateCurrentSegment(C),_e(E.Default,e)},ft=()=>{le(void 0),de(void 0),ue(void 0),ge(void 0)},_e=(e,i,I)=>Dt(void 0,null,function*(){var y,C,N;if(!f)return;const Ne=f.pointCloudObject;if(!Ne)return;let He=[],Oe=[];try{if(i&&Z.record.length){const{record:L,recordIndex:R}=Z;let B=R;R>0&&(e===E.SingleToggleValid||e===E.SingleRotate||e===E.Single&&i.length===((y=L[R])==null?void 0:y.pointCloudBoxList.length))&&(B=R-1);let Y=(C=L[B])==null?void 0:C.pointCloudBoxList;const Me=mt(e,i,Y);He=Me.modifiedBoxIds,Oe=Me.resetAreas}}catch(L){console.error("call calcResetAreasAndBoxIds error",L)}try{const L=yield f.getHighlightIndexByMappingImgList({mappingImgList:I!=null?I:Q,points:Ne.geometry.attributes.position.array}),R=yield f==null?void 0:f.highlightOriginPointCloud(i,L,{modifiedBoxIds:He,resetAreas:Oe}),{color:B,currentPCDSrc:Y}=R!=null?R:{};return B&&((N=p==null?void 0:p.pointCloudInstance)==null||N.updateColor(B,Y)),B}catch(L){console.error("call highlightOriginPointCloud error",L)}});return{selectedID:Se,pointCloudBoxList:s,pointCloudSphereList:x,displayPointCloudList:Be,displaySphereList:Ae,displayLineList:Ve,selectedIDs:v,setPointCloudResult:De,setSelectedIDs:l,addPointCloudBox:n,addPointCloudSphere:t,setPointCloudSphereList:A,valid:ne,visibleBatchSetValid:Pe,selectedPointCloudBox:o,setPointCloudValid:a,setBatchSetValidModal:d,addSelectedID:S,addHighlightID:k,selectedAllBoxes:dt,topViewInstance:p,setTopViewInstance:le,sideViewInstance:ae,setSideViewInstance:de,backViewInstance:ce,setBackViewInstance:ue,mainViewInstance:f,setMainViewInstance:ge,polygonList:V,setPolygonList:K,rectList:w,setRectList:g,addRectIn2DView:P,removeRectIn2DView:X,updateRectIn2DView:j,lineList:b,setLineList:We,zoom:re,setZoom:Je,history:Z,toggleAttributesVisible:ut,hideAttributes:m,setHideAttributes:U,reRender:gt,attrPanelLayout:pe,setAttrPanelLayout:Ye,syncAllViewPointCloudColor:_e,defaultAttribute:fe,setDefaultAttribute:Qe,pointCloudPattern:W,setPointCloudPattern:Xe,selectSpecAttr:ct,globalPattern:q,setGlobalPattern:e=>{q!==e&&(st(vt),$e(e),e===$.Detection&&me(void 0))},ptSegmentInstance:D,setPtSegmentInstance:me,segmentation:J,setSegmentation:et,clearAllDetectionInstance:ft,highlight2DDataList:Q,setHighlight2DDataList:tt,highlight2DLoading:he,setHighlight2DLoading:ot,cuboidBoxIn2DView:se,setCuboidBoxIn2DView:qe,imageSizes:we,cacheImageNodeSize:rt,highlightIDs:_,setHighlightIDs:T,removeRectByPointCloudBoxId:Ce,removeRectBySpecifyId:O,addRectFromPointCloudBoxByImageName:Le,rectRotateSensitivity:ie,setRectRotateSensitivity:Ue,imageNamePointCloudBoxMap:be,linkageImageNameRectMap:xe,updateRectListByReducer:Re,windowKeydownListenerHook:ye,isLargeStatus:Ie,setIsLargeStatus:ve}},[ne,Pe,v,s,x,V,b,w,p,ae,ce,f,re,m,pe,fe,W,q,D,J,Q,he,se,we,_,Ce,O,Le,ie,be,xe,Re,ye,Ie,ve]);ee(()=>{var o,n,t;(o=h==null?void 0:h.setPointCloudBoxList)==null||o.call(h,s),(n=h==null?void 0:h.setHighlightIDs)==null||n.call(h,_),(t=h==null?void 0:h.setSelectedIDs)==null||t.call(h,v)},[s,v,_]),ee(()=>{var o;(o=h==null?void 0:h.setPtCtx)==null||o.call(h,M)},[M]);const at=()=>{const o=s.filter(d=>m.includes(d.attribute)),{setSelectedIDs:n,reRender:t}=M,a=o.map(d=>d.id);a.length>0&&n(v.filter(d=>!a.includes(d))),t()};return ee(()=>{var o,n,t,a;at(),(n=(o=p==null?void 0:p.toolInstance)==null?void 0:o.setHiddenAttributes)==null||n.call(o,m),(a=(t=D==null?void 0:D.store)==null?void 0:t.setHiddenAttributes)==null||a.call(t,m)},[m]),je.createElement(Te.Provider,{value:M},c)};export{Te as PointCloudContext,Bt as PointCloudProvider};
@@ -1 +1 @@
1
- import{PointCloudContext as re}from"./PointCloudContext.js";import{useRotate as se}from"./hooks/useRotate.js";import{useRotateEdge as ne}from"./hooks/useRotateEdge.js";import{useBoxes as ie}from"./hooks/useBoxes.js";import{useSingleBox as ae}from"./hooks/useSingleBox.js";import{useSphere as ue}from"./hooks/useSphere.js";import{useContext as le,useEffect as d}from"react";import{CommonToolUtils as ce,AttributeUtils as de,EToolName as f,cTool as pe}from"@labelbee/lb-annotation";import{message as g}from"antd";import{connect as me}from"react-redux";import{a2MapStateToProps as be}from"../../store/annotation/map.js";import{useStatus as fe}from"./hooks/useStatus.js";import{usePointCloudViews as Pe}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as ye}from"../../store/ctx.js";import{useHistory as ve}from"./hooks/useHistory.js";import{useAttribute as we}from"./hooks/useAttribute.js";import{useConfig as Ce}from"./hooks/useConfig.js";import{usePolygon as he}from"./hooks/usePolygon.js";import{useLine as ge}from"./hooks/useLine.js";import{useUpdatePointCloudColor as Se}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as ke}from"react-i18next";import{useLatest as O}from"ahooks";var xe=Object.defineProperty,Ve=Object.defineProperties,_e=Object.getOwnPropertyDescriptors,j=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,A=(n,r,a)=>r in n?xe(n,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[r]=a,P=(n,r)=>{for(var a in r||(r={}))Be.call(r,a)&&A(n,a,r[a]);if(j)for(var a of j(r))Ie.call(r,a)&&A(n,a,r[a]);return n},y=(n,r)=>Ve(n,_e(r));const{EPolygonPattern:Le}=pe,Oe=({currentData:n,config:r,checkMode:a,configString:E,imgIndex:S,toolInstanceRef:i,setResourceLoading:k})=>{const e=le(re),{changeSelectedBoxValid:T,selectNextBox:D,selectPrevBox:H,updateSelectedBox:K,deleteSelectedPointCloudBoxAndPolygon:N}=ae(),{selectedSphere:v,updatePointCloudSphere:U}=ue(),{clearAllResult:w,updatePointCloudPattern:z}=fe(),{copySelectedBoxes:R,pasteSelectedBoxes:F,copiedBoxes:Ae}=ie({config:r,currentData:n}),{updateRotate:x}=se({currentData:n}),{updateRotateEdge:q}=ne({currentData:n}),{updatePointCloudData:m,topViewSelectedChanged:G}=Pe({setResourceLoading:k}),{redo:V,undo:_,pushHistoryWithList:M,pushHistoryUnderUpdatePolygon:W,pushHistoryUnderUpdateLine:Y}=ve(),{syncThreeViewsAttribute:B}=we(),{syncAllViewsConfig:$,reRenderTopViewRange:J}=Ce(),{selectedPolygon:I}=he(),{selectedLine:L}=ge(),{t:C}=ke(),{updatePointCloudColor:Q}=Se(k,r),X=O(n),b=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Z=(t,o)=>{var s,u;const{topViewInstance:c,mainViewInstance:l}=e;if(!c)return;const{pointCloud2dOperation:h}=c;switch(t){case"q":{x(e.rectRotateSensitivity);break}case"e":x(-Number(e.rectRotateSensitivity));break;case"g":q(-90);break;case"u":{const p=h.pattern===Le.Normal?f.Rect:f.Polygon;z(p);const oe={[f.Polygon]:C("PolygonPattern"),[f.Rect]:C("RectPattern")};g.success(C("ChangePatternMsg",{pattern:oe[p]})),h.clearActiveStatus(),h.clearDrawingStatus()}break;case"+":l==null||l.updatePointSize({zoomIn:!0});break;case"-":l==null||l.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){H();break}D(),o.preventDefault();break;case"f":T();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":N(X.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=de.getAttributeByKeycode(o.keyCode,r.attributeList);p!==void 0&&((u=i.current)==null||u.setDefaultAttribute(p))}return}}},ee=(t,o)=>{switch(t){case"c":R();break;case"v":F();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?V():_();break}}},te=O(t=>{if(!ce.hotkeyFilter(t)||a===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){ee(o,t);return}Z(o,t)});return d(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(c=>te.current(c))},[e,e.topViewInstance,e.windowKeydownListenerHook]),d(()=>{$(r)},[E]),d(()=>{(r==null?void 0:r.radius)&&J(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),d(()=>{m==null||m()},[S,e.mainViewInstance]),d(()=>{e.setHideAttributes([])},[S]),d(()=>{i.current.setDefaultAttribute=t=>{var o;if(B(t),Q(t),I&&W(y(P({},I),{attribute:t})),L&&Y(y(P({},L),{attribute:t})),v){const s=U(y(P({},v),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),G({newSelectedSphere:v,newSphereList:s}))}},i.current.setSubAttribute=(t,o)=>{var s;const u=e.selectedPointCloudBox;if(u){const c=(s=u==null?void 0:u.subAttribute)!=null?s:{};u.subAttribute=y(P({},c),{[t]:o}),K(u),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(u.id),e.mainViewInstance.render())}},i.current.clearResult=()=>{w==null||w()},i.current.redo=()=>{V()},i.current.undo=()=>{_()},i.current.setValid=t=>{i.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&w()})},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(()=>{m==null||m(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),d(()=>{i.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},i.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),d(()=>{i.current.history={pushHistory:t=>{M({pointCloudBoxList:t})},initRecord:()=>{}}},[]),d(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||a)return;const s=l=>{B(l)},u=l=>{g.error(l)},c=l=>{g.info(l)};return o.on("syncAttribute",s),o.on("messageError",u),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",u),o.unbind("messageInfo",c)}},[e.topViewInstance]),null};var je=me(be,null,null,{context:ye})(Oe);export{je as default};
1
+ import{PointCloudContext as re}from"./PointCloudContext.js";import{useRotate as se}from"./hooks/useRotate.js";import{useRotateEdge as ne}from"./hooks/useRotateEdge.js";import{useBoxes as ie}from"./hooks/useBoxes.js";import{useSingleBox as ae}from"./hooks/useSingleBox.js";import{useSphere as le}from"./hooks/useSphere.js";import{useContext as ue,useEffect as c}from"react";import{CommonToolUtils as ce,EToolName as v,cTool as de}from"@labelbee/lb-annotation";import{Modal as pe,message as f}from"antd";import{connect as me}from"react-redux";import{a2MapStateToProps as ve}from"../../store/annotation/map.js";import{useStatus as Pe}from"./hooks/useStatus.js";import{usePointCloudViews as we}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as be}from"../../store/ctx.js";import{useHistory as ye}from"./hooks/useHistory.js";import{useAttribute as fe}from"./hooks/useAttribute.js";import{useConfig as he}from"./hooks/useConfig.js";import{usePolygon as Ce}from"./hooks/usePolygon.js";import{useLine as Se}from"./hooks/useLine.js";import{useUpdatePointCloudColor as ge}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as ke}from"react-i18next";import{useLatest as L}from"ahooks";var Ve=Object.defineProperty,xe=Object.defineProperties,_e=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,O=(i,r,l)=>r in i?Ve(i,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[r]=l,P=(i,r)=>{for(var l in r||(r={}))Ie.call(r,l)&&O(i,l,r[l]);if(B)for(var l of B(r))Le.call(r,l)&&O(i,l,r[l]);return i},w=(i,r)=>xe(i,_e(r));const{EPolygonPattern:Be}=de,Oe=({currentData:i,config:r,checkMode:l,configString:j,imgIndex:h,toolInstanceRef:a,setResourceLoading:C,isBatchSetValid:T})=>{const e=ue(re),{changeSelectedBoxValid:A,selectNextBox:E,selectPrevBox:D,updateSelectedBox:H,deleteSelectedPointCloudBoxAndPolygon:K}=ae(),{selectedSphere:b,updatePointCloudSphere:N}=le(),{clearAllResult:S,updatePointCloudPattern:U}=Pe(),{copySelectedBoxes:z,pasteSelectedBoxes:R,copiedBoxes:Te}=ie({config:r,currentData:i}),{updateRotate:g}=se({currentData:i}),{updateRotateEdge:F}=ne({currentData:i}),{updatePointCloudData:p,topViewSelectedChanged:M}=we({setResourceLoading:C}),{redo:k,undo:V,pushHistoryWithList:q,pushHistoryUnderUpdatePolygon:G,pushHistoryUnderUpdateLine:W}=ye(),{syncThreeViewsAttribute:x}=fe(),{syncAllViewsConfig:Y,reRenderTopViewRange:$,reRenderTopViewTipScopeList:J}=he(),{selectedPolygon:_}=Ce(),{selectedLine:I}=Se(),{t:y}=ke(),{updatePointCloudColor:Q}=ge(C,r),X=L(i),m=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Z=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:u}=s;switch(t){case"q":{g(e.rectRotateSensitivity);break}case"e":g(-Number(e.rectRotateSensitivity));break;case"g":F(-90);break;case"u":{const d=u.pattern===Be.Normal?v.Rect:v.Polygon;U(d);const oe={[v.Polygon]:y("PolygonPattern"),[v.Rect]:y("RectPattern")};f.success(y("ChangePatternMsg",{pattern:oe[d]})),u.clearActiveStatus(),u.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":T?(pe.destroyAll(),e.setBatchSetValidModal(!e.visibleBatchSetValid)):e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){D();break}E(),o.preventDefault();break;case"f":A();break;case"arrowup":m({y:-1});break;case"arrowdown":m({y:1});break;case"arrowleft":m({x:-1});break;case"arrowright":m({x:1});break;case"delete":K(X.current);break}},ee=(t,o)=>{switch(t){case"c":z();break;case"v":R();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?k():V();break}}},te=L(t=>{if(!ce.hotkeyFilter(t)||l===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){ee(o,t);return}Z(o,t)});return c(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(u=>te.current(u))},[e,e.topViewInstance,e.windowKeydownListenerHook]),c(()=>{Y(r)},[j]),c(()=>{(r==null?void 0:r.radius)&&$(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{(r==null?void 0:r.tipScopeList)&&J(r==null?void 0:r.tipScopeList)},[r==null?void 0:r.tipScopeList]),c(()=>{p==null||p()},[h,e.mainViewInstance]),c(()=>{e.setHideAttributes([])},[h]),c(()=>{a.current.setAttrChangeTrigger=t=>{var o;(o=e.topViewInstance)==null||o.toolInstance.setAttrChangeTrigger(t)},a.current.setDefaultAttribute=t=>{var o;if(x(t),Q(t),_&&G(w(P({},_),{attribute:t})),I&&W(w(P({},I),{attribute:t})),b){const s=N(w(P({},b),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),M({newSelectedSphere:b,newSphereList:s}))}},a.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const u=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=w(P({},u),{[t]:o}),H(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},a.current.clearResult=()=>{S==null||S()},a.current.redo=()=>{k()},a.current.undo=()=>{V()},a.current.setValid=t=>{a.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t)})},a.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},a.current.asyncData=t=>{setTimeout(()=>{p==null||p(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),c(()=>{a.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},a.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),c(()=>{a.current.history={pushHistory:t=>{q({pointCloudBoxList:t})},initRecord:()=>{}}},[]),c(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||l)return;const s=d=>{x(d)},n=d=>{f.error(d)},u=d=>{f.info(d)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",u),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",u)}},[e.topViewInstance]),null};var je=me(ve,null,null,{context:be})(Oe);export{je as default};
@@ -1 +1 @@
1
- import{getClassName as _}from"../../utils/dom.js";import{FooterDivider as F}from"../../views/MainView/toolFooter/index.js";import{ZoomController as me}from"../../views/MainView/toolFooter/ZoomController/index.js";import{LeftOutlined as fe,UpSquareOutlined as Ce,DownSquareOutlined as ve}from"@ant-design/icons";import{cKeyCode as we,PointCloudAnnotation as Pe,MathUtils as W,cTool as ge,cAnnotation as ye}from"@labelbee/lb-annotation";import{PointCloudUtils as K}from"@labelbee/lb-utils";import{EPointCloudBoxRenderTrigger as Ie}from"../../utils/ToolPointCloudBoxRenderHelper.js";import s,{useState as A,useRef as xe,useLayoutEffect as he,useEffect as y}from"react";import{PointCloudContext as M}from"./PointCloudContext.js";import{useRotate as Ve}from"./hooks/useRotate.js";import{useRotateEdge as Se}from"./hooks/useRotateEdge.js";import{useSingleBox as X}from"./hooks/useSingleBox.js";import{PointCloudContainer as _e}from"./PointCloudLayout.js";import{BoxInfos as Y,PointCloudValidity as Ee}from"./PointCloudInfos.js";import{usePolygon as Le}from"./hooks/usePolygon.js";import{useSphere as q}from"./hooks/useSphere.js";import{useZoom as $}from"./hooks/useZoom.js";import{Slider as be}from"antd";import{a2MapStateToProps as Oe}from"../../store/annotation/map.js";import{connect as je}from"react-redux";import{usePointCloudViews as Te}from"./hooks/usePointCloudViews.js";import Re from"../../hooks/useSize.js";import{useTranslation as ke}from"react-i18next";import{LabelBeeContext as De}from"../../store/ctx.js";import{jsonParser as Be}from"../../utils/index.js";import Ne from"../../utils/ToolUtils.js";import Ae from"lodash";import Ue from"./components/PointCloudSizeSlider/index.js";import{useHistory as ze}from"./hooks/useHistory.js";import Ze from"./components/TitleButton/index.js";var He=Object.defineProperty,Fe=Object.defineProperties,We=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,J=(i,l,r)=>l in i?He(i,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[l]=r,U=(i,l)=>{for(var r in l||(l={}))Ke.call(l,r)&&J(i,r,l[r]);if(G)for(var r of G(l))Me.call(l,r)&&J(i,r,l[r]);return i},z=(i,l)=>Fe(i,We(l));const{EPolygonPattern:Xe,EToolName:Q}=ge,{ESortDirection:ee}=ye,Ye=we.default,te=(i,l,r=1)=>{const{width:v,height:m}=l,I={x:i.x+v*r/2,y:i.y+m*r/2},x={x:l.width/2,y:l.height/2};return{offsetX:(x.x-I.x)/r,offsetY:-(x.y-I.y)/r}},qe=({currentData:i})=>{var l,r;const{zoom:v,zoomIn:m,zoomOut:I,initialPosition:x}=$(),{selectNextBox:O,selectPrevBox:j}=X(),{switchToNextSphere:E}=q(),{updateRotate:L}=Ve({currentData:i}),{updateRotateEdge:T}=Se({currentData:i}),P=s.useContext(M),{topViewInstance:h}=P,f=(r=(l=P==null?void 0:P.topViewInstance)==null?void 0:l.toolScheduler)==null?void 0:r.getCurrentToolName(),e=()=>{L(-Number(P.rectRotateSensitivity))},d=()=>{L(P.rectRotateSensitivity)},C=()=>{T(-90)};return s.createElement(s.Fragment,null,s.createElement(Ue,{onChange:B=>{var V;(V=h==null?void 0:h.pointCloudInstance)==null||V.updatePointSize({customSize:B})}}),s.createElement("span",{onClick:d,className:_("point-cloud","rotate-reserve")}),s.createElement("span",{onClick:e,className:_("point-cloud","rotate")}),s.createElement("span",{onClick:C,className:_("point-cloud","rotate-90")}),s.createElement(F,null),s.createElement(Ce,{onClick:()=>{if(f===Q.Point){E(ee.descend);return}j(!0)},className:_("point-cloud","prev")}),s.createElement(ve,{onClick:()=>{if(f===Q.Point){E(ee.ascend);return}O(!0)},className:_("point-cloud","next")}),s.createElement(F,null),s.createElement(me,{initialPosition:x,zoomIn:m,zoomOut:I,zoom:v}))},$e=({setZAxisLimit:i,zAxisLimit:l,checkMode:r})=>r?null:s.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},s.createElement(be,{vertical:!0,step:.5,max:10,min:.5,defaultValue:l,onAfterChange:v=>{i(v)}})),Ge=({currentData:i,imgList:l,stepInfo:r,drawLayerSlot:v,checkMode:m,intelligentFit:I,setIsEnlargeTopView:x,isEnlargeTopView:O,onExitZoom:j,highlightAttribute:E})=>{var L,T;const[P,h]=A({zoom:1,currentPos:{x:0,y:0}}),f=xe(null),e=s.useContext(M),d=Re(f),C=Be(r.config),{setZoom:B,syncTopviewToolZoom:V}=$(),{hideAttributes:oe}=e,{addPolygon:ne,deletePolygon:ie}=Le(),{deletePointCloudSphere:se}=q(),{deletePointCloudBox:le,changeValidByID:re}=X(),[N,ae]=A(10),{t:Z}=ke(),w=Te(),{pushHistoryWithList:ce}=ze(),[de,R]=A(!0);he(()=>{if(!e.topViewInstance&&f.current&&(i==null?void 0:i.url)&&(i==null?void 0:i.result)){const o={width:f.current.clientWidth,height:f.current.clientHeight},a=new Pe({container:f.current,size:o,pcdPath:i.url,config:z(U({},C),{pointCloudPattern:e.pointCloudPattern}),checkMode:m,toolName:Ne.getPointCloudToolList(),proxyMode:m});e.setTopViewInstance(a)}},[i]),y(()=>{if(!d||!e.topViewInstance||!e.sideViewInstance)return;const{toolInstance:o}=e.topViewInstance;o.singleOn("dataUpdated",(t,n)=>{const u=Ae.cloneDeep(t).map(c=>z(U({},c),{pointList:K.pointListTransferCanvas2World(c.pointList,d)}));e.setSelectedIDs(n),e.setLineList(u),ce({lineList:u})}),o.singleOn("pointCreated",(t,n)=>{w.topViewAddSphere({newPoint:t,size:d,trackConfigurable:C.trackConfigurable,zoom:n})}),o.singleOn("pointDeleted",t=>{se(t)}),o.singleOn("pointSelected",t=>{e.setSelectedIDs([t])}),o.singleOn("updatePointByDrag",(t,n)=>{var u;(u=w.topViewUpdatePoint)==null||u.call(w,t,d)}),o.singleOn("polygonCreated",(t,n)=>{if(o.pattern===Xe.Normal||!(i==null?void 0:i.url)){const u=z(U({},t),{pointList:t.pointList.map(c=>K.transferCanvas2World(c,d))});ne(u),e.setSelectedIDs(oe.includes(t.attribute)?"":t.id);return}R(!1),w.topViewAddBox({polygon:t,size:d,imgList:l,trackConfigurable:C.trackConfigurable,zoom:n,intelligentFit:I})}),o.singleOn("deletedObject",({id:t})=>{le(t),ie(t)}),o.singleOn("deleteSelectedIDs",()=>{e.setSelectedIDs([])}),o.singleOn("addSelectedIDs",t=>{e.addSelectedID(t)}),o.singleOn("setSelectedIDs",t=>{R(!1),e.setSelectedIDs(t)}),o.singleOn("updatePolygonByDrag",t=>{var n;(n=w.topViewUpdateBox)==null||n.call(w,t,d)});const a=t=>{var n;const u=re(t);u&&e.syncAllViewPointCloudColor(Ie.Default,u),e.polygonList.find(c=>c.id===t)&&((n=e.topViewInstance)==null||n.toolInstance.setPolygonValidAndRender(t,!0))};return o.on("validUpdate",a),()=>{o.unbind("validUpdate",a)}},[e,d,i,w,e.polygonList,e.lineList,(L=e.topViewInstance)==null?void 0:L.toolInstance]),y(()=>{var o,a;if(!(d==null?void 0:d.width)||!e.topViewInstance)return;const t=(a=(o=C==null?void 0:C.attributeList)==null?void 0:o[0])==null?void 0:a.value;t&&e.topViewInstance.toolInstance.setDefaultAttribute(t),e.topViewInstance.initSize(d),e.topViewInstance.updatePolygonList(e.displayPointCloudList,e.polygonList),e.topViewInstance.updatePointList(e.displaySphereList),e.topViewInstance.updateLineList(e.displayLineList);const{topViewInstance:{pointCloudInstance:n,toolInstance:u}}=e;u.singleOn("renderZoom",(c,p)=>{const{offsetX:S,offsetY:b}=te(p,d,c);if(n.camera.zoom=c,p){const{x:g,y:k,z:D}=n.initCameraPosition;n.camera.position.set(g+b,k-S,D)}n.camera.updateProjectionMatrix(),n.render(),B(c),V(p,c,d),h({zoom:c,currentPos:p})}),u.singleOn("dragMove",({currentPos:c,zoom:p})=>{const{offsetX:S,offsetY:b}=te(c,d,p);n.camera.zoom=p;const{x:g,y:k,z:D}=n.initCameraPosition;n.camera.position.set(g+b,k-S,D),n.render(),V(c,p,d),h({zoom:p,currentPos:c})})},[d,e.topViewInstance,(T=e.topViewInstance)==null?void 0:T.toolInstance]),y(()=>{var o,a;(a=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null||a.applyZAxisPoints(N)},[N]),y(()=>{var o,a,t,n;w.topViewSelectedChanged({}),(n=(t=(a=(o=e.topViewInstance)==null?void 0:o.toolInstance)==null?void 0:a.selection)==null?void 0:t.hardSetSelectedIDs)==null||n.call(t,e.selectedIDs)},[e.selectedIDs]),y(()=>{const{topViewInstance:o,selectedID:a,selectedPointCloudBox:t,zoom:n}=e;if(!o||!a||!t||!de){R(!0);return}const{center:u}=t,{pointCloudInstance:c,toolInstance:p}=o,S=p.polygonList.find(pe=>pe.id===e.selectedID);if(!S){R(!0);return}const b=W.getRectCenterPoint(S.pointList),g=W.getCurrentPosFromRectCenter(p.size,b,n);p.setCurrentPos(g),p.render();const{x:k,y:D,z:ue}=c.initCameraPosition;c.camera.position.set(u.x,u.y,ue),c.render(),V(g,n,d),h({zoom:n,currentPos:g})},[e.selectedID]),y(()=>(window.addEventListener("keydown",H),()=>{window.removeEventListener("keydown",H)}),[]);const H=o=>{const{keyCode:a}=o;a===Ye.Esc&&j()};return y(()=>{var o,a,t;(t=(a=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:a.setHighlightAttribute)==null||t.call(a,E)},[e.topViewInstance,E]),s.createElement(_e,{className:_("point-cloud-container","top-view"),title:O?s.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative"}},s.createElement(fe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{j()}}),s.createElement("span",null,Z("TopView")),s.createElement(Y,{checkMode:m,config:C,style:{display:"flex",position:"initial",margin:"0px 20px"}})):s.createElement(Ze,{title:Z("TopView"),onClick:()=>{x(!0)}}),toolbar:s.createElement(qe,{currentData:i})},s.createElement("div",{style:{position:"relative",flex:1}},s.createElement("div",{style:{width:"100%",height:"100%"},ref:f},v==null?void 0:v(P)),!O&&s.createElement(Y,{checkMode:m,config:C}),s.createElement($e,{checkMode:m,zAxisLimit:N,setZAxisLimit:ae}),s.createElement(Ee,null)))};var Je=je(Oe,null,null,{context:De})(Ge);export{Je as default};
1
+ import{getClassName as S}from"../../utils/dom.js";import{FooterDivider as H}from"../../views/MainView/toolFooter/index.js";import{ZoomController as ge}from"../../views/MainView/toolFooter/ZoomController/index.js";import{LeftOutlined as Ie,UpSquareOutlined as ye,DownSquareOutlined as xe}from"@ant-design/icons";import{cKeyCode as Ve,PointCloudAnnotation as he,MathUtils as W,cTool as Se,cAnnotation as _e}from"@labelbee/lb-annotation";import{PointCloudUtils as K}from"@labelbee/lb-utils";import{EPointCloudBoxRenderTrigger as M}from"../../utils/ToolPointCloudBoxRenderHelper.js";import s,{useState as D,useRef as Ee,useContext as X,useLayoutEffect as Le,useEffect as C}from"react";import{PointCloudContext as Y}from"./PointCloudContext.js";import{useRotate as be}from"./hooks/useRotate.js";import{useRotateEdge as Oe}from"./hooks/useRotateEdge.js";import{useSingleBox as q}from"./hooks/useSingleBox.js";import{PointCloudContainer as je}from"./PointCloudLayout.js";import{BoxInfos as $,PointCloudValidity as Te}from"./PointCloudInfos.js";import{usePolygon as De}from"./hooks/usePolygon.js";import{useSphere as G}from"./hooks/useSphere.js";import{useZoom as J}from"./hooks/useZoom.js";import{Slider as ke}from"antd";import{a2MapStateToProps as Re}from"../../store/annotation/map.js";import{connect as Be}from"react-redux";import{usePointCloudViews as Ae}from"./hooks/usePointCloudViews.js";import Ne from"../../hooks/useSize.js";import{useTranslation as Ue}from"react-i18next";import{LabelBeeContext as ze}from"../../store/ctx.js";import{jsonParser as Ze}from"../../utils/index.js";import Fe from"../../utils/ToolUtils.js";import He from"lodash";import We from"./components/PointCloudSizeSlider/index.js";import{useHistory as Ke}from"./hooks/useHistory.js";import Me from"./components/TitleButton/index.js";import{useDebounceFn as Xe}from"ahooks";var Ye=Object.defineProperty,qe=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,ee=(i,l,a)=>l in i?Ye(i,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[l]=a,A=(i,l)=>{for(var a in l||(l={}))Ge.call(l,a)&&ee(i,a,l[a]);if(Q)for(var a of Q(l))Je.call(l,a)&&ee(i,a,l[a]);return i},N=(i,l)=>qe(i,$e(l));const{EPolygonPattern:Qe,EToolName:te}=Se,{ESortDirection:oe}=_e,et=Ve.default,ne=(i,l,a=1)=>{const{width:v,height:p}=l,I={x:i.x+v*a/2,y:i.y+p*a/2},y={x:l.width/2,y:l.height/2};return{offsetX:(y.x-I.x)/a,offsetY:-(y.y-I.y)/a}},tt=({currentData:i})=>{var l,a;const{zoom:v,zoomIn:p,zoomOut:I,initialPosition:y}=J(),{selectNextBox:b,selectPrevBox:O}=q(),{switchToNextSphere:_}=G(),{updateRotate:E}=be({currentData:i}),{updateRotateEdge:j}=Oe({currentData:i}),g=X(Y),{topViewInstance:x}=g,m=(a=(l=g==null?void 0:g.topViewInstance)==null?void 0:l.toolScheduler)==null?void 0:a.getCurrentToolName(),t=()=>{E(-Number(g.rectRotateSensitivity))},c=()=>{E(g.rectRotateSensitivity)},f=()=>{j(-90)};return s.createElement(s.Fragment,null,s.createElement(We,{onChange:k=>{var V;(V=x==null?void 0:x.pointCloudInstance)==null||V.updatePointSize({customSize:k})}}),s.createElement("span",{onClick:c,className:S("point-cloud","rotate-reserve")}),s.createElement("span",{onClick:t,className:S("point-cloud","rotate")}),s.createElement("span",{onClick:f,className:S("point-cloud","rotate-90")}),s.createElement(H,null),s.createElement(ye,{onClick:()=>{if(m===te.Point){_(oe.descend);return}O(!0)},className:S("point-cloud","prev")}),s.createElement(xe,{onClick:()=>{if(m===te.Point){_(oe.ascend);return}b(!0)},className:S("point-cloud","next")}),s.createElement(H,null),s.createElement(ge,{initialPosition:y,zoomIn:p,zoomOut:I,zoom:v}))},ot=({setZAxisLimit:i,zAxisLimit:l,checkMode:a})=>a?null:s.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},s.createElement(ke,{vertical:!0,step:.5,max:10,min:.5,defaultValue:l,onAfterChange:v=>{i(v)}})),nt=({currentData:i,imgList:l,stepInfo:a,drawLayerSlot:v,checkMode:p,intelligentFit:I,setIsEnlargeTopView:y,isEnlargeTopView:b,onExitZoom:O,highlightAttribute:_})=>{var E,j;const[g,x]=D({zoom:1,currentPos:{x:0,y:0}}),m=Ee(null),t=X(Y),c=Ne(m),f=Ze(a.config),{setZoom:k,syncTopviewToolZoom:V}=J(),{run:ie}=Xe(k,{wait:500}),{hideAttributes:se,setIsLargeStatus:le,selectedID:re,pointCloudBoxList:ae}=t,{addPolygon:ce,deletePolygon:de}=De(),{deletePointCloudSphere:ue}=G(),{deletePointCloudBox:pe,changeValidByID:me}=q(),[R,fe]=D(10),{t:U}=Ue(),w=Ae(),{pushHistoryWithList:Ce}=Ke(),[ve,T]=D(!0),[z,Z]=D(!1);Le(()=>{if(!t.topViewInstance&&m.current&&(i==null?void 0:i.url)&&(i==null?void 0:i.result)){const o={width:m.current.clientWidth,height:m.current.clientHeight},r=new he({container:m.current,size:o,pcdPath:i.url,config:N(A({},f),{pointCloudPattern:t.pointCloudPattern}),checkMode:p,toolName:Fe.getPointCloudToolList(),proxyMode:p,view:"topView"});t.setTopViewInstance(r)}},[i]),C(()=>{z&&re&&(t.syncAllViewPointCloudColor(M.Single,ae),Z(!1))},[z]),C(()=>{if(!c||!t.topViewInstance||!t.sideViewInstance)return;const{toolInstance:o}=t.topViewInstance;o.singleOn("dataUpdated",(e,n)=>{const d=He.cloneDeep(e).map(u=>N(A({},u),{pointList:K.pointListTransferCanvas2World(u.pointList,c)}));t.setSelectedIDs(n),t.setLineList(d),Ce({lineList:d})}),o.singleOn("pointCreated",(e,n)=>{w.topViewAddSphere({newPoint:e,size:c,trackConfigurable:f.trackConfigurable,zoom:n})}),o.singleOn("pointDeleted",e=>{ue(e)}),o.singleOn("pointSelected",e=>{t.setSelectedIDs([e])}),o.singleOn("updatePointByDrag",(e,n)=>{var d;(d=w.topViewUpdatePoint)==null||d.call(w,e,c)}),o.singleOn("polygonCreated",(e,n)=>{if(o.pattern===Qe.Normal||!(i==null?void 0:i.url)){const d=N(A({},e),{pointList:e.pointList.map(u=>K.transferCanvas2World(u,c))});ce(d),t.setSelectedIDs(se.includes(e.attribute)?"":e.id);return}T(!1),w.topViewAddBox({polygon:e,size:c,imgList:l,trackConfigurable:f.trackConfigurable,zoom:n,intelligentFit:I}),Z(!0)}),o.singleOn("deletedObject",({id:e})=>{pe(e),de(e)}),o.singleOn("deleteSelectedIDs",()=>{t.setSelectedIDs([])}),o.singleOn("addSelectedIDs",e=>{t.addSelectedID(e)}),o.singleOn("setSelectedIDs",e=>{T(!1),t.setSelectedIDs(e)}),o.singleOn("updatePolygonByDrag",e=>{var n;(n=w.topViewUpdateBox)==null||n.call(w,e,c)});const r=e=>{var n;const d=me(e);d&&t.syncAllViewPointCloudColor(M.Default,d),t.polygonList.find(u=>u.id===e)&&((n=t.topViewInstance)==null||n.toolInstance.setPolygonValidAndRender(e,!0))};return o.on("validUpdate",r),()=>{o.unbind("validUpdate",r)}},[t,c,i,w,t.polygonList,t.lineList,(E=t.topViewInstance)==null?void 0:E.toolInstance]),C(()=>{var o,r;if(!t.topViewInstance)return;const e=(r=(o=f==null?void 0:f.attributeList)==null?void 0:o[0])==null?void 0:r.value;e&&t.topViewInstance.toolInstance.setDefaultAttribute(e)},[t.topViewInstance]),C(()=>{if(!(c==null?void 0:c.width)||!t.topViewInstance)return;t.topViewInstance.initSize(c),t.topViewInstance.updatePolygonList(t.displayPointCloudList,t.polygonList),t.topViewInstance.updatePointList(t.displaySphereList),t.topViewInstance.updateLineList(t.displayLineList);const{topViewInstance:{pointCloudInstance:o,toolInstance:r}}=t;r.singleOn("renderZoom",(e,n)=>{const{offsetX:d,offsetY:u}=ne(n,c,e);if(o.camera.zoom=e,n){const{x:P,y:h,z:L}=o.initCameraPosition;o.camera.position.set(P+u,h-d,L)}o.camera.updateProjectionMatrix(),o.render(),ie(e),V(n,e,c),x({zoom:e,currentPos:n})}),r.singleOn("dragMove",({currentPos:e,zoom:n})=>{const{offsetX:d,offsetY:u}=ne(e,c,n);o.camera.zoom=n;const{x:P,y:h,z:L}=o.initCameraPosition;o.camera.position.set(P+u,h-d,L),o.render(),V(e,n,c),x({zoom:n,currentPos:e})})},[c,t.topViewInstance,(j=t.topViewInstance)==null?void 0:j.toolInstance]),C(()=>{var o,r;(r=(o=t.topViewInstance)==null?void 0:o.pointCloudInstance)==null||r.applyZAxisPoints(R)},[R]),C(()=>{var o,r,e,n;w.topViewSelectedChanged({}),(n=(e=(r=(o=t.topViewInstance)==null?void 0:o.toolInstance)==null?void 0:r.selection)==null?void 0:e.hardSetSelectedIDs)==null||n.call(e,t.selectedIDs)},[t.selectedIDs]),C(()=>{const{topViewInstance:o,selectedID:r,selectedPointCloudBox:e,zoom:n}=t;if(!o||!r||!e||!ve){T(!0);return}const{center:d}=e,{pointCloudInstance:u,toolInstance:P}=o,h=P.polygonList.find(Pe=>Pe.id===t.selectedID);if(!h){T(!0);return}const L=W.getRectCenterPoint(h.pointList),B=W.getCurrentPosFromRectCenter(P.size,L,n);P.setCurrentPos(B),P.render();const{x:st,y:lt,z:we}=u.initCameraPosition;u.camera.position.set(d.x,d.y,we),u.render(),V(B,n,c),x({zoom:n,currentPos:B})},[t.selectedID]),C(()=>(window.addEventListener("keydown",F),()=>{window.removeEventListener("keydown",F)}),[]);const F=o=>{const{keyCode:r}=o;r===et.Esc&&O()};return C(()=>{var o,r,e;(e=(r=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:r.setHighlightAttribute)==null||e.call(r,_)},[t.topViewInstance,_]),s.createElement(je,{className:S("point-cloud-container","top-view"),title:b?s.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative"}},s.createElement(Ie,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{O()}}),s.createElement("span",null,U("TopView")),s.createElement($,{checkMode:p,config:f,style:{display:"flex",position:"initial",margin:"0px 20px"}})):s.createElement(Me,{title:U("TopView"),onClick:()=>{le(!0),y(!0)}}),toolbar:s.createElement(tt,{currentData:i})},s.createElement("div",{style:{position:"relative",flex:1}},s.createElement("div",{style:{width:"100%",height:"100%"},ref:m},v==null?void 0:v(g)),!b&&s.createElement($,{checkMode:p,config:f}),s.createElement(ot,{checkMode:p,zAxisLimit:R,setZAxisLimit:fe}),s.createElement(Te,null)))};var it=Be(Re,null,null,{context:ze})(nt);export{it as default};
@@ -1 +1 @@
1
- import a from"react";import{ExpandAltOutlined as r}from"@ant-design/icons";import{getClassName as o}from"../../../../utils/dom.js";const l=({title:e,onClick:t,style:n})=>!t&&!e?null:a.createElement("span",{className:o("point-cloud-container","title-button"),style:n},e,t&&a.createElement(r,{onClick:t,style:{marginLeft:4}}));export{l as default};
1
+ import a from"react";import{ExpandAltOutlined as r}from"@ant-design/icons";import{getClassName as o}from"../../../../utils/dom.js";const l=({title:e,onClick:t,style:n})=>!t&&!e?null:a.createElement("span",{className:o("point-cloud-container","title-button"),style:n,onClick:t},e,t&&a.createElement(r,{style:{marginLeft:4}}));export{l as default};
@@ -1 +1 @@
1
- import{ESubmitType as L}from"../../../../constant/index.js";import{ToSubmitFileData as z,BatchUpdateResultByTrackID as R}from"../../../../store/annotation/actionCreators.js";import{LabelBeeContext as T,useDispatch as M}from"../../../../store/ctx.js";import{Form as u,Modal as q,InputNumber as _,Select as g,Popover as N,message as V}from"antd";import e,{useState as H,useEffect as K,useCallback as Q}from"react";import{useTranslation as W}from"react-i18next";import{QuestionCircleOutlined as $}from"@ant-design/icons";import{PointCloudUtils as F}from"@labelbee/lb-utils";import{connect as G}from"react-redux";import{useSingleBox as J}from"../../hooks/useSingleBox.js";import{MathUtils as X}from"@labelbee/lb-annotation";var Y=Object.defineProperty,Z=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,w=(r,n,a)=>n in r?Y(r,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[n]=a,v=(r,n)=>{for(var a in n||(n={}))te.call(n,a)&&w(r,a,n[a]);if(B)for(var a of B(n))re.call(n,a)&&w(r,a,n[a]);return r},ne=(r,n)=>Z(r,ee(n));const ae={labelCol:{span:8},wrapperCol:{span:16}},O=[{required:!0,message:"\u8BF7\u586B\u5199\u4E00\u4E2A\u6570\u5B57"}],le=[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u5C5E\u6027"}],h=2,k=({text:r})=>e.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}},r),ie=({id:r,visible:n,onCancel:a,config:m,imgList:y,imgIndex:A})=>{const P=M(),{selectedBox:i}=J(),[p,E]=H(),[d]=u.useForm(),{t:o}=W();K(()=>{n===!1?(d.resetFields(),E(void 0)):b()},[n]);const C=t=>{var s;if(!r)return;if(!p){V.info("\u8BE5\u8303\u56F4\u4E0D\u5B58\u5728\u66F4\u6539\u6570\u636E, \u8BF7\u66F4\u6539\u7EDF\u4E00\u8303\u56F4");return}P(z(L.SyncImgList));const l={attribute:t.attribute};if(m.secondaryAttributeConfigurable){const c={};(s=m.inputList)==null||s.forEach(f=>{const x=t[f.value];x!==void 0&&Object.assign(c,{[f.value]:x})}),Object.keys(c).length>0&&Object.assign(l,{subAttribute:c})}p&&Object.assign(l,p),P(R(r,l,[t.prevPage-1,t.nextPage-1])),a()},b=Q(()=>{var t;const{prevPage:s,nextPage:l}=d.getFieldsValue(["prevPage","nextPage"]),c=y.filter((x,U)=>X.isInRange(U,[s-1,l-1]));if(!((c==null?void 0:c.length)>0)||!(i==null?void 0:i.info)||((t=i==null?void 0:i.info)==null?void 0:t.trackID)===void 0){E(void 0);return}const f=F.getMaxSizeFromBox({trackID:i.info.trackID,imgList:c});E(f)},[y,i,A]),D=()=>d.submit(),j=()=>{if(!p||!(i==null?void 0:i.info))return;const t={marginRight:16},{length:s,width:l,height:c}=F.transferBox2Kitti(v(v({},i==null?void 0:i.info),p));return e.createElement("div",null,e.createElement("span",{style:t},o("Length"),": ",s.toFixed(h)),e.createElement("span",{style:t},o("Width"),": ",l.toFixed(h)),e.createElement("span",{style:t},o("Height"),": ",c.toFixed(h)),e.createElement(N,{placement:"rightBottom",content:"\u7EDF\u4E00\u5C3A\u5BF8\u4E3A\u8BE5ID\u7684\u6240\u6709\u6807\u6CE8\u6846\u4E2D\u6700\u5927\u7684\u5C3A\u5BF8"},e.createElement($,null)))},S={width:"200px"},I={marginBottom:"24px",display:"flex",alignItems:"center"};return e.createElement(q,{title:o("UnifyParams"),visible:n,onCancel:a,onOk:D,wrapClassName:"labelbee-custom-modal"},e.createElement(u,ne(v({},ae),{form:d,onFinish:C}),e.createElement(u.Item,{name:"id",label:o("UnifyTrackID")},r),e.createElement(u.Item,{label:o("UnifyAttributeRange"),required:!0},e.createElement(u.Item,{style:{display:"inline-block"},rules:O,name:"prevPage",noStyle:!0,initialValue:1},e.createElement(_,{precision:0,min:1,style:{width:"80px"},onChange:()=>b()})),e.createElement("span",{style:{display:"inline-block",width:"24px",textAlign:"center"}},"-"),e.createElement(u.Item,{style:{display:"inline-block"},rules:O,name:"nextPage",noStyle:!0,initialValue:y.length},e.createElement(_,{precision:0,min:1,style:{width:"80px"},onChange:()=>b()})),e.createElement("span",{style:{display:"inline-block",width:"40x",marginLeft:"10px",textAlign:"center"}},o("Page"))),e.createElement(u.Item,{name:"UnifySize",label:o("UnifySize")},j()),e.createElement(u.Item,{label:o("UnifyTag"),required:!0},e.createElement("div",{style:I},e.createElement(k,{text:o("Attribute")}),e.createElement(u.Item,{name:"attribute",noStyle:!0,rules:le},e.createElement(g,{style:S},m.attributeList.map(t=>e.createElement(g.Option,{key:t.value,value:t.value},t.key))))),m.secondaryAttributeConfigurable&&m.inputList.map(t=>{var s;return e.createElement("div",{key:t.value,style:I},e.createElement(k,{text:t.key}),e.createElement(u.Item,{name:t.value,noStyle:!0,required:!1},e.createElement(g,{style:S},(s=t.subSelected)==null?void 0:s.map(l=>e.createElement(g.Option,{key:l.value,value:l.value},l.key)))))}))))},oe=r=>({imgIndex:r.annotation.imgIndex});var ue=G(oe,null,null,{context:T})(ie);export{ue as default};
1
+ import{BatchUpdateResultByTrackID as q}from"../../../../store/annotation/actionCreators.js";import{LabelBeeContext as V,useDispatch as N}from"../../../../store/ctx.js";import{Form as o,Modal as $,InputNumber as C,Radio as O,Select as v,Popover as G,message as H}from"antd";import e,{useState as K,useEffect as Q,useCallback as W}from"react";import{useTranslation as k}from"react-i18next";import{QuestionCircleOutlined as J}from"@ant-design/icons";import{PointCloudUtils as D}from"@labelbee/lb-utils";import{connect as X}from"react-redux";import{useSingleBox as Y}from"../../hooks/useSingleBox.js";import{MathUtils as Z}from"@labelbee/lb-annotation";var ee=Object.defineProperty,te=Object.defineProperties,ne=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable,z=(r,n,a)=>n in r?ee(r,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[n]=a,_=(r,n)=>{for(var a in n||(n={}))re.call(n,a)&&z(r,a,n[a]);if(U)for(var a of U(n))ae.call(n,a)&&z(r,a,n[a]);return r},le=(r,n)=>te(r,ne(n));const ie={labelCol:{span:8},wrapperCol:{span:16}},j=[{required:!0,message:"\u8BF7\u586B\u5199\u4E00\u4E2A\u6570\u5B57"}],ue=[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u5C5E\u6027"}],B=2,M=({text:r})=>e.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}},r),oe=r=>{const{t:n}=k(),{size:a,isMax:s,selectedBox:m}=r;if(!a||!m)return null;const f={marginRight:16},h=_(_({},m),s&&a),{length:l,width:p,height:E}=D.transferBox2Kitti(h);return e.createElement("div",null,e.createElement("span",{style:f},n("Length"),": ",l.toFixed(B)),e.createElement("span",{style:f},n("Width"),": ",p.toFixed(B)),e.createElement("span",{style:f},n("Height"),": ",E.toFixed(B)),e.createElement(G,{placement:"rightBottom",content:`\u7EDF\u4E00\u5C3A\u5BF8\u4E3A\u8BE5ID\u7684\u6240\u6709\u6807\u6CE8\u6846${s?"\u4E2D\u6700\u5927\u7684\u5C3A\u5BF8":"\u4EE5\u5F53\u524D\u5E27\u6846\u5C3A\u5BF8\u4E3A\u6807\u51C6"}`},e.createElement(J,null)))},se=[{value:"current",label:"\u5F53\u524D\u5E27\u5C3A\u5BF8"},{value:"max",label:"\u6700\u5927\u5C3A\u5BF8"},{value:"ignore",label:"\u5FFD\u7565"}],ce=({id:r,visible:n,onCancel:a,config:s,imgList:m,imgIndex:f})=>{const h=N(),{selectedBox:l}=Y(),[p,E]=K(),[g]=o.useForm(),{t:c}=k();Q(()=>{n===!1?(g.resetFields(),E(void 0)):F()},[n]);const R=t=>{var i,u,d,y;if(!r)return;if(!p){H.info("\u8BE5\u8303\u56F4\u4E0D\u5B58\u5728\u66F4\u6539\u6570\u636E, \u8BF7\u66F4\u6539\u7EDF\u4E00\u8303\u56F4");return}const b={attribute:t.attribute};if(s.secondaryAttributeConfigurable){const S={};(i=s.inputList)==null||i.forEach(w=>{const x=t[w.value];if(x!==void 0){const T=Array.isArray(x)?x.join(";"):x;Object.assign(S,{[w.value]:T})}}),Object.keys(S).length>0&&Object.assign(b,{subAttribute:S})}const{UnifySize:P}=t;t.UnifySize!=="ignore"&&Object.assign(b,p&&P==="max"?p:{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:(y=l==null?void 0:l.info)==null?void 0:y.depth}),h(q(r,b,[t.prevPage-1,t.nextPage-1],m)),a()},F=W(()=>{var t;const{prevPage:i,nextPage:u}=g.getFieldsValue(["prevPage","nextPage"]),d=m.filter((b,P)=>Z.isInRange(P,[i-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){E(void 0);return}const y=D.getMaxSizeFromBox({trackID:l.info.trackID,imgList:d});E(y)},[m,l,f]),L=()=>g.submit(),A={width:"200px"},I={marginBottom:"24px",display:"flex",alignItems:"center"};return e.createElement($,{title:c("UnifyParams"),visible:n,onCancel:a,onOk:L,wrapClassName:"labelbee-custom-modal"},e.createElement(e.Fragment,null,e.createElement("div",{style:{marginBottom:"20px",color:"#f00"}},c("UnifyParamsTips")),e.createElement(o,le(_({},ie),{form:g,onFinish:R}),e.createElement(o.Item,{name:"id",label:c("UnifyTrackID")},r),e.createElement(o.Item,{label:c("UnifyAttributeRange"),required:!0},e.createElement(o.Item,{style:{display:"inline-block"},rules:j,name:"prevPage",noStyle:!0,initialValue:1},e.createElement(C,{precision:0,min:1,style:{width:"80px"},onChange:()=>F()})),e.createElement("span",{style:{display:"inline-block",width:"24px",textAlign:"center"}},"-"),e.createElement(o.Item,{style:{display:"inline-block"},rules:j,name:"nextPage",noStyle:!0,initialValue:m.length},e.createElement(C,{precision:0,min:1,style:{width:"80px"},onChange:()=>F()})),e.createElement("span",{style:{display:"inline-block",width:"40x",marginLeft:"10px",textAlign:"center"}},c("Page"))),e.createElement(o.Item,{name:"UnifySize",label:c("UnifySize"),required:!0,initialValue:"current"},e.createElement(O.Group,{onChange:t=>{g.setFieldValue("UnifySize",t.target.value)}},se.map(t=>{const{value:i,label:u}=t;return e.createElement(O,{value:i,key:i},e.createElement("div",null,u),i!=="ignore"&&e.createElement(oe,{selectedBox:l==null?void 0:l.info,size:p,isMax:i==="max"}))}))),e.createElement(o.Item,{label:c("UnifyTag"),required:!0},e.createElement("div",{style:I},e.createElement(M,{text:c("Attribute")}),e.createElement(o.Item,{name:"attribute",noStyle:!0,rules:ue},e.createElement(v,{style:A},s.attributeList.map(t=>e.createElement(v.Option,{key:t.value,value:t.value},t.key))))),s.secondaryAttributeConfigurable&&s.inputList.map(t=>{var i;return e.createElement("div",{key:t.value,style:I},e.createElement(M,{text:t.key}),e.createElement(o.Item,{name:t.value,noStyle:!0,required:!1},e.createElement(v,{style:A,mode:t.isMulti?"multiple":void 0},(i=t.subSelected)==null?void 0:i.map(u=>e.createElement(v.Option,{key:u.value,value:u.value},u.key)))))})))))},me=r=>({imgIndex:r.annotation.imgIndex});var pe=X(me,null,null,{context:V})(ce);export{pe as default};
@@ -1 +1 @@
1
- import g from"classnames";import s,{useState as p,useEffect as v}from"react";import C from"../../PointCloudBackView.js";import P from"../../PointCloudSideView.js";import{getClassName as c}from"../../../../utils/dom.js";import{useTranslation as h}from"react-i18next";const D=y=>{const{t:E}=h(),{selectAndEnlarge:a,checkMode:l}=y,d=360,m=400,f=window.innerWidth-d,u=window.innerHeight-m,[o,n]=p({x:f,y:u}),[i,w]=p({x:0,y:0});v(()=>(window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x),n({x:f,y:u}),w({x:0,y:0})}),[]);const x=()=>{const t=window.innerWidth-d,e=window.innerHeight-m;n({x:t,y:e})};return s.createElement("div",{className:g({[c("point-cloud-container","left-bottom")]:!0,[c("point-cloud-container","left-bottom-float")]:!0}),style:{top:o.y,left:o.x,width:360,height:400,zIndex:a?1003:-1}},s.createElement("div",{className:c("point-cloud-container","left-bottom-floatHeader"),draggable:"true",onDragStart:t=>{a&&w({x:t.clientX-o.x,y:t.clientY-o.y})},onDrag:t=>{const e=t.clientX-i.x,r=t.clientY-i.y;n({x:e,y:r})},onDragEnd:t=>{const e=t.clientX-i.x,r=t.clientY-i.y;n({x:e,y:r})}},E("DragAndDrop")),s.createElement(C,{checkMode:l}),s.createElement(P,{checkMode:l}))};export{D as default};
1
+ import E from"classnames";import r,{useState as p,useEffect as v}from"react";import D from"../../PointCloudBackView.js";import C from"../../PointCloudSideView.js";import{getClassName as c}from"../../../../utils/dom.js";import{useTranslation as P}from"react-i18next";const X=y=>{const{t:g}=P(),{selectAndEnlarge:a,checkMode:l}=y,d=360,m=400,f=window.innerWidth-d,u=window.innerHeight-m,[n,o]=p({x:f,y:u}),[i,w]=p({x:0,y:0});v(()=>(window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x),o({x:f,y:u}),w({x:0,y:0})}),[]);const x=()=>{const t=window.innerWidth-d,e=window.innerHeight-m;o({x:t,y:e})};return r.createElement("div",{className:E({[c("point-cloud-container","left-bottom")]:!0,[c("point-cloud-container","left-bottom-float")]:!0}),style:{top:n.y,left:n.x,width:360,height:400,zIndex:a?1003:-1}},r.createElement("div",{className:c("point-cloud-container","left-bottom-floatHeader"),draggable:"true",onDragStart:t=>{a&&w({x:t.clientX-n.x,y:t.clientY-n.y})},onDragOver:t=>{t.preventDefault()},onDrag:t=>{if(t.clientX===0&&t.clientY===0)return;const e=t.clientX-i.x,s=t.clientY-i.y;o({x:e,y:s})},onDragEnd:t=>{if(t.clientX===0&&t.clientY===0)return;const e=t.clientX-i.x,s=t.clientY-i.y;o({x:e,y:s})}},g("DragAndDrop")),r.createElement(D,{checkMode:l}),r.createElement(C,{checkMode:l}))};export{X as default};
@@ -1 +1 @@
1
- import{PointCloudContext as r}from"../PointCloudContext.js";import{useContext as s}from"react";const v=()=>{const{topViewInstance:t,sideViewInstance:d,backViewInstance:a,mainViewInstance:i}=s(r);return{syncAllViewsConfig:n=>{[t,d,a].forEach(e=>{var o,l;e==null||e.updateConfig(n);const u=(l=(o=n==null?void 0:n.attributeList)==null?void 0:o[0])==null?void 0:l.value;u&&(e==null||e.pointCloud2dOperation.setDefaultAttribute(u))}),i==null||i.setConfig(n)},reRenderTopViewRange:n=>{var e,o,l;(o=(e=t==null?void 0:t.pointCloudInstance)==null?void 0:e.generateRange)==null||o.call(e,n),(l=t==null?void 0:t.pointCloudInstance)==null||l.render()}}};export{v as useConfig};
1
+ import{PointCloudContext as a}from"../PointCloudContext.js";import{useContext as s}from"react";const p=()=>{const{topViewInstance:n,sideViewInstance:u,backViewInstance:r,mainViewInstance:i}=s(a);return{syncAllViewsConfig:o=>{[n,u,r].forEach(e=>{var t,l;e==null||e.updateConfig(o);const d=(l=(t=o==null?void 0:o.attributeList)==null?void 0:t[0])==null?void 0:l.value;d&&(e==null||e.pointCloud2dOperation.setDefaultAttribute(d))}),i==null||i.setConfig(o)},reRenderTopViewRange:o=>{var e,t,l;(t=(e=n==null?void 0:n.pointCloudInstance)==null?void 0:e.generateRange)==null||t.call(e,o),(l=n==null?void 0:n.pointCloudInstance)==null||l.render()},reRenderTopViewTipScopeList:(o=[])=>{var e,t,l;(t=(e=n==null?void 0:n.pointCloudInstance)==null?void 0:e.generateTipScopeList)==null||t.call(e,o),(l=n==null?void 0:n.pointCloudInstance)==null||l.render()}}};export{p as useConfig};
@@ -1 +1 @@
1
- import{useContext as C,useCallback as y}from"react";import{PointCloudContext as I}from"../PointCloudContext.js";var x=(s,g,t)=>new Promise((a,h)=>{var e=i=>{try{o(t.next(i))}catch(l){h(l)}},d=i=>{try{o(t.throw(i))}catch(l){h(l)}},o=i=>i.done?a(i.value):Promise.resolve(i.value).then(e,d);o((t=t.apply(s,g)).next())});const L=({currentData:s})=>{var g;const{mainViewInstance:t,topViewInstance:a,pointCloudBoxList:h,highlight2DDataList:e,setHighlight2DDataList:d}=C(I),o=(g=s==null?void 0:s.mappingImgList)!=null?g:[],i=(r,c,v)=>x(void 0,null,function*(){var p;let u=[...e];if(e.find(n=>n.url===r)?u=e.filter(n=>n.url!==r):u.push({url:r,fallbackUrl:c,calib:v}),d(u),!t||(o==null?void 0:o.length)===0)return;const m=t.pointCloudObject;if(!m)return;const f=yield t.getHighlightIndexByMappingImgList({mappingImgList:u,points:m.geometry.attributes.position.array});try{const n=yield t.highlightOriginPointCloud(h,f);n&&((p=a==null?void 0:a.pointCloudInstance)==null||p.updateColor(n))}catch(n){console.error("toggle2dVisible highlightOriginPointCloud error:",n)}}),l=y(r=>e.findIndex(c=>c.url===r)>=0,[e]);return{toggle2dVisible:i,isHighlightVisible:l}};export{L as useHighlight};
1
+ import{useContext as I,useCallback as y}from"react";import{PointCloudContext as x}from"../PointCloudContext.js";var L=(s,g,t)=>new Promise((u,a)=>{var o=i=>{try{e(t.next(i))}catch(l){a(l)}},d=i=>{try{e(t.throw(i))}catch(l){a(l)}},e=i=>i.done?u(i.value):Promise.resolve(i.value).then(o,d);e((t=t.apply(s,g)).next())});const b=({currentData:s})=>{var g;const{mainViewInstance:t,topViewInstance:u,pointCloudBoxList:a,highlight2DDataList:o,setHighlight2DDataList:d}=I(x),e=(g=s==null?void 0:s.mappingImgList)!=null?g:[],i=(r,c,v)=>L(void 0,null,function*(){var p;let h=[...o];if(o.find(n=>n.url===r)?h=o.filter(n=>n.url!==r):h.push({url:r,fallbackUrl:c,calib:v}),d(h),!t||(e==null?void 0:e.length)===0)return;const m=t.pointCloudObject;if(!m)return;const C=yield t.getHighlightIndexByMappingImgList({mappingImgList:h,points:m.geometry.attributes.position.array});try{const n=yield t.highlightOriginPointCloud(a,C),{color:f}=n!=null?n:{};f&&((p=u==null?void 0:u.pointCloudInstance)==null||p.updateColor(f))}catch(n){console.error("toggle2dVisible highlightOriginPointCloud error:",n)}}),l=y(r=>o.findIndex(c=>c.url===r)>=0,[o]);return{toggle2dVisible:i,isHighlightVisible:l}};export{b as useHighlight};
@@ -0,0 +1 @@
1
+ import{useContext as j}from"react";import{PointCloudContext as v}from"../PointCloudContext.js";import{useUpdatePointCloudColor as O}from"./useUpdatePointCloudColor.js";import{useAttribute as g}from"./useAttribute.js";import{usePolygon as w}from"./usePolygon.js";import{useLine as S}from"./useLine.js";import{useSphere as c}from"./useSphere.js";import{useHistory as b}from"./useHistory.js";import{usePointCloudViews as V}from"./usePointCloudViews.js";var U=Object.defineProperty,x=Object.defineProperties,L=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,m=(o,e,t)=>e in o?U(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,n=(o,e)=>{for(var t in e||(e={}))H.call(e,t)&&m(o,t,e[t]);if(P)for(var t of P(e))I.call(e,t)&&m(o,t,e[t]);return o},i=(o,e)=>x(o,L(e));const A=(o,e)=>{const{updatePointCloudColor:t}=O(o,e),{syncThreeViewsAttribute:f}=g(),{selectedPolygon:p}=w(),{selectedLine:u}=S(),{selectedSphere:s}=c(),{updatePointCloudSphere:C}=c(),{pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdateLine:y}=b(),{topViewSelectedChanged:h}=V(),a=j(v);return{updatePointCloudAttribute:r=>{var l;if(f(r),t(r),p&&_(i(n({},p),{attribute:r})),u&&y(i(n({},u),{attribute:r})),s){const d=C(i(n({},s),{attribute:r}));a.mainViewInstance&&((l=a.mainViewInstance)==null||l.generateSpheres(d),h({newSelectedSphere:s,newSphereList:d}))}}}};export{A as usePointCloudAttribute};
@@ -1 +1 @@
1
- import{EPointCloudName as st,TagUtils as oo,MathUtils as w,getCuboidFromPointCloudBox as eo}from"@labelbee/lb-annotation";import{EPerspectiveView as X,PointCloudUtils as O,POINT_CLOUD_DEFAULT_STEP as no,DEFAULT_SPHERE_PARAMS as io}from"@labelbee/lb-utils";import{useContext as mt,useCallback as ht}from"react";import{PointCloudContext as xt}from"../PointCloudContext.js";import{useSingleBox as so}from"./useSingleBox.js";import{useSphere as ro}from"./useSphere.js";import{pick as lo}from"lodash";import{useSelector as ao,useDispatch as co}from"../../../store/ctx.js";import uo from"../../../utils/StepUtils.js";import{EPointCloudBoxRenderTrigger as rt}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{jsonParser as lt,generatePointCloudBoxRects as po}from"../../../utils/index.js";import{PreDataProcess as dt,SetAnnotationLoading as Lt,SetLoadPCDFileLoading as vt}from"../../../store/annotation/actionCreators.js";import{useHistory as go}from"./useHistory.js";import{usePolygon as fo}from"./usePolygon.js";import{useLatest as $}from"ahooks";var Co=Object.defineProperty,Po=Object.defineProperties,mo=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,ho=Object.prototype.hasOwnProperty,xo=Object.prototype.propertyIsEnumerable,Bt=(e,n,t)=>n in e?Co(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,L=(e,n)=>{for(var t in n||(n={}))ho.call(n,t)&&Bt(e,t,n[t]);if(yt)for(var t of yt(n))xo.call(n,t)&&Bt(e,t,n[t]);return e},A=(e,n)=>Po(e,mo(n)),bt=(e,n,t)=>new Promise((d,p)=>{var o=a=>{try{u(t.next(a))}catch(h){p(h)}},f=a=>{try{u(t.throw(a))}catch(h){p(h)}},u=a=>a.done?d(a.value):Promise.resolve(a.value).then(o,f);u((t=t.apply(e,n)).next())});const tt=5,ot=90,wt=.01,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},at=(e,n,t,d,p)=>{const{x:o,y:f}=O.transferCanvas2World(e,n),{defaultZ:u}=io,a={center:{x:o,y:f,z:u},id:e.id},h=d?L(L({},d),a):A(L({},a),{attribute:"",valid:!0});return p&&Object.assign(h,p),h},ct=(e,n,t,d,p,o)=>{let f=e.pointList.map(I=>O.transferCanvas2World(I,n)),u=0,a=1,h={};if(t){const I=t.getSensesPointZAxisInPolygon(f,void 0,o);o&&I.fittedCoordinates.length>0&&(f=I.fittedCoordinates),u=(I.maxZ+I.minZ)/2,a=I.maxZ-I.minZ,h={count:I.zCount}}const[P,v,T]=f,V=w.getLineCenterPoint([P,T]),D=w.getLineLength(P,v),U=w.getLineLength(v,T),N=w.getRadiusFromQuadrangle(e.pointList);d&&(u=d.center.z,a=d.depth);const z={center:{x:V.x,y:V.y,z:u},width:o?U+wt:U,height:o?D+wt:D,depth:a,rotation:N,id:e.id},j=L(d?L(L({},d),z):A(L({},z),{attribute:"",valid:!0}),h);p&&Object.assign(j,p);const M=f.map(I=>O.transferWorld2Canvas(I,n));return{boxParams:j,newPointList:M}},It=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(L({},t),{center:{x:t.center.x-d.x,y:t.center.y,z:t.center.z-d.y}})},Dt=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),v=w.getLineCenterPoint([u,h]),V={x:{x:P.x-v.x,y:P.y-v.y}.x,y:0,z:P.y-v.y},D=w.getLineLength(p,o),U=w.getLineLength(u,a),N=D-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),M=z-j,{newBoxParams:I}=d.getNewBoxBySideUpdate(V,M,N,t);return I},Lo=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(L({},t),{center:{x:t.center.x,y:t.center.y-d.x,z:t.center.z-d.y}})},vo=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),v=w.getLineCenterPoint([u,h]),V={x:{x:P.x-v.x,y:P.y-v.y}.x,y:0,z:P.y-v.y},D=w.getLineLength(p,o),U=w.getLineLength(u,a),N=D-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),M=z-j;let{newBoxParams:I}=d.getNewBoxByBackUpdate(V,M,N,t);return I},St=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:ot);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Left);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(L(L({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Rt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{width:tt,depth:tt});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Left);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxSidePolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},_t=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:ot);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Back);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(L(L({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Vt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{height:tt,depth:tt});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Back);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxBackPolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},kt=(e,n,t,d)=>{if(!t||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,X.Top),d.render();const{toolInstance:p,pointCloudInstance:o}=t,{point2d:f}=o.getSphereTopPoint2DCoordinate(e),u=[...p.pointList].map(a=>a.id===n.id?A(L(L({},n),f),{valid:e.valid,textAttribute:"",attribute:e.attribute}):a);p.setResult(u),p.setSelectedID(n.id)},ut=(e,n,t,d)=>{var p,o;if(!t||!d)return;d.generateBox(e),d.setHighlightColor(e.id),d.render();const{pointCloud2dOperation:f,pointCloudInstance:u}=t,{polygon2d:a}=u.getBoxTopPolygon2DCoordinate(e),h=[...f.polygonList],P=h.find(v=>v.id===n.id);P?(P.pointList=a,P.valid=(p=e.valid)!=null?p:!0):h.push({id:n.id,pointList:a,textAttribute:"",isRect:!0,valid:(o=e.valid)!=null?o:!0}),f.setResultAndSelectedID(h,n.id)},yo=e=>{const n=mt(xt),{topViewInstance:t,sideViewInstance:d,backViewInstance:p,mainViewInstance:o,addPointCloudBox:f,addPointCloudSphere:u,setSelectedIDs:a,selectedIDs:h,pointCloudBoxList:P,pointCloudSphereList:v,hideAttributes:T,setHighlight2DDataList:V,cuboidBoxIn2DView:D,imageSizes:U,history:N,linkageImageNameRectMap:z}=n,{addHistory:j,initHistory:M,pushHistoryUnderUpdatePolygon:I}=go(),{selectedPolygon:Ot}=fo(),{getPointCloudSphereByID:At,updatePointCloudSphere:pt,selectedSphere:Y}=ro(),{currentData:F,config:B}=ao(s=>{const{stepList:i,step:c,imgList:r,imgIndex:l}=s.annotation;return{currentData:r[l],config:lt(uo.getCurrentStepInfo(c,i).config)}}),H=co(),Tt=$(D),Ut=$(z),zt=ht((s,i)=>{const c=Ut.current,r=i.id;return s.filter(g=>{if(!g)return!1;const C=c.get(g.imageName);return C===void 0?!0:Boolean(C.get(r))})},[]),et=s=>{const{enableAutoMap2DRect:i=!1}=B;if(!Tt.current||i){const{mappingImgList:c=[]}=F;po({pointCloudBox:s,mappingImgList:c,imageSizes:U},{prepareRectsFn:zt})}},{selectedBox:k,updateSelectedBox:Nt,updateSelectedBoxes:nt,getPointCloudByID:jt}=so({generateRects:et}),gt=k==null?void 0:k.info;if(!t||!d||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:it}=t,Et=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},Mt=({newPoint:s,size:i,zoom:c,trackConfigurable:r})=>{var l;const g={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(g,{trackID:O.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const C=at(s,i,it,void 0,g);a(s.id);const m=u(C);G(y.Top,s,C,c,m,B),j({newSphereParams:C})},Ht=({polygon:s,size:i,imgList:c,trackConfigurable:r,zoom:l,intelligentFit:g})=>{var C,m,b;const S={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(S,{trackID:O.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:v})});const _=t==null?void 0:t.toolInstance,R=L({},s);let{boxParams:x,newPointList:E}=ct(R,i,it,void 0,S,g);x=H(dt({tool:st.PointCloud,dataList:[x],stepConfig:B,action:"viewUpdateBox"}))[0],g&&(E==null?void 0:E.length)&&(R.pointList=E);const Z=T.includes(R.attribute);et(x);const Q=f(x),q=(m=n==null?void 0:n.polygonList)!=null?m:[];x.subAttribute=oo.getDefaultResultByConfig((B==null?void 0:B.secondaryAttributeConfigurable)?(b=B==null?void 0:B.inputList)!=null?b:[]:[]),t==null||t.updatePolygonList(Q!=null?Q:[],q),Z?a([]):(a(x.id),_.selection.setSelectedIDs(R.id),W({omitView:y.Top,polygon:R,boxParams:x,zoom:l,newPointCloudBoxList:Q}),g&&ut(x,R,t,o)),j({newBoxParams:x})},Ft=s=>{const{boxID:i,imageName:c,width:r,height:l,x:g,y:C}=s,m=P.find(x=>x.id===i);if(!(m==null?void 0:m.rects)||!m.rects.find(x=>x.imageName===c))return;const S=m.rects.map(x=>x.imageName===c?A(L({},x),{width:r,height:l,x:g,y:C}):x),_=A(L({},m),{rects:S}),R=P.map(x=>x.id===i?_:x);return t==null||t.updatePolygonList(R!=null?R:[]),R},Wt=s=>{const{boxID:i,imageName:c}=s,r=P.find(m=>m.id===i);if(!(r==null?void 0:r.rects))return;const l=r.rects.filter(m=>m.imageName!==c),g=A(L({},r),{rects:l}),C=P.map(m=>m.id===i?g:m);return t==null||t.updatePolygonList(C!=null?C:[]),C},Zt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:c,newSphereList:r})=>{var l;const g=t==null?void 0:t.toolInstance;if(!(h.length===0||!g)){if(s||(k==null?void 0:k.info)){const C=s!=null?s:k==null?void 0:k.info;(l=g==null?void 0:g.selection)==null||l.setSelectedIDs(h[0]);const m=g.selectedPolygon;if(h.length===1&&C){W({omitView:y.Top,polygon:m,boxParams:C,newPointCloudBoxList:i});return}}if((c||Y)&&h.length===1){const C=c!=null?c:Y;g.setSelectedID(h[0]);const m=g.selectedPoint;C&&G(y.Top,m,C,void 0,r,B)}}},ft=(s,i,c)=>{if(gt){let r,l;switch(c){case y.Back:r=vo;break;case y.Side:r=Dt;break;default:r=Dt;break}if(l=r(s,i,gt,d.pointCloudInstance),o){const{count:S}=o.getSensesPointZAxisInPolygon(eo(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=A(L({},l),{count:S})}const C=H(dt({tool:st.PointCloud,dataList:[l],stepConfig:B,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;l=C;const b=Nt(l);return l=b.find(S=>S.id===l.id),W({omitView:m?void 0:c,polygon:s,boxParams:l,newPointCloudBoxList:b}),b}},Ct=(s,i,c)=>{if(Y){let r,l;switch(c){case y.Back:r=Lo;break;case y.Side:r=It;break;default:r=It;break}l=r(s,i,Y);const g=pt(l);return G(c,s,l,void 0,g,B),g}},Gt=(s,i)=>{Ct(s,i,y.Side)},Jt=(s,i)=>{Ct(s,i,y.Back)},Qt=(s,i)=>{ft(s,i,y.Side)},Xt=(s,i)=>{ft(s,i,y.Back)},Yt=(s,i)=>{const c=At(s.id),r=at(s,i,it,c),l=pt(r);G(y.Top,s,r,void 0,l,B)},qt=(s,i)=>{if(Ot){const r=L({},s[0].newPolygon);r.pointList=r.pointList.map(l=>O.transferCanvas2World(l,i)),I(r);return}let c=s.map(({newPolygon:r})=>{const l=jt(r.id),{boxParams:g}=ct(r,i,t.pointCloudInstance,l);return g});if(c=H(dt({tool:st.PointCloud,dataList:c,stepConfig:B,action:"viewUpdateBox"})),c.length===1){const{newPolygon:r}=s[0],l=nt(c);W({polygon:r,boxParams:c[0],newPointCloudBoxList:l})}else{const r=nt(c);r&&n.syncAllViewPointCloudColor(rt.MultiMove,r)}},Kt=s=>{var i,c,r,l,g;if(k){const C=Number(s.widthDefault),m=Number(s.depthDefault),b=Number(s.heightDefault),S=k==null?void 0:k.info.trackID,R=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(K=>(K==null?void 0:K.trackID)===S),x={width:(r=(c=t==null?void 0:t.toolInstance)==null?void 0:c.basicImgInfo)==null?void 0:r.width,height:(g=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:g.height},E=R.pointList.map(K=>O.transferCanvas2World(K,x)),J=w.getModifiedRectangleCoordinates(E,b,C),Z=J[0],Q=J[2],q=w.getLineCenterPoint([Z,Q]),$t=k.info.center.z-k.info.depth/2,Pt=A(L({},k.info),{center:{x:q.x,y:q.y,z:$t+m/2},width:C,height:b,depth:m,valid:!0}),to=nt([Pt]);W({omitView:y["3D"],polygon:R,boxParams:Pt,newPointCloudBoxList:to})}},G=(s,i,c,r,l,g)=>bt(void 0,null,function*(){const C=F==null?void 0:F.url,m={[y.Side]:()=>{St(c,i,d,C,g)},[y.Back]:()=>{p&&_t(c,i,p,C,g)},[y.Top]:()=>{kt(c,i,t,o)}};Object.keys(m).forEach(b=>{b!==s&&m[b]()}),r&&(o==null||o.updateCameraZoom(r)),Et(c)}),W=(s,i=rt.Default)=>{const{omitView:c,polygon:r,boxParams:l,zoom:g,newPointCloudBoxList:C}=s,m=F==null?void 0:F.url;C&&n.syncAllViewPointCloudColor(i,C);const b={[y.Side]:()=>{Rt(l,r,d,m)},[y.Back]:()=>{p&&Vt(l,r,p,m)},[y.Top]:()=>{ut(l,r,t,o)}};Object.keys(b).forEach(S=>{S!==c&&b[S]()}),g&&(o==null||o.updateCameraZoom(g))};return{topViewAddSphere:Mt,topViewAddBox:Ht,topViewSelectedChanged:Zt,topViewUpdatePoint:Yt,sideViewUpdatePoint:Gt,backViewUpdatePoint:Jt,topViewUpdateBox:qt,sideViewUpdateBox:Qt,backViewUpdateBox:Xt,syncPointCloudViews:W,syncPointCloudPoint:G,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=O.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>bt(void 0,[...s],function*(i=F){var c,r,l,g,C,m,b,S;if(!(i==null?void 0:i.url)||!o)return;V([]),Lt(H,!0),vt(H,!0),(c=e==null?void 0:e.setResourceLoading)==null||c.call(e,!0),yield o.loadPCDFile(i.url,(r=B==null?void 0:B.radius)!=null?r:ot),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let _=[],R=[],x=[],E=[];o.updateTopCamera();const J=(g=(l=lt(i.result))==null?void 0:l.valid)!=null?g:!0;if(n.setPointCloudValid(J),(C=n.sideViewInstance)==null||C.clearAllData(),(m=n.backViewInstance)==null||m.clearAllData(),i.result){if(_=O.getBoxParamsFromResultList(i.result),(_==null?void 0:_.length)>0&&i.isPreResult&&(B==null?void 0:B.lowerLimitPointsNumInBox)>0){_=yield o==null?void 0:o.filterPreResult(i.url,B,_);const Z=lt(i.result);Z[no].result=_,i.result=JSON.stringify(Z),n.setPointCloudResult(_)}x=O.getPolygonListFromResultList(i.result),R=O.getLineListFromResultList(i.result),E=O.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(b=B==null?void 0:B.radius)!=null?b:ot}),o==null||o.generateBoxes(_),o==null||o.generateSpheres(E),yield n.syncAllViewPointCloudColor(rt.Default,_,[])}M({pointCloudBoxList:_,polygonList:x,lineList:R,pointCloudSphereList:E}),Lt(H,!1),vt(H,!1),(S=e==null?void 0:e.setResourceLoading)==null||S.call(e,!1)}),updateViewsByDefaultSize:Kt,generateRects:et,update2DViewRect:Ft,remove2DViewRect:Wt}},Bo=()=>{const{pointCloudBoxList:e,rectList:n,setPointCloudResult:t}=mt(xt),d=$(e),p=$(n);return{syncToPointCloudBoxList:ht(()=>{const f=d.current,u=p.current;if(u.length===0)return null;const a=new Map,h=new Set;if(u.filter(P=>P.extId!==void 0).forEach(P=>{const v=P.extId,T=P.imageName,V=lo(P,["x","y","width","height"]);let D=a.get(v);D||(D=new Map,a.set(v,D)),D.set(T,V),h.add(v)}),a.size){const P=f.map(v=>{var T;const V=v.id;if(h.has(V)){const D=L({},v);return(T=D.rects)==null||T.forEach(U=>{var N;const z=U.imageName;Object.assign(U,(N=a.get(V))==null?void 0:N.get(z))}),D}return v});return t(P),P}return null},[])}};export{_t as syncBackViewByPoint,St as syncSideViewByPoint,kt as syncTopViewByPoint,Vt as synchronizeBackView,Rt as synchronizeSideView,ut as synchronizeTopView,at as topViewPoint2PointCloud,ct as topViewPolygon2PointCloud,yo as usePointCloudViews,Bo as useSyncRectPositionDimensionToPointCloudList};
1
+ import{EPointCloudName as st,TagUtils as oo,MathUtils as w,getCuboidFromPointCloudBox as eo}from"@labelbee/lb-annotation";import{EPerspectiveView as X,PointCloudUtils as O,POINT_CLOUD_DEFAULT_STEP as no,DEFAULT_SPHERE_PARAMS as io}from"@labelbee/lb-utils";import{useContext as mt,useCallback as ht}from"react";import{PointCloudContext as xt}from"../PointCloudContext.js";import{useSingleBox as so}from"./useSingleBox.js";import{useSphere as ro}from"./useSphere.js";import{pick as lo}from"lodash";import{useSelector as ao,useDispatch as co}from"../../../store/ctx.js";import uo from"../../../utils/StepUtils.js";import{EPointCloudBoxRenderTrigger as F}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{jsonParser as rt,generatePointCloudBoxRects as po}from"../../../utils/index.js";import{PreDataProcess as lt,SetAnnotationLoading as Lt,SetLoadPCDFileLoading as vt}from"../../../store/annotation/actionCreators.js";import{useHistory as go}from"./useHistory.js";import{usePolygon as fo}from"./usePolygon.js";import{useLatest as K}from"ahooks";var Co=Object.defineProperty,Po=Object.defineProperties,mo=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,ho=Object.prototype.hasOwnProperty,xo=Object.prototype.propertyIsEnumerable,Bt=(e,n,t)=>n in e?Co(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,x=(e,n)=>{for(var t in n||(n={}))ho.call(n,t)&&Bt(e,t,n[t]);if(yt)for(var t of yt(n))xo.call(n,t)&&Bt(e,t,n[t]);return e},A=(e,n)=>Po(e,mo(n)),bt=(e,n,t)=>new Promise((d,p)=>{var o=a=>{try{u(t.next(a))}catch(h){p(h)}},f=a=>{try{u(t.throw(a))}catch(h){p(h)}},u=a=>a.done?d(a.value):Promise.resolve(a.value).then(o,f);u((t=t.apply(e,n)).next())});const $=5,tt=90,It=.01,b={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},dt=(e,n,t,d,p)=>{const{x:o,y:f}=O.transferCanvas2World(e,n),{defaultZ:u}=io,a={center:{x:o,y:f,z:u},id:e.id},h=d?x(x({},d),a):A(x({},a),{attribute:"",valid:!0});return p&&Object.assign(h,p),h},at=(e,n,t,d,p,o)=>{let f=e.pointList.map(S=>O.transferCanvas2World(S,n)),u=0,a=1,h={};if(t){const S=t.getSensesPointZAxisInPolygon(f,void 0,o);o&&S.fittedCoordinates.length>0&&(f=S.fittedCoordinates),u=(S.maxZ+S.minZ)/2,a=S.maxZ-S.minZ,h={count:S.zCount}}const[P,L,T]=f,V=w.getLineCenterPoint([P,T]),R=w.getLineLength(P,L),U=w.getLineLength(L,T),N=w.getRadiusFromQuadrangle(e.pointList);d&&(u=d.center.z,a=d.depth);const z={center:{x:V.x,y:V.y,z:u},width:o?U+It:U,height:o?R+It:R,depth:a,rotation:N,id:e.id},j=x(d?x(x({},d),z):A(x({},z),{attribute:"",valid:!0}),h);p&&Object.assign(j,p);const E=f.map(S=>O.transferWorld2Canvas(S,n));return{boxParams:j,newPointList:E}},wt=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(x({},t),{center:{x:t.center.x-d.x,y:t.center.y,z:t.center.z-d.y}})},St=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),L=w.getLineCenterPoint([u,h]),V={x:{x:P.x-L.x,y:P.y-L.y}.x,y:0,z:P.y-L.y},R=w.getLineLength(p,o),U=w.getLineLength(u,a),N=R-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),E=z-j,{newBoxParams:S}=d.getNewBoxBySideUpdate(V,E,N,t);return S},Lo=(e,n,t)=>{const d={x:e.x-n.x,y:e.y-n.y};return A(x({},t),{center:{x:t.center.x,y:t.center.y-d.x,z:t.center.z-d.y}})},vo=(e,n,t,d)=>{const[p,o,f]=e.pointList,[u,a,h]=n.pointList,P=w.getLineCenterPoint([p,f]),L=w.getLineCenterPoint([u,h]),V={x:{x:P.x-L.x,y:P.y-L.y}.x,y:0,z:P.y-L.y},R=w.getLineLength(p,o),U=w.getLineLength(u,a),N=R-U,z=w.getLineLength(o,f),j=w.getLineLength(a,h),E=z-j;let{newBoxParams:S}=d.getNewBoxByBackUpdate(V,E,N,t);return S},Dt=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:tt);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Left);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(x(x({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Rt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{width:$,depth:$});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Left);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxSidePolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},_t=(e,n,t,d,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(d,(o=p==null?void 0:p.radius)!=null?o:tt);const{cameraPositionVector:a}=u.updateOrthoCameraBySphere(e,X.Back);u.setInitCameraPosition(a);const{point2d:h,zoom:P}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(x(x({},n),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Vt=(e,n,t,d)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(d,e,{height:$,depth:$});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Back);o.setInitCameraPosition(f);const{polygon2d:u,zoom:a}=o.getBoxBackPolygon2DCoordinate(e);o.camera.zoom=a,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(a),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},kt=(e,n,t,d)=>{if(!t||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,X.Top),d.render();const{toolInstance:p,pointCloudInstance:o}=t,{point2d:f}=o.getSphereTopPoint2DCoordinate(e),u=[...p.pointList].map(a=>a.id===n.id?A(x(x({},n),f),{valid:e.valid,textAttribute:"",attribute:e.attribute}):a);p.setResult(u),p.setSelectedID(n.id)},ct=(e,n,t,d)=>{var p,o;if(!t||!d)return;d.generateBox(e),d.setHighlightColor(e.id),d.render();const{pointCloud2dOperation:f,pointCloudInstance:u}=t,{polygon2d:a}=u.getBoxTopPolygon2DCoordinate(e),h=[...f.polygonList],P=h.find(L=>L.id===n.id);P?(P.pointList=a,P.valid=(p=e.valid)!=null?p:!0):h.push({id:n.id,pointList:a,textAttribute:"",isRect:!0,valid:(o=e.valid)!=null?o:!0}),f.setResultAndSelectedID(h,n.id)},yo=e=>{const n=mt(xt),{topViewInstance:t,sideViewInstance:d,backViewInstance:p,mainViewInstance:o,addPointCloudBox:f,addPointCloudSphere:u,setSelectedIDs:a,selectedIDs:h,pointCloudBoxList:P,pointCloudSphereList:L,hideAttributes:T,setHighlight2DDataList:V,cuboidBoxIn2DView:R,imageSizes:U,history:N,linkageImageNameRectMap:z}=n,{addHistory:j,initHistory:E,pushHistoryUnderUpdatePolygon:S}=go(),{selectedPolygon:Ot}=fo(),{getPointCloudSphereByID:At,updatePointCloudSphere:ut,selectedSphere:Y}=ro(),{currentData:W,config:y}=ao(s=>{const{stepList:i,step:c,imgList:l,imgIndex:g}=s.annotation;return{currentData:l[g],config:rt(uo.getCurrentStepInfo(c,i).config)}}),M=co(),Tt=K(R),Ut=K(z),zt=ht((s,i)=>{const c=Ut.current,l=i.id;return s.filter(r=>{if(!r)return!1;const m=c.get(r.imageName);return m===void 0?!0:Boolean(m.get(l))})},[]),ot=s=>{const{enableAutoMap2DRect:i=!1}=y;if(!Tt.current||i){const{mappingImgList:c=[]}=W;po({pointCloudBox:s,mappingImgList:c,imageSizes:U},{prepareRectsFn:zt})}},{selectedBox:k,updateSelectedBox:Nt,updateSelectedBoxes:et,getPointCloudByID:jt}=so({generateRects:ot}),pt=k==null?void 0:k.info;if(!t||!d||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:nt}=t,Et=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},Mt=({newPoint:s,size:i,zoom:c,trackConfigurable:l})=>{var g;const r={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};l===!0&&Object.assign(r,{trackID:O.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:L})});const m=dt(s,i,nt,void 0,r);a(s.id);const C=u(m);J(b.Top,s,m,c,C,y),j({newSphereParams:m})},Ht=({polygon:s,size:i,imgList:c,trackConfigurable:l,zoom:g,intelligentFit:r})=>{var m,C,D;const _={attribute:(m=t.toolInstance.defaultAttribute)!=null?m:""};l===!0&&Object.assign(_,{trackID:O.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:L})}),t==null||t.toolInstance;const v=x({},s);let{boxParams:I,newPointList:B}=at(v,i,nt,void 0,_,r);I=M(lt({tool:st.PointCloud,dataList:[I],stepConfig:y,action:"viewUpdateBox"}))[0],r&&(B==null?void 0:B.length)&&(v.pointList=B);const G=T.includes(v.attribute);ot(I);const H=f(I),it=(C=n==null?void 0:n.polygonList)!=null?C:[];I.subAttribute=oo.getDefaultResultByConfig((y==null?void 0:y.secondaryAttributeConfigurable)?(D=y==null?void 0:y.inputList)!=null?D:[]:[]),t==null||t.updatePolygonList(H!=null?H:[],it,!1),G?a([]):(a(I.id),r&&ct(I,v,t,o)),j({newBoxParams:I})},Ft=s=>{const{boxID:i,imageName:c,width:l,height:g,x:r,y:m}=s,C=P.find(B=>B.id===i);if(!(C==null?void 0:C.rects)||!C.rects.find(B=>B.imageName===c))return;const _=C.rects.map(B=>B.imageName===c?A(x({},B),{width:l,height:g,x:r,y:m}):B),v=A(x({},C),{rects:_}),I=P.map(B=>B.id===i?v:B);return t==null||t.updatePolygonList(I!=null?I:[]),I},Wt=s=>{const{boxID:i,imageName:c}=s,l=P.find(C=>C.id===i);if(!(l==null?void 0:l.rects))return;const g=l.rects.filter(C=>C.imageName!==c),r=A(x({},l),{rects:g}),m=P.map(C=>C.id===i?r:C);return t==null||t.updatePolygonList(m!=null?m:[]),m},Zt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:c,newSphereList:l})=>{var g;const r=t==null?void 0:t.toolInstance;if(!(h.length===0||!r)){if(s||(k==null?void 0:k.info)){const m=s!=null?s:k==null?void 0:k.info;(g=r==null?void 0:r.selection)==null||g.setSelectedIDs(h[0]);const C=r.selectedPolygon;if(h.length===1&&m){Q({omitView:b.Top,polygon:C,boxParams:m,newPointCloudBoxList:i});return}}if((c||Y)&&h.length===1){const m=c!=null?c:Y;r.setSelectedID(h[0]);const C=r.selectedPoint;m&&J(b.Top,C,m,void 0,l,y)}}},gt=(s,i,c,l=F.Default)=>{if(pt){let g,r;switch(c){case b.Back:g=vo;break;case b.Side:g=St;break;default:g=St;break}if(r=g(s,i,pt,d.pointCloudInstance),o){const{count:v}=o.getSensesPointZAxisInPolygon(eo(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=A(x({},r),{count:v})}const C=M(lt({tool:st.PointCloud,dataList:[r],stepConfig:y,action:"viewUpdateBox"}))[0],D=r.valid!==C.valid;r=C;const _=Nt(r);return r=_.find(v=>v.id===r.id),Q({omitView:D?void 0:c,polygon:s,boxParams:r,newPointCloudBoxList:_},l),_}},ft=(s,i,c)=>{if(Y){let l,g;switch(c){case b.Back:l=Lo;break;case b.Side:l=wt;break;default:l=wt;break}g=l(s,i,Y);const r=ut(g);return J(c,s,g,void 0,r,y),r}},Gt=(s,i)=>{ft(s,i,b.Side)},Jt=(s,i)=>{ft(s,i,b.Back)},Qt=(s,i)=>{gt(s,i,b.Side,F.Single)},Xt=(s,i)=>{gt(s,i,b.Back,F.Single)},Yt=(s,i)=>{const c=At(s.id),l=dt(s,i,nt,c),g=ut(l);J(b.Top,s,l,void 0,g,y)},qt=(s,i)=>{if(Ot){const l=x({},s[0].newPolygon);l.pointList=l.pointList.map(g=>O.transferCanvas2World(g,i)),S(l);return}let c=s.map(({newPolygon:l})=>{const g=jt(l.id),{boxParams:r}=at(l,i,t.pointCloudInstance,g);return r});if(c=M(lt({tool:st.PointCloud,dataList:c,stepConfig:y,action:"viewUpdateBox"})),c.length===1){const{newPolygon:l}=s[0],g=et(c);Q({polygon:l,boxParams:c[0],newPointCloudBoxList:g},F.Single)}else{const l=et(c);l&&n.syncAllViewPointCloudColor(F.MultiMove,l)}},Kt=s=>{var i,c,l,g,r;if(k){const m=Number(s.widthDefault),C=Number(s.depthDefault),D=Number(s.heightDefault),_=k==null?void 0:k.info.trackID,I=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(q=>(q==null?void 0:q.trackID)===_),B={width:(l=(c=t==null?void 0:t.toolInstance)==null?void 0:c.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},Z=I.pointList.map(q=>O.transferCanvas2World(q,B)),G=w.getModifiedRectangleCoordinates(Z,D,m),H=G[0],it=G[2],Ct=w.getLineCenterPoint([H,it]),$t=k.info.center.z-k.info.depth/2,Pt=A(x({},k.info),{center:{x:Ct.x,y:Ct.y,z:$t+C/2},width:m,height:D,depth:C,valid:!0}),to=et([Pt]);Q({omitView:b["3D"],polygon:I,boxParams:Pt,newPointCloudBoxList:to})}},J=(s,i,c,l,g,r)=>bt(void 0,null,function*(){const m=W==null?void 0:W.url,C={[b.Side]:()=>{Dt(c,i,d,m,r)},[b.Back]:()=>{p&&_t(c,i,p,m,r)},[b.Top]:()=>{kt(c,i,t,o)}};Object.keys(C).forEach(D=>{D!==s&&C[D]()}),l&&(o==null||o.updateCameraZoom(l)),Et(c)}),Q=(s,i=F.Default)=>{const{omitView:c,polygon:l,boxParams:g,zoom:r,newPointCloudBoxList:m}=s,C=W==null?void 0:W.url;m&&n.syncAllViewPointCloudColor(i,m);const D={[b.Side]:()=>{Rt(g,l,d,C)},[b.Back]:()=>{p&&Vt(g,l,p,C)},[b.Top]:()=>{ct(g,l,t,o)}};Object.keys(D).forEach(_=>{_!==c&&D[_]()}),r&&(o==null||o.updateCameraZoom(r))};return{topViewAddSphere:Mt,topViewAddBox:Ht,topViewSelectedChanged:Zt,topViewUpdatePoint:Yt,sideViewUpdatePoint:Gt,backViewUpdatePoint:Jt,topViewUpdateBox:qt,sideViewUpdateBox:Qt,backViewUpdateBox:Xt,syncPointCloudViews:Q,syncPointCloudPoint:J,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=O.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>bt(void 0,[...s],function*(i=W){var c,l,g,r,m,C,D,_;if(!(i==null?void 0:i.url)||!o)return;V([]),Lt(M,!0),vt(M,!0),(c=e==null?void 0:e.setResourceLoading)==null||c.call(e,!0),yield o.loadPCDFile(i.url,(l=y==null?void 0:y.radius)!=null?l:tt,y==null?void 0:y.tipScopeList),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let v=[],I=[],B=[],Z=[];o.updateTopCamera();const G=(r=(g=rt(i.result))==null?void 0:g.valid)!=null?r:!0;if(n.setPointCloudValid(G),(m=n.sideViewInstance)==null||m.clearAllData(),(C=n.backViewInstance)==null||C.clearAllData(),i.result){if(v=O.getBoxParamsFromResultList(i.result),(v==null?void 0:v.length)>0&&i.isPreResult&&(y==null?void 0:y.lowerLimitPointsNumInBox)>0){v=yield o==null?void 0:o.filterPreResult(i.url,y,v);const H=rt(i.result);H[no].result=v,i.result=JSON.stringify(H),n.setPointCloudResult(v)}B=O.getPolygonListFromResultList(i.result),I=O.getLineListFromResultList(i.result),Z=O.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(D=y==null?void 0:y.radius)!=null?D:tt}),o==null||o.generateBoxes(v),o==null||o.generateSpheres(Z),yield n.syncAllViewPointCloudColor(F.Default,v,[])}E({pointCloudBoxList:v,polygonList:B,lineList:I,pointCloudSphereList:Z}),Lt(M,!1),vt(M,!1),(_=e==null?void 0:e.setResourceLoading)==null||_.call(e,!1)}),updateViewsByDefaultSize:Kt,generateRects:ot,update2DViewRect:Ft,remove2DViewRect:Wt}},Bo=()=>{const{pointCloudBoxList:e,rectList:n,setPointCloudResult:t}=mt(xt),d=K(e),p=K(n);return{syncToPointCloudBoxList:ht(()=>{const f=d.current,u=p.current;if(u.length===0)return null;const a=new Map,h=new Set;if(u.filter(P=>P.extId!==void 0).forEach(P=>{const L=P.extId,T=P.imageName,V=lo(P,["x","y","width","height"]);let R=a.get(L);R||(R=new Map,a.set(L,R)),R.set(T,V),h.add(L)}),a.size){const P=f.map(L=>{var T;const V=L.id;if(h.has(V)){const R=x({},L);return(T=R.rects)==null||T.forEach(U=>{var N;const z=U.imageName;Object.assign(U,(N=a.get(V))==null?void 0:N.get(z))}),R}return L});return t(P),P}return null},[])}};export{_t as syncBackViewByPoint,Dt as syncSideViewByPoint,kt as syncTopViewByPoint,Vt as synchronizeBackView,Rt as synchronizeSideView,ct as synchronizeTopView,dt as topViewPoint2PointCloud,at as topViewPolygon2PointCloud,yo as usePointCloudViews,Bo as useSyncRectPositionDimensionToPointCloudList};
@@ -1 +1 @@
1
- import{getClassName as n}from"../../utils/dom.js";import t,{useContext as y,useState as R,useEffect as C}from"react";import _ from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import M from"./PointCloud2DView.js";import G from"./PointCloudListener.js";import O from"./PointCloudSegmentListener.js";import Z from"./PointCloudSegment.js";import U from"./PointCloudSegmentStatus.js";import W from"./PointCloudSegmentToolbar.js";import $ from"./PointCloudSegment2DView.js";import{connect as q}from"react-redux";import{LabelBeeContext as z,useDispatch as H}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as J,AnnotatedAttributesPanelFixedRight as K}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as Q}from"./PointCloudContext.js";import{PointCloudUtils as X,EPointCloudPattern as Y}from"@labelbee/lb-utils";import{useCustomToolInstance as tt}from"../../hooks/annotation.js";import{jsonParser as et}from"../../utils/index.js";import{a2MapStateToProps as ot}from"../../store/annotation/map.js";import L from"classnames";import nt from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as it}from"../../store/annotation/actionCreators.js";const lt=E=>{const{currentData:s,imgList:S,drawLayerSlot:d,checkMode:i,intelligentFit:w,imgIndex:x,config:b,measureVisible:j,setResourceLoading:v}=E,e=y(Q),{globalPattern:p,setGlobalPattern:V,selectedIDs:P}=e,h=H(),[l,f]=R(!1),D=(P==null?void 0:P.length)>0&&l,A=et(s.result),{toolInstanceRef:r,clearToolInstance:N}=tt({basicInfo:A});if(C(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==p&&(V(o),e.clearAllDetectionInstance(),N())}},[p]),C(()=>{var o;if(it(h,!0),s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:c,segmentation:I,rectList:T}=X.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(c),e.setRectList(T),e.setSegmentation(I)}},[x]),C(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u,c;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(c=e.segmentation)!=null?c:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),S.length===0)return null;if(p===Y.Segmentation)return t.createElement(t.Fragment,null,t.createElement(O,{checkMode:i,toolInstanceRef:r}),t.createElement(W,null),t.createElement("div",{className:n("point-cloud-layout")},t.createElement(Z,{checkMode:i}),t.createElement($,null)),t.createElement(U,{config:b}),d==null?void 0:d({direct:!0}));let g=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(k,{checkMode:i}),t.createElement(F,{checkMode:i}));return l&&(g=t.createElement(nt,{selectAndEnlarge:D,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(G,{checkMode:i,toolInstanceRef:r,setResourceLoading:v}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(J,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(_,null),g),t.createElement("div",{className:L({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(B,{drawLayerSlot:d,checkMode:i,intelligentFit:w,setIsEnlargeTopView:f,onExitZoom:()=>{f(!1)},isEnlargeTopView:l}),t.createElement("div",{className:L({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(M,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i,measureVisible:j})))),t.createElement(K,null))))};var rt=q(ot,null,null,{context:z})(lt);export{rt as default};
1
+ import{getClassName as i}from"../../utils/dom.js";import e,{useContext as K,useRef as b,useState as w,useEffect as f}from"react";import O from"./PointCloud3DView.js";import Z from"./PointCloudBackView.js";import Q from"./PointCloudTopView.js";import U from"./PointCloudSideView.js";import $ from"./PointCloud2DView.js";import q from"./PointCloudListener.js";import J from"./PointCloudSegmentListener.js";import X from"./PointCloudSegment.js";import Y from"./PointCloudSegmentStatus.js";import tt from"./PointCloudSegmentToolbar.js";import et from"./PointCloudSegment2DView.js";import{connect as ot}from"react-redux";import{LabelBeeContext as nt,useDispatch as it}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as lt,AnnotatedAttributesPanelFixedRight as rt}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as at}from"./PointCloudContext.js";import{PointCloudUtils as st,EPointCloudPattern as ut}from"@labelbee/lb-utils";import{useCustomToolInstance as mt}from"../../hooks/annotation.js";import{jsonParser as dt}from"../../utils/index.js";import{a2MapStateToProps as ct}from"../../store/annotation/map.js";import j from"classnames";import pt from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as ft}from"../../store/annotation/actionCreators.js";import x from"../DynamicResizer/DynamicResizer.js";const gt=D=>{const{currentData:u,imgList:y,drawLayerSlot:g,checkMode:l,intelligentFit:I,imgIndex:R,config:A,measureVisible:B,setResourceLoading:L,stepInfo:o,setBatchSetValid:C}=D,t=K(at),{globalPattern:P,setGlobalPattern:k,selectedIDs:h,isLargeStatus:m,setIsLargeStatus:T}=t,N=it(),v=b(null),S=b(null),[_,M]=w(0),[r,E]=w(!1),F=(h==null?void 0:h.length)>0&&r,H=dt(u.result),{toolInstanceRef:s,clearToolInstance:z}=mt({basicInfo:H});if(f(()=>{s.current.setPointCloudGlobalPattern=n=>{n!==P&&(k(n),t.clearAllDetectionInstance(),z())}},[P]),f(()=>{var n;if(ft(N,!0),u){const{boxParamsList:a,polygonList:d,lineList:c,sphereParamsList:p,segmentation:W,rectList:G}=st.parsePointCloudCurrentResult((n=u==null?void 0:u.result)!=null?n:"");t.setPointCloudResult(a),t.setPolygonList(d),t.setLineList(c),t.setPointCloudSphereList(p),t.setRectList(G),t.setSegmentation(W)}},[R]),f(()=>{var n;if(v.current){const a=((n=v.current)==null?void 0:n.offsetHeight)-233;M(a)}},[S.current]),f(()=>{s.current.exportData=()=>[t.pointCloudBoxList,{valid:t.valid}],s.current.exportCustomData=()=>{var n,a,d,c,p;return{resultPolygon:(n=t.polygonList)!=null?n:[],resultLine:(a=t.lineList)!=null?a:[],resultPoint:(d=t.pointCloudSphereList)!=null?d:[],resultRect:(c=t.rectList)!=null?c:[],segmentation:(p=t.segmentation)!=null?p:[]}}},[t.pointCloudBoxList,t.rectList,t.valid,t.polygonList,t.lineList,t.pointCloudSphereList,t.ptSegmentInstance,t.segmentation]),y.length===0)return null;if(P===ut.Segmentation)return e.createElement(e.Fragment,null,e.createElement(J,{checkMode:l,toolInstanceRef:s}),e.createElement(tt,null),e.createElement("div",{className:i("point-cloud-layout")},e.createElement(X,{checkMode:l}),e.createElement(et,null)),e.createElement(Y,{config:A}),g==null?void 0:g({direct:!0}));let V=e.createElement("div",{className:i("point-cloud-container","left-bottom")},e.createElement(Z,{checkMode:l}),e.createElement(U,{checkMode:l}));return r&&(V=e.createElement(pt,{selectAndEnlarge:F,checkMode:l})),e.createElement(e.Fragment,null,e.createElement(q,{checkMode:l,toolInstanceRef:s,setResourceLoading:L,isBatchSetValid:!!C}),e.createElement("div",{className:i("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},e.createElement("div",{className:i("point-cloud-wrapper")},e.createElement(lt,null),e.createElement("div",{className:i("point-cloud-content"),ref:S},e.createElement(x,{direction:"horizontal",localKey:"leftAllViewid:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type),defaultWidth:360,minLeftWidth:244,minRightWidth:"50%",disabled:m},e.createElement("div",{className:i("point-cloud-container",m?"left-large":"left-noLarge")},e.createElement(O,{setResourceLoading:L}),V),e.createElement("div",{className:j({[i("point-cloud-container","right")]:!0,[i("point-cloud-container","rightZoom")]:r}),ref:v},e.createElement(x,{localKey:"rightAllViewid:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type),defaultHeight:300,minTopHeight:_,minBottomHeight:160,disabled:m},e.createElement(Q,{drawLayerSlot:g,checkMode:l,intelligentFit:I,setIsEnlargeTopView:E,onExitZoom:()=>{T(!1),E(!1)},isEnlargeTopView:r}),e.createElement("div",{className:j({[i("point-cloud-container",m?"right-bottom-large":"right-bottom-noLarge")]:!r,[i("point-cloud-container","right-bottom-floatLeft")]:r})},e.createElement($,{isEnlargeTopView:r,thumbnailWidth:r?300:455,checkMode:l,measureVisible:B})))))),e.createElement(rt,null))),t.visibleBatchSetValid&&(C==null?void 0:C({valid:t.valid,isModal:!0,visibleModal:t.visibleBatchSetValid,onClose:()=>t.setBatchSetValidModal(!1),singleSetQuestionImg:()=>t.setPointCloudValid(!t.valid)})))};var Ct=ot(ct,null,null,{context:nt})(gt);export{Ct as default};
@@ -1 +1 @@
1
- import l from"react";import{Row as x,Col as y,Radio as E,Tag as h}from"antd";import a from"./index.module.scss.js";import k from"../longText/index.js";import b from"classnames";const{CheckableTag:N}=h,T=({tagItem:d,selectedTags:c,handleChange:i,disabeledAll:v})=>{var r;const o=v,{isMulti:s,subSelected:u=[],value:m}=d,n=m;return s?l.createElement(l.Fragment,null,u.map(e=>{var t,p;return l.createElement(N,{key:e==null?void 0:e.value,checked:(t=c[n])==null?void 0:t.includes(e==null?void 0:e.value),onChange:f=>{o||i({key:n,tag:e==null?void 0:e.value,checked:f})},className:b({[`${a.disabled}`]:o,[`${a.active}`]:o&&((p=c[n])==null?void 0:p.includes(e==null?void 0:e.value))})},l.createElement("span",{className:a.tagItem},l.createElement(k,{text:e==null?void 0:e.key,openByText:!0})))})):l.createElement(E.Group,{onChange:e=>{i({key:n,tag:e.target.value,checked:e.target.checked,isRadio:!0})},value:(r=c[n])==null?void 0:r[0]},u.map(e=>l.createElement(E,{value:e==null?void 0:e.value,key:e==null?void 0:e.value,disabled:o},l.createElement("span",{className:a.tagItem},l.createElement(k,{text:e==null?void 0:e.key,openByText:!0})))))},L=d=>{const{selectedTags:c,updateValue:i,disabeledAll:v,inputList:r=[]}=d,o=s=>{const{key:u,checked:m,tag:n,isRadio:e}=s;let t=c[u]||[];if(e&&(t=[]),m){if(t==null?void 0:t.includes(n))return;t.push(n)}else!m&&(t==null?void 0:t.includes(n))&&(t=t.filter(f=>f!==n));i({key:u,value:t})};return(r==null?void 0:r.length)>0?l.createElement("div",{className:a.tagList},r.map((s,u)=>l.createElement(x,{key:u,className:a.content},l.createElement(y,{span:4,className:a.left},l.createElement(k,{text:s==null?void 0:s.key,openByText:!0})),l.createElement(y,{span:20,className:a.right},l.createElement(T,{selectedTags:c,handleChange:o,tagItem:s,disabeledAll:v}))))):null};export{L as default};
1
+ import l from"react";import{Row as E,Col as x,Radio as y,Tag as h}from"antd";import a from"./index.module.scss.js";import k from"../longText/index.js";import b from"classnames";const{CheckableTag:N}=h,C=({tagItem:d,selectedTags:o,handleChange:i,disabeledAll:v})=>{var r;const c=v,{isMulti:s,subSelected:u=[],value:m}=d,n=m;return s?l.createElement(l.Fragment,null,u.map(e=>{var t,p;return l.createElement(N,{key:e==null?void 0:e.value,checked:(t=o[n])==null?void 0:t.includes(e==null?void 0:e.value),onChange:f=>{c||i({key:n,tag:e==null?void 0:e.value,checked:f})},className:b({[`${a.disabled}`]:c,[`${a.active}`]:c&&((p=o[n])==null?void 0:p.includes(e==null?void 0:e.value))})},l.createElement("span",{className:a.tagItem},l.createElement(k,{text:e==null?void 0:e.key,openByText:!0,maxWordCount:10})))})):l.createElement(y.Group,{onChange:e=>{i({key:n,tag:e.target.value,checked:e.target.checked,isRadio:!0})},value:(r=o[n])==null?void 0:r[0]},u.map(e=>l.createElement(y,{value:e==null?void 0:e.value,key:e==null?void 0:e.value,disabled:c},l.createElement("span",{className:a.tagItem},l.createElement(k,{text:e==null?void 0:e.key,openByText:!0,maxWordCount:10})))))},T=d=>{const{selectedTags:o,updateValue:i,disabeledAll:v,inputList:r=[]}=d,c=s=>{const{key:u,checked:m,tag:n,isRadio:e}=s;let t=o[u]||[];if(e&&(t=[]),m){if(t==null?void 0:t.includes(n))return;t.push(n)}else!m&&(t==null?void 0:t.includes(n))&&(t=t.filter(f=>f!==n));i({key:u,value:t})};return(r==null?void 0:r.length)>0?l.createElement("div",{className:a.tagList},r.map((s,u)=>l.createElement(E,{key:u,className:a.content},l.createElement(x,{span:4,className:a.left},l.createElement(k,{text:s==null?void 0:s.key,openByText:!0})),l.createElement(x,{span:20,className:a.right},l.createElement(C,{selectedTags:o,handleChange:c,tagItem:s,disabeledAll:v}))))):null};export{T as default};
@@ -1 +1 @@
1
- import{CaretUpOutlined as k,CaretDownOutlined as x}from"@ant-design/icons";import t,{useState as I,useEffect as K}from"react";import d from"./index.module.scss.js";import{cKeyCode as L,CommonToolUtils as S}from"@labelbee/lb-annotation";import{useTranslation as T}from"react-i18next";const E=L.default,m=[.5,1,1.5,2,4,6,8,16],A=[.5,.75,1,1.25,1.5,1.75,2];var c;(function(e){e[e.Video=0]="Video",e[e.Audio=1]="Audio"})(c||(c={}));var f;(function(e){e[e.Increase=0]="Increase",e[e.Reduce=1]="Reduce"})(f||(f={}));const u={[0]:m,[1]:A},Y=e=>{const{onChange:_,playerType:C}=e,{t:p}=T(),o=u[C],P=o.slice(-1)[0],R=o[0],[s,y]=I(1),r=n=>{const a=n===0?1:-1;if(a===1&&s===P||a===-1&&s===R)return;const w=o.findIndex(D=>D===s)+a,l=o[w];y(l),_(l)},i=n=>{!S.hotkeyFilter(n)||(n.keyCode===E.Up&&r(0),n.keyCode===E.Down&&r(1))};return K(()=>(window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i))),t.createElement("div",{className:d.speedControllerWrap},t.createElement("span",{style:{display:"flex",alignItems:"center"}},t.createElement("span",{style:{fontSize:12}},p("Speed")),s,"x"),t.createElement("span",{className:d.speedController},t.createElement(k,{onClick:()=>r(0)}),t.createElement(x,{onClick:()=>r(1)})))};export{A as AUDIO_PLAYBACK_RATE_SPEED,c as EPlayerType,u as PLAYER_TYPE_RATE_SPEED,m as VIDEO_PLAYBACK_RATE_SPEED,Y as default};
1
+ import{CaretUpOutlined as k,CaretDownOutlined as x}from"@ant-design/icons";import t,{useState as I,useEffect as K}from"react";import d from"./index.module.scss.js";import{cKeyCode as L,CommonToolUtils as S}from"@labelbee/lb-annotation";import{useTranslation as T}from"react-i18next";const E=L.default,m=[.1,.2,.3,.4,.5,1,1.5,2,4,6,8,16],A=[.5,.75,1,1.25,1.5,1.75,2];var c;(function(e){e[e.Video=0]="Video",e[e.Audio=1]="Audio"})(c||(c={}));var f;(function(e){e[e.Increase=0]="Increase",e[e.Reduce=1]="Reduce"})(f||(f={}));const u={[0]:m,[1]:A},Y=e=>{const{onChange:_,playerType:C}=e,{t:p}=T(),o=u[C],P=o.slice(-1)[0],R=o[0],[s,y]=I(1),r=n=>{const a=n===0?1:-1;if(a===1&&s===P||a===-1&&s===R)return;const w=o.findIndex(D=>D===s)+a,l=o[w];y(l),_(l)},i=n=>{!S.hotkeyFilter(n)||(n.keyCode===E.Up&&r(0),n.keyCode===E.Down&&r(1))};return K(()=>(window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i))),t.createElement("div",{className:d.speedControllerWrap},t.createElement("span",{style:{display:"flex",alignItems:"center"}},t.createElement("span",{style:{fontSize:12}},p("Speed")),s,"x"),t.createElement("span",{className:d.speedController},t.createElement(k,{onClick:()=>r(0)}),t.createElement(x,{onClick:()=>r(1)})))};export{A as AUDIO_PLAYBACK_RATE_SPEED,c as EPlayerType,u as PLAYER_TYPE_RATE_SPEED,m as VIDEO_PLAYBACK_RATE_SPEED,Y as default};
@@ -1 +1 @@
1
- import o from"react";import A from"./components/controller/index.js";import j from"../videoAnnotate/videoClipTool/components/videoTrack/index.js";import{getClassName as l}from"../../utils/dom.js";import{cKeyCode as M}from"@labelbee/lb-annotation";import{decimalReserved as d}from"./utils.js";import z from"../fileException/index.js";const s=M.default,c=o.createContext({isPlay:!1,playPause:()=>{},updateNextPlaybackRate:()=>{},playbackRate:1,currentTime:0,duration:0,buffered:0,setCurrentTime:()=>{},imgList:[],imgIndex:-1,pageBackward:()=>{},pageJump:f=>{},pageForward:()=>{},addTime:()=>{},toggleClipStatus:()=>{}}),U=50,p=.1,n=[.5,1,1.5,2,4,6,8,16];class v extends o.Component{constructor(a){super(a);this.changePlaybackPate=e=>{this.videoElm&&(this.videoElm.playbackRate=e,this.setState({playbackRate:e}))},this.playPause=()=>{var e,t,i;((e=this.videoElm)==null?void 0:e.paused)?(t=this.videoElm)==null||t.play():(i=this.videoElm)==null||i.pause()},this.updateNextPlaybackRate=(e=!0)=>{const t=n.findIndex(r=>r===this.state.playbackRate);let i=e?Math.min(t+1,n.length-1):Math.max(t-1,0);this.changePlaybackPate(n[i])},this.fastForward=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime+p)},this.rewind=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime-p)},this.keydown=e=>{e.keyCode===s.Space&&(e.preventDefault(),this.playPause()),e.keyCode===s.Up&&(e.preventDefault(),this.updateNextPlaybackRate()),e.keyCode===s.Down&&(e.preventDefault(),this.updateNextPlaybackRate(!1)),e.keyCode===s.Left&&(e.preventDefault(),this.rewind()),e.keyCode===s.Right&&(e.preventDefault(),this.fastForward())},this.onPlay=()=>{this.setState({isPlay:!0},this.onVideoStart)},this.onPause=()=>{this.onVideoStopped()},this.onTimeUpdate=()=>{var e;this.videoElm&&this.setState({currentTime:d((e=this.videoElm)==null?void 0:e.currentTime,1)})},this.onVideoStopped=()=>{this.setState({isPlay:!1}),this.timeInterval&&(clearInterval(this.timeInterval),this.timeInterval=void 0),this.videoElm&&this.setCurrentTime(this.videoElm.currentTime)},this.onVideoStart=()=>{this.timeInterval=window.setInterval(()=>{var e,t,i;if(this.videoElm)try{if(((e=this.videoElm)==null?void 0:e.buffered.length)>0){const r=(t=this.videoElm)==null?void 0:t.buffered.end(0);this.setState({currentTime:d((i=this.videoElm)==null?void 0:i.currentTime,1),buffered:r})}}catch(r){console.error(r)}},U)},this.resetVideoData=()=>{this.setState({currentTime:0,buffered:0,error:!1,isPlay:!1}),this.videoElm&&(this.videoElm.playbackRate=this.state.playbackRate),this.onVideoStopped()},this.setDuration=()=>{var e,t,i;if(this.videoElm){const r=d((e=this.videoElm)==null?void 0:e.duration,1);(i=(t=this.props).dataLoaded)==null||i.call(t),this.setState({duration:r})}},this.setCurrentTime=e=>{var t,i;this.videoElm&&(this.videoElm.currentTime=e,this.setState({currentTime:e}),(i=(t=this.props).updateCurrentTime)==null||i.call(t,e))},this.reload=()=>{var e;(e=this.videoElm)==null||e.load()},this.onError=()=>{this.resetVideoData(),this.setState({error:!0})},this.state={playbackRate:1,currentTime:0,isPlay:!1,duration:0,buffered:0,error:!1},this.videoRef=o.createRef()}get videoElm(){var a;return(a=this.videoRef)==null?void 0:a.current}get videoSrc(){var a,e;const{imgIndex:t,imgList:i}=this.props;return t>-1&&(e=(a=i[t])==null?void 0:a.url)!=null?e:""}componentDidMount(){var a,e;window.addEventListener("keydown",this.keydown),((a=this.videoRef)==null?void 0:a.current)&&this.props.setVideoRef&&this.props.setVideoRef((e=this.videoRef)==null?void 0:e.current)}componentWillUnmount(){window.removeEventListener("keydown",this.keydown)}render(){const{isPlay:a,playbackRate:e,currentTime:t,duration:i,buffered:r,error:E}=this.state,{imgList:y,imgIndex:k,pageBackward:g,pageJump:T,pageForward:R,valid:P,footer:b,drawLayerSlot:h}=this.props,C=isNaN(i)?0:Math.max(d(i,1)-t,0),{playPause:m,updateNextPlaybackRate:w,onPause:x,onPlay:_,onTimeUpdate:S,resetVideoData:V,setDuration:D,setCurrentTime:I,onError:N,videoRef:L,videoSrc:F}=this;return o.createElement(c.Provider,{value:{videoRef:this.videoRef,addTime:this.props.addTime,toggleClipStatus:this.props.toggleClipStatus,isPlay:a,playPause:m,updateNextPlaybackRate:w,playbackRate:e,currentTime:t,duration:i,buffered:r,setCurrentTime:I,imgIndex:k,imgList:y,pageBackward:g,pageJump:T,pageForward:R}},o.createElement(o.Fragment,null,h==null?void 0:h({currentTime:t,remainingTime:C,zoom:1,currentPos:{x:0,y:0}}),o.createElement("div",{className:l("video-wrapper")},o.createElement("div",{className:l("video-container")},o.createElement("video",{ref:L,className:l(this.props.showVideoTrack?"video-track":"video"),src:F,onPause:x,onPlay:_,onTimeUpdate:S,onLoadedMetadata:V,onError:N,onDurationChange:D,width:"100%",height:"100%",onClick:m}),this.props.showVideoTrack&&o.createElement(j,{currentTime:t,onTrackResize:this.props.onTrackResize,onTrackResizeStart:()=>{var u;(u=this.videoElm)==null||u.pause()},readonly:!1}),o.createElement(z,{fileType:"video",errorProps:{reloadImage:this.reload,backgroundColor:"#e2e2e2",ignoreOffsetY:!0,isError:E},invalidProps:{isValid:P}})),o.createElement(A,{footer:b}))))}}export{v as VideoPlayer,c as VideoPlayerCtx,v as default};
1
+ import o from"react";import A from"./components/controller/index.js";import j from"../videoAnnotate/videoClipTool/components/videoTrack/index.js";import{getClassName as l}from"../../utils/dom.js";import{cKeyCode as M}from"@labelbee/lb-annotation";import{decimalReserved as d}from"./utils.js";import z from"../fileException/index.js";const s=M.default,c=o.createContext({isPlay:!1,playPause:()=>{},updateNextPlaybackRate:()=>{},playbackRate:1,currentTime:0,duration:0,buffered:0,setCurrentTime:()=>{},imgList:[],imgIndex:-1,pageBackward:()=>{},pageJump:f=>{},pageForward:()=>{},addTime:()=>{},toggleClipStatus:()=>{}}),U=50,p=.1,n=[.1,.2,.3,.4,.5,1,1.5,2,4,6,8,16];class v extends o.Component{constructor(a){super(a);this.changePlaybackPate=e=>{this.videoElm&&(this.videoElm.playbackRate=e,this.setState({playbackRate:e}))},this.playPause=()=>{var e,t,i;((e=this.videoElm)==null?void 0:e.paused)?(t=this.videoElm)==null||t.play():(i=this.videoElm)==null||i.pause()},this.updateNextPlaybackRate=(e=!0)=>{const t=n.findIndex(r=>r===this.state.playbackRate);let i=e?Math.min(t+1,n.length-1):Math.max(t-1,0);this.changePlaybackPate(n[i])},this.fastForward=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime+p)},this.rewind=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime-p)},this.keydown=e=>{e.keyCode===s.Space&&(e.preventDefault(),this.playPause()),e.keyCode===s.Up&&(e.preventDefault(),this.updateNextPlaybackRate()),e.keyCode===s.Down&&(e.preventDefault(),this.updateNextPlaybackRate(!1)),e.keyCode===s.Left&&(e.preventDefault(),this.rewind()),e.keyCode===s.Right&&(e.preventDefault(),this.fastForward())},this.onPlay=()=>{this.setState({isPlay:!0},this.onVideoStart)},this.onPause=()=>{this.onVideoStopped()},this.onTimeUpdate=()=>{var e;this.videoElm&&this.setState({currentTime:d((e=this.videoElm)==null?void 0:e.currentTime,1)})},this.onVideoStopped=()=>{this.setState({isPlay:!1}),this.timeInterval&&(clearInterval(this.timeInterval),this.timeInterval=void 0),this.videoElm&&this.setCurrentTime(this.videoElm.currentTime)},this.onVideoStart=()=>{this.timeInterval=window.setInterval(()=>{var e,t,i;if(this.videoElm)try{if(((e=this.videoElm)==null?void 0:e.buffered.length)>0){const r=(t=this.videoElm)==null?void 0:t.buffered.end(0);this.setState({currentTime:d((i=this.videoElm)==null?void 0:i.currentTime,1),buffered:r})}}catch(r){console.error(r)}},U)},this.resetVideoData=()=>{this.setState({currentTime:0,buffered:0,error:!1,isPlay:!1}),this.videoElm&&(this.videoElm.playbackRate=this.state.playbackRate),this.onVideoStopped()},this.setDuration=()=>{var e,t,i;if(this.videoElm){const r=d((e=this.videoElm)==null?void 0:e.duration,1);(i=(t=this.props).dataLoaded)==null||i.call(t),this.setState({duration:r})}},this.setCurrentTime=e=>{var t,i;this.videoElm&&(this.videoElm.currentTime=e,this.setState({currentTime:e}),(i=(t=this.props).updateCurrentTime)==null||i.call(t,e))},this.reload=()=>{var e;(e=this.videoElm)==null||e.load()},this.onError=()=>{var e,t;(t=(e=this.props).dataLoaded)==null||t.call(e,!0),this.resetVideoData(),this.setState({error:!0})},this.state={playbackRate:1,currentTime:0,isPlay:!1,duration:0,buffered:0,error:!1},this.videoRef=o.createRef()}get videoElm(){var a;return(a=this.videoRef)==null?void 0:a.current}get videoSrc(){var a,e;const{imgIndex:t,imgList:i}=this.props;return t>-1&&(e=(a=i[t])==null?void 0:a.url)!=null?e:""}componentDidMount(){var a,e;window.addEventListener("keydown",this.keydown),((a=this.videoRef)==null?void 0:a.current)&&this.props.setVideoRef&&this.props.setVideoRef((e=this.videoRef)==null?void 0:e.current)}componentWillUnmount(){window.removeEventListener("keydown",this.keydown)}render(){const{isPlay:a,playbackRate:e,currentTime:t,duration:i,buffered:r,error:E}=this.state,{imgList:y,imgIndex:k,pageBackward:g,pageJump:T,pageForward:R,valid:P,footer:b,drawLayerSlot:h}=this.props,C=isNaN(i)?0:Math.max(d(i,1)-t,0),{playPause:m,updateNextPlaybackRate:_,onPause:w,onPlay:x,onTimeUpdate:S,resetVideoData:V,setDuration:D,setCurrentTime:I,onError:L,videoRef:N,videoSrc:F}=this;return o.createElement(c.Provider,{value:{videoRef:this.videoRef,addTime:this.props.addTime,toggleClipStatus:this.props.toggleClipStatus,isPlay:a,playPause:m,updateNextPlaybackRate:_,playbackRate:e,currentTime:t,duration:i,buffered:r,setCurrentTime:I,imgIndex:k,imgList:y,pageBackward:g,pageJump:T,pageForward:R}},o.createElement(o.Fragment,null,h==null?void 0:h({currentTime:t,remainingTime:C,zoom:1,currentPos:{x:0,y:0}}),o.createElement("div",{className:l("video-wrapper")},o.createElement("div",{className:l("video-container")},o.createElement("video",{ref:N,className:l(this.props.showVideoTrack?"video-track":"video"),src:F,onPause:w,onPlay:x,onTimeUpdate:S,onLoadedMetadata:V,onError:L,onDurationChange:D,width:"100%",height:"100%",onClick:m}),this.props.showVideoTrack&&o.createElement(j,{currentTime:t,onTrackResize:this.props.onTrackResize,onTrackResizeStart:()=>{var u;(u=this.videoElm)==null||u.pause()},readonly:!1}),o.createElement(z,{fileType:"video",errorProps:{reloadImage:this.reload,backgroundColor:"#e2e2e2",ignoreOffsetY:!0,isError:E},invalidProps:{isValid:P}})),o.createElement(A,{footer:b}))))}}export{v as VideoPlayer,c as VideoPlayerCtx,v as default};
@@ -1 +1 @@
1
- var n;(function(a){a[a.Check=0]="Check",a[a.ANNOTATION=1]="ANNOTATION",a[a.QUALITY_INSPECTION=2]="QUALITY_INSPECTION",a[a.PRE_ANNOTATION=3]="PRE_ANNOTATION",a[a.MANUAL_CORRECTION=4]="MANUAL_CORRECTION"})(n||(n={}));var c;(function(a){a[a.Backward=1]="Backward",a[a.Forward=2]="Forward",a[a.Jump=3]="Jump",a[a.Quit=4]="Quit",a[a.Export=5]="Export",a[a.StepChanged=6]="StepChanged",a[a.Save=7]="Save",a[a.BatchUpdateTrackID=8]="BatchUpdateTrackID",a[a.BatchUpdateImgList=9]="BatchUpdateImgList",a[a.SyncImgList=10001]="SyncImgList",a[a.SyncCurrentPageData=10002]="SyncCurrentPageData"})(c||(c={}));const o="bee",I=`${o}-component`;var r;(function(a){a.Default="default",a.Markdown="markdown"})(r||(r={}));var N;(function(a){a.Picture="picture",a.Text="text",a.None="none"})(N||(N={}));export{r as EDataFormatType,N as ELLMDataType,n as EStepType,c as ESubmitType,I as componentCls,o as prefix};
1
+ var n;(function(a){a[a.Check=0]="Check",a[a.ANNOTATION=1]="ANNOTATION",a[a.QUALITY_INSPECTION=2]="QUALITY_INSPECTION",a[a.PRE_ANNOTATION=3]="PRE_ANNOTATION",a[a.MANUAL_CORRECTION=4]="MANUAL_CORRECTION"})(n||(n={}));var c;(function(a){a[a.Backward=1]="Backward",a[a.Forward=2]="Forward",a[a.Jump=3]="Jump",a[a.Quit=4]="Quit",a[a.Export=5]="Export",a[a.StepChanged=6]="StepChanged",a[a.Save=7]="Save",a[a.BatchUpdateTrackID=8]="BatchUpdateTrackID",a[a.BatchUpdateImgList=9]="BatchUpdateImgList",a[a.SyncImgList=10001]="SyncImgList",a[a.SyncCurrentPageData=10002]="SyncCurrentPageData"})(c||(c={}));const o="bee",I=`${o}-component`;var r;(function(a){a.Default="default",a.Markdown="markdown",a.Latex="latex"})(r||(r={}));var N;(function(a){a.Picture="picture",a.Text="text",a.None="none",a.Audio="audio"})(N||(N={}));export{r as EDataFormatType,N as ELLMDataType,n as EStepType,c as ESubmitType,I as componentCls,o as prefix};