@labelbee/lb-components 1.23.0-alpha.12 → 1.23.0-alpha.120

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 (277) hide show
  1. package/dist/App.js +1 -1
  2. package/dist/_virtual/2DViewWorker.js +1 -0
  3. package/dist/_virtual/highlightSegmentWorker.js +1 -1
  4. package/dist/assets/annotation/icon_link.svg.js +1 -0
  5. package/dist/assets/annotation/icon_unlink.svg.js +1 -0
  6. package/dist/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
  7. package/dist/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
  8. package/dist/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
  9. package/dist/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
  10. package/dist/assets/icons/ad33251.svg +26 -0
  11. package/dist/components/AnnotationView/index.js +1 -1
  12. package/dist/components/DynamicResizer/DynamicResizer.js +1 -0
  13. package/dist/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
  14. package/dist/components/DynamicResizer/assets/divider.svg.js +1 -0
  15. package/dist/components/DynamicResizer/assets/topToZero.svg.js +1 -0
  16. package/dist/components/DynamicResizer/hooks/useDrag.js +1 -0
  17. package/dist/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
  18. package/dist/components/DynamicResizer/index.js +1 -0
  19. package/dist/components/LLMToolView/index.js +1 -1
  20. package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
  21. package/dist/components/LLMToolView/questionView/components/imgView/index.js +1 -1
  22. package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
  23. package/dist/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
  24. package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
  25. package/dist/components/LLMToolView/sidebar/index.js +1 -1
  26. package/dist/components/LLMToolView/utils/data.js +1 -1
  27. package/dist/components/audioAnnotate/audioContext/index.js +1 -1
  28. package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +2 -1
  29. package/dist/components/audioAnnotate/index.js +1 -1
  30. package/dist/components/audioAnnotate/textInput/index.js +1 -1
  31. package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  32. package/dist/components/audioAnnotate/utils/dataTransform.js +1 -0
  33. package/dist/components/audioPlayer/clipRegion/index.js +1 -1
  34. package/dist/components/audioPlayer/index.js +1 -1
  35. package/dist/components/audioPlayer/useAudioCombine/index.js +3 -2
  36. package/dist/components/audioPlayer/useAudioScroll/index.js +1 -1
  37. package/dist/components/audioPlayer/useAudioSegment/index.js +1 -1
  38. package/dist/components/audioPlayer/zoomSlider/index.js +1 -1
  39. package/dist/components/longText/index.js +1 -1
  40. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  41. package/dist/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
  42. package/dist/components/pointCloud2DRectOperationView/util.js +1 -0
  43. package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  44. package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
  45. package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
  46. package/dist/components/pointCloudView/PointCloudBackView.js +1 -1
  47. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  48. package/dist/components/pointCloudView/PointCloudInfos.js +1 -1
  49. package/dist/components/pointCloudView/PointCloudLayout.js +1 -1
  50. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  51. package/dist/components/pointCloudView/PointCloudSegment2DView.js +1 -1
  52. package/dist/components/pointCloudView/PointCloudSegmentListener.js +1 -1
  53. package/dist/components/pointCloudView/PointCloudSideView.js +1 -1
  54. package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
  55. package/dist/components/pointCloudView/components/HighlightVisible/index.js +1 -1
  56. package/dist/components/pointCloudView/hooks/useBoxes.js +1 -1
  57. package/dist/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
  58. package/dist/components/pointCloudView/hooks/useHighlight.js +1 -1
  59. package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
  60. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  61. package/dist/components/pointCloudView/hooks/usePolygon.js +1 -1
  62. package/dist/components/pointCloudView/hooks/useRotate.js +1 -1
  63. package/dist/components/pointCloudView/hooks/useRotateEdge.js +1 -0
  64. package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
  65. package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
  66. package/dist/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
  67. package/dist/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
  68. package/dist/components/pointCloudView/index.js +1 -1
  69. package/dist/components/pointCloudView/utils/event-polyfill.js +1 -0
  70. package/dist/components/pointCloudView/utils/map.js +1 -0
  71. package/dist/components/predictTracking/predictTrackingIcon/index.js +1 -1
  72. package/dist/components/predictTracking/previewResult/index.js +1 -1
  73. package/dist/components/subAttributeList/index.js +1 -0
  74. package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
  75. package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  76. package/dist/hooks/useToolStyle.js +1 -0
  77. package/dist/index.css +161 -12
  78. package/dist/index.js +1 -1
  79. package/dist/store/Actions.js +1 -1
  80. package/dist/store/annotatedBox/index.js +1 -1
  81. package/dist/store/annotation/actionCreators.js +1 -1
  82. package/dist/store/annotation/reducer.js +1 -1
  83. package/dist/store/toolConfig/baseToolConfig.js +1 -0
  84. package/dist/store/toolConfig/index.js +1 -0
  85. package/dist/store/toolConfig/pointCloudToolConfig.js +1 -0
  86. package/dist/types/App.d.ts +6 -1
  87. package/dist/types/components/AnnotationView/index.d.ts +8 -0
  88. package/dist/types/components/DynamicResizer/DynamicResizer.d.ts +5 -0
  89. package/dist/types/components/DynamicResizer/hooks/useDrag.d.ts +12 -0
  90. package/dist/types/components/DynamicResizer/hooks/useUpdateHeight.d.ts +23 -0
  91. package/dist/types/components/DynamicResizer/index.d.ts +2 -0
  92. package/dist/types/components/DynamicResizer/types/interface.d.ts +17 -0
  93. package/dist/types/components/LLMToolView/utils/data.d.ts +1 -1
  94. package/dist/types/components/audioAnnotate/audioContext/index.d.ts +10 -2
  95. package/dist/types/components/audioAnnotate/textInput/index.d.ts +1 -0
  96. package/dist/types/components/audioAnnotate/utils/dataTransform.d.ts +9 -0
  97. package/dist/types/components/audioPlayer/clipRegion/index.d.ts +1 -0
  98. package/dist/types/components/audioPlayer/index.d.ts +28 -21
  99. package/dist/types/components/audioPlayer/zoomSlider/index.d.ts +1 -0
  100. package/dist/types/components/longText/index.d.ts +1 -0
  101. package/dist/types/components/pointCloud2DRectOperationView/index.d.ts +1 -0
  102. package/dist/types/components/pointCloud2DRectOperationView/useUpdateRectList.d.ts +2 -0
  103. package/dist/types/components/pointCloud2DRectOperationView/util.d.ts +8 -0
  104. package/dist/types/components/pointCloudView/2DViewWorker.d.ts +1 -0
  105. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -1
  106. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +28 -4
  107. package/dist/types/components/pointCloudView/PointCloudLayout.d.ts +1 -0
  108. package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -0
  109. package/dist/types/components/pointCloudView/components/HighlightVisible/index.d.ts +2 -1
  110. package/dist/types/components/pointCloudView/hooks/useBoxes.d.ts +5 -3
  111. package/dist/types/components/pointCloudView/hooks/useDataLinkSwitch.d.ts +19 -0
  112. package/dist/types/components/pointCloudView/hooks/useHighlight.d.ts +1 -1
  113. package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +13 -1
  114. package/dist/types/components/pointCloudView/hooks/useRotateEdge.d.ts +9 -0
  115. package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +3 -2
  116. package/dist/types/components/pointCloudView/hooks/useTimeoutFunc.d.ts +6 -0
  117. package/dist/types/components/pointCloudView/hooks/useWindowKeydownListener.d.ts +16 -0
  118. package/dist/types/components/pointCloudView/index.d.ts +1 -0
  119. package/dist/types/components/pointCloudView/utils/event-polyfill.d.ts +8 -0
  120. package/dist/types/components/pointCloudView/utils/map.d.ts +11 -0
  121. package/dist/types/components/subAttributeList/index.d.ts +10 -0
  122. package/dist/types/components/videoAnnotate/index.d.ts +2 -1
  123. package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +2 -1
  124. package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +1 -1
  125. package/dist/types/hooks/useToolStyle.d.ts +30 -0
  126. package/dist/types/index.d.ts +8 -2
  127. package/dist/types/store/Actions.d.ts +1 -0
  128. package/dist/types/store/annotatedBox/index.d.ts +2 -0
  129. package/dist/types/store/annotation/actionCreators.d.ts +4 -3
  130. package/dist/types/store/annotation/reducer.d.ts +1 -0
  131. package/dist/types/store/annotation/types.d.ts +9 -2
  132. package/dist/types/store/toolConfig/baseToolConfig.d.ts +4 -0
  133. package/dist/types/store/toolConfig/index.d.ts +3 -0
  134. package/dist/types/store/toolConfig/pointCloudToolConfig.d.ts +4 -0
  135. package/dist/types/store/toolConfig/types.d.ts +10 -0
  136. package/dist/types/utils/AnnotationDataUtils.d.ts +58 -1
  137. package/dist/types/utils/ToolPointCloudBoxRenderHelper.d.ts +23 -0
  138. package/dist/types/utils/index.d.ts +31 -1
  139. package/dist/types/views/MainView/sidebar/GeneralOperation/ActionsConfirm.d.ts +1 -0
  140. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.d.ts +3 -0
  141. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.d.ts +3 -0
  142. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.d.ts +3 -0
  143. package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +1 -1
  144. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.d.ts +9 -0
  145. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.d.ts +3 -0
  146. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/index.d.ts +1 -0
  147. package/dist/types/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.d.ts +10 -2
  148. package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
  149. package/dist/types/views/MainView/toolHeader/StepSwitch/index.d.ts +1 -1
  150. package/dist/types/views/MainView/toolHeader/index.d.ts +1 -1
  151. package/dist/utils/AnnotationDataUtils.js +1 -1
  152. package/dist/utils/ToolPointCloudBoxRenderHelper.js +1 -0
  153. package/dist/utils/index.js +1 -1
  154. package/dist/views/MainView/index.js +1 -1
  155. package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
  156. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.js +1 -0
  157. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.module.scss.js +1 -0
  158. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
  159. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
  160. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.js +1 -0
  161. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss.js +1 -0
  162. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  163. package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
  164. package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  165. package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
  166. package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
  167. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
  168. package/dist/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
  169. package/dist/views/MainView/toolFooter/index.js +1 -1
  170. package/dist/views/MainView/toolHeader/index.js +1 -1
  171. package/es/App.js +1 -1
  172. package/es/_virtual/2DViewWorker.js +1 -0
  173. package/es/_virtual/highlightSegmentWorker.js +1 -1
  174. package/es/assets/annotation/icon_link.svg.js +1 -0
  175. package/es/assets/annotation/icon_unlink.svg.js +1 -0
  176. package/es/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
  177. package/es/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
  178. package/es/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
  179. package/es/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
  180. package/es/components/AnnotationView/index.js +1 -1
  181. package/es/components/DynamicResizer/DynamicResizer.js +1 -0
  182. package/es/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
  183. package/es/components/DynamicResizer/assets/divider.svg.js +1 -0
  184. package/es/components/DynamicResizer/assets/topToZero.svg.js +1 -0
  185. package/es/components/DynamicResizer/hooks/useDrag.js +1 -0
  186. package/es/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
  187. package/es/components/DynamicResizer/index.js +1 -0
  188. package/es/components/LLMToolView/index.js +1 -1
  189. package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
  190. package/es/components/LLMToolView/questionView/components/imgView/index.js +1 -1
  191. package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
  192. package/es/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
  193. package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
  194. package/es/components/LLMToolView/sidebar/index.js +1 -1
  195. package/es/components/LLMToolView/utils/data.js +1 -1
  196. package/es/components/audioAnnotate/audioContext/index.js +1 -1
  197. package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +2 -1
  198. package/es/components/audioAnnotate/index.js +1 -1
  199. package/es/components/audioAnnotate/textInput/index.js +1 -1
  200. package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  201. package/es/components/audioAnnotate/utils/dataTransform.js +1 -0
  202. package/es/components/audioPlayer/clipRegion/index.js +1 -1
  203. package/es/components/audioPlayer/index.js +1 -1
  204. package/es/components/audioPlayer/useAudioCombine/index.js +3 -2
  205. package/es/components/audioPlayer/useAudioScroll/index.js +1 -1
  206. package/es/components/audioPlayer/useAudioSegment/index.js +1 -1
  207. package/es/components/audioPlayer/zoomSlider/index.js +1 -1
  208. package/es/components/longText/index.js +1 -1
  209. package/es/components/pointCloud2DRectOperationView/index.js +1 -1
  210. package/es/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
  211. package/es/components/pointCloud2DRectOperationView/util.js +1 -0
  212. package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  213. package/es/components/pointCloudView/PointCloud2DView.js +1 -1
  214. package/es/components/pointCloudView/PointCloud3DView.js +1 -1
  215. package/es/components/pointCloudView/PointCloudBackView.js +1 -1
  216. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  217. package/es/components/pointCloudView/PointCloudInfos.js +1 -1
  218. package/es/components/pointCloudView/PointCloudLayout.js +1 -1
  219. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  220. package/es/components/pointCloudView/PointCloudSegment2DView.js +1 -1
  221. package/es/components/pointCloudView/PointCloudSegmentListener.js +1 -1
  222. package/es/components/pointCloudView/PointCloudSideView.js +1 -1
  223. package/es/components/pointCloudView/PointCloudTopView.js +1 -1
  224. package/es/components/pointCloudView/components/HighlightVisible/index.js +1 -1
  225. package/es/components/pointCloudView/hooks/useBoxes.js +1 -1
  226. package/es/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
  227. package/es/components/pointCloudView/hooks/useHighlight.js +1 -1
  228. package/es/components/pointCloudView/hooks/useHistory.js +1 -1
  229. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  230. package/es/components/pointCloudView/hooks/usePolygon.js +1 -1
  231. package/es/components/pointCloudView/hooks/useRotate.js +1 -1
  232. package/es/components/pointCloudView/hooks/useRotateEdge.js +1 -0
  233. package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
  234. package/es/components/pointCloudView/hooks/useStatus.js +1 -1
  235. package/es/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
  236. package/es/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
  237. package/es/components/pointCloudView/index.js +1 -1
  238. package/es/components/pointCloudView/utils/event-polyfill.js +1 -0
  239. package/es/components/pointCloudView/utils/map.js +1 -0
  240. package/es/components/predictTracking/predictTrackingIcon/index.js +1 -1
  241. package/es/components/predictTracking/previewResult/index.js +1 -1
  242. package/es/components/subAttributeList/index.js +1 -0
  243. package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
  244. package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  245. package/es/hooks/useToolStyle.js +1 -0
  246. package/es/index.css +161 -12
  247. package/es/index.js +1 -1
  248. package/es/store/Actions.js +1 -1
  249. package/es/store/annotatedBox/index.js +1 -1
  250. package/es/store/annotation/actionCreators.js +1 -1
  251. package/es/store/annotation/reducer.js +1 -1
  252. package/es/store/toolConfig/baseToolConfig.js +1 -0
  253. package/es/store/toolConfig/index.js +1 -0
  254. package/es/store/toolConfig/pointCloudToolConfig.js +1 -0
  255. package/es/utils/AnnotationDataUtils.js +1 -1
  256. package/es/utils/ToolPointCloudBoxRenderHelper.js +1 -0
  257. package/es/utils/index.js +1 -1
  258. package/es/views/MainView/index.js +1 -1
  259. package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
  260. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.js +1 -0
  261. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.module.scss.js +1 -0
  262. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
  263. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
  264. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.js +1 -0
  265. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss.js +1 -0
  266. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  267. package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
  268. package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  269. package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
  270. package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
  271. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
  272. package/es/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
  273. package/es/views/MainView/toolHeader/index.js +1 -1
  274. package/package.json +6 -4
  275. package/dist/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
  276. package/dist/assets/icons/9d70807.svg +0 -5
  277. package/es/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
@@ -1,2 +1,3 @@
1
- import{message as a}from"antd";import{cKeyCode as k}from"@labelbee/lb-annotation";import{useAudioClipStore as w}from"../../audioAnnotate/audioContext/index.js";import{useMemoizedFn as b,useEventListener as $}from"ahooks";import{useEffect as K}from"react";const _=k.default,j=g=>{const{waveRef:p,sortByStartRegions:x,regionMap:d,updateRegion:c,removeRegion:u,generateRegions:C,setSelectedRegion:B}=g,{audioClipState:E,setAudioClipState:s}=w(),{selectedRegion:v,clipConfigurable:y,combined:R}=E,{id:n}=v,A=b(i=>{var l;if(!n)return;const e=d[n],o=d[i.id];if(e.attribute!==o.attribute){a.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const f=x.filter(t=>t.attribute===e.attribute),F=f.findIndex(t=>t.id===n),I=f.findIndex(t=>t.id===i.id);if(Math.abs(F-I)!==1){a.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const r=[];["start","end"].forEach(t=>{r.push(e[t]),r.push(o[t])});const M=Math.min(...r),S=Math.max(...r),m={id:(l=p.current)==null?void 0:l.util.getId("combined_"),start:M,end:S,attribute:e.attribute,text:[e.text,o.text].includes("")?`${e.text}${o.text}`:`${e.text}
2
- ${o.text}`};c==null||c(m),u==null||u(n),u==null||u(o.id),C(),s({combined:!1}),B({id:m.id,playImmediately:!0})}),h=b(i=>{if(!!y&&i.altKey&&i.keyCode===_.Z){if(!n){a.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5408\u5E76\u7684\u533A\u95F4");return}s({combined:!0,segment:!1})}});return K(()=>{R&&s({combined:!1})},[n]),$("keydown",h),{combineInstance:A}};export{j as default};
1
+ import{message as b}from"antd";import{cKeyCode as K}from"@labelbee/lb-annotation";import{useAudioClipStore as _}from"../../audioAnnotate/audioContext/index.js";import{useMemoizedFn as C,useEventListener as D}from"ahooks";import{useEffect as L}from"react";import{cloneDeep as O}from"lodash";const z=K.default,Z=y=>{const{waveRef:E,sortByStartRegions:B,regionMap:g,updateRegion:x,removeRegion:a,generateRegions:h,setSelectedRegion:A}=y,{audioClipState:R,setAudioClipState:m}=_(),{selectedRegion:v,clipConfigurable:$,combined:k,clipTextList:F}=R,{id:i}=v,I=(o,d,c)=>{const t=O(o);return F.forEach((e,l)=>{const u=d[e.key],s=c[e.key],f=[u,s].includes("")?`${u}${s}`:`${u}
2
+ ${s}`;l===0?Object.assign(t,{text:f}):Object.assign(t,{[e.key]:f})}),t},w=C(o=>{var d,c;if(!i)return;const t=g[i],e=g[o.id];if(t.attribute!==e.attribute){b.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const l=B.filter(n=>n.attribute===t.attribute),u=l.findIndex(n=>n.id===i),s=l.findIndex(n=>n.id===o.id);if(Math.abs(u-s)!==1){b.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const r=[];["start","end"].forEach(n=>{r.push(t[n]),r.push(e[n])});const S=Math.min(...r),T=Math.max(...r),j={id:(d=E.current)==null?void 0:d.util.getId("combined_"),start:S,end:T,attribute:t.attribute,text:[t.text,e.text].includes("")?`${t.text}${e.text}`:`${t.text}
3
+ ${e.text}`,subAttribute:(c=e.subAttribute)!=null?c:{}},p=I(j,t,e);x==null||x(p),a==null||a(i),a==null||a(e.id),h(),m({combined:!1}),A({id:p.id,playImmediately:!0})}),M=C(o=>{if(!!$&&o.altKey&&o.keyCode===z.Z){if(!i){b.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5408\u5E76\u7684\u533A\u95F4");return}m({combined:!0,segment:!1})}});return L(()=>{k&&m({combined:!1})},[i]),D("keydown",M),{combineInstance:w}};export{Z as default};
@@ -1 +1 @@
1
- import{useEffect as w}from"react";import{precisionAdd as B,precisionMinus as C}from"../../../utils/audio.js";import{useLatest as d}from"ahooks";import{audioZoomInfo as s}from"../zoomSlider/index.js";const v=u=>{const{container:t,target:i,bufferWidth:o=10,clipping:f=!1,zoom:r=1,zoomHandler:c}=u,g=d(t),l=d(r),a=e=>{var n;e.ctrlKey&&((n=g.current)==null?void 0:n.contains(e.target))&&(e.deltaY>0?c(B(l.current,s.ratio)):c(C(l.current,s.ratio)))};if(w(()=>(document.addEventListener("wheel",a),()=>{document.removeEventListener("wheel",a)}),[]),t&&i&&f&&r>1){const{scrollLeft:e}=t,{right:n,left:m,width:h}=i.getBoundingClientRect(),{right:R,left:p,width:L}=t.getBoundingClientRect();if(h>L)return;p+o>m&&window.requestAnimationFrame(()=>{t.scrollLeft=e-20}),n+o>R&&window.requestAnimationFrame(()=>{t.scrollLeft=e+20})}};export{v as default};
1
+ import{useEffect as w}from"react";import{precisionAdd as B,precisionMinus as C}from"../../../utils/audio.js";import{useLatest as f}from"ahooks";import{audioZoomInfo as g}from"../zoomSlider/index.js";const v=m=>{const{container:t,target:i,bufferWidth:o=10,clipping:h=!1,zoom:r=1,zoomHandler:c}=m,R=f(t),l=f(r),a=e=>{var n;e.ctrlKey&&((n=R.current)==null?void 0:n.contains(e.target))&&(e.deltaY>0?c(B(l.current,g.ratio)):c(C(l.current,g.ratio)))};if(w(()=>(document.addEventListener("wheel",a),()=>{document.removeEventListener("wheel",a)}),[]),t&&i&&h&&r>1){const{scrollLeft:e}=t,{right:n,left:d,width:p}=i.getBoundingClientRect(),{right:s,left:u,width:L}=t.getBoundingClientRect();if(p>L)return;u+o>d&&d>u&&window.requestAnimationFrame(()=>{t.scrollLeft=e-20}),n+o>s&&n<s&&window.requestAnimationFrame(()=>{t.scrollLeft=e+20})}};export{v as default};
@@ -1 +1 @@
1
- import{useRef as _,useEffect as R}from"react";import{message as y}from"antd";import{cKeyCode as h}from"@labelbee/lb-annotation";import{useAudioClipStore as K}from"../../audioAnnotate/audioContext/index.js";import{useMemoizedFn as v,useEventListener as D}from"ahooks";const L=h.default,j=C=>{const{waveRef:o,regionMap:p,updateRegion:s,removeRegion:b,generateRegions:E,setSelectedRegion:x}=C,{audioClipState:A,setAudioClipState:c}=K(),{selectedRegion:F,clipConfigurable:S,segment:g}=A,{id:e}=F,m=_(null),a=_(null);R(()=>{var t,u,r,i,n,l,d;if(a.current&&o.current&&g&&e){const f=(l=(r=(u=(t=o.current)==null?void 0:t.regions)==null?void 0:u.util)==null?void 0:r.getRegionSnapToGridValue)==null?void 0:l.call(r,((i=o.current)==null?void 0:i.drawer.handleEvent(a.current))*((n=o.current)==null?void 0:n.getDuration())),B=(d=p[e])!=null?d:{},{start:I,end:M}=B;if(f>I&&f<M){m.current=f;return}}m.current=null},[a.current,g]);const T=v((t,u)=>{var r,i;if(!e||e!==t.id){y.info("\u8BF7\u70B9\u51FB\u6240\u9009\u533A\u95F4");return}const n=p[e],l={id:(r=o.current)==null?void 0:r.util.getId("segment_"),start:n.start,end:u,attribute:n.attribute,text:n.text},d={id:(i=o.current)==null?void 0:i.util.getId("segment_"),start:u,end:n.end,attribute:n.attribute,text:""};s==null||s(l),s==null||s(d),b==null||b(e),E(),c({segment:!1}),x({id:l.id,playImmediately:!0})}),k=v(t=>{if(!!S&&t.altKey&&t.keyCode===L.X){if(!e){y.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5206\u5272\u7684\u533A\u95F4");return}c({segment:!0,combined:!1})}}),w=v((t,u)=>{a.current=u});return D("keydown",k),R(()=>{g&&c({segment:!1})},[e]),{segmentInstance:T,onRegionMouseMove:w,segmentTimeTip:m.current}};export{j as default};
1
+ import{useRef as O,useEffect as P}from"react";import{message as T}from"antd";import{cKeyCode as z,TagUtils as G}from"@labelbee/lb-annotation";import{useAudioClipStore as N}from"../../audioAnnotate/audioContext/index.js";import{useMemoizedFn as y,useEventListener as U}from"ahooks";import R from"../../audioAnnotate/utils/dataTransform.js";var X=Object.defineProperty,q=Object.defineProperties,H=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,S=(r,e,t)=>e in r?X(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,x=(r,e)=>{for(var t in e||(e={}))J.call(e,t)&&S(r,t,e[t]);if(E)for(var t of E(e))Q.call(e,t)&&S(r,t,e[t]);return r},B=(r,e)=>q(r,H(e));const W=z.default,Y=r=>{const{waveRef:e,regionMap:t,updateRegion:d,removeRegion:C,generateRegions:D,setSelectedRegion:j}=r,{audioClipState:F,setAudioClipState:p}=N(),{selectedRegion:I,clipConfigurable:h,segment:m,clipTextList:w,subAttributeList:A,secondaryAttributeConfigurable:L=!1}=F,{id:n}=I,v=O(null),f=O(null);P(()=>{var o,u,i,a,c,s,g;if(f.current&&e.current&&m&&n){const l=(s=(i=(u=(o=e.current)==null?void 0:o.regions)==null?void 0:u.util)==null?void 0:i.getRegionSnapToGridValue)==null?void 0:s.call(i,((a=e.current)==null?void 0:a.drawer.handleEvent(f.current))*((c=e.current)==null?void 0:c.getDuration())),_=(g=t[n])!=null?g:{},{start:b,end:V}=_;if(l>b&&l<V){v.current=l;return}}v.current=null},[f.current,m]);const M=y((o,u)=>{var i,a,c;if(!n||n!==o.id){T.info("\u8BF7\u70B9\u51FB\u6240\u9009\u533A\u95F4");return}const s=t[n],g=R.getClipTextByConfig(s,w),l=B(x({},g),{id:(i=e.current)==null?void 0:i.util.getId("segment_"),end:u,subAttribute:(a=s.subAttribute)!=null?a:{}}),_=R.getClipTextByConfig(s,w,!0),b=B(x({},_),{id:(c=e.current)==null?void 0:c.util.getId("segment_"),start:u,subAttribute:G.getDefaultResultByConfig(L?A!=null?A:[]:[])});d==null||d(l),d==null||d(b),C==null||C(n),D(),p({segment:!1}),j({id:l.id,playImmediately:!0})}),K=y(o=>{if(!!h&&o.altKey&&o.keyCode===W.X){if(!n){T.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5206\u5272\u7684\u533A\u95F4");return}p({segment:!0,combined:!1})}}),k=y((o,u)=>{f.current=u});return U("keydown",K),P(()=>{m&&p({segment:!1})},[n]),{segmentInstance:M,onRegionMouseMove:k,segmentTimeTip:v.current}};export{Y as default};
@@ -1 +1 @@
1
- import t,{useEffect as p}from"react";import{ZoomOutOutlined as y,ZoomInOutlined as E}from"@ant-design/icons";import{Slider as k}from"antd";import{precisionAdd as v,precisionMinus as x}from"../../../utils/audio.js";import{cKeyCode as C}from"@labelbee/lb-annotation";import{useLatest as h}from"ahooks";import Z from"./index.module.scss.js";import{useTranslation as b}from"react-i18next";const l=C.default,o={min:1,max:150,ratio:1},g=d=>{const{onChange:u,zoom:r}=d,{t:f}=b(),i=h(r),n=e=>{u(e)},a={fontSize:14,margin:"0 8px",cursor:"pointer"},s=()=>{const e=v(i.current,o.ratio);n(e)},c=()=>{const e=x(i.current,o.ratio);n(e)},m=e=>{switch(e.keyCode){case l.I:e.ctrlKey&&s();break;case l.O:e.ctrlKey&&(e.preventDefault(),c());break}};return p(()=>(document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}),[]),t.createElement("div",{className:Z.sliderContainer},t.createElement("div",null,f("Scale")),t.createElement(y,{style:a,onClick:c}),t.createElement("div",{style:{width:120}},t.createElement(k,{min:o.min,max:o.max,step:o.ratio,onChange:n,value:r})),t.createElement(E,{style:a,onClick:s}))};export{o as audioZoomInfo,g as default};
1
+ import t,{useEffect as p}from"react";import{ZoomOutOutlined as y,ZoomInOutlined as E}from"@ant-design/icons";import{Slider as k}from"antd";import{precisionAdd as v,precisionMinus as x}from"../../../utils/audio.js";import{cKeyCode as C}from"@labelbee/lb-annotation";import{useLatest as h}from"ahooks";import Z from"./index.module.scss.js";import{useTranslation as b}from"react-i18next";const l=C.default,o={min:1,max:150,ratio:1,defaultValue:30},g=d=>{const{onChange:u,zoom:r}=d,{t:f}=b(),i=h(r),n=e=>{u(e)},a={fontSize:14,margin:"0 8px",cursor:"pointer"},s=()=>{const e=v(i.current,o.ratio);n(e)},c=()=>{const e=x(i.current,o.ratio);n(e)},m=e=>{switch(e.keyCode){case l.I:e.ctrlKey&&s();break;case l.O:e.ctrlKey&&(e.preventDefault(),c());break}};return p(()=>(document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}),[]),t.createElement("div",{className:Z.sliderContainer},t.createElement("div",null,f("Scale")),t.createElement(y,{style:a,onClick:c}),t.createElement("div",{style:{width:120}},t.createElement(k,{min:o.min,max:o.max,step:o.ratio,onChange:n,value:r})),t.createElement(E,{style:a,onClick:s}))};export{o as audioZoomInfo,g as default};
@@ -1 +1 @@
1
- import n,{useRef as P}from"react";import{Popover as m,Tooltip as x}from"antd";import{useSize as E}from"ahooks";import{prefix as g}from"../../constant/index.js";import{SearchOutlined as h}from"@ant-design/icons";var T=Object.defineProperty,b=Object.defineProperties,N=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,d=(r,e,t)=>e in r?T(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_=(r,e)=>{for(var t in e||(e={}))$.call(e,t)&&d(r,t,e[t]);if(v)for(var t of v(e))j.call(e,t)&&d(r,t,e[t]);return r},S=(r,e)=>b(r,N(e));const l=`${g}-longText`,C=r=>{var e,t;const{text:o,placement:c="bottom",icon:y=n.createElement(h,null),openByText:O,style:f,isToolTips:w,wordCount:p}=r,a=P(null);E(a);const i=a.current&&((e=a.current)==null?void 0:e.clientWidth)<((t=a.current)==null?void 0:t.scrollWidth);if(p)if((o==null?void 0:o.length)>p){const s=o.slice(0,p);return n.createElement(m,{placement:c,overlayClassName:`${l}-popover`,content:o},n.createElement("span",{style:{cursor:"pointer",whiteSpace:"pre-wrap"}},s,"..."))}else return n.createElement("div",{style:{whiteSpace:"pre-wrap"}}," ",o);if(O){let s={placement:c,overlayClassName:`${l}-popover`,content:o,key:`${i}`};i||Object.assign(s,{open:!1});const u=n.createElement("div",{className:`${l}-text`,style:f,ref:a},o);return w?n.createElement(x,S(_({},s),{title:o}),u):n.createElement(m,_({},s),u)}return n.createElement("div",{className:l,style:f},n.createElement("div",{className:`${l}-text`,ref:a},o),i&&n.createElement(m,{placement:c,overlayClassName:`${l}-popover`,content:o},y))};export{C as default};
1
+ import l,{forwardRef as h,useRef as E,useMemo as S}from"react";import{Tooltip as T,Popover as x}from"antd";import{useSize as j}from"ahooks";import{prefix as L}from"../../constant/index.js";import{SearchOutlined as C}from"@ant-design/icons";var M=Object.defineProperty,N=Object.defineProperties,R=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,b=(t,e,r)=>e in t?M(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f=(t,e)=>{for(var r in e||(e={}))g.call(e,r)&&b(t,r,e[r]);if(v)for(var r of v(e))P.call(e,r)&&b(t,r,e[r]);return t},W=(t,e)=>N(t,R(e)),$=(t,e)=>{var r={};for(var n in t)g.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&v)for(var n of v(t))e.indexOf(n)<0&&P.call(t,n)&&(r[n]=t[n]);return r};const u=`${L}-longText`,_=h((t,e)=>{var r=t,{text:n,overflowMaxLines:p,style:i}=r,m=$(r,["text","overflowMaxLines","style"]);const a={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},o={display:"-webkit-box",WebkitLineClamp:p,WebkitBoxOrient:"vertical",overflow:"hidden"},d=p>1?o:a,c=f(f({},d),i!=null?i:{});return l.createElement("div",f({style:c,ref:e},m),n)}),k=t=>{const{text:e,placement:r="bottom",icon:n=l.createElement(C,null),openByText:p,style:i,isToolTips:m,overflowMaxLines:a=1}=t,o=E(null),d=j(o),c=S(()=>{var s,y,O,w;return a>1?o.current&&((s=o.current)==null?void 0:s.clientHeight)<((y=o.current)==null?void 0:y.scrollHeight):o.current&&((O=o.current)==null?void 0:O.clientWidth)<((w=o.current)==null?void 0:w.scrollWidth)},[d]);if(p){let s={placement:r,overlayClassName:`${u}-popover`,content:e,key:`${c}`};return c||Object.assign(s,{open:!1}),m?l.createElement(T,W(f({},s),{title:e}),l.createElement(_,{overflowMaxLines:a,style:i,ref:o,text:e})):l.createElement(x,f({},s),l.createElement(_,{overflowMaxLines:a,style:i,ref:o,text:e}))}return l.createElement("div",{className:u,style:i},l.createElement(_,{overflowMaxLines:a,style:i,ref:o,text:e}),c&&l.createElement(x,{placement:r,overlayClassName:`${u}-popover`,content:e},n))};export{k as default};
@@ -1 +1 @@
1
- import{useLatest as B}from"ahooks";import{Spin as M}from"antd/es";import d,{useContext as N,useRef as w,useState as U,useEffect as u}from"react";import{connect as F}from"react-redux";import{usePointCloudViews as T}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as $}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as q}from"../../store/annotation/map.js";import{LabelBeeContext as A}from"../../store/ctx.js";import{PointCloud2DRectOperation as G,ImgUtils as H}from"@labelbee/lb-annotation";var J=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,O=(o,e,t)=>e in o?J(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,f=(o,e)=>{for(var t in e||(e={}))W.call(e,t)&&O(o,t,e[t]);if(C)for(var t of C(e))X.call(e,t)&&O(o,t,e[t]);return o},R=(o,e)=>K(o,Q(e));const Y=o=>{var e;const{mappingData:t,size:l,config:b,checkMode:D,afterImgOnLoad:h}=o,s=(e=t==null?void 0:t.url)!=null?e:"",{pointCloudBoxList:c,setPointCloudResult:x}=N($),{update2DViewRect:y}=T(),p=d.useRef(null),n=w(null),m=B(y),_=w(null),[I,V]=U(!0),v=r=>{var a;const i=(a=m.current)==null?void 0:a.call(m,r);_.current=i,x(i)},j=()=>{var r;let a=[];c.forEach(i=>{const{rects:S=[],id:P,attribute:E,trackID:L}=i,g=S.find(z=>z.imageName===(t==null?void 0:t.path)),k=P+"_"+(t==null?void 0:t.path);g&&(a=[...a,R(f({},g),{boxID:P,id:k,attribute:E,order:L})])}),(r=n.current)==null||r.setResult(a)};return u(()=>{if(p.current){const r=new G({container:p.current,size:l,config:R(f({},b),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:D});return n.current=r,n.current.init(),n.current.on("updateDragResult",v),()=>{var a,i;(a=n.current)==null||a.unbind("updateDragResult",v),(i=n.current)==null||i.destroy()}}},[]),u(()=>{n.current&&s&&H.load(s).then(r=>{n.current.setImgNode(r),h(r),V(!1)})},[s]),u(()=>{var r;(r=n.current)==null||r.setSize(l)},[l]),u(()=>{c!==_.current&&j()},[c,s]),d.createElement(M,{spinning:I},d.createElement("div",{ref:p,style:f({position:"relative"},l)}))};var Z=F(q,null,null,{context:A})(Y);export{Z as default};
1
+ import{useLatest as X,useMemoizedFn as F}from"ahooks";import{Spin as ae}from"antd/es";import M,{useContext as fe,useRef as Y,useState as Z,useMemo as pe,useCallback as me,useEffect as f}from"react";import{connect as ve}from"react-redux";import{usePointCloudViews as ge}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as Re}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as he}from"../../store/annotation/map.js";import{LabelBeeContext as _e}from"../../store/ctx.js";import{PointCloud2DRectOperation as Ie,ImgUtils as De}from"@labelbee/lb-annotation";import{selectSpecifiedRectsFromTopViewSelectedIds as be}from"./util.js";import{useUpdateRectList as we}from"./useUpdateRectList.js";import{useToolStyleContext as Ce}from"../../hooks/useToolStyle.js";import xe from"../../store/toolConfig/index.js";var ye=Object.defineProperty,Pe=Object.defineProperties,Se=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,te=(s,i,c)=>i in s?ye(s,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):s[i]=c,v=(s,i)=>{for(var c in i||(i={}))Le.call(i,c)&&te(s,c,i[c]);if(ee)for(var c of ee(i))Oe.call(i,c)&&te(s,c,i[c]);return s},b=(s,i)=>Pe(s,Se(i)),z=(s,i,c)=>new Promise((d,g)=>{var I=a=>{try{D(c.next(a))}catch(R){g(R)}},L=a=>{try{D(c.throw(a))}catch(R){g(R)}},D=a=>a.done?d(a.value):Promise.resolve(a.value).then(I,L);D((c=c.apply(s,i)).next())});const Ve=s=>{var i,c;const{mappingData:d,size:g,config:I,checkMode:L,afterImgOnLoad:D,shouldExcludePointCloudBoxListUpdate:a}=s,{selectBoxVisibleSwitch:R}=xe(),O=(i=d==null?void 0:d.url)!=null?i:"",w=(c=d==null?void 0:d.fallbackUrl)!=null?c:"",{pointCloudBoxList:V,setPointCloudResult:j,defaultAttribute:k,rectList:E,addRectIn2DView:ne,updateRectIn2DView:re,removeRectIn2DView:oe,updateRectListByReducer:le,selectedIDs:p,setSelectedIDs:B}=fe(Re),{value:N}=Ce(),ie=X(p),{update2DViewRect:ce,remove2DViewRect:ue}=ge(),U=M.useRef(null),o=Y(null),H=F(ce),C=F(ue),x=Y(null),[se,J]=Z(!0),[$,q]=Z(""),y=pe(()=>E==null?void 0:E.filter(e=>e.imageName===(d==null?void 0:d.path)),[d==null?void 0:d.path,E]),P=X(d==null?void 0:d.path),A=me(e=>z(void 0,null,function*(){try{const r=ie.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(r.length){const n=new Set(r),l=t.filter(u=>n.has(u.id)).map(u=>u.id);B(l)}return t}catch(r){}}),[B]),G=e=>{const{boxID:r}=e;if(!a&&r){A(()=>{const t=H==null?void 0:H(e);return t?(x.current=t,j(t),t):null});return}re(e,!0)},K=e=>{P.current&&ne(b(v({},e),{imageName:P.current}))},Q=e=>{if(e.length===0)return;if(!a){const t=e.find(n=>n.boxID);if(t){A(()=>{const n=C==null?void 0:C(t);return n?(x.current=n,j(n),h(),n):null});return}}const r=e.find(t=>t.extId);r&&A(()=>{const{imageName:t,extId:n}=r,l=C==null?void 0:C({boxID:n,imageName:t});return l?(x.current=l,j(l),l):null}),oe(e)},de=F(()=>{let e=[];return V.forEach(r=>{const{rects:t=[],id:n,attribute:l,trackID:u}=r,m=t.find(S=>S.imageName===P.current),_=n+"_"+P.current;m&&(e=[...e,b(v({},m),{boxID:n,id:_,attribute:l,order:u})])}),e}),h=we(()=>{var e,r,t,n;const l=a?[]:de(),u=(e=o.current)==null?void 0:e.selectedRectID,m=p.slice(0),_=R?be(m,l,y):[...l,...y];let S=[];!R&&(p==null?void 0:p.length)&&(S=l.filter(T=>u?p.includes(T.boxID)&&!u.includes(T.boxID):p.includes(T.boxID))),(r=o.current)==null||r.setHighLightRectList(S),(t=o.current)==null||t.setResult(_),$&&((n=o.current)==null||n.setSelectedRectID($),q(""))}),W=({targetId:e,id:r})=>{B(e),q(r)};return f(()=>{if(U.current){const e=new Ie({container:U.current,size:g,config:b(v({},I),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:L});return o.current=e,o.current.init(),o.current.on("updateDragResult",G),o.current.on("afterAddingDrawingRect",K),o.current.on("deleteSelectedRects",Q),o.current.on("onRightClick",W),()=>{var r,t,n,l,u;(r=o.current)==null||r.unbind("updateDragResult",G),(t=o.current)==null||t.unbind("afterAddingDrawingRect",K),(n=o.current)==null||n.unbind("deleteSelectedRects",Q),(l=o.current)==null||l.unbind("onRightClick",W),(u=o.current)==null||u.destroy()}}},[]),f(()=>{const e=t=>z(void 0,null,function*(){try{return yield De.load(t)}catch(n){return console.error("Error loading image:",n),null}}),r=()=>z(void 0,null,function*(){var t;J(!0);let n=yield e(O);!n&&w&&(n=yield e(w)),n&&((t=o.current)==null||t.setImgNode(n),D(n)),J(!1)});o.current&&(O||w)&&r()},[O,w]),f(()=>{var e;(e=o.current)==null||e.setSize(g)},[g]),f(()=>{V!==x.current&&h()},[V]),f(()=>{var e,r;const t=y.find(n=>n.id===o.current.selectedRectID);(r=(e=o.current)==null?void 0:e.setDefaultAttribute)==null||r.call(e,k),t&&le(n=>{var l;const u=[];let m=null;return n.forEach(_=>{_.id!==o.current.selectedRectID?u.push(_):m=_}),t.extId===void 0&&(m=(l=o.current)==null?void 0:l.selectedRect),[...u,b(v({},m||{}),{attribute:k})]}),h()},[k]),f(()=>{h()},[y]),f(()=>{h()},[a]),f(()=>{var e,r,t,n;const l=(r=(e=o.current)==null?void 0:e.config)!=null?r:{},u=b(v({},l),{attributeList:(t=I.attributeList)!=null?t:[]});(n=o.current)==null||n.setConfig(JSON.stringify(u))},[I.attributeList]),f(()=>{var e;(e=o.current)==null||e.setEnableAddRect(p.length===0),h()},[p]),f(()=>{const{hiddenText:e}=N||{};if(e===void 0)return;const r=o.current;if(!r)return;const t=v(v({},r.style),N);r.setStyle(t)},[N]),f(()=>{h()},[R]),M.createElement(ae,{spinning:se},M.createElement("div",{ref:U,style:v({position:"relative"},g)}))};var je=ve(he,null,null,{context:_e})(Ve);export{je as default};
@@ -0,0 +1 @@
1
+ import{useDebounceFn as o}from"ahooks";const n=t=>{const{run:e}=o(t,{wait:100});return e};export{n as useUpdateRectList};
@@ -0,0 +1 @@
1
+ const c=(t,r,n)=>{if(t.length){const f=new Set(t),l=r.filter(({boxID:e})=>f.has(e)),o=n.filter(e=>e.extId&&f.has(e.extId));return[...l,...o]}return[...r,...n]};export{c as selectSpecifiedRectsFromTopViewSelectedIds};
@@ -1 +1 @@
1
- import{getClassName as H}from"../../utils/dom.js";import u,{useRef as y,useState as L,useContext as R,useCallback as O,useEffect as N}from"react";import w from"../AnnotationView/index.js";import A from"../../hooks/useSize.js";import{useSingleBox as q}from"./hooks/useSingleBox.js";import{useHighlight as F}from"./hooks/useHighlight.js";import G from"./components/HighlightVisible/index.js";import{PointCloudContext as J}from"./PointCloudContext.js";import K from"../pointCloud2DRectOperationView/index.js";var M=(t,s,e)=>new Promise((d,a)=>{var m=o=>{try{i(e.next(o))}catch(n){a(n)}},r=o=>{try{i(e.throw(o))}catch(n){a(n)}},i=o=>o.done?d(o.value):Promise.resolve(o.value).then(m,r);i((e=e.apply(t,s)).next())});const Q=({view2dData:t,setSelectedID:s,currentData:e,showEnlarge:d,checkMode:a=!1,measureVisible:m})=>{var r;const i=y(null),o=y(),{selectedBox:n}=q(),p=A(i),{url:h,calib:g,path:j}=t,{toggle2dVisible:P,isHighlightVisible:S}=F({currentData:e}),[k,x]=L(!1),{cuboidBoxIn2DView:_,cacheImageNodeSize:z}=R(J),B=!t,b=c=>{f(),z({path:j,imgNode:c})},f=O(()=>{var c,C;const v=(c=o.current)==null?void 0:c.toolInstance;if(s(""),!n||!v)return;const l=t.annotations.find(E=>E.annotation.id===n.info.id);let V="";l&&((C=l==null?void 0:l.annotation.pointList)==null?void 0:C.length)>0&&(v.focusPositionByPointList(l==null?void 0:l.annotation.pointList),V=n.info.id,s(V))},[n,o.current,t.annotations]);N(()=>{f()},[f]);const I=()=>M(void 0,null,function*(){x(!0),yield P(h,g),x(!1)});return u.createElement("div",{className:H("point-cloud-2d-image"),ref:i},_?u.createElement(w,{src:(r=t==null?void 0:t.url)!=null?r:"",annotations:t.annotations,size:p,ref:o,globalStyle:{display:B?"none":"block"},afterImgOnLoad:b,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:m}):u.createElement(K,{mappingData:t,size:p,checkMode:a,afterImgOnLoad:b}),g&&u.createElement(G,{visible:S(h),onClick:I,loading:k,style:{position:"absolute",right:16,top:16,zIndex:d?-1:101}}))};export{Q as default};
1
+ import{getClassName as w}from"../../utils/dom.js";import s,{useRef as P,useState as G,useContext as J,useMemo as K,useCallback as M,useEffect as Q}from"react";import W from"../AnnotationView/index.js";import X from"../../hooks/useSize.js";import{useSingleBox as Y}from"./hooks/useSingleBox.js";import{useHighlight as Z}from"./hooks/useHighlight.js";import $ from"./components/HighlightVisible/index.js";import{PointCloudContext as oo}from"./PointCloudContext.js";import to from"./hooks/useDataLinkSwitch.js";import eo from"../pointCloud2DRectOperationView/index.js";import{useToolStyleContext as no}from"../../hooks/useToolStyle.js";var io=(o,u,i)=>new Promise((a,r)=>{var h=t=>{try{l(i.next(t))}catch(n){r(n)}},d=t=>{try{l(i.throw(t))}catch(n){r(n)}},l=t=>t.done?a(t.value):Promise.resolve(t.value).then(h,d);l((i=i.apply(o,u)).next())});const lo=({view2dData:o,setSelectedID:u,currentData:i,showEnlarge:a,checkMode:r=!1,measureVisible:h})=>{var d,l;const t=P(null),n=P(),{selectedBox:m}=Y(),p=X(t),{url:x,fallbackUrl:k,calib:C,path:v}=o,{toggle2dVisible:B,isHighlightVisible:I}=Z({currentData:i}),[_,b]=G(!1),{highlight2DLoading:z,setHighlight2DLoading:S,cuboidBoxIn2DView:f,cacheImageNodeSize:O,setSelectedIDs:R,pointCloudBoxList:H}=J(oo),{value:E}=no(),{hiddenText:N}=E||{},T=!o,U=K(()=>({zIndex:a?-1:101,is2DView:!f,imageName:o.path}),[a,f,o.path]),{rendered:A,isLinking:D}=to(U),L=e=>{g(),O({path:v,imgNode:e})},g=M(()=>{var e,y;const V=(e=n.current)==null?void 0:e.toolInstance;if(u(""),!m||!V)return;const c=o.annotations.find(q=>q.annotation.id===m.info.id);let j="";c&&((y=c==null?void 0:c.annotation.pointList)==null?void 0:y.length)>0&&(V.focusPositionByPointList(c==null?void 0:c.annotation.pointList),j=m.info.id,u(j))},[m,n.current,o.annotations]);Q(()=>{g()},[g]);const F=()=>io(void 0,null,function*(){b(!0),S(!0);try{yield B(x,k!=null?k:"",C)}catch(e){console.error("highlightOnClick error:",e)}finally{b(!1),S(!1)}});return s.createElement("div",{className:w("point-cloud-2d-image"),ref:t},f?s.createElement(W,{src:(d=o==null?void 0:o.url)!=null?d:"",fallbackSrc:(l=o==null?void 0:o.fallbackUrl)!=null?l:"",annotations:o.annotations,size:p,ref:n,globalStyle:{display:T?"none":"block"},afterImgOnLoad:L,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:h,onRightClick:({targetId:e})=>R(e),pointCloudBoxList:H,hiddenText:N}):s.createElement(s.Fragment,null,s.createElement(eo,{shouldExcludePointCloudBoxListUpdate:!D,mappingData:o,size:p,checkMode:r,afterImgOnLoad:L}),!r&&A),C&&s.createElement($,{visible:I(x),onClick:F,loading:_,disabled:z,style:{position:"absolute",right:16,top:16,zIndex:a?-1:101}}))};export{lo as default};
@@ -1 +1 @@
1
- import{getClassName as J}from"../../utils/dom.js";import i,{useState as L,useContext as ie,useEffect as Q}from"react";import{PointCloudContainer as le}from"./PointCloudLayout.js";import{PointCloudContext as re}from"./PointCloudContext.js";import{connect as se}from"react-redux";import{cKeyCode as ae,pointCloudLidar2image as ue,pointListLidar2Img as ce}from"@labelbee/lb-annotation";import{LabelBeeContext as de}from"../../store/ctx.js";import{a2MapStateToProps as me}from"../../store/annotation/map.js";import{toolStyleConverter as U}from"@labelbee/lb-utils";import fe from"./PointCloud2DSingleView.js";import W from"./components/TitleButton/index.js";import{LeftOutlined as pe}from"@ant-design/icons";import ge from"classnames";import ve from"../../assets/annotation/common/icon_esc.svg.js";import be from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import ye from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import{isNumber as Ee}from"lodash";var _e=Object.defineProperty,he=Object.defineProperties,we=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,Y=(e,n,t)=>n in e?_e(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,f=(e,n)=>{for(var t in n||(n={}))Ce.call(n,t)&&Y(e,t,n[t]);if(X)for(var t of X(n))Pe.call(n,t)&&Y(e,t,n[t]);return e},p=(e,n)=>he(e,we(n));const I=ae.default,Le=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:y,setCurIndex:g,curIndex:E=0,index:x,annotations2d:_})=>n?i.createElement(W,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?i.createElement("div",{style:{display:"flex",alignItems:"center"}},i.createElement(pe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{y(!1),g(void 0)}}),i.createElement("span",null,t==null?void 0:t.calName),i.createElement("span",{style:{marginLeft:"8px"}},E+1,"/",_==null?void 0:_.length)):i.createElement(W,{title:t==null?void 0:t.calName,onClick:()=>{y(!0),g(x)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),xe=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:y,highlightAttribute:g,loadPCDFileLoading:E,checkMode:x,measureVisible:_})=>{var O;const[d,Z]=L([]),{topViewInstance:B,displayPointCloudList:j,polygonList:S,imageSizes:N,selectedIDs:V}=ie(re),[F,D]=L(""),[h,k]=L(!1),[a,w]=L(void 0);Q(()=>{var l;if(!E&&B&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(o=>{var v,T,K;const $=j.reduce((m,c)=>{var b,u;const C=c.id===F||g===c.attribute,{transferViewData:H,viewRangePointList:P}=(b=ue(c,o.calib,{createRange:C}))!=null?b:{};if(!H||!P)return[];const M=(u=U.getColorFromConfig({attribute:c.attribute},p(f({},n),{attributeConfigurable:!0}),{}))==null?void 0:u.stroke,ne=ee({viewDataPointList:H,pointCloudBox:c,defaultViewStyle:r,stroke:M}),G=[...m,...ne];return(P==null?void 0:P.length)>0&&G.unshift({type:"polygon",annotation:p(f({id:F,pointList:P},r),{stroke:M,fill:"rgba(255, 255, 255, 0.6)"})}),G},[]),q=N[(v=o==null?void 0:o.path)!=null?v:""];q&&Ee((T=o==null?void 0:o.calib)==null?void 0:T.groundHeight)&&S.forEach(m=>{const c=m.pointList.map(u=>{var C;return p(f({},u),{z:(C=o==null?void 0:o.calib)==null?void 0:C.groundHeight})}),b=ce(c,o==null?void 0:o.calib,q);if(b){const u=U.getColorFromConfig({attribute:m.attribute},p(f({},n),{attributeConfigurable:!0}),{});$.push({type:"polygon",annotation:p(f({id:m.id,pointList:b},r),{stroke:u==null?void 0:u.stroke,fill:V.includes(m.id)?u==null?void 0:u.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:$,url:o==null?void 0:o.url,calName:(K=o==null?void 0:o.calib)==null?void 0:K.calName,calib:o==null?void 0:o.calib,path:o==null?void 0:o.path})}),Z(s)}},[j,e==null?void 0:e.mappingImgList,F,g,E,S,N,V]),Q(()=>(window.addEventListener("keydown",R),()=>{window.removeEventListener("keydown",R)}),[a]);const R=l=>{const{keyCode:r}=l;switch(r){case I.Esc:h&&k(!1);break;case I.Left:A();break;case I.Right:z();break}},A=()=>{a===void 0||!h||Number(a)>0&&w(a-1)},z=()=>{a===void 0||!h||Number(a)<(d==null?void 0:d.length)-1&&w(a+1)},ee=({viewDataPointList:l,pointCloudBox:r,defaultViewStyle:s,stroke:o})=>l?l.map(v=>({type:v.type,annotation:p(f({id:r.id,pointList:v.pointList},s),{stroke:o})})):[],te=!e||!(e==null?void 0:e.mappingImgList)||!(((O=e==null?void 0:e.mappingImgList)==null?void 0:O.length)>0),oe=i.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},i.createElement("img",{src:be,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>A()}),i.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),i.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),i.createElement("img",{src:ye,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>z()}),i.createElement("img",{src:ve,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{k(!1),w(void 0)}}),i.createElement("span",null,"\u952E\u9000\u51FA"));return(d==null?void 0:d.length)>0?i.createElement(i.Fragment,null,d.map((l,r)=>{const s=h&&r===a;return i.createElement(le,{className:ge({[J("point-cloud-2d-container")]:!0,[J("point-cloud-container","zoom")]:s}),title:i.createElement(Le,{showEnlarge:s,isEnlargeTopView:y,data:l,setIsEnlarge:k,setCurIndex:w,curIndex:a,index:r,annotations2d:d}),titleOnSurface:!s,style:{display:te?"none":"flex",width:s?"100%":t},key:r,toolbar:oe},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&i.createElement(fe,{currentData:e,view2dData:l,setSelectedID:D,showEnlarge:s,checkMode:x,measureVisible:_}))})):null};var Fe=se(me,null,null,{context:de})(xe);export{Fe as default};
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 +1 @@
1
- import{getClassName as m}from"../../utils/dom.js";import{cKeyCode as K,PointCloud as M}from"@labelbee/lb-annotation";import{PointCloudUtils as B,toolStyleConverter as Z,EPerspectiveView as E}from"@labelbee/lb-utils";import j from"classnames";import e,{useContext as b,useState as O,useRef as H,useEffect as u,useMemo as U}from"react";import{PointCloudContainer as q}from"./PointCloudLayout.js";import{PointCloudContext as G}from"./PointCloudContext.js";import{a2MapStateToProps as J}from"../../store/annotation/map.js";import{connect as Q}from"react-redux";import{jsonParser as W}from"../../utils/index.js";import{useSingleBox as X}from"./hooks/useSingleBox.js";import{useSphere as Y}from"./hooks/useSphere.js";import{Switch as $,Tooltip as ee}from"antd";import te from"../../hooks/useSize.js";import{usePointCloudViews as oe}from"./hooks/usePointCloudViews.js";import{useTranslation as L}from"react-i18next";import{LabelBeeContext as ne}from"../../store/ctx.js";import ie from"./components/PointCloudSizeSlider/index.js";import re from"./components/TitleButton/index.js";import{LeftOutlined as ae}from"@ant-design/icons";var le=Object.defineProperty,se=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,D=(n,r,a)=>r in n?le(n,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[r]=a,N=(n,r)=>{for(var a in r||(r={}))me.call(r,a)&&D(n,a,r[a]);if(z)for(var a of z(r))ue.call(r,a)&&D(n,a,r[a]);return n},de=(n,r)=>se(n,ce(r));const pe=K.default,we="LABELBEE-POINTCLOUD",P=e.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),d=({perspectiveView:n})=>{const{isActive:r,setTarget3DView:a}=b(P),o=p=>j({[m("point-cloud-3d-view",p)]:!0,active:r});return e.createElement("span",{onClick:()=>{a(E[n])},className:o(n.toLocaleLowerCase())})},k=({isEnlarge:n})=>{const{reset3DView:r,followTopView:a}=b(P),{t:o}=L(),p=e.createElement(e.Fragment,null,e.createElement(d,{perspectiveView:"Top"}),e.createElement(d,{perspectiveView:"Front"}),e.createElement(d,{perspectiveView:"Left"}),e.createElement(d,{perspectiveView:"Back"}),e.createElement(d,{perspectiveView:"Right"}),e.createElement(d,{perspectiveView:"LFT"}),e.createElement(d,{perspectiveView:"RBT"})),V=e.createElement(e.Fragment,null,e.createElement(ee,{title:o("CameraFollowTopView")},e.createElement("span",{onClick:()=>{a()},className:m("point-cloud-3d-view","followTop")})),e.createElement("span",{onClick:()=>{r()},className:m("point-cloud-3d-view","reset")}));return n?e.createElement("div",{className:m("point-cloud-3d-sidebarZoom")},V,p):e.createElement("div",{className:m("point-cloud-3d-sidebar")},p,V)},ve=({currentData:n,config:r,highlightAttribute:a})=>{const o=b(G),[p,V]=O(!0),[v,_]=O(!1),f=H(null),{initPointCloud3d:S}=oe(),C=te(f),{t:h}=L();u(()=>{!o.mainViewInstance||S==null||S(C)},[C]);const{selectedBox:w}=X(),{selectedSphere:g}=Y(),x=t=>{var i,l;const s=w==null?void 0:w.info;if(s){const c=N({},s.center);c.x=c.x-.01,c.z=1e3;const I=t===E.Top;(i=o.mainViewInstance)==null||i.updateCameraByBox(s,t,I?c:void 0)}g&&((l=o.mainViewInstance)==null||l.updateCameraBySphere(g,t))},R=()=>{var t;(t=o.mainViewInstance)==null||t.resetCamera()},F=()=>{var t,i;const l=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance.camera;l&&((i=o.mainViewInstance)==null||i.applyCameraTarget(l))};u(()=>{if(f.current&&(n==null?void 0:n.url)){let t=o.mainViewInstance;!t&&C.width&&(t=new M({container:f.current,isOrthographicCamera:!0,orthographicParams:B.getDefaultOrthographicParams(C),config:r}),o.setMainViewInstance(t))}},[C,n]),u(()=>{var t;if(f.current&&(n==null?void 0:n.url)&&n.result&&o.mainViewInstance){let i=o.mainViewInstance;const l=B.getBoxParamsFromResultList(n.result);l.forEach(s=>{var c;const I=(c=Z.getColorFromConfig({attribute:s.attribute},de(N({},r),{attributeConfigurable:!0}),{}))==null?void 0:c.hex;i==null||i.addBoxToSense(s,I)}),i.render(),o.setPointCloudResult(l),o.setPointCloudValid((t=W(n.result))==null?void 0:t.valid)}},[n,o.mainViewInstance]),u(()=>{var t,i,l,s;if(w){x(E.Top);const c=(l=(i=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?l:1;(s=o.mainViewInstance)==null||s.updateCameraZoom(c)}},[w]),u(()=>{var t,i,l,s;if(g){x(E.Top);const c=(l=(i=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?l:1;(s=o.mainViewInstance)==null||s.updateCameraZoom(c)}},[g]),u(()=>(window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T)}),[]);const T=t=>{if(t.keyCode===pe.Esc){_(!1);return}},y=U(()=>({reset3DView:R,setTarget3DView:x,isActive:!!w,followTopView:F}),[w,o.mainViewInstance]);u(()=>{var t,i,l;const s=o.pointCloudBoxList.filter(c=>c.attribute===a);(s==null?void 0:s.length)>0&&((t=o.mainViewInstance)==null||t.clearHighlightBoxes(),(i=o.mainViewInstance)==null||i.highlightBoxes(s)),s.length===0&&((l=o.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[a,o.mainViewInstance]);const A=e.createElement(e.Fragment,null,e.createElement(ie,{onChange:t=>{var i;(i=o.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),e.createElement("span",{style:{marginRight:8}},h("ShowArrows")),e.createElement($,{size:"small",checked:p,onChange:t=>{var i;V(t),(i=o.mainViewInstance)==null||i.setShowDirection(t)}}),v&&e.createElement(P.Provider,{value:y},e.createElement(k,{isEnlarge:v})));return e.createElement(q,{className:j({[m("point-cloud-3d-container")]:!0,[m("point-cloud-container","zoom")]:v}),title:v?e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement(ae,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{_(!1)}}),h("3DView")):e.createElement(re,{title:h("3DView"),onClick:()=>{_(!0)}}),toolbar:A},e.createElement("div",{className:m("point-cloud-3d-content")},!v&&e.createElement(P.Provider,{value:y},e.createElement(k,null)),e.createElement("div",{className:m("point-cloud-3d-view"),id:we,ref:f})))};var fe=Q(J,null,null,{context:ne})(ve);export{fe as default};
1
+ import{getClassName as d}from"../../utils/dom.js";import{cKeyCode as G,PointCloud as J}from"@labelbee/lb-annotation";import{PointCloudUtils as T,toolStyleConverter as Q,EPerspectiveView as E}from"@labelbee/lb-utils";import N from"classnames";import o,{useContext as b,useState as y,useRef as W,useEffect as u,useMemo as X}from"react";import{PointCloudContainer as Y}from"./PointCloudLayout.js";import{PointCloudContext as $}from"./PointCloudContext.js";import{a2MapStateToProps as ee}from"../../store/annotation/map.js";import{connect as te}from"react-redux";import{jsonParser as oe}from"../../utils/index.js";import{useSingleBox as ne}from"./hooks/useSingleBox.js";import{useSphere as ie}from"./hooks/useSphere.js";import{Switch as le,Tooltip as re}from"antd";import ae from"../../hooks/useSize.js";import{usePointCloudViews as se}from"./hooks/usePointCloudViews.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as ce}from"../../store/ctx.js";import de from"./components/PointCloudSizeSlider/index.js";import me from"./components/TitleButton/index.js";import{LeftOutlined as ue}from"@ant-design/icons";import{useToolStyleContext as pe}from"../../hooks/useToolStyle.js";var ve=Object.defineProperty,we=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,F=(n,l,r)=>l in n?ve(n,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[l]=r,A=(n,l)=>{for(var r in l||(l={}))Ce.call(l,r)&&F(n,r,l[r]);if(R)for(var r of R(l))Ve.call(l,r)&&F(n,r,l[r]);return n},Pe=(n,l)=>we(n,fe(l));const ge=G.default,Ee="LABELBEE-POINTCLOUD",_=o.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),p=({perspectiveView:n})=>{const{isActive:l,setTarget3DView:r}=b(_),v=t=>N({[d("point-cloud-3d-view",t)]:!0,active:l});return o.createElement("span",{onClick:()=>{r(E[n])},className:v(n.toLocaleLowerCase())})},H=({isEnlarge:n})=>{const{reset3DView:l,followTopView:r}=b(_),{t:v}=k(),t=o.createElement(o.Fragment,null,o.createElement(p,{perspectiveView:"Top"}),o.createElement(p,{perspectiveView:"Front"}),o.createElement(p,{perspectiveView:"Left"}),o.createElement(p,{perspectiveView:"Back"}),o.createElement(p,{perspectiveView:"Right"}),o.createElement(p,{perspectiveView:"LFT"}),o.createElement(p,{perspectiveView:"RBT"})),P=o.createElement(o.Fragment,null,o.createElement(re,{title:v("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")},P,t):o.createElement("div",{className:d("point-cloud-3d-sidebar")},t,P)},_e=({currentData:n,config:l,highlightAttribute:r})=>{var v;const t=b($),[P,U]=y(!0),[f,h]=y(!1),C=W(null),{initPointCloud3d:B}=se(),V=ae(C),{t:x}=k(),{value:L}=pe(),{hiddenText:j}=L||{};u(()=>{let e=t.mainViewInstance;e&&e.updateHiddenTextAndRender(j,t.pointCloudBoxList)},[L]),u(()=>{!t.mainViewInstance||B==null||B(V)},[V]);const{selectedBox:m}=ne(),{selectedSphere:g}=ie(),[K,O]=y(!0),I=e=>{var i,a;const s=m==null?void 0:m.info;if(s){const c=A({},s.center);c.x=c.x-.01,c.z=1e3;const w=e===E.Top;(i=t.mainViewInstance)==null||i.updateCameraByBox(s,e,w?c:void 0)}g&&((a=t.mainViewInstance)==null||a.updateCameraBySphere(g,e))},M=()=>{var e;(e=t.mainViewInstance)==null||e.resetCamera()},Z=()=>{var e,i;const a=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance.camera;a&&((i=t.mainViewInstance)==null||i.applyCameraTarget(a))};u(()=>{if(C.current&&(n==null?void 0:n.url)){let e=t.mainViewInstance;!e&&V.width&&(e=new J({container:C.current,isOrthographicCamera:!0,orthographicParams:T.getDefaultOrthographicParams(V),config:l,hiddenText:j}),e.setHandlerPipe({setSelectedIDs:t.setSelectedIDs,setNeedUpdateCenter:O}),t.setMainViewInstance(e))}},[V,n]),u(()=>{var e;if(C.current&&(n==null?void 0:n.url)&&n.result&&t.mainViewInstance){let i=t.mainViewInstance;const a=T.getBoxParamsFromResultList(n.result);a.forEach(c=>{var w;const S=(w=Q.getColorFromConfig({attribute:c.attribute},Pe(A({},l),{attributeConfigurable:!0}),{}))==null?void 0:w.hex;i==null||i.addBoxToSense(c,S)}),i.render(),t.setPointCloudResult(a);const s=T.getRectParamsFromResultList(n.result);t.setRectList(s),t.setPointCloudValid((e=oe(n.result))==null?void 0:e.valid)}},[n,t.mainViewInstance]),u(()=>{var e,i,a,s,c;const w=(e=m==null?void 0:m.info)==null?void 0:e.id;if(!K){O(!0);return}if(w!==void 0){I(E.Top);const S=(s=(a=(i=t.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?s:1;(c=t.mainViewInstance)==null||c.updateCameraZoom(S)}},[(v=m==null?void 0:m.info)==null?void 0:v.id]),u(()=>{var e,i,a,s;if(g){I(E.Top);const c=(a=(i=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?a:1;(s=t.mainViewInstance)==null||s.updateCameraZoom(c)}},[g]),u(()=>(window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D)}),[]);const D=e=>{if(e.keyCode===ge.Esc){h(!1);return}},z=X(()=>({reset3DView:M,setTarget3DView:I,isActive:!!m,followTopView:Z}),[m,t.mainViewInstance]);u(()=>{var e,i,a;const s=t.pointCloudBoxList.filter(c=>c.attribute===r);(s==null?void 0:s.length)>0&&((e=t.mainViewInstance)==null||e.clearHighlightBoxes(),(i=t.mainViewInstance)==null||i.highlightBoxes(s)),s.length===0&&((a=t.mainViewInstance)==null||a.clearHighlightBoxesAndRender())},[r,t.mainViewInstance]);const q=o.createElement(o.Fragment,null,o.createElement(de,{onChange:e=>{var i;(i=t.mainViewInstance)==null||i.updatePointSize({customSize:e})}}),o.createElement("span",{style:{marginRight:8}},x("ShowArrows")),o.createElement(le,{size:"small",checked:P,onChange:e=>{var i;U(e),(i=t.mainViewInstance)==null||i.setShowDirection(e)}}),f&&o.createElement(_.Provider,{value:z},o.createElement(H,{isEnlarge:f})));return o.createElement(Y,{className:N({[d("point-cloud-3d-container")]:!0,[d("point-cloud-container","zoom")]:f}),title:f?o.createElement("div",{style:{display:"flex",alignItems:"center"}},o.createElement(ue,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{h(!1)}}),x("3DView")):o.createElement(me,{title:x("3DView"),onClick:()=>{h(!0)}}),toolbar:q},o.createElement("div",{className:d("point-cloud-3d-content")},!f&&o.createElement(_.Provider,{value:z},o.createElement(H,null)),o.createElement("div",{className:d("point-cloud-3d-view"),id:Ee,ref:C})))};var he=te(ee,null,null,{context:ce})(_e);export{he as default};
@@ -1 +1 @@
1
- import{PointCloudAnnotation as B}from"@labelbee/lb-annotation";import{getClassName as w}from"../../utils/dom.js";import{PointCloudContainer as y}from"./PointCloudLayout.js";import c,{useRef as k,useEffect as h}from"react";import{PointCloudContext as v}from"./PointCloudContext.js";import{EPerspectiveView as j}from"@labelbee/lb-utils";import{useSingleBox as V}from"./hooks/useSingleBox.js";import{useSphere as b}from"./hooks/useSphere.js";import{useZoom as S}from"./hooks/useZoom.js";import{SizeInfoForView as E}from"./PointCloudInfos.js";import{connect as I}from"react-redux";import{a2MapStateToProps as T}from"../../store/annotation/map.js";import{usePointCloudViews as D}from"./hooks/usePointCloudViews.js";import O from"../../hooks/useSize.js";import N from"./components/EmptyPage/index.js";import{useTranslation as M}from"react-i18next";import{LabelBeeContext as X}from"../../store/ctx.js";import U from"../../utils/ToolUtils.js";import Z from"./components/TitleButton/index.js";const A=(u,r,a=1)=>{const{width:e,height:o}=r,t={x:u.x+e*a/2,y:u.y+o*a/2},m={x:r.width/2,y:r.height/2};return{offsetX:(m.x-t.x)/a,offsetY:-(m.y-t.y)/a}},g=(u,r,a,e,o)=>{const{offsetX:t,offsetY:m}=A(u,a,r);if(o.camera.zoom=r,u){const d=Math.cos(e),f=Math.sin(e),x=t*d,C=t*f,{x:p,y:n,z:l}=o.initCameraPosition;o.camera.position.set(p+C,n-x,l+m)}o.camera.updateProjectionMatrix(),o.render()},L=({currentData:u,config:r,checkMode:a})=>{const e=c.useContext(v),o=k(null),t=O(o),{selectedBox:m}=V(),{selectedSphere:d}=b(),{syncBackviewToolZoom:f}=S(),{t:x}=M(),{backViewUpdateBox:C,backViewUpdatePoint:p}=D();return h(()=>{if(o.current){const n={width:o.current.clientWidth,height:o.current.clientHeight},l=new B({container:o.current,size:n,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:r,checkMode:a,toolName:U.getPointCloudToolList()});e.setBackViewInstance(l)}},[]),h(()=>{if(!t||!e.backViewInstance)return;const{toolInstance:n,pointCloudInstance:l}=e.backViewInstance;n.singleOn("renderZoom",(i,s)=>{if(e.selectedPointCloudBox){g(s,i,t,e.selectedPointCloudBox.rotation,l),f(s,i,t);return}if(d){g(s,i,t,0,l),f(s,i,t);return}}),n.singleOn("dragMove",({currentPos:i,zoom:s})=>{!e.selectedPointCloudBox&&!d||g(i,s,t,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,l)}),n.singleOn("updatePointByDrag",(i,s)=>{d&&(p==null||p(i,s[0]))}),n.singleOn("updatePolygonByDrag",i=>{if(e.selectedIDs.length===1&&i.length===1){const{newPolygon:s,originPolygon:P}=i[0];s&&P&&C(s,P)}})},[e,t]),h(()=>{var n;(n=e==null?void 0:e.backViewInstance)==null||n.initSize(t)},[t]),c.createElement(y,{className:w("point-cloud-container","back-view"),title:c.createElement(Z,{title:x("BackView")}),titleOnSurface:!0},c.createElement("div",{className:w("point-cloud-container","bottom-view-content")},c.createElement("div",{className:w("point-cloud-container","core-instance"),ref:o}),!m&&!d&&c.createElement(N,null),c.createElement(E,{perspectiveView:j.Back})))};var Y=I(T,null,null,{context:X})(L);export{Y as default};
1
+ import{PointCloudAnnotation as B}from"@labelbee/lb-annotation";import{getClassName as w}from"../../utils/dom.js";import{PointCloudContainer as v}from"./PointCloudLayout.js";import c,{useRef as y,useEffect as h}from"react";import{PointCloudContext as k}from"./PointCloudContext.js";import{EPerspectiveView as j}from"@labelbee/lb-utils";import{useSingleBox as V}from"./hooks/useSingleBox.js";import{useSphere as b}from"./hooks/useSphere.js";import{useZoom as S}from"./hooks/useZoom.js";import{SizeInfoForView as E}from"./PointCloudInfos.js";import{connect as I}from"react-redux";import{a2MapStateToProps as T}from"../../store/annotation/map.js";import{usePointCloudViews as D}from"./hooks/usePointCloudViews.js";import N from"../../hooks/useSize.js";import O from"./components/EmptyPage/index.js";import{useTranslation as M}from"react-i18next";import{LabelBeeContext as X}from"../../store/ctx.js";import U from"../../utils/ToolUtils.js";import Z from"./components/TitleButton/index.js";const A=(u,r,a=1)=>{const{width:e,height:o}=r,t={x:u.x+e*a/2,y:u.y+o*a/2},m={x:r.width/2,y:r.height/2};return{offsetX:(m.x-t.x)/a,offsetY:-(m.y-t.y)/a}},g=(u,r,a,e,o)=>{const{offsetX:t,offsetY:m}=A(u,a,r);if(o.camera.zoom=r,u){const d=Math.cos(e),f=Math.sin(e),x=t*d,C=t*f,{x:p,y:n,z:l}=o.initCameraPosition;o.camera.position.set(p+C,n-x,l+m)}o.camera.updateProjectionMatrix(),o.render()},L=({currentData:u,config:r,checkMode:a})=>{const e=c.useContext(k),o=y(null),t=N(o),{selectedBox:m}=V(),{selectedSphere:d}=b(),{syncBackviewToolZoom:f}=S(),{t:x}=M(),{backViewUpdateBox:C,backViewUpdatePoint:p}=D();return h(()=>{if(o.current){const n={width:o.current.clientWidth,height:o.current.clientHeight},l=new B({container:o.current,size:n,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:r,checkMode:a,toolName:U.getPointCloudToolList()});e.setBackViewInstance(l)}},[]),h(()=>{if(!t||!e.backViewInstance)return;const{toolInstance:n,pointCloudInstance:l}=e.backViewInstance;n.singleOn("renderZoom",(i,s)=>{if(e.selectedPointCloudBox){g(s,i,t,e.selectedPointCloudBox.rotation,l),f(s,i,t);return}if(d){g(s,i,t,0,l),f(s,i,t);return}}),n.singleOn("dragMove",({currentPos:i,zoom:s})=>{!e.selectedPointCloudBox&&!d||g(i,s,t,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,l)}),n.singleOn("updatePointByDrag",(i,s)=>{d&&(p==null||p(i,s[0]))}),n.singleOn("updatePolygonByDrag",i=>{if(e.selectedIDs.length===1&&i.length===1){const{newPolygon:s,originPolygon:P}=i[0];s&&P&&C(s,P)}})},[e,t]),h(()=>{var n;(n=e==null?void 0:e.backViewInstance)==null||n.initSize(t)},[t]),c.createElement(v,{className:w("point-cloud-container","back-view"),title:c.createElement(Z,{title:x("BackView")}),titleOnSurface:!0,titleNonInteractive:!0},c.createElement("div",{className:w("point-cloud-container","bottom-view-content")},c.createElement("div",{className:w("point-cloud-container","core-instance"),ref:o}),!m&&!d&&c.createElement(O,null),c.createElement(E,{perspectiveView:j.Back})))};var Y=I(T,null,null,{context:X})(L);export{Y as default};
@@ -1 +1 @@
1
- import{EPointCloudPattern as z}from"@labelbee/lb-utils";import nt,{useState as n,useRef as Vt,useMemo as it,useEffect as E}from"react";import{ActionsHistory as st,EToolName as G}from"@labelbee/lb-annotation";import{useDispatch as Bt}from"../../store/ctx.js";import{ChangeSave as Ot}from"../../store/annotation/actionCreators.js";import Ht from"../../store/annotatedBox/index.js";var Rt=Object.defineProperty,jt=Object.defineProperties,zt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,rt=(a,e,i)=>e in a?Rt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i,Nt=(a,e)=>{for(var i in e||(e={}))Et.call(e,i)&&rt(a,i,e[i]);if(lt)for(var i of lt(e))Gt.call(e,i)&&rt(a,i,e[i]);return a},Ft=(a,e)=>jt(a,zt(e)),Mt=(a,e,i)=>new Promise((m,C)=>{var S=v=>{try{f(i.next(v))}catch(s){C(s)}},_=v=>{try{f(i.throw(v))}catch(s){C(s)}},f=v=>v.done?m(v.value):Promise.resolve(v.value).then(S,_);f((i=i.apply(a,e)).next())});const at=nt.createContext({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:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new st,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:G.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:z.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:a=>{},imageSizes:{},cacheImageNodeSize:()=>{}}),Tt=({children:a})=>{const[e,i]=n([]),[m,C]=n([]),[S,_]=n([]),[f,v]=n([]),[s,x]=n([]),[y,V]=n([]),[N,dt]=n(!0),[F,ct]=n(!0),[M,ut]=n(1),[d,T]=n(),[Z,k]=n(),[q,J]=n(),[l,K]=n(),[Q,pt]=n(""),[B,gt]=n(G.Rect),ht=Vt(new st).current,[p,O]=n([]),[U,vt]=n(""),[H,Pt]=n(z.Detection),[b,W]=n(void 0),[R,ft]=n([]),[j,mt]=n([]),g=Ht(),[X,bt]=n({}),It=Bt(),Ct=r=>{const{imgNode:c,path:u}=r;u&&c&&bt(P=>Ft(Nt({},P),{[u]:{width:c.width,height:c.height}}))},Y=it(()=>s.length===1?s[0]:"",[s]),w=it(()=>{const r=e.find(t=>t.id===Y),c=t=>{const o=e.concat(t);return i(o),o},u=t=>{const o=m.concat(t);return C(o),o},P=t=>{dt(t!==!1)},h=t=>{t===void 0&&x([]),typeof t=="string"&&x([t]),Array.isArray(t)&&x(Array.from(new Set(t)))},yt=t=>{s.includes(t)?h(s.filter(o=>o!==t)):h([...s,t])},Lt=t=>{y.includes(t)?V([]):V([t])},Dt=()=>{if(B===G.Rect){const t=e.map(o=>o.id);h(t),d==null||d.pointCloud2dOperation.setSelectedIDs(t)}},wt=t=>{h(e.filter(o=>o.attribute===t).map(o=>o.id))},$=e.filter(t=>!p.includes(t.attribute)),tt=m.filter(t=>!p.includes(t.attribute)),et=f.filter(t=>t.attribute&&!p.includes(t.attribute)),At=t=>{if(p.includes(t))O(p.filter(o=>o!==t));else{const o=p.concat(t);O(o)}},_t=(t=$,o=S,L=tt,A=et,D=R)=>{var I;l==null||l.clearAllBox(),l==null||l.clearAllSphere(),d==null||d.updatePolygonList(t,o),d==null||d.updatePointList(L),d==null||d.updateLineList(A),l==null||l.generateBoxes(t),l==null||l.generateSpheres(L),(I=b==null?void 0:b.store)==null||I.updateCurrentSegment(D),ot(t)},xt=()=>{T(void 0),k(void 0),J(void 0),K(void 0)},ot=(t,o)=>Mt(void 0,null,function*(){var L;if(!l)return;const A=l.pointCloudObject;if(!!A)try{const D=yield l.getHighlightIndexByMappingImgList({mappingImgList:o!=null?o:j,points:A.geometry.attributes.position.array}),I=yield l==null?void 0:l.highlightOriginPointCloud(t,D);return I&&((L=d==null?void 0:d.pointCloudInstance)==null||L.updateColor(I)),I}catch(D){console.error(D)}});return{selectedID:Y,pointCloudBoxList:e,pointCloudSphereList:m,displayPointCloudList:$,displaySphereList:tt,displayLineList:et,selectedIDs:s,setPointCloudResult:i,setSelectedIDs:h,addPointCloudBox:c,addPointCloudSphere:u,setPointCloudSphereList:C,valid:N,selectedPointCloudBox:r,setPointCloudValid:P,addSelectedID:yt,addHighlightID:Lt,selectedAllBoxes:Dt,topViewInstance:d,setTopViewInstance:T,sideViewInstance:Z,setSideViewInstance:k,backViewInstance:q,setBackViewInstance:J,mainViewInstance:l,setMainViewInstance:K,polygonList:S,setPolygonList:_,lineList:f,setLineList:v,zoom:M,setZoom:ut,history:ht,toggleAttributesVisible:At,hideAttributes:p,setHideAttributes:O,reRender:_t,attrPanelLayout:U,setAttrPanelLayout:vt,syncAllViewPointCloudColor:ot,defaultAttribute:Q,setDefaultAttribute:pt,pointCloudPattern:B,setPointCloudPattern:gt,selectSpecAttr:wt,globalPattern:H,setGlobalPattern:t=>{H!==t&&(It(Ot),Pt(t),t===z.Detection&&W(void 0))},ptSegmentInstance:b,setPtSegmentInstance:W,segmentation:R,setSegmentation:ft,clearAllDetectionInstance:xt,highlight2DDataList:j,setHighlight2DDataList:mt,cuboidBoxIn2DView:F,setCuboidBoxIn2DView:ct,imageSizes:X,cacheImageNodeSize:Ct,highlightIDs:y,setHighlightIDs:V}},[N,s,e,m,S,f,d,Z,q,l,M,p,U,Q,B,H,b,R,j,F,X,y]);E(()=>{var r,c,u;(r=g==null?void 0:g.setPointCloudBoxList)==null||r.call(g,e),(c=g==null?void 0:g.setHighlightIDs)==null||c.call(g,y),(u=g==null?void 0:g.setSelectedIDs)==null||u.call(g,s)},[e,s,y]),E(()=>{var r;(r=g==null?void 0:g.setPtCtx)==null||r.call(g,w)},[w]);const St=()=>{const r=e.filter(h=>p.includes(h.attribute)),{setSelectedIDs:c,reRender:u}=w,P=r.map(h=>h.id);P.length>0&&c(s.filter(h=>!P.includes(h))),u()};return E(()=>{var r,c,u,P;St(),(c=(r=d==null?void 0:d.toolInstance)==null?void 0:r.setHiddenAttributes)==null||c.call(r,p),(P=(u=b==null?void 0:b.store)==null?void 0:u.setHiddenAttributes)==null||P.call(u,p)},[p]),nt.createElement(at.Provider,{value:w},a)};export{at as PointCloudContext,Tt as PointCloudProvider};
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 +1 @@
1
- import{PointCloudUtils as v,EPerspectiveView as k}from"@labelbee/lb-utils";import r,{useState as D,useEffect as N}from"react";import{PointCloudContext as m}from"./PointCloudContext.js";import{UnitUtils as V}from"@labelbee/lb-annotation";import{useSingleBox as $}from"./hooks/useSingleBox.js";import{useTranslation as x}from"react-i18next";var H=Object.defineProperty,U=Object.defineProperties,R=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,S=(o,e,t)=>e in o?H(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,B=(o,e)=>{for(var t in e||(e={}))T.call(e,t)&&S(o,t,e[t]);if(I)for(var t of I(e))K.call(e,t)&&S(o,t,e[t]);return o},F=(o,e)=>U(o,R(e));const a=2,A={color:"white",backgroundColor:"rgba(153, 153, 153, 0.3)",padding:"8px 10px",zIndex:20,fontSize:12},W=({perspectiveView:o})=>{const{pointCloudBoxList:e,selectedID:t}=r.useContext(m),d=e.find(u=>u.id===t),l=x(),{t:s}=l;if(t&&d){const{length:u,width:f,height:i}=v.transferBox2Kitti(d),b=o===k.Back?[{label:s("Width"),value:f},{label:s("Height"),value:i}]:[{label:s("Length"),value:u},{label:s("Height"),value:i}];return r.createElement("div",{style:F(B({position:"absolute"},A),{bottom:"4%",left:"50%",transform:"translate(-50%, 0)"})},b.map((c,n)=>r.createElement("span",{key:n,style:{marginRight:n===0?16:0}},`${c.label}: ${c.value.toFixed(a)}`)))}return null},M=({checkMode:o,config:e,style:t})=>{const d=r.useContext(m),{selectedBox:l}=$(),[s,u]=D([]),f=x(),{t:i,i18n:b}=f,c=t;return N(()=>{var n,g;if(!l)return;const{length:h,width:_,height:y,rotation_y:L}=v.transferBox2Kitti(l.info),{x:P,y:C,z:w}=l.info.center;let p=[{label:"x",value:P==null?void 0:P.toFixed(a)},{label:"y",value:C==null?void 0:C.toFixed(a)},{label:"z",value:w==null?void 0:w.toFixed(a)},{label:i("Length"),value:h==null?void 0:h.toFixed(a)},{label:i("Width"),value:_==null?void 0:_.toFixed(a)},{label:i("Height"),value:y==null?void 0:y.toFixed(a)},{label:i("Rotation_y"),value:(n=V.rad2deg(L))==null?void 0:n.toFixed(a)}];(g=d.mainViewInstance)==null||g.filterPointsByBox(l.info).then(j=>{var E,O;if(!j){u(p);return}p.push({label:i("PointCount"),value:`${(O=(E=l.info)==null?void 0:E.count)!=null?O:0}`}),o===!0&&l.info.subAttribute&&e&&v.getSubAttributeName(l.info.subAttribute,e).forEach(z=>p.push(z)),u(p)})},[l,b.language]),l?r.createElement("div",{style:t||F(B({position:"absolute"},A),{right:8,bottom:8})},s.map(n=>c?r.createElement("div",{key:n.label,style:{margin:"0px 4px"}},`${n.label}: ${n.value}`):r.createElement("div",{key:n.label},r.createElement("span",{style:{width:"38px",display:"inline-block",textAlign:"end"}},n.label),": ",r.createElement("span",null,n.value)))):null},X=()=>{const o=r.useContext(m),{t:e}=x();return o.valid===!1?r.createElement("div",{style:{position:"absolute",backgroundColor:"rgb(242, 101, 73)",color:"white",opacity:.7,left:0,top:0,fontSize:30,padding:"8px 16px",zIndex:20,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},e("Invalid")):null};export{M as BoxInfos,X as PointCloudValidity,W as SizeInfoForView};
1
+ import{PointCloudUtils as v,EPerspectiveView as k}from"@labelbee/lb-utils";import r,{useState as D,useEffect as N}from"react";import{PointCloudContext as m}from"./PointCloudContext.js";import{UnitUtils as V}from"@labelbee/lb-annotation";import{useSingleBox as $}from"./hooks/useSingleBox.js";import{useTranslation as x}from"react-i18next";var H=Object.defineProperty,U=Object.defineProperties,R=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,S=(o,e,t)=>e in o?H(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,B=(o,e)=>{for(var t in e||(e={}))T.call(e,t)&&S(o,t,e[t]);if(I)for(var t of I(e))K.call(e,t)&&S(o,t,e[t]);return o},F=(o,e)=>U(o,R(e));const a=2,A={color:"white",backgroundColor:"rgba(153, 153, 153, 0.3)",padding:"8px 10px",zIndex:20,fontSize:12},W=({perspectiveView:o})=>{const{pointCloudBoxList:e,selectedID:t}=r.useContext(m),d=e.find(u=>u.id===t),l=x(),{t:s}=l;if(t&&d){const{length:u,width:f,height:i}=v.transferBox2Kitti(d),b=o===k.Back?[{label:s("Width"),value:f},{label:s("Height"),value:i}]:[{label:s("Length"),value:u},{label:s("Height"),value:i}];return r.createElement("div",{style:F(B({position:"absolute"},A),{bottom:"4%",left:"50%",transform:"translate(-50%, 0)",pointerEvents:"none"})},b.map((c,n)=>r.createElement("span",{key:n,style:{marginRight:n===0?16:0}},`${c.label}: ${c.value.toFixed(a)}`)))}return null},M=({checkMode:o,config:e,style:t})=>{const d=r.useContext(m),{selectedBox:l}=$(),[s,u]=D([]),f=x(),{t:i,i18n:b}=f,c=t;return N(()=>{var n,g;if(!l)return;const{length:h,width:_,height:y,rotation_y:L}=v.transferBox2Kitti(l.info),{x:P,y:C,z:E}=l.info.center;let p=[{label:"x",value:P==null?void 0:P.toFixed(a)},{label:"y",value:C==null?void 0:C.toFixed(a)},{label:"z",value:E==null?void 0:E.toFixed(a)},{label:i("Length"),value:h==null?void 0:h.toFixed(a)},{label:i("Width"),value:_==null?void 0:_.toFixed(a)},{label:i("Height"),value:y==null?void 0:y.toFixed(a)},{label:i("Rotation_y"),value:(n=V.rad2deg(L))==null?void 0:n.toFixed(a)}];(g=d.mainViewInstance)==null||g.filterPointsByBox(l.info).then(j=>{var w,O;if(!j){u(p);return}p.push({label:i("PointCount"),value:`${(O=(w=l.info)==null?void 0:w.count)!=null?O:0}`}),o===!0&&l.info.subAttribute&&e&&v.getSubAttributeName(l.info.subAttribute,e).forEach(z=>p.push(z)),u(p)})},[l,b.language]),l?r.createElement("div",{style:t||F(B({position:"absolute"},A),{right:8,bottom:8})},s.map(n=>c?r.createElement("div",{key:n.label,style:{margin:"0px 4px"}},`${n.label}: ${n.value}`):r.createElement("div",{key:n.label},r.createElement("span",{style:{width:"38px",display:"inline-block",textAlign:"end"}},n.label),": ",r.createElement("span",null,n.value)))):null},X=()=>{const o=r.useContext(m),{t:e}=x();return o.valid===!1?r.createElement("div",{style:{position:"absolute",backgroundColor:"rgb(242, 101, 73)",color:"white",opacity:.7,left:0,top:0,fontSize:30,padding:"8px 16px",zIndex:20,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},e("Invalid")):null};export{M as BoxInfos,X as PointCloudValidity,W as SizeInfoForView};
@@ -1 +1 @@
1
- import{getClassName as e}from"../../utils/dom.js";import l from"classnames";import a from"react";const m=({title:t,toolbar:n,children:o,className:c,style:r,titleOnSurface:s})=>a.createElement("div",{className:l([c,e("point-cloud-container")]),style:r},s?a.createElement("span",{className:e("point-cloud-container","header-title-box")},t):a.createElement("div",{className:e("point-cloud-container","header")},t&&a.createElement("span",{className:e("point-cloud-container","header-title")},t),n&&a.createElement("div",{className:e("point-cloud-container","header-toolbar")},n)),o);export{m as PointCloudContainer};
1
+ import{getClassName as e}from"../../utils/dom.js";import i from"classnames";import a from"react";const m=({title:t,toolbar:n,children:o,className:r,style:c,titleNonInteractive:s,titleOnSurface:l})=>a.createElement("div",{className:i([r,e("point-cloud-container")]),style:c},l?a.createElement("span",{className:e("point-cloud-container","header-title-box"),style:{pointerEvents:s?"none":"auto"}},t):a.createElement("div",{className:e("point-cloud-container","header")},t&&a.createElement("span",{className:e("point-cloud-container","header-title")},t),n&&a.createElement("div",{className:e("point-cloud-container","header-toolbar")},n)),o);export{m as PointCloudContainer};
@@ -1 +1 @@
1
- import{PointCloudContext as ee}from"./PointCloudContext.js";import{useRotate as te}from"./hooks/useRotate.js";import{useBoxes as oe}from"./hooks/useBoxes.js";import{useSingleBox as re}from"./hooks/useSingleBox.js";import{useSphere as ne}from"./hooks/useSphere.js";import{useContext as se,useEffect as c}from"react";import{EPointCloudName as ie,CommonToolUtils as ae,AttributeUtils as ue,EToolName as P,cTool as le}from"@labelbee/lb-annotation";import{message as S}from"antd";import{connect as de}from"react-redux";import{a2MapStateToProps as ce}from"../../store/annotation/map.js";import{useStatus as pe}from"./hooks/useStatus.js";import{usePointCloudViews as me}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as ve,useDispatch as be}from"../../store/ctx.js";import{useHistory as Pe}from"./hooks/useHistory.js";import{useAttribute as fe}from"./hooks/useAttribute.js";import{useConfig as ye}from"./hooks/useConfig.js";import{usePolygon as we}from"./hooks/usePolygon.js";import{useLine as Ce}from"./hooks/useLine.js";import{useTranslation as he}from"react-i18next";import{PreDataProcess as ge}from"../../store/annotation/actionCreators.js";var Se=Object.defineProperty,xe=Object.defineProperties,ke=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,I=(l,r,u)=>r in l?Se(l,r,{enumerable:!0,configurable:!0,writable:!0,value:u}):l[r]=u,f=(l,r)=>{for(var u in r||(r={}))_e.call(r,u)&&I(l,u,r[u]);if(D)for(var u of D(r))Ve.call(r,u)&&I(l,u,r[u]);return l},y=(l,r)=>xe(l,ke(r));const{EPolygonPattern:Le}=le,Be=({currentData:l,config:r,checkMode:u,configString:E,imgIndex:x,toolInstanceRef:i})=>{const t=se(ee),{changeSelectedBoxValid:T,selectNextBox:N,selectPrevBox:H,updateSelectedBox:k,deleteSelectedPointCloudBoxAndPolygon:K}=re(),{selectedSphere:w,updatePointCloudSphere:U}=ne(),{clearAllResult:C,updatePointCloudPattern:z}=pe(),{copySelectedBoxes:F,pasteSelectedBoxes:q,copiedBoxes:G}=oe({config:r}),{updateRotate:h}=te({currentData:l}),{updatePointCloudData:v,topViewSelectedChanged:_}=me(),{redo:V,undo:L,pushHistoryWithList:M,pushHistoryUnderUpdatePolygon:R,pushHistoryUnderUpdateLine:W}=Pe(),Y=be(),{syncThreeViewsAttribute:B}=fe(),{syncAllViewsConfig:$,reRenderTopViewRange:J}=ye(),{selectedPolygon:O}=we(),{selectedLine:j}=Ce(),{t:g}=he(),b=e=>{var o;const{topViewInstance:n}=t;!n||(o=n.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(e)},Q=(e,o)=>{var n,a;const{topViewInstance:d,mainViewInstance:s}=t;if(!d)return;const{pointCloud2dOperation:p}=d;switch(e){case"q":{h(2);break}case"e":h(-2);break;case"g":h(180);break;case"u":{const m=p.pattern===Le.Normal?P.Rect:P.Polygon;z(m);const Z={[P.Polygon]:g("PolygonPattern"),[P.Rect]:g("RectPattern")};S.success(g("ChangePatternMsg",{pattern:Z[m]})),p.clearActiveStatus(),p.clearDrawingStatus()}break;case"+":s==null||s.updatePointSize({zoomIn:!0});break;case"-":s==null||s.updatePointSize({zoomIn:!1});break;case"v":t.setPointCloudValid(!t.valid);break;case"tab":if(o.shiftKey){H();break}N(),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":K();break;default:{if(((n=r.attributeList)==null?void 0:n.length)>0){const m=ue.getAttributeByKeycode(o.keyCode,r.attributeList);m!==void 0&&((a=i.current)==null||a.setDefaultAttribute(m))}return}}},X=(e,o)=>{switch(e){case"c":F();break;case"v":q();break;case"a":o.preventDefault(),t.selectedAllBoxes();break;case"z":{o.shiftKey?V():L();break}}},A=e=>{if(!ae.hotkeyFilter(e)||u===!0)return;const o=e.key.toLocaleLowerCase();if(e.ctrlKey){X(o,e);return}Q(o,e)};return c(()=>{const{topViewInstance:e}=t;if(!!e)return window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A)}},[t,G,r,t.pointCloudBoxList,t.polygonList]),c(()=>{$(r)},[E]),c(()=>{(r==null?void 0:r.radius)&&J(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{v==null||v()},[x,t.mainViewInstance]),c(()=>{t.setHideAttributes([])},[x]),c(()=>{i.current.setDefaultAttribute=e=>{var o,n,a,d;B(e);const s=t.selectedPointCloudBox;if(s){s.attribute=e;const p=Y(ge({tool:ie.PointCloud,dataList:[s],stepConfig:r,action:"viewUpdateBox"}));s.valid=p[0].valid;const m=k(s);(a=(n=(o=t==null?void 0:t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:n.setPolygonValidAndRender)==null||a.call(n,s.id,!0,s.valid),t.mainViewInstance&&_({newSelectedBox:s,newPointCloudList:m})}if(O&&R(y(f({},O),{attribute:e})),j&&W(y(f({},j),{attribute:e})),w){const p=U(y(f({},w),{attribute:e}));t.mainViewInstance&&((d=t.mainViewInstance)==null||d.generateSpheres(p),_({newSelectedSphere:w,newSphereList:p}))}},i.current.setSubAttribute=(e,o)=>{var n;const a=t.selectedPointCloudBox;if(a){const d=(n=a==null?void 0:a.subAttribute)!=null?n:{};a.subAttribute=y(f({},d),{[e]:o}),k(a)}},i.current.clearResult=()=>{C==null||C()},i.current.redo=()=>{V()},i.current.undo=()=>{L()},i.current.setValid=e=>{i.current.valid=e,setTimeout(()=>{t.setPointCloudValid(e),e===!1&&C()})},i.current.setForbidOperation=e=>{var o,n;(n=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||n.setForbidOperation(e),e===!0&&t.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=e=>{var o,n;(n=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||n.setShowDefaultCursor(e)},i.current.asyncData=e=>{setTimeout(()=>{v==null||v(e)})}},[t.pointCloudBoxList,t.pointCloudSphereList,t.selectedID,t.valid,t.polygonList,t.lineList,t.mainViewInstance,t.ptSegmentInstance]),c(()=>{i.current.updateSegmentTool=e=>{var o;(o=t.ptSegmentInstance)==null||o.emit(e)},i.current.segmentInstance=t.ptSegmentInstance},[t.ptSegmentInstance]),c(()=>{i.current.history={pushHistory:e=>{M({pointCloudBoxList:e})},initRecord:()=>{}}},[]),c(()=>{var e;const o=(e=t.topViewInstance)==null?void 0:e.toolInstance;if(!o||u)return;const n=s=>{B(s)},a=s=>{S.error(s)},d=s=>{S.info(s)};return o.on("syncAttribute",n),o.on("messageError",a),o.on("messageInfo",d),()=>{o.unbind("syncAttribute",n),o.unbind("messageError",a),o.unbind("messageInfo",d)}},[t.topViewInstance]),null};var Oe=de(ce,null,null,{context:ve})(Be);export{Oe as default};
1
+ import{PointCloudContext as ne}from"./PointCloudContext.js";import{useRotate as re}from"./hooks/useRotate.js";import{useRotateEdge as se}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,EPointCloudName as de,AttributeUtils as pe,EToolName as P,cTool as me}from"@labelbee/lb-annotation";import{message as h}from"antd";import{connect as ve}from"react-redux";import{a2MapStateToProps as be}from"../../store/annotation/map.js";import{useStatus as Pe}from"./hooks/useStatus.js";import{usePointCloudViews as fe}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as we,useDispatch as ye}from"../../store/ctx.js";import{useHistory as Ce}from"./hooks/useHistory.js";import{useAttribute as ge}from"./hooks/useAttribute.js";import{useConfig as he}from"./hooks/useConfig.js";import{usePolygon as Se}from"./hooks/usePolygon.js";import{useLine as xe}from"./hooks/useLine.js";import{useTranslation as ke}from"react-i18next";import{PreDataProcess as _e}from"../../store/annotation/actionCreators.js";import{useLatest as j}from"ahooks";var Ve=Object.defineProperty,Be=Object.defineProperties,Le=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,E=(a,n,l)=>n in a?Ve(a,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[n]=l,f=(a,n)=>{for(var l in n||(n={}))Ie.call(n,l)&&E(a,l,n[l]);if(A)for(var l of A(n))Oe.call(n,l)&&E(a,l,n[l]);return a},w=(a,n)=>Be(a,Le(n));const{EPolygonPattern:je}=me,Ae=({currentData:a,config:n,checkMode:l,configString:D,imgIndex:S,toolInstanceRef:u,setResourceLoading:T})=>{const e=le(ne),{changeSelectedBoxValid:H,selectNextBox:K,selectPrevBox:N,updateSelectedBox:x,deleteSelectedPointCloudBoxAndPolygon:R}=ae(),{selectedSphere:y,updatePointCloudSphere:U}=ue(),{clearAllResult:C,updatePointCloudPattern:z}=Pe(),{copySelectedBoxes:F,pasteSelectedBoxes:q,copiedBoxes:De}=ie({config:n,currentData:a}),{updateRotate:k}=re({currentData:a}),{updateRotateEdge:G}=se({currentData:a}),{updatePointCloudData:v,topViewSelectedChanged:_}=fe({setResourceLoading:T}),{redo:V,undo:B,pushHistoryWithList:M,pushHistoryUnderUpdatePolygon:W,pushHistoryUnderUpdateLine:Y}=Ce(),$=ye(),{syncThreeViewsAttribute:L}=ge(),{syncAllViewsConfig:J,reRenderTopViewRange:Q}=he(),{selectedPolygon:I}=Se(),{selectedLine:O}=xe(),{t:g}=ke(),X=j(a),b=t=>{var o;const{topViewInstance:r}=e;!r||(o=r.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Z=(t,o)=>{var r,i;const{topViewInstance:c,mainViewInstance:s}=e;if(!c)return;const{pointCloud2dOperation:p}=c;switch(t){case"q":{k(e.rectRotateSensitivity);break}case"e":k(-Number(e.rectRotateSensitivity));break;case"g":G(-90);break;case"u":{const m=p.pattern===je.Normal?P.Rect:P.Polygon;z(m);const oe={[P.Polygon]:g("PolygonPattern"),[P.Rect]:g("RectPattern")};h.success(g("ChangePatternMsg",{pattern:oe[m]})),p.clearActiveStatus(),p.clearDrawingStatus()}break;case"+":s==null||s.updatePointSize({zoomIn:!0});break;case"-":s==null||s.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){N();break}K(),o.preventDefault();break;case"f":H();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":R(X.current);break;default:{if(((r=n.attributeList)==null?void 0:r.length)>0){const m=pe.getAttributeByKeycode(o.keyCode,n.attributeList);m!==void 0&&((i=u.current)==null||i.setDefaultAttribute(m))}return}}},ee=(t,o)=>{switch(t){case"c":F();break;case"v":q();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?V():B();break}}},te=j(t=>{if(!ce.hotkeyFilter(t)||l===!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(()=>{J(n)},[D]),d(()=>{(n==null?void 0:n.radius)&&Q(n==null?void 0:n.radius)},[n==null?void 0:n.radius]),d(()=>{v==null||v()},[S,e.mainViewInstance]),d(()=>{e.setHideAttributes([])},[S]),d(()=>{u.current.setDefaultAttribute=t=>{var o,r,i,c;L(t);const s=e.selectedPointCloudBox;if(s){s.attribute=t;const p=$(_e({tool:de.PointCloud,dataList:[s],stepConfig:n,action:"viewUpdateBox"}));s.valid=p[0].valid;const m=x(s);(i=(r=(o=e==null?void 0:e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:r.setPolygonValidAndRender)==null||i.call(r,s.id,!0,s.valid),e.mainViewInstance&&(_({newSelectedBox:s,newPointCloudList:m}),e.mainViewInstance.generateBoxes(m))}if(I&&W(w(f({},I),{attribute:t})),O&&Y(w(f({},O),{attribute:t})),y){const p=U(w(f({},y),{attribute:t}));e.mainViewInstance&&((c=e.mainViewInstance)==null||c.generateSpheres(p),_({newSelectedSphere:y,newSphereList:p}))}},u.current.setSubAttribute=(t,o)=>{var r;const i=e.selectedPointCloudBox;if(i){const c=(r=i==null?void 0:i.subAttribute)!=null?r:{};i.subAttribute=w(f({},c),{[t]:o}),x(i),e.mainViewInstance&&e.selectedPointCloudBox&&e.mainViewInstance.generateBox(e.selectedPointCloudBox)}},u.current.clearResult=()=>{C==null||C()},u.current.redo=()=>{V()},u.current.undo=()=>{B()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&C()})},u.current.setForbidOperation=t=>{var o,r;(r=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||r.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,r;(r=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||r.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{v==null||v(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),d(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),d(()=>{u.current.history={pushHistory:t=>{M({pointCloudBoxList:t})},initRecord:()=>{}}},[]),d(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||l)return;const r=s=>{L(s)},i=s=>{h.error(s)},c=s=>{h.info(s)};return o.on("syncAttribute",r),o.on("messageError",i),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",r),o.unbind("messageError",i),o.unbind("messageInfo",c)}},[e.topViewInstance]),null};var Ee=ve(be,null,null,{context:we})(Ae);export{Ee as default};
@@ -1 +1 @@
1
- import{a2MapStateToProps as L}from"../../store/annotation/map.js";import{LabelBeeContext as z}from"../../store/ctx.js";import d,{useContext as R,useRef as f,useState as w,useEffect as g,useCallback as V,useMemo as B}from"react";import A from"../AnnotationView/index.js";import{connect as W}from"react-redux";import{PointCloudContext as T}from"./PointCloudContext.js";import G from"./components/TitleButton/index.js";import{Spin as H}from"antd";import N from"../../_virtual/highlightSegmentWorker.js";import{pointMappingLidar2image as Y}from"@labelbee/lb-annotation";import{debounce as $}from"lodash";var q=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,D=(t,o,n)=>o in t?q(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,X=(t,o)=>{for(var n in o||(o={}))Q.call(o,n)&&D(t,n,o[n]);if(x)for(var n of x(o))U.call(o,n)&&D(t,n,o[n]);return t},Z=(t,o)=>J(t,K(o));const ee=({path:t,url:o,calib:n,pcdUrl:c,highlightAttribute:a})=>{const{ptSegmentInstance:e,cacheImageNodeSize:O,imageSizes:E}=R(T),F=f(null),m=f(0),v=f({}),u=f(),[h,P]=w([]),[I,C]=w(!1),b=f(void 0);g(()=>()=>{m.current=0,v.current={},u.current=void 0},[c]);const _=V(()=>{var r,l,i;if(m.current=m.current+1,m.current===2){const s=(r=e==null?void 0:e.store)==null?void 0:r.originPoints;if(!s||!u.current){console.error("cacheMappingPCD2Img Error",{path:t,points:s,filterSize:u.current});return}v.current=(i=(l=Y(s,n,u.current))==null?void 0:l.pcdMapping)!=null?i:{}}},[e]),S=B(()=>$((l,i)=>{var s,y;if(l&&u.current){b.current&&((y=(s=b.current)==null?void 0:s.terminate)==null||y.call(s));const k=v.current,p=new N;p.current=p,C(!0),p.postMessage({cacheMap:k,indexes:l,defaultRGBA:i}),p.onmessage=M=>{P(M.data.annotations),p.terminate(),C(!1),p.current=void 0}}},100),[]);g(()=>{if(!(e==null?void 0:e.store))return;const r=e.store.getHighlightAttribute(a!=null?a:""),l=e==null?void 0:e.getColorFromConfig(a!=null?a:"");S(r.flat(),l.stroke)},[a,e]),g(()=>{if(e){const r=({newAttribute:l})=>{const i=e==null?void 0:e.getColorFromConfig(l);i&&P(h.map(s=>Z(X({},s),{defaultRGBA:i.stroke})))};return e.on("updateDefaultAttribute",r),()=>{e.unbind("updateDefaultAttribute",r)}}},[e,h]),g(()=>{if(e){const r=l=>{if(l.cacheSegData){const{cacheSegData:i}=l;if(i==null?void 0:i.indexes){const s=e.getColorFromConfig(i.attribute);S(i==null?void 0:i.indexes,s.stroke)}}else P([])};return e.on("syncPointCloudStatus",r),e.on("loadPCDFileEnd",_),()=>{e.unbind("syncPointCloudStatus",r),e.unbind("loadPCDFileEnd",_)}}},[e,c,E]);const j=r=>{O({path:t,imgNode:r}),u.current={width:r.width,height:r.height},_()};return d.createElement("div",{key:t,style:{position:"relative"},ref:F},d.createElement(G,{title:n.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF",position:"absolute",top:10,left:10,zIndex:1}}),d.createElement(H,{spinning:I,delay:1e3},d.createElement(A,{size:{width:300,height:200},key:t,src:o,annotations:h,afterImgOnLoad:j})))},te=({currentData:t,highlightAttribute:o})=>{var n;const c=(n=t.mappingImgList)!=null?n:[];return(c==null?void 0:c.length)>0?d.createElement("div",{style:{position:"absolute",height:"100%",overflowY:"scroll",zIndex:100,width:300}},c==null?void 0:c.map((a,e)=>a.calib&&d.createElement(ee,{key:a.path+e,path:a.path,url:a.url,calib:a.calib,pcdUrl:t.url,highlightAttribute:o}))):null};var oe=W(L,null,null,{context:z})(te);export{oe as default};
1
+ import{a2MapStateToProps as z}from"../../store/annotation/map.js";import{LabelBeeContext as R}from"../../store/ctx.js";import f,{useContext as V,useRef as m,useState as x,useEffect as v,useCallback as B,useMemo as A}from"react";import W from"../AnnotationView/index.js";import{connect as T}from"react-redux";import{PointCloudContext as U}from"./PointCloudContext.js";import G from"./components/TitleButton/index.js";import{Spin as H}from"antd";import N from"../../_virtual/highlightSegmentWorker.js";import{pointMappingLidar2image as Y}from"@labelbee/lb-annotation";import{debounce as $}from"lodash";var q=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,k=(t,o,n)=>o in t?q(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,Z=(t,o)=>{for(var n in o||(o={}))Q.call(o,n)&&k(t,n,o[n]);if(D)for(var n of D(o))X.call(o,n)&&k(t,n,o[n]);return t},ee=(t,o)=>J(t,K(o));const te=({path:t,url:o,fallbackUrl:n,calib:c,pcdUrl:s,highlightAttribute:u})=>{const{ptSegmentInstance:e,cacheImageNodeSize:O,imageSizes:E}=V(U),F=m(null),g=m(0),h=m({}),p=m(),[P,_]=x([]),[I,C]=x(!1),S=m(void 0);v(()=>()=>{g.current=0,h.current={},p.current=void 0},[s]);const b=B(()=>{var r,l,i;if(g.current=g.current+1,g.current===2){const a=(r=e==null?void 0:e.store)==null?void 0:r.originPoints;if(!a||!p.current){console.error("cacheMappingPCD2Img Error",{path:t,points:a,filterSize:p.current});return}h.current=(i=(l=Y(a,c,p.current))==null?void 0:l.pcdMapping)!=null?i:{}}},[e]),y=A(()=>$((l,i)=>{var a,w;if(l&&p.current){S.current&&((w=(a=S.current)==null?void 0:a.terminate)==null||w.call(a));const M=h.current,d=new N;d.current=d,C(!0),d.postMessage({cacheMap:M,indexes:l,defaultRGBA:i}),d.onmessage=L=>{_(L.data.annotations),d.terminate(),C(!1),d.current=void 0}}},100),[]);v(()=>{if(!(e==null?void 0:e.store))return;const r=e.store.getHighlightAttribute(u!=null?u:""),l=e==null?void 0:e.getColorFromConfig(u!=null?u:"");y(r.flat(),l.stroke)},[u,e]),v(()=>{if(e){const r=({newAttribute:l})=>{const i=e==null?void 0:e.getColorFromConfig(l);i&&_(P.map(a=>ee(Z({},a),{defaultRGBA:i.stroke})))};return e.on("updateDefaultAttribute",r),()=>{e.unbind("updateDefaultAttribute",r)}}},[e,P]),v(()=>{if(e){const r=l=>{if(l.cacheSegData){const{cacheSegData:i}=l;if(i==null?void 0:i.indexes){const a=e.getColorFromConfig(i.attribute);y(i==null?void 0:i.indexes,a.stroke)}}else _([])};return e.on("syncPointCloudStatus",r),e.on("loadPCDFileEnd",b),()=>{e.unbind("syncPointCloudStatus",r),e.unbind("loadPCDFileEnd",b)}}},[e,s,E]);const j=r=>{O({path:t,imgNode:r}),p.current={width:r.width,height:r.height},b()};return f.createElement("div",{key:t,style:{position:"relative"},ref:F},f.createElement(G,{title:c.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF",position:"absolute",top:10,left:10,zIndex:1}}),f.createElement(H,{spinning:I,delay:1e3},f.createElement(W,{size:{width:300,height:200},key:t,src:o,fallbackSrc:n,annotations:P,afterImgOnLoad:j})))},oe=({currentData:t,highlightAttribute:o})=>{var n;const c=(n=t.mappingImgList)!=null?n:[];return(c==null?void 0:c.length)>0?f.createElement("div",{style:{position:"absolute",height:"100%",overflowY:"scroll",zIndex:100,width:300}},c==null?void 0:c.map((s,u)=>{var e;return s.calib&&f.createElement(te,{key:s.path+u,path:s.path,url:s.url,fallbackUrl:(e=s.fallbackUrl)!=null?e:"",calib:s.calib,pcdUrl:t.url,highlightAttribute:o})})):null};var ne=T(z,null,null,{context:R})(oe);export{ne as default};
@@ -1 +1 @@
1
- import{useContext as L,useEffect as r}from"react";import{a2MapStateToProps as x}from"../../store/annotation/map.js";import{connect as y}from"react-redux";import{LabelBeeContext as P,useDispatch as w}from"../../store/ctx.js";import{PointCloudContext as h}from"./PointCloudContext.js";import{CommonToolUtils as j}from"@labelbee/lb-annotation";import{PointCloudUtils as A,EPointCloudSegmentMode as S}from"@labelbee/lb-utils";import{useAttribute as D}from"./hooks/useAttribute.js";import{SetPointCloudLoading as v}from"../../store/annotation/actionCreators.js";import{jsonParser as E}from"../../utils/index.js";const _=({checkMode:b,currentData:l,imgIndex:g,highlightAttribute:a,config:B,toolInstanceRef:u,configString:m})=>{const d=w(),{updateSegmentAttribute:C,updateSegmentSubAttribute:f}=D(),o=L(h),{ptSegmentInstance:e,setSegmentation:c}=o;r(()=>{var t;if(e&&l.url)return v(d,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var n,i;const s=A.getSegmentFromResultList((n=l==null?void 0:l.result)!=null?n:"");(i=e==null?void 0:e.store)==null||i.updateCurrentSegment(s),v(d,!1)}),e.on("syncSegmentData",c),()=>{e.unbind("syncSegmentData",c)}},[g,e]),r(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(a!=null?a:"")},[a,e]),r(()=>{e==null||e.setConfig(E(m))},[m]);const k=(t,n)=>{var i,s;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",S.Add);break;case"i":e==null||e.emit("setSegmentMode",S.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(s=(i=e.store)==null?void 0:i.cacheSegData)==null?void 0:s.id);break}},p=t=>{if(!j.hotkeyFilter(t)||b===!0)return;const n=t.key.toLocaleLowerCase();k(n)};return r(()=>(window.addEventListener("keydown",p),u.current.setDefaultAttribute=t=>{C(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},u.current.setSubAttribute=(t,n)=>{f(t,n)},()=>{window.removeEventListener("keydown",p)}),[e]),r(()=>{u.current.clearResult=()=>{!o.ptSegmentInstance||(o.ptSegmentInstance.emit("clearStash"),o.ptSegmentInstance.emit("clearAllSegmentData"))}},[o.pointCloudBoxList,o.valid,o.polygonList,o.lineList,o.pointCloudSphereList,o.ptSegmentInstance]),null};var M=y(x,null,null,{context:P})(_);export{M as default};
1
+ import{useContext as L,useEffect as r}from"react";import{a2MapStateToProps as x}from"../../store/annotation/map.js";import{connect as y}from"react-redux";import{LabelBeeContext as w,useDispatch as P}from"../../store/ctx.js";import{PointCloudContext as h}from"./PointCloudContext.js";import{CommonToolUtils as A}from"@labelbee/lb-annotation";import{PointCloudUtils as j,EPointCloudSegmentMode as S}from"@labelbee/lb-utils";import{useAttribute as D}from"./hooks/useAttribute.js";import{SetAnnotationLoading as v}from"../../store/annotation/actionCreators.js";import{jsonParser as E}from"../../utils/index.js";const _=({checkMode:b,currentData:l,imgIndex:g,highlightAttribute:s,config:B,toolInstanceRef:u,configString:m})=>{const d=P(),{updateSegmentAttribute:C,updateSegmentSubAttribute:f}=D(),n=L(h),{ptSegmentInstance:e,setSegmentation:c}=n;r(()=>{var t;if(e&&l.url)return v(d,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var o,i;const a=j.getSegmentFromResultList((o=l==null?void 0:l.result)!=null?o:"");(i=e==null?void 0:e.store)==null||i.updateCurrentSegment(a),v(d,!1)}),e.on("syncSegmentData",c),()=>{e.unbind("syncSegmentData",c)}},[g,e]),r(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(s!=null?s:"")},[s,e]),r(()=>{e==null||e.setConfig(E(m))},[m]);const k=(t,o)=>{var i,a;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",S.Add);break;case"i":e==null||e.emit("setSegmentMode",S.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(a=(i=e.store)==null?void 0:i.cacheSegData)==null?void 0:a.id);break}},p=t=>{if(!A.hotkeyFilter(t)||b===!0)return;const o=t.key.toLocaleLowerCase();k(o)};return r(()=>(window.addEventListener("keydown",p),u.current.setDefaultAttribute=t=>{C(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},u.current.setSubAttribute=(t,o)=>{f(t,o)},()=>{window.removeEventListener("keydown",p)}),[e]),r(()=>{u.current.clearResult=()=>{!n.ptSegmentInstance||(n.ptSegmentInstance.emit("clearStash"),n.ptSegmentInstance.emit("clearAllSegmentData"))}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var M=y(x,null,null,{context:w})(_);export{M as default};
@@ -1 +1 @@
1
- import{PointCloudAnnotation as P}from"@labelbee/lb-annotation";import{getClassName as w}from"../../utils/dom.js";import{PointCloudContainer as v}from"./PointCloudLayout.js";import u,{useRef as y,useEffect as C}from"react";import{EPerspectiveView as j}from"@labelbee/lb-utils";import{PointCloudContext as B}from"./PointCloudContext.js";import{SizeInfoForView as V}from"./PointCloudInfos.js";import{connect as S}from"react-redux";import{a2MapStateToProps as b}from"../../store/annotation/map.js";import{usePointCloudViews as E}from"./hooks/usePointCloudViews.js";import{useSingleBox as I}from"./hooks/useSingleBox.js";import{useSphere as T}from"./hooks/useSphere.js";import D from"./components/EmptyPage/index.js";import N from"../../hooks/useSize.js";import{useTranslation as O}from"react-i18next";import{LabelBeeContext as k}from"../../store/ctx.js";import M from"../../utils/ToolUtils.js";import{useZoom as X}from"./hooks/useZoom.js";import L from"./components/TitleButton/index.js";const U=(c,l,e=1)=>{const{width:f,height:i}=l,d={x:c.x+f*e/2,y:c.y+i*e/2},r={x:l.width/2,y:l.height/2};return{offsetX:(r.x-d.x)/e,offsetY:-(r.y-d.y)/e}},h=(c,l,e,f,i)=>{const{offsetX:d,offsetY:r}=U(c,e,l);if(i.camera.zoom=l,c){const a=Math.cos(f),o=Math.sin(f),x=d*a,p=d*o,{x:n,y:m,z:t}=i.initCameraPosition;i.camera.position.set(n-x,m-p,t+r)}i.camera.updateProjectionMatrix(),i.render()},Z=({config:c,checkMode:l})=>{const e=u.useContext(B),{sideViewUpdateBox:f,sideViewUpdatePoint:i}=E(),{selectedBox:d}=I(),{selectedSphere:r}=T(),a=y(null),o=N(a),{t:x}=O(),{syncSideviewToolZoom:p}=X();return C(()=>{if(a.current){const n={width:a.current.clientWidth,height:a.current.clientHeight},m=new P({container:a.current,size:n,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:c,checkMode:l,toolName:M.getPointCloudToolList()});e.setSideViewInstance(m)}},[]),C(()=>{if(!o||!e.sideViewInstance)return;const{toolInstance:n,pointCloudInstance:m}=e.sideViewInstance;n.singleOn("renderZoom",(t,s)=>{if(e.selectedPointCloudBox){h(s,t,o,e.selectedPointCloudBox.rotation,m),p(s,t,o);return}r&&(h(s,t,o,0,m),p(s,t,o))}),n.singleOn("dragMove",({currentPos:t,zoom:s})=>{!e.selectedPointCloudBox&&!r||h(t,s,o,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,m)}),n.singleOn("updatePointByDrag",(t,s)=>{r&&(i==null||i(t,s[0]))}),n.singleOn("updatePolygonByDrag",t=>{if(e.selectedIDs.length===1&&t.length===1){const{newPolygon:s,originPolygon:g}=t[0];f(s,g)}})},[e,o]),C(()=>{var n;(n=e==null?void 0:e.sideViewInstance)==null||n.initSize(o)},[o]),u.createElement(v,{className:w("point-cloud-container","side-view"),title:u.createElement(L,{title:x("SideView")}),titleOnSurface:!0},u.createElement("div",{className:w("point-cloud-container","bottom-view-content")},u.createElement("div",{className:w("point-cloud-container","core-instance"),ref:a}),!d&&!r&&u.createElement(D,null),u.createElement(V,{perspectiveView:j.Left})))};var A=S(b,null,null,{context:k})(Z);export{A as default};
1
+ import{PointCloudAnnotation as P}from"@labelbee/lb-annotation";import{getClassName as w}from"../../utils/dom.js";import{PointCloudContainer as v}from"./PointCloudLayout.js";import m,{useRef as y,useEffect as C}from"react";import{EPerspectiveView as j}from"@labelbee/lb-utils";import{PointCloudContext as B}from"./PointCloudContext.js";import{SizeInfoForView as V}from"./PointCloudInfos.js";import{connect as S}from"react-redux";import{a2MapStateToProps as b}from"../../store/annotation/map.js";import{usePointCloudViews as E}from"./hooks/usePointCloudViews.js";import{useSingleBox as I}from"./hooks/useSingleBox.js";import{useSphere as T}from"./hooks/useSphere.js";import N from"./components/EmptyPage/index.js";import D from"../../hooks/useSize.js";import{useTranslation as O}from"react-i18next";import{LabelBeeContext as k}from"../../store/ctx.js";import M from"../../utils/ToolUtils.js";import{useZoom as X}from"./hooks/useZoom.js";import L from"./components/TitleButton/index.js";const U=(c,l,e=1)=>{const{width:f,height:i}=l,d={x:c.x+f*e/2,y:c.y+i*e/2},r={x:l.width/2,y:l.height/2};return{offsetX:(r.x-d.x)/e,offsetY:-(r.y-d.y)/e}},h=(c,l,e,f,i)=>{const{offsetX:d,offsetY:r}=U(c,e,l);if(i.camera.zoom=l,c){const a=Math.cos(f),o=Math.sin(f),x=d*a,p=d*o,{x:n,y:u,z:t}=i.initCameraPosition;i.camera.position.set(n-x,u-p,t+r)}i.camera.updateProjectionMatrix(),i.render()},Z=({config:c,checkMode:l})=>{const e=m.useContext(B),{sideViewUpdateBox:f,sideViewUpdatePoint:i}=E(),{selectedBox:d}=I(),{selectedSphere:r}=T(),a=y(null),o=D(a),{t:x}=O(),{syncSideviewToolZoom:p}=X();return C(()=>{if(a.current){const n={width:a.current.clientWidth,height:a.current.clientHeight},u=new P({container:a.current,size:n,extraProps:{showDirectionLine:!1,forbidAddNew:!0,forbidDelete:!0},config:c,checkMode:l,toolName:M.getPointCloudToolList()});e.setSideViewInstance(u)}},[]),C(()=>{if(!o||!e.sideViewInstance)return;const{toolInstance:n,pointCloudInstance:u}=e.sideViewInstance;n.singleOn("renderZoom",(t,s)=>{if(e.selectedPointCloudBox){h(s,t,o,e.selectedPointCloudBox.rotation,u),p(s,t,o);return}r&&(h(s,t,o,0,u),p(s,t,o))}),n.singleOn("dragMove",({currentPos:t,zoom:s})=>{!e.selectedPointCloudBox&&!r||h(t,s,o,e.selectedPointCloudBox?e.selectedPointCloudBox.rotation:0,u)}),n.singleOn("updatePointByDrag",(t,s)=>{r&&(i==null||i(t,s[0]))}),n.singleOn("updatePolygonByDrag",t=>{if(e.selectedIDs.length===1&&t.length===1){const{newPolygon:s,originPolygon:g}=t[0];f(s,g)}})},[e,o]),C(()=>{var n;(n=e==null?void 0:e.sideViewInstance)==null||n.initSize(o)},[o]),m.createElement(v,{className:w("point-cloud-container","side-view"),title:m.createElement(L,{title:x("SideView")}),titleOnSurface:!0,titleNonInteractive:!0},m.createElement("div",{className:w("point-cloud-container","bottom-view-content")},m.createElement("div",{className:w("point-cloud-container","core-instance"),ref:a}),!d&&!r&&m.createElement(N,null),m.createElement(V,{perspectiveView:j.Left})))};var A=S(b,null,null,{context:k})(Z);export{A as default};
@@ -1 +1 @@
1
- import{getClassName as x}from"../../utils/dom.js";import{FooterDivider as z}from"../../views/MainView/toolFooter/index.js";import{ZoomController as ae}from"../../views/MainView/toolFooter/ZoomController/index.js";import{LeftOutlined as ce,UpSquareOutlined as de,DownSquareOutlined as pe}from"@ant-design/icons";import{cKeyCode as ue,PointCloudAnnotation as me,cTool as fe,cAnnotation as ve}from"@labelbee/lb-annotation";import{PointCloudUtils as H}from"@labelbee/lb-utils";import i,{useState as W,useRef as we,useLayoutEffect as Ce,useEffect as h}from"react";import{PointCloudContext as F}from"./PointCloudContext.js";import{useRotate as Pe}from"./hooks/useRotate.js";import{useSingleBox as K}from"./hooks/useSingleBox.js";import{PointCloudContainer as ge}from"./PointCloudLayout.js";import{BoxInfos as X,PointCloudValidity as ye}from"./PointCloudInfos.js";import{usePolygon as Ie}from"./hooks/usePolygon.js";import{useSphere as Y}from"./hooks/useSphere.js";import{useZoom as q}from"./hooks/useZoom.js";import{Slider as xe}from"antd";import{a2MapStateToProps as he}from"../../store/annotation/map.js";import{connect as Ve}from"react-redux";import{usePointCloudViews as _e}from"./hooks/usePointCloudViews.js";import Se from"../../hooks/useSize.js";import{useTranslation as Ee}from"react-i18next";import{LabelBeeContext as Le}from"../../store/ctx.js";import{jsonParser as Oe}from"../../utils/index.js";import be from"../../utils/ToolUtils.js";import je from"lodash";import Te from"./components/PointCloudSizeSlider/index.js";import{useHistory as ke}from"./hooks/useHistory.js";import Ae from"./components/TitleButton/index.js";var De=Object.defineProperty,Ne=Object.defineProperties,Be=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,$=(n,s,r)=>s in n?De(n,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[s]=r,B=(n,s)=>{for(var r in s||(s={}))Re.call(s,r)&&$(n,r,s[r]);if(M)for(var r of M(s))Ue.call(s,r)&&$(n,r,s[r]);return n},R=(n,s)=>Ne(n,Be(s));const{EPolygonPattern:Ze,EToolName:G}=fe,{ESortDirection:J}=ve,ze=ue.default,Q=(n,s,r=1)=>{const{width:w,height:u}=s,P={x:n.x+w*r/2,y:n.y+u*r/2},g={x:s.width/2,y:s.height/2};return{offsetX:(g.x-P.x)/r,offsetY:-(g.y-P.y)/r}},He=({currentData:n})=>{var s,r;const{zoom:w,zoomIn:u,zoomOut:P,initialPosition:g}=q(),{selectNextBox:E,selectPrevBox:L}=K(),{switchToNextSphere:V}=Y(),{updateRotate:y}=Pe({currentData:n}),I=i.useContext(F),{topViewInstance:O}=I,_=(r=(s=I==null?void 0:I.topViewInstance)==null?void 0:s.toolScheduler)==null?void 0:r.getCurrentToolName(),m=2,e=()=>{y(-m)},c=()=>{y(m)},f=()=>{y(180)};return i.createElement(i.Fragment,null,i.createElement(Te,{onChange:b=>{var S;(S=O==null?void 0:O.pointCloudInstance)==null||S.updatePointSize({customSize:b})}}),i.createElement("span",{onClick:c,className:x("point-cloud","rotate-reserve")}),i.createElement("span",{onClick:e,className:x("point-cloud","rotate")}),i.createElement("span",{onClick:f,className:x("point-cloud","rotate-180")}),i.createElement(z,null),i.createElement(de,{onClick:()=>{if(_===G.Point){V(J.descend);return}L(!0)},className:x("point-cloud","prev")}),i.createElement(pe,{onClick:()=>{if(_===G.Point){V(J.ascend);return}E(!0)},className:x("point-cloud","next")}),i.createElement(z,null),i.createElement(ae,{initialPosition:g,zoomIn:u,zoomOut:P,zoom:w}))},We=({setZAxisLimit:n,zAxisLimit:s,checkMode:r})=>r?null:i.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},i.createElement(xe,{vertical:!0,step:.5,max:10,min:.5,defaultValue:s,onAfterChange:w=>{n(w)}})),Fe=({currentData:n,imgList:s,stepInfo:r,drawLayerSlot:w,checkMode:u,intelligentFit:P,setIsEnlargeTopView:g,isEnlargeTopView:E,onExitZoom:L,highlightAttribute:V})=>{var y,I;const[O,_]=W({zoom:1,currentPos:{x:0,y:0}}),m=we(null),e=i.useContext(F),c=Se(m),f=Oe(r.config),{setZoom:b,syncTopviewToolZoom:S}=q(),{hideAttributes:ee}=e,{addPolygon:te,deletePolygon:oe}=Ie(),{deletePointCloudSphere:ne}=Y(),{deletePointCloudBox:ie,changeValidByID:le}=K(),[j,se]=W(10),{t:U}=Ee(),C=_e(),{pushHistoryWithList:re}=ke();Ce(()=>{if(!e.topViewInstance&&m.current&&(n==null?void 0:n.url)&&(n==null?void 0:n.result)){const o={width:m.current.clientWidth,height:m.current.clientHeight},a=new me({container:m.current,size:o,pcdPath:n.url,config:R(B({},f),{pointCloudPattern:e.pointCloudPattern}),checkMode:u,toolName:be.getPointCloudToolList(),proxyMode:u});e.setTopViewInstance(a)}},[n]),h(()=>{if(!c||!e.topViewInstance||!e.sideViewInstance)return;const{toolInstance:o}=e.topViewInstance;o.singleOn("dataUpdated",(t,l)=>{const p=je.cloneDeep(t).map(d=>R(B({},d),{pointList:H.pointListTransferCanvas2World(d.pointList,c)}));e.setSelectedIDs(l),e.setLineList(p),re({lineList:p})}),o.singleOn("pointCreated",(t,l)=>{C.topViewAddSphere({newPoint:t,size:c,trackConfigurable:f.trackConfigurable,zoom:l})}),o.singleOn("pointDeleted",t=>{ne(t)}),o.singleOn("pointSelected",t=>{e.setSelectedIDs([t])}),o.singleOn("updatePointByDrag",(t,l)=>{var p;(p=C.topViewUpdatePoint)==null||p.call(C,t,c)}),o.singleOn("polygonCreated",(t,l)=>{if(o.pattern===Ze.Normal||!(n==null?void 0:n.url)){const p=R(B({},t),{pointList:t.pointList.map(d=>H.transferCanvas2World(d,c))});te(p),e.setSelectedIDs(ee.includes(t.attribute)?"":t.id);return}C.topViewAddBox({polygon:t,size:c,imgList:s,trackConfigurable:f.trackConfigurable,zoom:l,intelligentFit:P})}),o.singleOn("deletedObject",({id:t})=>{ie(t),oe(t)}),o.singleOn("deleteSelectedIDs",()=>{e.setSelectedIDs([])}),o.singleOn("addSelectedIDs",t=>{e.addSelectedID(t)}),o.singleOn("setSelectedIDs",t=>{e.setSelectedIDs(t)}),o.singleOn("updatePolygonByDrag",t=>{var l;(l=C.topViewUpdateBox)==null||l.call(C,t,c)});const a=t=>{var l;const p=le(t);p&&e.syncAllViewPointCloudColor(p),e.polygonList.find(d=>d.id===t)&&((l=e.topViewInstance)==null||l.toolInstance.setPolygonValidAndRender(t,!0))};return o.on("validUpdate",a),()=>{o.unbind("validUpdate",a)}},[e,c,n,C,e.polygonList,e.lineList,(y=e.topViewInstance)==null?void 0:y.toolInstance]),h(()=>{var o,a;if(!(c==null?void 0:c.width)||!e.topViewInstance)return;const t=(a=(o=f==null?void 0:f.attributeList)==null?void 0:o[0])==null?void 0:a.value;t&&e.topViewInstance.toolInstance.setDefaultAttribute(t),e.topViewInstance.initSize(c),e.topViewInstance.updatePolygonList(e.displayPointCloudList,e.polygonList),e.topViewInstance.updatePointList(e.displaySphereList),e.topViewInstance.updateLineList(e.displayLineList);const{topViewInstance:{pointCloudInstance:l,toolInstance:p}}=e;p.singleOn("renderZoom",(d,v)=>{const{offsetX:T,offsetY:k}=Q(v,c,d);if(l.camera.zoom=d,v){const{x:A,y:D,z:N}=l.initCameraPosition;l.camera.position.set(A+k,D-T,N)}l.camera.updateProjectionMatrix(),l.render(),b(d),S(v,d,c),_({zoom:d,currentPos:v})}),p.singleOn("dragMove",({currentPos:d,zoom:v})=>{const{offsetX:T,offsetY:k}=Q(d,c,v);l.camera.zoom=v;const{x:A,y:D,z:N}=l.initCameraPosition;l.camera.position.set(A+k,D-T,N),l.render(),S(d,v,c),_({zoom:v,currentPos:d})})},[c,e.topViewInstance,(I=e.topViewInstance)==null?void 0:I.toolInstance]),h(()=>{var o,a;(a=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null||a.applyZAxisPoints(j)},[j]),h(()=>{var o,a,t,l;C.topViewSelectedChanged({}),(l=(t=(a=(o=e.topViewInstance)==null?void 0:o.toolInstance)==null?void 0:a.selection)==null?void 0:t.hardSetSelectedIDs)==null||l.call(t,e.selectedIDs)},[e.selectedIDs]),h(()=>(window.addEventListener("keydown",Z),()=>{window.removeEventListener("keydown",Z)}),[]);const Z=o=>{const{keyCode:a}=o;a===ze.Esc&&L()};return h(()=>{var o,a,t;(t=(a=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:a.setHighlightAttribute)==null||t.call(a,V)},[e.topViewInstance,V]),i.createElement(ge,{className:x("point-cloud-container","top-view"),title:E?i.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative"}},i.createElement(ce,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{L()}}),i.createElement("span",null,U("TopView")),i.createElement(X,{checkMode:u,config:f,style:{display:"flex",position:"initial",margin:"0px 20px"}})):i.createElement(Ae,{title:U("TopView"),onClick:()=>{g(!0)}}),toolbar:i.createElement(He,{currentData:n})},i.createElement("div",{style:{position:"relative",flex:1}},i.createElement("div",{style:{width:"100%",height:"100%"},ref:m},w==null?void 0:w(O)),!E&&i.createElement(X,{checkMode:u,config:f}),i.createElement(We,{checkMode:u,zAxisLimit:j,setZAxisLimit:se}),i.createElement(ye,null)))};var Ke=Ve(he,null,null,{context:Le})(Fe);export{Ke as default};
1
+ import{getClassName as I}from"../../utils/dom.js";import{FooterDivider as z}from"../../views/MainView/toolFooter/index.js";import{ZoomController as ae}from"../../views/MainView/toolFooter/ZoomController/index.js";import{LeftOutlined as de,UpSquareOutlined as ce,DownSquareOutlined as pe}from"@ant-design/icons";import{cKeyCode as ue,PointCloudAnnotation as me,cTool as fe,cAnnotation as ve}from"@labelbee/lb-annotation";import{PointCloudUtils as H}from"@labelbee/lb-utils";import{EPointCloudBoxRenderTrigger as we}from"../../utils/ToolPointCloudBoxRenderHelper.js";import i,{useState as W,useRef as Ce,useLayoutEffect as ge,useEffect as x}from"react";import{PointCloudContext as F}from"./PointCloudContext.js";import{useRotate as Pe}from"./hooks/useRotate.js";import{useRotateEdge as ye}from"./hooks/useRotateEdge.js";import{useSingleBox as K}from"./hooks/useSingleBox.js";import{PointCloudContainer as Ie}from"./PointCloudLayout.js";import{BoxInfos as X,PointCloudValidity as xe}from"./PointCloudInfos.js";import{usePolygon as he}from"./hooks/usePolygon.js";import{useSphere as Y}from"./hooks/useSphere.js";import{useZoom as q}from"./hooks/useZoom.js";import{Slider as Ve}from"antd";import{a2MapStateToProps as Se}from"../../store/annotation/map.js";import{connect as _e}from"react-redux";import{usePointCloudViews as Ee}from"./hooks/usePointCloudViews.js";import Le from"../../hooks/useSize.js";import{useTranslation as Oe}from"react-i18next";import{LabelBeeContext as be}from"../../store/ctx.js";import{jsonParser as je}from"../../utils/index.js";import Te from"../../utils/ToolUtils.js";import ke from"lodash";import Re from"./components/PointCloudSizeSlider/index.js";import{useHistory as Ae}from"./hooks/useHistory.js";import Be from"./components/TitleButton/index.js";var Ne=Object.defineProperty,De=Object.defineProperties,Ue=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Ze=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,$=(n,l,r)=>l in n?Ne(n,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[l]=r,N=(n,l)=>{for(var r in l||(l={}))Ze.call(l,r)&&$(n,r,l[r]);if(M)for(var r of M(l))ze.call(l,r)&&$(n,r,l[r]);return n},D=(n,l)=>De(n,Ue(l));const{EPolygonPattern:He,EToolName:G}=fe,{ESortDirection:J}=ve,We=ue.default,Q=(n,l,r=1)=>{const{width:w,height:u}=l,P={x:n.x+w*r/2,y:n.y+u*r/2},y={x:l.width/2,y:l.height/2};return{offsetX:(y.x-P.x)/r,offsetY:-(y.y-P.y)/r}},Fe=({currentData:n})=>{var l,r;const{zoom:w,zoomIn:u,zoomOut:P,initialPosition:y}=q(),{selectNextBox:E,selectPrevBox:L}=K(),{switchToNextSphere:h}=Y(),{updateRotate:V}=Pe({currentData:n}),{updateRotateEdge:O}=ye({currentData:n}),g=i.useContext(F),{topViewInstance:S}=g,m=(r=(l=g==null?void 0:g.topViewInstance)==null?void 0:l.toolScheduler)==null?void 0:r.getCurrentToolName(),e=()=>{V(-Number(g.rectRotateSensitivity))},d=()=>{V(g.rectRotateSensitivity)},f=()=>{O(-90)};return i.createElement(i.Fragment,null,i.createElement(Re,{onChange:b=>{var _;(_=S==null?void 0:S.pointCloudInstance)==null||_.updatePointSize({customSize:b})}}),i.createElement("span",{onClick:d,className:I("point-cloud","rotate-reserve")}),i.createElement("span",{onClick:e,className:I("point-cloud","rotate")}),i.createElement("span",{onClick:f,className:I("point-cloud","rotate-90")}),i.createElement(z,null),i.createElement(ce,{onClick:()=>{if(m===G.Point){h(J.descend);return}L(!0)},className:I("point-cloud","prev")}),i.createElement(pe,{onClick:()=>{if(m===G.Point){h(J.ascend);return}E(!0)},className:I("point-cloud","next")}),i.createElement(z,null),i.createElement(ae,{initialPosition:y,zoomIn:u,zoomOut:P,zoom:w}))},Ke=({setZAxisLimit:n,zAxisLimit:l,checkMode:r})=>r?null:i.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},i.createElement(Ve,{vertical:!0,step:.5,max:10,min:.5,defaultValue:l,onAfterChange:w=>{n(w)}})),Xe=({currentData:n,imgList:l,stepInfo:r,drawLayerSlot:w,checkMode:u,intelligentFit:P,setIsEnlargeTopView:y,isEnlargeTopView:E,onExitZoom:L,highlightAttribute:h})=>{var V,O;const[g,S]=W({zoom:1,currentPos:{x:0,y:0}}),m=Ce(null),e=i.useContext(F),d=Le(m),f=je(r.config),{setZoom:b,syncTopviewToolZoom:_}=q(),{hideAttributes:ee}=e,{addPolygon:te,deletePolygon:oe}=he(),{deletePointCloudSphere:ne}=Y(),{deletePointCloudBox:ie,changeValidByID:se}=K(),[j,le]=W(10),{t:U}=Oe(),C=Ee(),{pushHistoryWithList:re}=Ae();ge(()=>{if(!e.topViewInstance&&m.current&&(n==null?void 0:n.url)&&(n==null?void 0:n.result)){const o={width:m.current.clientWidth,height:m.current.clientHeight},a=new me({container:m.current,size:o,pcdPath:n.url,config:D(N({},f),{pointCloudPattern:e.pointCloudPattern}),checkMode:u,toolName:Te.getPointCloudToolList(),proxyMode:u});e.setTopViewInstance(a)}},[n]),x(()=>{if(!d||!e.topViewInstance||!e.sideViewInstance)return;const{toolInstance:o}=e.topViewInstance;o.singleOn("dataUpdated",(t,s)=>{const p=ke.cloneDeep(t).map(c=>D(N({},c),{pointList:H.pointListTransferCanvas2World(c.pointList,d)}));e.setSelectedIDs(s),e.setLineList(p),re({lineList:p})}),o.singleOn("pointCreated",(t,s)=>{C.topViewAddSphere({newPoint:t,size:d,trackConfigurable:f.trackConfigurable,zoom:s})}),o.singleOn("pointDeleted",t=>{ne(t)}),o.singleOn("pointSelected",t=>{e.setSelectedIDs([t])}),o.singleOn("updatePointByDrag",(t,s)=>{var p;(p=C.topViewUpdatePoint)==null||p.call(C,t,d)}),o.singleOn("polygonCreated",(t,s)=>{if(o.pattern===He.Normal||!(n==null?void 0:n.url)){const p=D(N({},t),{pointList:t.pointList.map(c=>H.transferCanvas2World(c,d))});te(p),e.setSelectedIDs(ee.includes(t.attribute)?"":t.id);return}C.topViewAddBox({polygon:t,size:d,imgList:l,trackConfigurable:f.trackConfigurable,zoom:s,intelligentFit:P})}),o.singleOn("deletedObject",({id:t})=>{ie(t),oe(t)}),o.singleOn("deleteSelectedIDs",()=>{e.setSelectedIDs([])}),o.singleOn("addSelectedIDs",t=>{e.addSelectedID(t)}),o.singleOn("setSelectedIDs",t=>{e.setSelectedIDs(t)}),o.singleOn("updatePolygonByDrag",t=>{var s;(s=C.topViewUpdateBox)==null||s.call(C,t,d)});const a=t=>{var s;const p=se(t);p&&e.syncAllViewPointCloudColor(we.Default,p),e.polygonList.find(c=>c.id===t)&&((s=e.topViewInstance)==null||s.toolInstance.setPolygonValidAndRender(t,!0))};return o.on("validUpdate",a),()=>{o.unbind("validUpdate",a)}},[e,d,n,C,e.polygonList,e.lineList,(V=e.topViewInstance)==null?void 0:V.toolInstance]),x(()=>{var o,a;if(!(d==null?void 0:d.width)||!e.topViewInstance)return;const t=(a=(o=f==null?void 0:f.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:s,toolInstance:p}}=e;p.singleOn("renderZoom",(c,v)=>{const{offsetX:T,offsetY:k}=Q(v,d,c);if(s.camera.zoom=c,v){const{x:R,y:A,z:B}=s.initCameraPosition;s.camera.position.set(R+k,A-T,B)}s.camera.updateProjectionMatrix(),s.render(),b(c),_(v,c,d),S({zoom:c,currentPos:v})}),p.singleOn("dragMove",({currentPos:c,zoom:v})=>{const{offsetX:T,offsetY:k}=Q(c,d,v);s.camera.zoom=v;const{x:R,y:A,z:B}=s.initCameraPosition;s.camera.position.set(R+k,A-T,B),s.render(),_(c,v,d),S({zoom:v,currentPos:c})})},[d,e.topViewInstance,(O=e.topViewInstance)==null?void 0:O.toolInstance]),x(()=>{var o,a;(a=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null||a.applyZAxisPoints(j)},[j]),x(()=>{var o,a,t,s;C.topViewSelectedChanged({}),(s=(t=(a=(o=e.topViewInstance)==null?void 0:o.toolInstance)==null?void 0:a.selection)==null?void 0:t.hardSetSelectedIDs)==null||s.call(t,e.selectedIDs)},[e.selectedIDs]),x(()=>(window.addEventListener("keydown",Z),()=>{window.removeEventListener("keydown",Z)}),[]);const Z=o=>{const{keyCode:a}=o;a===We.Esc&&L()};return x(()=>{var o,a,t;(t=(a=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:a.setHighlightAttribute)==null||t.call(a,h)},[e.topViewInstance,h]),i.createElement(Ie,{className:I("point-cloud-container","top-view"),title:E?i.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative"}},i.createElement(de,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{L()}}),i.createElement("span",null,U("TopView")),i.createElement(X,{checkMode:u,config:f,style:{display:"flex",position:"initial",margin:"0px 20px"}})):i.createElement(Be,{title:U("TopView"),onClick:()=>{y(!0)}}),toolbar:i.createElement(Fe,{currentData:n})},i.createElement("div",{style:{position:"relative",flex:1}},i.createElement("div",{style:{width:"100%",height:"100%"},ref:m},w==null?void 0:w(g)),!E&&i.createElement(X,{checkMode:u,config:f}),i.createElement(Ke,{checkMode:u,zAxisLimit:j,setZAxisLimit:le}),i.createElement(xe,null)))};var Ye=_e(Se,null,null,{context:be})(Xe);export{Ye as default};
@@ -1 +1 @@
1
- import c from"react";import{EyeFilled as d,EyeInvisibleFilled as p,LoadingOutlined as f}from"@ant-design/icons";import{getClassName as u}from"../../../../utils/dom.js";var m=Object.defineProperty,l=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable,n=(t,e,r)=>e in t?m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s=(t,e)=>{for(var r in e||(e={}))_.call(e,r)&&n(t,r,e[r]);if(l)for(var r of l(e))g.call(e,r)&&n(t,r,e[r]);return t};const y=({visible:t,style:e,onClick:r,loading:o})=>{const i={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16};let a=t?d:p;return o&&(a=f,Object.assign(i,{borderRadius:100})),c.createElement(a,{className:u("point-cloud-highlight-view"),style:s(s({},i),e),onClick:o?()=>{}:r})};export{y as default};
1
+ import u from"react";import{EyeFilled as f,EyeInvisibleFilled as g,LoadingOutlined as m}from"@ant-design/icons";import{getClassName as _}from"../../../../utils/dom.js";var b=Object.defineProperty,s=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,c=(t,e,r)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d=(t,e)=>{for(var r in e||(e={}))y.call(e,r)&&c(t,r,e[r]);if(s)for(var r of s(e))O.call(e,r)&&c(t,r,e[r]);return t};const h=({visible:t,style:e,onClick:r,loading:a,disabled:o})=>{const l={background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,fontSize:16},p={background:"rgba(0, 0, 0, 0.2)",color:"rgba(255, 255, 255, 0.5)",cursor:"not-allowed"};let i=t?f:g;a&&(i=m,Object.assign(l,{borderRadius:100}));const n=d(d({},l),e);return o&&Object.assign(n,p),u.createElement(i,{disabled:o,className:_("point-cloud-highlight-view"),style:n,onClick:a||o?()=>{}:r})};export{h as default};
@@ -1 +1 @@
1
- import{useContext as y,useState as B,useMemo as h,useCallback as p}from"react";import R from"lodash";import{message as C,Modal as w}from"antd";import{usePointCloudViews as H}from"./usePointCloudViews.js";import{PointCloudContext as M}from"../PointCloudContext.js";import{useTranslation as S}from"react-i18next";const V=({config:m})=>{const{selectedIDs:l,pointCloudBoxList:a,displayPointCloudList:o,setPointCloudResult:f,syncAllViewPointCloudColor:D}=y(M),[t,i]=B([]),{pointCloudBoxListUpdated:c}=H(),{t:n,i18n:d}=S(),x=s=>m.trackConfigurable!==!0?!1:a.some(r=>s.some(e=>e.trackID===r.trackID)),u=h(()=>o.filter(s=>l.includes(s.id)),[l,o]),P=p(()=>{u.length>0?i(R.cloneDeep(u)):(i([]),C.error(n("CopyEmptyInPointCloud")))},[l,o,d.language]),I=p(()=>{if(t.length===0){C.error(n("PasteEmptyInPointCloud"));return}const s=x(t),r=e=>{f(e),c==null||c(e),i([]),D(e)};if(s)w.confirm({title:n("HasDuplicateIDHeader"),content:n("HasDuplicateIDMsg"),onOk:()=>{const e=a.filter(g=>!t.find(k=>k.trackID===g.trackID)).concat(t);r(e)}});else{const e=[...o,...t];r(e)}},[t,o,d.language]);return{copySelectedBoxes:P,pasteSelectedBoxes:I,copiedBoxes:t,selectedBoxes:u}};export{V as useBoxes};
1
+ import{useContext as E,useState as T,useMemo as k,useCallback as O}from"react";import N from"lodash";import{message as v}from"antd";import{usePointCloudViews as H}from"./usePointCloudViews.js";import{PointCloudContext as V}from"../PointCloudContext.js";import{useTranslation as A}from"react-i18next";import{EPointCloudBoxRenderTrigger as U}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import z from"../../../utils/AnnotationDataUtils.js";import{uuid as L}from"@labelbee/lb-annotation";import{useHistory as X}from"./useHistory.js";import{generatePointCloudBoxRects as Y}from"../../../utils/index.js";var W=Object.defineProperty,q=Object.defineProperties,F=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,j=(o,t,e)=>t in o?W(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,M=(o,t)=>{for(var e in t||(t={}))G.call(t,e)&&j(o,e,t[e]);if(b)for(var e of b(t))J.call(t,e)&&j(o,e,t[e]);return o},B=(o,t)=>q(o,F(t));const K=(o,t=[],e=[])=>{const{rects:p=[]}=o,s=p.map(i=>{var m;return B(M({},i),{imageName:(m=z.getNextPath({prePath:i.imageName,preMappingImgList:e,nextMappingImgList:t}))!=null?m:""})}).filter(i=>i.imageName!=="");return B(M({},o),{rects:s})},Q=(o,t)=>{const e=new Set(o.map(i=>i.trackID||0));let p=Math.max(...e,0);const s=.2;return t.map((i,m)=>{const{width:_,height:u,center:g,rotation:n,trackID:f=0}=i,{x,y:P,z:h}=g,c=_*s,C=u*s,y=c*Math.cos(n)-C*Math.sin(n),r=c*Math.sin(n)+C*Math.cos(n),l=x-Math.abs(y),I=P-Math.abs(r);let d=f;return e.has(f)?d=++p:p=Math.max(p,d),e.add(d),B(M({},i),{id:L(),uuid:L(),center:{x:l,y:I,z:h},trackID:d})})},Z=({config:o,currentData:t})=>{const{selectedIDs:e,pointCloudBoxList:p,displayPointCloudList:s,setPointCloudResult:i,syncAllViewPointCloudColor:m,imageSizes:_}=E(V),[u,g]=T({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:n}=u,{pointCloudBoxListUpdated:f}=H(),{t:x,i18n:P}=A(),{pushHistoryWithList:h}=X(),c=k(()=>s.filter(r=>e.includes(r.id)),[e,s]),C=O(()=>{var r;if(c.length>0){const l=(r=t==null?void 0:t.mappingImgList)!=null?r:[];g({copiedBoxes:N.cloneDeep(c),copiedMappingImgList:l})}else g({copiedBoxes:[],copiedMappingImgList:[]}),v.error(x("CopyEmptyInPointCloud"));v.success(x("CopySuccess"))},[e,s,P.language,t]),y=O(()=>{var r,l;if(n.length===0){v.error(x("PasteEmptyInPointCloud"));return}const I=(r=t==null?void 0:t.mappingImgList)!=null?r:[],d=(l=u==null?void 0:u.copiedMappingImgList)!=null?l:[],R=n.map(a=>K(a,I,d)),w=Q(s,R),S=a=>{i(a),f==null||f(a),g({copiedBoxes:[],copiedMappingImgList:[]}),h({pointCloudBoxList:a}),m(U.MultiPaste,a)};w.forEach(a=>Y({pointCloudBox:a,mappingImgList:I,imageSizes:_}));const D=[...s,...w];S(D)},[n,s,P.language,t]);return{copySelectedBoxes:C,pasteSelectedBoxes:y,copiedBoxes:n,selectedBoxes:c}};export{Z as useBoxes};