@labelbee/lb-components 1.23.0-alpha.14 → 1.23.0-alpha.140

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 (325) 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/hooks/useFilterAnnotations.js +1 -0
  12. package/dist/components/AnnotationView/index.js +1 -1
  13. package/dist/components/DynamicResizer/DynamicResizer.js +1 -0
  14. package/dist/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
  15. package/dist/components/DynamicResizer/assets/divider.svg.js +1 -0
  16. package/dist/components/DynamicResizer/assets/topToZero.svg.js +1 -0
  17. package/dist/components/DynamicResizer/hooks/useDrag.js +1 -0
  18. package/dist/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
  19. package/dist/components/DynamicResizer/index.js +1 -0
  20. package/dist/components/LLMMultiWheelView/dialogView/index.js +1 -0
  21. package/dist/components/LLMMultiWheelView/index.js +1 -0
  22. package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -0
  23. package/dist/components/LLMToolView/index.js +1 -1
  24. package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
  25. package/dist/components/LLMToolView/questionView/components/imgView/index.js +1 -1
  26. package/dist/components/LLMToolView/questionView/index.js +1 -1
  27. package/dist/components/LLMToolView/sidebar/components/answerSort/index.js +1 -1
  28. package/dist/components/LLMToolView/sidebar/components/modelAnswerSort/index.js +1 -0
  29. package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
  30. package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
  31. package/dist/components/LLMToolView/sidebar/index.js +1 -1
  32. package/dist/components/attributeList/index.js +1 -1
  33. package/dist/components/audioAnnotate/audioContext/index.js +1 -1
  34. package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +2 -1
  35. package/dist/components/audioAnnotate/index.js +1 -1
  36. package/dist/components/audioAnnotate/textInput/index.js +1 -1
  37. package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  38. package/dist/components/audioAnnotate/utils/dataTransform.js +1 -0
  39. package/dist/components/audioPlayer/clipRegion/index.js +1 -1
  40. package/dist/components/audioPlayer/index.js +1 -1
  41. package/dist/components/audioPlayer/useAudioCombine/index.js +3 -2
  42. package/dist/components/audioPlayer/useAudioScroll/index.js +1 -1
  43. package/dist/components/audioPlayer/useAudioSegment/index.js +1 -1
  44. package/dist/components/audioPlayer/zoomSlider/index.js +1 -1
  45. package/dist/components/longText/index.js +1 -1
  46. package/dist/components/markdownView/index.js +1 -1
  47. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  48. package/dist/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
  49. package/dist/components/pointCloud2DRectOperationView/util.js +1 -0
  50. package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  51. package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
  52. package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
  53. package/dist/components/pointCloudView/PointCloudBackView.js +1 -1
  54. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  55. package/dist/components/pointCloudView/PointCloudInfos.js +1 -1
  56. package/dist/components/pointCloudView/PointCloudLayout.js +1 -1
  57. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  58. package/dist/components/pointCloudView/PointCloudSegment2DView.js +1 -1
  59. package/dist/components/pointCloudView/PointCloudSegmentListener.js +1 -1
  60. package/dist/components/pointCloudView/PointCloudSideView.js +1 -1
  61. package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
  62. package/dist/components/pointCloudView/components/HighlightVisible/index.js +1 -1
  63. package/dist/components/pointCloudView/hooks/useBoxes.js +1 -1
  64. package/dist/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
  65. package/dist/components/pointCloudView/hooks/useHighlight.js +1 -1
  66. package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
  67. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  68. package/dist/components/pointCloudView/hooks/usePolygon.js +1 -1
  69. package/dist/components/pointCloudView/hooks/useRotate.js +1 -1
  70. package/dist/components/pointCloudView/hooks/useRotateEdge.js +1 -0
  71. package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
  72. package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
  73. package/dist/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
  74. package/dist/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -0
  75. package/dist/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
  76. package/dist/components/pointCloudView/index.js +1 -1
  77. package/dist/components/pointCloudView/utils/event-polyfill.js +1 -0
  78. package/dist/components/pointCloudView/utils/map.js +1 -0
  79. package/dist/components/predictTracking/predictTrackingIcon/index.js +1 -1
  80. package/dist/components/predictTracking/previewResult/index.js +1 -1
  81. package/dist/components/subAttributeList/index.js +1 -0
  82. package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
  83. package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  84. package/dist/data/enums/ToolType.js +1 -1
  85. package/dist/hooks/useToolStyle.js +1 -0
  86. package/dist/index.css +205 -16
  87. package/dist/index.js +1 -1
  88. package/dist/store/Actions.js +1 -1
  89. package/dist/store/LLMMultiWheel/index.js +1 -0
  90. package/dist/store/annotatedBox/index.js +1 -1
  91. package/dist/store/annotation/actionCreators.js +1 -1
  92. package/dist/store/annotation/reducer.js +1 -1
  93. package/dist/store/ctx.js +1 -1
  94. package/dist/store/toolConfig/baseToolConfig.js +1 -0
  95. package/dist/store/toolConfig/index.js +1 -0
  96. package/dist/store/toolConfig/pointCloudToolConfig.js +1 -0
  97. package/dist/types/App.d.ts +6 -1
  98. package/dist/types/components/AnnotationView/hooks/useFilterAnnotations.d.ts +2 -0
  99. package/dist/types/components/AnnotationView/index.d.ts +10 -0
  100. package/dist/types/components/DynamicResizer/DynamicResizer.d.ts +5 -0
  101. package/dist/types/components/DynamicResizer/hooks/useDrag.d.ts +12 -0
  102. package/dist/types/components/DynamicResizer/hooks/useUpdateHeight.d.ts +23 -0
  103. package/dist/types/components/DynamicResizer/index.d.ts +2 -0
  104. package/dist/types/components/DynamicResizer/types/interface.d.ts +17 -0
  105. package/dist/types/components/LLMMultiWheelView/dialogView/index.d.ts +15 -0
  106. package/dist/types/components/LLMMultiWheelView/index.d.ts +21 -0
  107. package/dist/types/components/LLMMultiWheelView/sidebar/index.d.ts +8 -0
  108. package/dist/types/components/LLMMultiWheelView/types.d.ts +62 -0
  109. package/dist/types/components/LLMToolView/questionView/components/header/index.d.ts +15 -0
  110. package/dist/types/components/LLMToolView/questionView/index.d.ts +7 -0
  111. package/dist/types/components/LLMToolView/sidebar/components/answerSort/index.d.ts +3 -0
  112. package/dist/types/components/LLMToolView/sidebar/components/modelAnswerSort/index.d.ts +30 -0
  113. package/dist/types/components/LLMToolView/sidebar/components/textInputBox/index.d.ts +2 -2
  114. package/dist/types/components/LLMToolView/sidebar/index.d.ts +10 -0
  115. package/dist/types/components/LLMToolView/types.d.ts +6 -2
  116. package/dist/types/components/LLMToolView/utils/data.d.ts +1 -0
  117. package/dist/types/components/audioAnnotate/audioContext/index.d.ts +10 -2
  118. package/dist/types/components/audioAnnotate/textInput/index.d.ts +1 -0
  119. package/dist/types/components/audioAnnotate/utils/dataTransform.d.ts +9 -0
  120. package/dist/types/components/audioPlayer/clipRegion/index.d.ts +1 -0
  121. package/dist/types/components/audioPlayer/index.d.ts +28 -21
  122. package/dist/types/components/audioPlayer/zoomSlider/index.d.ts +1 -0
  123. package/dist/types/components/longText/index.d.ts +1 -0
  124. package/dist/types/components/pointCloud2DRectOperationView/index.d.ts +1 -0
  125. package/dist/types/components/pointCloud2DRectOperationView/useUpdateRectList.d.ts +2 -0
  126. package/dist/types/components/pointCloud2DRectOperationView/util.d.ts +8 -0
  127. package/dist/types/components/pointCloudView/2DViewWorker.d.ts +1 -0
  128. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +1 -0
  129. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +23 -4
  130. package/dist/types/components/pointCloudView/PointCloudLayout.d.ts +1 -0
  131. package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -0
  132. package/dist/types/components/pointCloudView/components/HighlightVisible/index.d.ts +2 -1
  133. package/dist/types/components/pointCloudView/hooks/useBoxes.d.ts +5 -3
  134. package/dist/types/components/pointCloudView/hooks/useDataLinkSwitch.d.ts +19 -0
  135. package/dist/types/components/pointCloudView/hooks/useHighlight.d.ts +1 -1
  136. package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +31 -1
  137. package/dist/types/components/pointCloudView/hooks/useRotateEdge.d.ts +9 -0
  138. package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +3 -2
  139. package/dist/types/components/pointCloudView/hooks/useTimeoutFunc.d.ts +6 -0
  140. package/dist/types/components/pointCloudView/hooks/useUpdatePointCloudColor.d.ts +4 -0
  141. package/dist/types/components/pointCloudView/hooks/useWindowKeydownListener.d.ts +16 -0
  142. package/dist/types/components/pointCloudView/index.d.ts +1 -0
  143. package/dist/types/components/pointCloudView/utils/event-polyfill.d.ts +8 -0
  144. package/dist/types/components/pointCloudView/utils/map.d.ts +11 -0
  145. package/dist/types/components/subAttributeList/index.d.ts +10 -0
  146. package/dist/types/components/videoAnnotate/index.d.ts +2 -1
  147. package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +2 -1
  148. package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +1 -1
  149. package/dist/types/data/enums/ToolType.d.ts +2 -1
  150. package/dist/types/hooks/useToolStyle.d.ts +30 -0
  151. package/dist/types/index.d.ts +9 -2
  152. package/dist/types/store/Actions.d.ts +1 -0
  153. package/dist/types/store/LLMMultiWheel/index.d.ts +15 -0
  154. package/dist/types/store/annotatedBox/index.d.ts +2 -0
  155. package/dist/types/store/annotation/actionCreators.d.ts +4 -3
  156. package/dist/types/store/annotation/reducer.d.ts +1 -0
  157. package/dist/types/store/annotation/types.d.ts +9 -2
  158. package/dist/types/store/ctx.d.ts +7 -0
  159. package/dist/types/store/toolConfig/baseToolConfig.d.ts +4 -0
  160. package/dist/types/store/toolConfig/index.d.ts +3 -0
  161. package/dist/types/store/toolConfig/pointCloudToolConfig.d.ts +4 -0
  162. package/dist/types/store/toolConfig/types.d.ts +10 -0
  163. package/dist/types/utils/AnnotationDataUtils.d.ts +58 -1
  164. package/dist/types/utils/ToolPointCloudBoxRenderHelper.d.ts +24 -0
  165. package/dist/types/utils/data.d.ts +0 -2
  166. package/dist/types/utils/index.d.ts +27 -0
  167. package/dist/types/views/MainView/LLMMultiWheelLayout/index.d.ts +9 -0
  168. package/dist/types/views/MainView/sidebar/GeneralOperation/ActionsConfirm.d.ts +1 -0
  169. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.d.ts +3 -0
  170. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.d.ts +3 -0
  171. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.d.ts +3 -0
  172. package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +1 -1
  173. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.d.ts +9 -0
  174. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.d.ts +3 -0
  175. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/index.d.ts +1 -0
  176. package/dist/types/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.d.ts +10 -2
  177. package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
  178. package/dist/types/views/MainView/toolHeader/StepSwitch/index.d.ts +1 -1
  179. package/dist/types/views/MainView/toolHeader/index.d.ts +1 -1
  180. package/dist/utils/AnnotationDataUtils.js +1 -1
  181. package/dist/utils/ToolPointCloudBoxRenderHelper.js +1 -0
  182. package/dist/utils/data.js +1 -1
  183. package/dist/utils/index.js +1 -1
  184. package/dist/views/MainView/LLMMultiWheelLayout/index.js +1 -0
  185. package/dist/views/MainView/index.js +1 -1
  186. package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
  187. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.js +1 -0
  188. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.module.scss.js +1 -0
  189. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
  190. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
  191. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.js +1 -0
  192. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss.js +1 -0
  193. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  194. package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
  195. package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  196. package/dist/views/MainView/sidebar/index.js +1 -1
  197. package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
  198. package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
  199. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
  200. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
  201. package/dist/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
  202. package/dist/views/MainView/toolFooter/index.js +1 -1
  203. package/dist/views/MainView/toolHeader/index.js +1 -1
  204. package/es/App.js +1 -1
  205. package/es/_virtual/2DViewWorker.js +1 -0
  206. package/es/_virtual/highlightSegmentWorker.js +1 -1
  207. package/es/assets/annotation/icon_link.svg.js +1 -0
  208. package/es/assets/annotation/icon_unlink.svg.js +1 -0
  209. package/es/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
  210. package/es/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
  211. package/es/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
  212. package/es/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
  213. package/es/components/AnnotationView/hooks/useFilterAnnotations.js +1 -0
  214. package/es/components/AnnotationView/index.js +1 -1
  215. package/es/components/DynamicResizer/DynamicResizer.js +1 -0
  216. package/es/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
  217. package/es/components/DynamicResizer/assets/divider.svg.js +1 -0
  218. package/es/components/DynamicResizer/assets/topToZero.svg.js +1 -0
  219. package/es/components/DynamicResizer/hooks/useDrag.js +1 -0
  220. package/es/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
  221. package/es/components/DynamicResizer/index.js +1 -0
  222. package/es/components/LLMMultiWheelView/dialogView/index.js +1 -0
  223. package/es/components/LLMMultiWheelView/index.js +1 -0
  224. package/es/components/LLMMultiWheelView/sidebar/index.js +1 -0
  225. package/es/components/LLMToolView/index.js +1 -1
  226. package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
  227. package/es/components/LLMToolView/questionView/components/imgView/index.js +1 -1
  228. package/es/components/LLMToolView/questionView/index.js +1 -1
  229. package/es/components/LLMToolView/sidebar/components/answerSort/index.js +1 -1
  230. package/es/components/LLMToolView/sidebar/components/modelAnswerSort/index.js +1 -0
  231. package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
  232. package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
  233. package/es/components/LLMToolView/sidebar/index.js +1 -1
  234. package/es/components/attributeList/index.js +1 -1
  235. package/es/components/audioAnnotate/audioContext/index.js +1 -1
  236. package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +2 -1
  237. package/es/components/audioAnnotate/index.js +1 -1
  238. package/es/components/audioAnnotate/textInput/index.js +1 -1
  239. package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  240. package/es/components/audioAnnotate/utils/dataTransform.js +1 -0
  241. package/es/components/audioPlayer/clipRegion/index.js +1 -1
  242. package/es/components/audioPlayer/index.js +1 -1
  243. package/es/components/audioPlayer/useAudioCombine/index.js +3 -2
  244. package/es/components/audioPlayer/useAudioScroll/index.js +1 -1
  245. package/es/components/audioPlayer/useAudioSegment/index.js +1 -1
  246. package/es/components/audioPlayer/zoomSlider/index.js +1 -1
  247. package/es/components/longText/index.js +1 -1
  248. package/es/components/markdownView/index.js +1 -1
  249. package/es/components/pointCloud2DRectOperationView/index.js +1 -1
  250. package/es/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
  251. package/es/components/pointCloud2DRectOperationView/util.js +1 -0
  252. package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  253. package/es/components/pointCloudView/PointCloud2DView.js +1 -1
  254. package/es/components/pointCloudView/PointCloud3DView.js +1 -1
  255. package/es/components/pointCloudView/PointCloudBackView.js +1 -1
  256. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  257. package/es/components/pointCloudView/PointCloudInfos.js +1 -1
  258. package/es/components/pointCloudView/PointCloudLayout.js +1 -1
  259. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  260. package/es/components/pointCloudView/PointCloudSegment2DView.js +1 -1
  261. package/es/components/pointCloudView/PointCloudSegmentListener.js +1 -1
  262. package/es/components/pointCloudView/PointCloudSideView.js +1 -1
  263. package/es/components/pointCloudView/PointCloudTopView.js +1 -1
  264. package/es/components/pointCloudView/components/HighlightVisible/index.js +1 -1
  265. package/es/components/pointCloudView/hooks/useBoxes.js +1 -1
  266. package/es/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
  267. package/es/components/pointCloudView/hooks/useHighlight.js +1 -1
  268. package/es/components/pointCloudView/hooks/useHistory.js +1 -1
  269. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  270. package/es/components/pointCloudView/hooks/usePolygon.js +1 -1
  271. package/es/components/pointCloudView/hooks/useRotate.js +1 -1
  272. package/es/components/pointCloudView/hooks/useRotateEdge.js +1 -0
  273. package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
  274. package/es/components/pointCloudView/hooks/useStatus.js +1 -1
  275. package/es/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
  276. package/es/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -0
  277. package/es/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
  278. package/es/components/pointCloudView/index.js +1 -1
  279. package/es/components/pointCloudView/utils/event-polyfill.js +1 -0
  280. package/es/components/pointCloudView/utils/map.js +1 -0
  281. package/es/components/predictTracking/predictTrackingIcon/index.js +1 -1
  282. package/es/components/predictTracking/previewResult/index.js +1 -1
  283. package/es/components/subAttributeList/index.js +1 -0
  284. package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
  285. package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  286. package/es/data/enums/ToolType.js +1 -1
  287. package/es/hooks/useToolStyle.js +1 -0
  288. package/es/index.css +205 -16
  289. package/es/index.js +1 -1
  290. package/es/store/Actions.js +1 -1
  291. package/es/store/LLMMultiWheel/index.js +1 -0
  292. package/es/store/annotatedBox/index.js +1 -1
  293. package/es/store/annotation/actionCreators.js +1 -1
  294. package/es/store/annotation/reducer.js +1 -1
  295. package/es/store/ctx.js +1 -1
  296. package/es/store/toolConfig/baseToolConfig.js +1 -0
  297. package/es/store/toolConfig/index.js +1 -0
  298. package/es/store/toolConfig/pointCloudToolConfig.js +1 -0
  299. package/es/utils/AnnotationDataUtils.js +1 -1
  300. package/es/utils/ToolPointCloudBoxRenderHelper.js +1 -0
  301. package/es/utils/data.js +1 -1
  302. package/es/utils/index.js +1 -1
  303. package/es/views/MainView/LLMMultiWheelLayout/index.js +1 -0
  304. package/es/views/MainView/index.js +1 -1
  305. package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
  306. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.js +1 -0
  307. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/firstFrameDataSwitch/index.module.scss.js +1 -0
  308. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
  309. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
  310. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.js +1 -0
  311. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss.js +1 -0
  312. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  313. package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
  314. package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  315. package/es/views/MainView/sidebar/index.js +1 -1
  316. package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
  317. package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
  318. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
  319. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
  320. package/es/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
  321. package/es/views/MainView/toolHeader/index.js +1 -1
  322. package/package.json +7 -4
  323. package/dist/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
  324. package/dist/assets/icons/9d70807.svg +0 -5
  325. package/es/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
@@ -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 re}from"./PointCloudContext.js";import{useRotate as se}from"./hooks/useRotate.js";import{useRotateEdge as ne}from"./hooks/useRotateEdge.js";import{useBoxes as ie}from"./hooks/useBoxes.js";import{useSingleBox as ae}from"./hooks/useSingleBox.js";import{useSphere as ue}from"./hooks/useSphere.js";import{useContext as le,useEffect as d}from"react";import{CommonToolUtils as ce,AttributeUtils as de,EToolName as f,cTool as pe}from"@labelbee/lb-annotation";import{message as g}from"antd";import{connect as me}from"react-redux";import{a2MapStateToProps as be}from"../../store/annotation/map.js";import{useStatus as fe}from"./hooks/useStatus.js";import{usePointCloudViews as Pe}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as ye}from"../../store/ctx.js";import{useHistory as ve}from"./hooks/useHistory.js";import{useAttribute as we}from"./hooks/useAttribute.js";import{useConfig as Ce}from"./hooks/useConfig.js";import{usePolygon as he}from"./hooks/usePolygon.js";import{useLine as ge}from"./hooks/useLine.js";import{useUpdatePointCloudColor as Se}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as ke}from"react-i18next";import{useLatest as j}from"ahooks";var xe=Object.defineProperty,_e=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,A=(n,r,a)=>r in n?xe(n,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[r]=a,P=(n,r)=>{for(var a in r||(r={}))Be.call(r,a)&&A(n,a,r[a]);if(I)for(var a of I(r))Le.call(r,a)&&A(n,a,r[a]);return n},y=(n,r)=>_e(n,Ve(r));const{EPolygonPattern:Oe}=pe,je=({currentData:n,config:r,checkMode:a,configString:E,imgIndex:S,toolInstanceRef:i,setResourceLoading:k})=>{const e=le(re),{changeSelectedBoxValid:T,selectNextBox:D,selectPrevBox:H,updateSelectedBox:K,deleteSelectedPointCloudBoxAndPolygon:N}=ae(),{selectedSphere:v,updatePointCloudSphere:U}=ue(),{clearAllResult:w,updatePointCloudPattern:z}=fe(),{copySelectedBoxes:R,pasteSelectedBoxes:F,copiedBoxes:Ae}=ie({config:r,currentData:n}),{updateRotate:x}=se({currentData:n}),{updateRotateEdge:q}=ne({currentData:n}),{updatePointCloudData:m,topViewSelectedChanged:G}=Pe({setResourceLoading:k}),{redo:_,undo:V,pushHistoryWithList:M,pushHistoryUnderUpdatePolygon:W,pushHistoryUnderUpdateLine:Y}=ve(),{syncThreeViewsAttribute:B}=we(),{syncAllViewsConfig:$,reRenderTopViewRange:J}=Ce(),{selectedPolygon:L}=he(),{selectedLine:O}=ge(),{t:C}=ke(),{updatePointCloudColor:Q}=Se(k,r),X=j(n),b=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Z=(t,o)=>{var s,u;const{topViewInstance:c,mainViewInstance:l}=e;if(!c)return;const{pointCloud2dOperation:h}=c;switch(t){case"q":{x(e.rectRotateSensitivity);break}case"e":x(-Number(e.rectRotateSensitivity));break;case"g":q(-90);break;case"u":{const p=h.pattern===Oe.Normal?f.Rect:f.Polygon;z(p);const oe={[f.Polygon]:C("PolygonPattern"),[f.Rect]:C("RectPattern")};g.success(C("ChangePatternMsg",{pattern:oe[p]})),h.clearActiveStatus(),h.clearDrawingStatus()}break;case"+":l==null||l.updatePointSize({zoomIn:!0});break;case"-":l==null||l.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){H();break}D(),o.preventDefault();break;case"f":T();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":N(X.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=de.getAttributeByKeycode(o.keyCode,r.attributeList);p!==void 0&&((u=i.current)==null||u.setDefaultAttribute(p))}return}}},ee=(t,o)=>{switch(t){case"c":R();break;case"v":F();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?_():V();break}}},te=j(t=>{if(!ce.hotkeyFilter(t)||a===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){ee(o,t);return}Z(o,t)});return d(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(c=>te.current(c))},[e,e.topViewInstance,e.windowKeydownListenerHook]),d(()=>{$(r)},[E]),d(()=>{(r==null?void 0:r.radius)&&J(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),d(()=>{m==null||m()},[S,e.mainViewInstance]),d(()=>{e.setHideAttributes([])},[S]),d(()=>{i.current.setDefaultAttribute=t=>{var o;if(B(t),Q(t),L&&W(y(P({},L),{attribute:t})),O&&Y(y(P({},O),{attribute:t})),v){const s=U(y(P({},v),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),G({newSelectedSphere:v,newSphereList:s}))}},i.current.setSubAttribute=(t,o)=>{var s;const u=e.selectedPointCloudBox;if(u){const c=(s=u==null?void 0:u.subAttribute)!=null?s:{};u.subAttribute=y(P({},c),{[t]:o}),K(u),e.mainViewInstance&&e.selectedPointCloudBox&&e.mainViewInstance.generateBox(e.selectedPointCloudBox)}},i.current.clearResult=()=>{w==null||w()},i.current.redo=()=>{_()},i.current.undo=()=>{V()},i.current.setValid=t=>{i.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&w()})},i.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},i.current.asyncData=t=>{setTimeout(()=>{m==null||m(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),d(()=>{i.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},i.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),d(()=>{i.current.history={pushHistory:t=>{M({pointCloudBoxList:t})},initRecord:()=>{}}},[]),d(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||a)return;const s=l=>{B(l)},u=l=>{g.error(l)},c=l=>{g.info(l)};return o.on("syncAttribute",s),o.on("messageError",u),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",u),o.unbind("messageInfo",c)}},[e.topViewInstance]),null};var Ie=me(be,null,null,{context:ye})(je);export{Ie 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 _}from"../../utils/dom.js";import{FooterDivider as F}from"../../views/MainView/toolFooter/index.js";import{ZoomController as me}from"../../views/MainView/toolFooter/ZoomController/index.js";import{LeftOutlined as fe,UpSquareOutlined as Ce,DownSquareOutlined as ve}from"@ant-design/icons";import{cKeyCode as we,PointCloudAnnotation as Pe,MathUtils as W,cTool as ge,cAnnotation as ye}from"@labelbee/lb-annotation";import{PointCloudUtils as K}from"@labelbee/lb-utils";import{EPointCloudBoxRenderTrigger as Ie}from"../../utils/ToolPointCloudBoxRenderHelper.js";import s,{useState as A,useRef as xe,useLayoutEffect as he,useEffect as y}from"react";import{PointCloudContext as M}from"./PointCloudContext.js";import{useRotate as Ve}from"./hooks/useRotate.js";import{useRotateEdge as Se}from"./hooks/useRotateEdge.js";import{useSingleBox as X}from"./hooks/useSingleBox.js";import{PointCloudContainer as _e}from"./PointCloudLayout.js";import{BoxInfos as Y,PointCloudValidity as Ee}from"./PointCloudInfos.js";import{usePolygon as Le}from"./hooks/usePolygon.js";import{useSphere as q}from"./hooks/useSphere.js";import{useZoom as $}from"./hooks/useZoom.js";import{Slider as be}from"antd";import{a2MapStateToProps as Oe}from"../../store/annotation/map.js";import{connect as je}from"react-redux";import{usePointCloudViews as Te}from"./hooks/usePointCloudViews.js";import Re from"../../hooks/useSize.js";import{useTranslation as ke}from"react-i18next";import{LabelBeeContext as De}from"../../store/ctx.js";import{jsonParser as Be}from"../../utils/index.js";import Ne from"../../utils/ToolUtils.js";import Ae from"lodash";import Ue from"./components/PointCloudSizeSlider/index.js";import{useHistory as ze}from"./hooks/useHistory.js";import Ze from"./components/TitleButton/index.js";var He=Object.defineProperty,Fe=Object.defineProperties,We=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,J=(i,l,r)=>l in i?He(i,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[l]=r,U=(i,l)=>{for(var r in l||(l={}))Ke.call(l,r)&&J(i,r,l[r]);if(G)for(var r of G(l))Me.call(l,r)&&J(i,r,l[r]);return i},z=(i,l)=>Fe(i,We(l));const{EPolygonPattern:Xe,EToolName:Q}=ge,{ESortDirection:ee}=ye,Ye=we.default,te=(i,l,r=1)=>{const{width:v,height:m}=l,I={x:i.x+v*r/2,y:i.y+m*r/2},x={x:l.width/2,y:l.height/2};return{offsetX:(x.x-I.x)/r,offsetY:-(x.y-I.y)/r}},qe=({currentData:i})=>{var l,r;const{zoom:v,zoomIn:m,zoomOut:I,initialPosition:x}=$(),{selectNextBox:O,selectPrevBox:j}=X(),{switchToNextSphere:E}=q(),{updateRotate:L}=Ve({currentData:i}),{updateRotateEdge:T}=Se({currentData:i}),P=s.useContext(M),{topViewInstance:h}=P,f=(r=(l=P==null?void 0:P.topViewInstance)==null?void 0:l.toolScheduler)==null?void 0:r.getCurrentToolName(),e=()=>{L(-Number(P.rectRotateSensitivity))},d=()=>{L(P.rectRotateSensitivity)},C=()=>{T(-90)};return s.createElement(s.Fragment,null,s.createElement(Ue,{onChange:B=>{var V;(V=h==null?void 0:h.pointCloudInstance)==null||V.updatePointSize({customSize:B})}}),s.createElement("span",{onClick:d,className:_("point-cloud","rotate-reserve")}),s.createElement("span",{onClick:e,className:_("point-cloud","rotate")}),s.createElement("span",{onClick:C,className:_("point-cloud","rotate-90")}),s.createElement(F,null),s.createElement(Ce,{onClick:()=>{if(f===Q.Point){E(ee.descend);return}j(!0)},className:_("point-cloud","prev")}),s.createElement(ve,{onClick:()=>{if(f===Q.Point){E(ee.ascend);return}O(!0)},className:_("point-cloud","next")}),s.createElement(F,null),s.createElement(me,{initialPosition:x,zoomIn:m,zoomOut:I,zoom:v}))},$e=({setZAxisLimit:i,zAxisLimit:l,checkMode:r})=>r?null:s.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},s.createElement(be,{vertical:!0,step:.5,max:10,min:.5,defaultValue:l,onAfterChange:v=>{i(v)}})),Ge=({currentData:i,imgList:l,stepInfo:r,drawLayerSlot:v,checkMode:m,intelligentFit:I,setIsEnlargeTopView:x,isEnlargeTopView:O,onExitZoom:j,highlightAttribute:E})=>{var L,T;const[P,h]=A({zoom:1,currentPos:{x:0,y:0}}),f=xe(null),e=s.useContext(M),d=Re(f),C=Be(r.config),{setZoom:B,syncTopviewToolZoom:V}=$(),{hideAttributes:oe}=e,{addPolygon:ne,deletePolygon:ie}=Le(),{deletePointCloudSphere:se}=q(),{deletePointCloudBox:le,changeValidByID:re}=X(),[N,ae]=A(10),{t:Z}=ke(),w=Te(),{pushHistoryWithList:ce}=ze(),[de,R]=A(!0);he(()=>{if(!e.topViewInstance&&f.current&&(i==null?void 0:i.url)&&(i==null?void 0:i.result)){const o={width:f.current.clientWidth,height:f.current.clientHeight},a=new Pe({container:f.current,size:o,pcdPath:i.url,config:z(U({},C),{pointCloudPattern:e.pointCloudPattern}),checkMode:m,toolName:Ne.getPointCloudToolList(),proxyMode:m});e.setTopViewInstance(a)}},[i]),y(()=>{if(!d||!e.topViewInstance||!e.sideViewInstance)return;const{toolInstance:o}=e.topViewInstance;o.singleOn("dataUpdated",(t,n)=>{const u=Ae.cloneDeep(t).map(c=>z(U({},c),{pointList:K.pointListTransferCanvas2World(c.pointList,d)}));e.setSelectedIDs(n),e.setLineList(u),ce({lineList:u})}),o.singleOn("pointCreated",(t,n)=>{w.topViewAddSphere({newPoint:t,size:d,trackConfigurable:C.trackConfigurable,zoom:n})}),o.singleOn("pointDeleted",t=>{se(t)}),o.singleOn("pointSelected",t=>{e.setSelectedIDs([t])}),o.singleOn("updatePointByDrag",(t,n)=>{var u;(u=w.topViewUpdatePoint)==null||u.call(w,t,d)}),o.singleOn("polygonCreated",(t,n)=>{if(o.pattern===Xe.Normal||!(i==null?void 0:i.url)){const u=z(U({},t),{pointList:t.pointList.map(c=>K.transferCanvas2World(c,d))});ne(u),e.setSelectedIDs(oe.includes(t.attribute)?"":t.id);return}R(!1),w.topViewAddBox({polygon:t,size:d,imgList:l,trackConfigurable:C.trackConfigurable,zoom:n,intelligentFit:I})}),o.singleOn("deletedObject",({id:t})=>{le(t),ie(t)}),o.singleOn("deleteSelectedIDs",()=>{e.setSelectedIDs([])}),o.singleOn("addSelectedIDs",t=>{e.addSelectedID(t)}),o.singleOn("setSelectedIDs",t=>{R(!1),e.setSelectedIDs(t)}),o.singleOn("updatePolygonByDrag",t=>{var n;(n=w.topViewUpdateBox)==null||n.call(w,t,d)});const a=t=>{var n;const u=re(t);u&&e.syncAllViewPointCloudColor(Ie.Default,u),e.polygonList.find(c=>c.id===t)&&((n=e.topViewInstance)==null||n.toolInstance.setPolygonValidAndRender(t,!0))};return o.on("validUpdate",a),()=>{o.unbind("validUpdate",a)}},[e,d,i,w,e.polygonList,e.lineList,(L=e.topViewInstance)==null?void 0:L.toolInstance]),y(()=>{var o,a;if(!(d==null?void 0:d.width)||!e.topViewInstance)return;const t=(a=(o=C==null?void 0:C.attributeList)==null?void 0:o[0])==null?void 0:a.value;t&&e.topViewInstance.toolInstance.setDefaultAttribute(t),e.topViewInstance.initSize(d),e.topViewInstance.updatePolygonList(e.displayPointCloudList,e.polygonList),e.topViewInstance.updatePointList(e.displaySphereList),e.topViewInstance.updateLineList(e.displayLineList);const{topViewInstance:{pointCloudInstance:n,toolInstance:u}}=e;u.singleOn("renderZoom",(c,p)=>{const{offsetX:S,offsetY:b}=te(p,d,c);if(n.camera.zoom=c,p){const{x:g,y:k,z:D}=n.initCameraPosition;n.camera.position.set(g+b,k-S,D)}n.camera.updateProjectionMatrix(),n.render(),B(c),V(p,c,d),h({zoom:c,currentPos:p})}),u.singleOn("dragMove",({currentPos:c,zoom:p})=>{const{offsetX:S,offsetY:b}=te(c,d,p);n.camera.zoom=p;const{x:g,y:k,z:D}=n.initCameraPosition;n.camera.position.set(g+b,k-S,D),n.render(),V(c,p,d),h({zoom:p,currentPos:c})})},[d,e.topViewInstance,(T=e.topViewInstance)==null?void 0:T.toolInstance]),y(()=>{var o,a;(a=(o=e.topViewInstance)==null?void 0:o.pointCloudInstance)==null||a.applyZAxisPoints(N)},[N]),y(()=>{var o,a,t,n;w.topViewSelectedChanged({}),(n=(t=(a=(o=e.topViewInstance)==null?void 0:o.toolInstance)==null?void 0:a.selection)==null?void 0:t.hardSetSelectedIDs)==null||n.call(t,e.selectedIDs)},[e.selectedIDs]),y(()=>{const{topViewInstance:o,selectedID:a,selectedPointCloudBox:t,zoom:n}=e;if(!o||!a||!t||!de){R(!0);return}const{center:u}=t,{pointCloudInstance:c,toolInstance:p}=o,S=p.polygonList.find(pe=>pe.id===e.selectedID);if(!S){R(!0);return}const b=W.getRectCenterPoint(S.pointList),g=W.getCurrentPosFromRectCenter(p.size,b,n);p.setCurrentPos(g),p.render();const{x:k,y:D,z:ue}=c.initCameraPosition;c.camera.position.set(u.x,u.y,ue),c.render(),V(g,n,d),h({zoom:n,currentPos:g})},[e.selectedID]),y(()=>(window.addEventListener("keydown",H),()=>{window.removeEventListener("keydown",H)}),[]);const H=o=>{const{keyCode:a}=o;a===Ye.Esc&&j()};return y(()=>{var o,a,t;(t=(a=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null?void 0:a.setHighlightAttribute)==null||t.call(a,E)},[e.topViewInstance,E]),s.createElement(_e,{className:_("point-cloud-container","top-view"),title:O?s.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative"}},s.createElement(fe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{j()}}),s.createElement("span",null,Z("TopView")),s.createElement(Y,{checkMode:m,config:C,style:{display:"flex",position:"initial",margin:"0px 20px"}})):s.createElement(Ze,{title:Z("TopView"),onClick:()=>{x(!0)}}),toolbar:s.createElement(qe,{currentData:i})},s.createElement("div",{style:{position:"relative",flex:1}},s.createElement("div",{style:{width:"100%",height:"100%"},ref:f},v==null?void 0:v(P)),!O&&s.createElement(Y,{checkMode:m,config:C}),s.createElement($e,{checkMode:m,zAxisLimit:N,setZAxisLimit:ae}),s.createElement(Ee,null)))};var Je=je(Oe,null,null,{context:De})(Ge);export{Je as default};
@@ -1 +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};
@@ -0,0 +1 @@
1
+ import v,{useState as T,useContext as p,useCallback as B,useMemo as h,useEffect as C}from"react";import{useLatest as s}from"ahooks";import{PointCloudContext as y}from"../PointCloudContext.js";import U from"../../../assets/annotation/icon_link.svg.js";import $ from"../../../assets/annotation/icon_unlink.svg.js";import{EventBusEvent as L}from"../../../views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js";import{EventBus as M}from"@labelbee/lb-annotation";import{useSyncRectPositionDimensionToPointCloudList as q}from"./usePointCloudViews.js";const A=e=>{const{imageNamePointCloudBoxMap:o,linkageImageNameRectMap:m}=p(y),r=h(()=>e?o.has(e):(console.error("Missing image name"),!1),[e,o]),d=h(()=>{var a,f;return e?((f=(a=m.get(e))==null?void 0:a.size)!=null?f:0)>0:!1},[m,e]),g=h(()=>r||d,[r,d]),I=s(g);return{visible:g,visibleRef:I}},N={width:16,height:16},G=e=>{e.imageName||console.warn("missing imageName");const[o,m]=T(!0),r=s(e.imageName),{addRectFromPointCloudBoxByImageName:d,removeRectByPointCloudBoxId:g,linkageImageNameRectMap:I,pointCloudBoxList:a,rectList:f,updateRectListByReducer:P}=p(y),{visible:R,visibleRef:D}=A(e.imageName),{syncToPointCloudBoxList:E}=q(),S=s(d),_=s(g),V=s(()=>E()),w=B(n=>{if(!D.current)return;const t=r.current;if(!t){console.warn("invalid image name");return}m(n),n?_.current(t):S.current(t)},[]),j=s(n=>{n&&V.current(),w(n)}),z=h(()=>{var n;if(!e.is2DView||!R)return null;const i={zIndex:(n=e.zIndex)!=null?n:999,position:"absolute",top:16,right:16+28+12,background:"rgba(0, 0, 0, 0.74)",color:"white",borderRadius:2,padding:6,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28};return v.createElement("div",{style:i},o&&v.createElement("img",{src:U,style:N}),!o&&v.createElement("img",{src:$,style:N}))},[o,e.is2DView,e.zIndex,R]),F=s(I),k=B(()=>{var n,t;if(!e.is2DView)return;const i=r.current;if(!i){console.warn("invalid image name");return}const c=[...(t=(n=F.current.get(i))==null?void 0:n.keys())!=null?t:[]];let l=!0;c.length&&(l=!1),w(l)},[e.is2DView,w]);return C(()=>{k()},[k,a,f]),C(()=>{const n=a.map(i=>i.id),t=new Set(n);P((i,x)=>{const c=[],l=[];return i.forEach(u=>{const b=u.extId;b!==void 0&&t.has(b)===!1?c.push(u):l.push(u)}),c.length?[...c.map(u=>x(u)),...l]:i})},[a]),C(()=>{const n=t=>{j.current(t)};return M.on(L.switchConnect,n),()=>M.unbind(L.switchConnect,n)},[]),{rendered:z,isLinking:o}};export{G as default};
@@ -1 +1 @@
1
- import{useContext as C,useCallback as I}from"react";import{PointCloudContext as y}from"../PointCloudContext.js";var x=(s,r,t)=>new Promise((a,u)=>{var n=i=>{try{e(t.next(i))}catch(l){u(l)}},h=i=>{try{e(t.throw(i))}catch(l){u(l)}},e=i=>i.done?a(i.value):Promise.resolve(i.value).then(n,h);e((t=t.apply(s,r)).next())});const L=({currentData:s})=>{var r;const{mainViewInstance:t,topViewInstance:a,pointCloudBoxList:u,highlight2DDataList:n,setHighlight2DDataList:h}=C(y),e=(r=s==null?void 0:s.mappingImgList)!=null?r:[],i=(o,d)=>x(void 0,null,function*(){var c;let g=[...n];if(n.find(p=>p.url===o)?g=n.filter(p=>p.url!==o):g.push({url:o,calib:d}),h(g),!t||(e==null?void 0:e.length)===0)return;const m=t.pointCloudObject;if(!m)return;const f=yield t.getHighlightIndexByMappingImgList({mappingImgList:g,points:m.geometry.attributes.position.array}),v=yield t.highlightOriginPointCloud(u,f);v&&((c=a==null?void 0:a.pointCloudInstance)==null||c.updateColor(v))}),l=I(o=>n.findIndex(d=>d.url===o)>=0,[n]);return{toggle2dVisible:i,isHighlightVisible:l}};export{L as useHighlight};
1
+ import{useContext as C,useCallback as y}from"react";import{PointCloudContext as I}from"../PointCloudContext.js";var x=(s,g,t)=>new Promise((a,h)=>{var e=i=>{try{o(t.next(i))}catch(l){h(l)}},d=i=>{try{o(t.throw(i))}catch(l){h(l)}},o=i=>i.done?a(i.value):Promise.resolve(i.value).then(e,d);o((t=t.apply(s,g)).next())});const L=({currentData:s})=>{var g;const{mainViewInstance:t,topViewInstance:a,pointCloudBoxList:h,highlight2DDataList:e,setHighlight2DDataList:d}=C(I),o=(g=s==null?void 0:s.mappingImgList)!=null?g:[],i=(r,c,v)=>x(void 0,null,function*(){var p;let u=[...e];if(e.find(n=>n.url===r)?u=e.filter(n=>n.url!==r):u.push({url:r,fallbackUrl:c,calib:v}),d(u),!t||(o==null?void 0:o.length)===0)return;const m=t.pointCloudObject;if(!m)return;const f=yield t.getHighlightIndexByMappingImgList({mappingImgList:u,points:m.geometry.attributes.position.array});try{const n=yield t.highlightOriginPointCloud(h,f);n&&((p=a==null?void 0:a.pointCloudInstance)==null||p.updateColor(n))}catch(n){console.error("toggle2dVisible highlightOriginPointCloud error:",n)}}),l=y(r=>e.findIndex(c=>c.url===r)>=0,[e]);return{toggle2dVisible:i,isHighlightVisible:l}};export{L as useHighlight};
@@ -1 +1 @@
1
- import{useContext as m}from"react";import{PointCloudContext as I}from"../PointCloudContext.js";var R=Object.defineProperty,g=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,P=(e,n,s)=>n in e?R(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s,a=(e,n)=>{for(var s in n||(n={}))U.call(n,s)&&P(e,s,n[s]);if(g)for(var s of g(n))V.call(n,s)&&P(e,s,n[s]);return e};const j=()=>{const{history:e,setPointCloudResult:n,setSelectedIDs:s,pointCloudBoxList:L,pointCloudSphereList:f,setPointCloudSphereList:x,mainViewInstance:d,topViewInstance:u,polygonList:c,setPolygonList:y,lineList:p,setLineList:h,syncAllViewPointCloudColor:S,segmentation:v}=m(I),_=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:l})=>{const r={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:f};t&&(r.pointCloudBoxList=L.concat(t)),o&&(r.polygonList=c.concat(o)),i&&(r.lineList=p.concat(i)),l&&(r.pointCloudSphereList=f.concat(l)),e.pushHistory(r)},w=t=>{const o={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:f,segmentation:v};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),t.segmentation&&(o.segmentation=t.segmentation),e.pushHistory(o)},B=t=>{if(p.find(i=>i.id===t.id)){const i=p.map(l=>l.id===t.id?t:a({},l));e.pushHistory({lineList:i}),h(i)}},H=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(l=>l.id===t.id?t:a({},l));e.pushHistory({pointCloudBoxList:L,polygonList:i}),y(i)}},O=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i})=>{e.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i,lineList:p},!0)},C=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:l=[],pointCloudSphereList:r=[]}=t;o&&(L.length!==o.length&&s(),d==null||d.clearAllBox(),d==null||d.generateBoxes(o),n(o),S(o)),r&&(f.length!==r.length&&s(),d==null||d.clearAllSphere(),d==null||d.generateSpheres(r),x(r)),i&&y(i),l&&h(l),u==null||u.updatePolygonList(o!=null?o:[],i!=null?i:[]),u==null||u.updateLineList(l!=null?l:[]),u==null||u.updatePointList(r)};return{addHistory:_,pushHistoryWithList:w,initHistory:O,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:B,redo:()=>{C(e.redo())},undo:()=>{C(e.undo())}}};export{j as useHistory};
1
+ import{EPointCloudBoxRenderTrigger as m}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{useContext as R}from"react";import{PointCloudContext as I}from"../PointCloudContext.js";var U=Object.defineProperty,h=Object.getOwnPropertySymbols,j=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,P=(e,n,s)=>n in e?U(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s,a=(e,n)=>{for(var s in n||(n={}))j.call(n,s)&&P(e,s,n[s]);if(h)for(var s of h(n))V.call(n,s)&&P(e,s,n[s]);return e};const A=()=>{const{history:e,setPointCloudResult:n,setSelectedIDs:s,pointCloudBoxList:L,pointCloudSphereList:f,setPointCloudSphereList:x,mainViewInstance:d,topViewInstance:u,polygonList:c,setPolygonList:y,lineList:p,setLineList:C,syncAllViewPointCloudColor:S,segmentation:v}=R(I),B=({newBoxParams:t,newPolygon:o,newLine:i,newSphereParams:l})=>{const r={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:f};t&&(r.pointCloudBoxList=L.concat(t)),o&&(r.polygonList=c.concat(o)),i&&(r.lineList=p.concat(i)),l&&(r.pointCloudSphereList=f.concat(l)),e.pushHistory(r)},_=t=>{const o={pointCloudBoxList:L,polygonList:c,lineList:p,pointCloudSphereList:f,segmentation:v};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),t.pointCloudSphereList&&(o.pointCloudSphereList=t.pointCloudSphereList),t.segmentation&&(o.segmentation=t.segmentation),e.pushHistory(o)},H=t=>{if(p.find(i=>i.id===t.id)){const i=p.map(l=>l.id===t.id?t:a({},l));e.pushHistory({lineList:i}),C(i)}},w=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(l=>l.id===t.id?t:a({},l));e.pushHistory({pointCloudBoxList:L,polygonList:i}),y(i)}},O=({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i})=>{e.initRecord({pointCloudBoxList:t,polygonList:o,pointCloudSphereList:i,lineList:p},!0)},g=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:l=[],pointCloudSphereList:r=[]}=t;o&&(L.length!==o.length&&s(),d==null||d.clearAllBox(),d==null||d.generateBoxes(o),n(o),S(m.UndoRedo,o)),r&&(f.length!==r.length&&s(),d==null||d.clearAllSphere(),d==null||d.generateSpheres(r),x(r)),i&&y(i),l&&C(l),u==null||u.updatePolygonList(o!=null?o:[],i!=null?i:[]),u==null||u.updateLineList(l!=null?l:[]),u==null||u.updatePointList(r)};return{addHistory:B,pushHistoryWithList:_,initHistory:O,pushHistoryUnderUpdatePolygon:w,pushHistoryUnderUpdateLine:H,redo:()=>{g(e.redo())},undo:()=>{g(e.undo())}}};export{A as useHistory};
@@ -1 +1 @@
1
- import{EPointCloudName as nt,MathUtils as B,getCuboidFromPointCloudBox as Mt}from"@labelbee/lb-annotation";import{EPerspectiveView as J,PointCloudUtils as V,POINT_CLOUD_DEFAULT_STEP as Gt,DEFAULT_SPHERE_PARAMS as Jt}from"@labelbee/lb-utils";import{useContext as Qt}from"react";import{PointCloudContext as Xt}from"../PointCloudContext.js";import{useSingleBox as Yt}from"./useSingleBox.js";import{useSphere as qt}from"./useSphere.js";import{useSelector as Kt,useDispatch as $t}from"../../../store/ctx.js";import to from"../../../utils/StepUtils.js";import{jsonParser as it,getRectPointCloudBox as oo}from"../../../utils/index.js";import{PreDataProcess as st,SetPointCloudLoading as Ct,SetLoadPCDFileLoading as Pt}from"../../../store/annotation/actionCreators.js";import{useHistory as eo}from"./useHistory.js";import{usePolygon as no}from"./usePolygon.js";import{useLatest as io}from"ahooks";var so=Object.defineProperty,ro=Object.defineProperties,lo=Object.getOwnPropertyDescriptors,ht=Object.getOwnPropertySymbols,ao=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,xt=(e,t,i)=>t in e?so(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t)=>{for(var i in t||(t={}))ao.call(t,i)&&xt(e,i,t[i]);if(ht)for(var i of ht(t))co.call(t,i)&&xt(e,i,t[i]);return e},O=(e,t)=>ro(e,lo(t)),rt=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(h){o(h)}},g=u=>{try{c(i.throw(u))}catch(h){o(h)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const q=5,K=90,mt=.01,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},lt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Jt,u={center:{x:a,y:g,z:c},id:e.id},h=d?L(L({},d),u):O(L({},u),{attribute:"",valid:!0});return o&&Object.assign(h,o),h},dt=(e,t,i,d,o,a)=>{let g=e.pointList.map(v=>V.transferCanvas2World(v,t)),c=0,u=1,h={};if(i){const v=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&v.fittedCoordinates.length>0&&(g=v.fittedCoordinates),c=(v.maxZ+v.minZ)/2,u=v.maxZ-v.minZ,h={count:v.zCount}}const[m,I,W]=g,z=B.getLineCenterPoint([m,W]),T=B.getLineLength(m,I),R=B.getLineLength(I,W),E=B.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const j={center:{x:z.x,y:z.y,z:c},width:a?R+mt:R,height:a?T+mt:T,depth:u,rotation:E,id:e.id},N=L(d?L(L({},d),j):O(L({},j),{attribute:"",valid:!0}),h);o&&Object.assign(N,o);const F=g.map(v=>V.transferWorld2Canvas(v,t));return{boxParams:N,newPointList:F}},Lt=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x-d.x,y:i.center.y,z:i.center.z-d.y}})},yt=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,h]=t.pointList,m=B.getLineCenterPoint([o,g]),I=B.getLineCenterPoint([c,h]),z={x:{x:m.x-I.x,y:m.y-I.y}.x,y:0,z:m.y-I.y},T=B.getLineLength(o,a),R=B.getLineLength(c,u),E=T-R,j=B.getLineLength(a,g),N=B.getLineLength(u,h),F=j-N,{newBoxParams:v}=d.getNewBoxBySideUpdate(z,F,E,i);return v},uo=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x,y:i.center.y-d.x,z:i.center.z-d.y}})},po=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,h]=t.pointList,m=B.getLineCenterPoint([o,g]),I=B.getLineCenterPoint([c,h]),z={x:{x:m.x-I.x,y:m.y-I.y}.x,y:0,z:m.y-I.y},T=B.getLineLength(o,a),R=B.getLineLength(c,u),E=T-R,j=B.getLineLength(a,g),N=B.getLineLength(u,h),F=j-N;let{newBoxParams:v}=d.getNewBoxByBackUpdate(z,F,E,i);return v},vt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,J.Left);c.setInitCameraPosition(u);const{point2d:h,zoom:m}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=m,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(m),g.setResult([O(L(L({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},Bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{width:q,depth:q});const{cameraPositionVector:g}=a.updateOrthoCamera(e,J.Left);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},bt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,J.Back);c.setInitCameraPosition(u);const{point2d:h,zoom:m}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=m,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(m),g.setResult([O(L(L({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},wt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:q,depth:q});const{cameraPositionVector:g}=a.updateOrthoCamera(e,J.Back);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},It=(e,t,i,d)=>{if(!i||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,J.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=i,{point2d:g}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?O(L(L({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},at=(e,t,i,d)=>{var o,a;if(!i||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:g,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),h=[...g.polygonList],m=h.find(I=>I.id===t.id);m?(m.pointList=u,m.valid=(o=e.valid)!=null?o:!0):h.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(h,t.id)},go=()=>{const e=Qt(Xt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:h,pointCloudSphereList:m,hideAttributes:I,setHighlight2DDataList:W,cuboidBoxIn2DView:z,imageSizes:T}=e,{addHistory:R,initHistory:E,pushHistoryUnderUpdatePolygon:j}=eo(),{selectedPolygon:N}=no(),{getPointCloudSphereByID:F,updatePointCloudSphere:v,selectedSphere:Q}=qt(),{currentData:Z,config:S}=Kt(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:it(to.getCurrentStepInfo(p,s).config)}}),H=$t(),St=io(z),$=n=>{if(!St.current){const{mappingImgList:s=[]}=Z,p=s.map(r=>oo({pointCloudBox:n,mappingData:r,imageSizes:T}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:_,updateSelectedBox:Dt,updateSelectedBoxes:tt,getPointCloudByID:_t}=Yt({generateRects:$}),ct=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Vt=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},Ot=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},kt=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const f={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(f,{trackID:V.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:m})});const P=lt(n,s,ot,void 0,f);c(n.id);const x=g(P);X(y.Top,n,P,p,x,S),R({newSphereParams:P})},Rt=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:f})=>{var P,x;const C={attribute:(P=t.toolInstance.defaultAttribute)!=null?P:""};r===!0&&Object.assign(C,{trackID:V.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:m})});const D=t==null?void 0:t.toolInstance,w=L({},n);let{boxParams:b,newPointList:A}=dt(w,s,ot,void 0,C,f);b=H(st({tool:nt.PointCloud,dataList:[b],stepConfig:S,action:"viewUpdateBox"}))[0],f&&(A==null?void 0:A.length)&&(w.pointList=A);const k=I.includes(w.attribute);$(b);const G=a(b),et=(x=e==null?void 0:e.polygonList)!=null?x:[];t==null||t.updatePolygonList(G!=null?G:[],et),k?c([]):(c(b.id),D.selection.setSelectedIDs(w.id),M({omitView:y.Top,polygon:w,boxParams:b,zoom:l,newPointCloudBoxList:G}),f&&at(b,w,t,o)),R({newBoxParams:b})},At=n=>{const{boxID:s,imageName:p,width:r,height:l,x:f,y:P}=n,x=h.find(C=>C.id===s);if(x==null?void 0:x.rects){const{rects:C=[]}=x,D=C.find(w=>w.imageName===p);if(D){let w=C;const b=O(L({},D),{width:r,height:l,x:f,y:P});w=C.map(k=>k===D?b:k);const A=O(L({},x),{rects:w}),U=h.map(k=>k===x?A:k);return t==null||t.updatePolygonList(U!=null?U:[]),U}}},Ut=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const f=t==null?void 0:t.toolInstance;if(!(u.length===0||!f)){if(n||(_==null?void 0:_.info)){const P=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const x=f.selectedPolygon;if(u.length===1&&P){M({omitView:y.Top,polygon:x,boxParams:P,newPointCloudBoxList:s});return}}if((p||Q)&&u.length===1){const P=p!=null?p:Q;f.setSelectedID(u[0]);const x=f.selectedPoint;P&&X(y.Top,x,P,void 0,r,S)}}},ut=(n,s,p)=>{if(ct){let r,l;switch(p){case y.Back:r=po;break;case y.Side:r=yt;break;default:r=yt;break}if(l=r(n,s,ct,i.pointCloudInstance),o){const{count:D}=o.getSensesPointZAxisInPolygon(Mt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(L({},l),{count:D})}const P=H(st({tool:nt.PointCloud,dataList:[l],stepConfig:S,action:"viewUpdateBox"}))[0],x=l.valid!==P.valid;l=P;const C=Dt(l);return l=C.find(D=>D.id===l.id),M({omitView:x?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:C}),C}},pt=(n,s,p)=>{if(Q){let r,l;switch(p){case y.Back:r=uo;break;case y.Side:r=Lt;break;default:r=Lt;break}l=r(n,s,Q);const f=v(l);return X(p,n,l,void 0,f,S),f}},zt=(n,s)=>{pt(n,s,y.Side)},Tt=(n,s)=>{pt(n,s,y.Back)},jt=(n,s)=>{ut(n,s,y.Side)},Nt=(n,s)=>{ut(n,s,y.Back)},Et=(n,s)=>{const p=F(n.id),r=lt(n,s,ot,p),l=v(r);X(y.Top,n,r,void 0,l,S)},Ft=(n,s)=>{if(N){const r=L({},n[0].newPolygon);r.pointList=r.pointList.map(l=>V.transferCanvas2World(l,s)),j(r);return}let p=n.map(({newPolygon:r})=>{const l=_t(r.id),{boxParams:f}=dt(r,s,t.pointCloudInstance,l);return f});if(p=H(st({tool:nt.PointCloud,dataList:p,stepConfig:S,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=tt(p);M({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=tt(p);r&&e.syncAllViewPointCloudColor(r)}},Ht=n=>{var s,p,r,l,f;if(_){const P=Number(n.widthDefault),x=Number(n.depthDefault),C=Number(n.heightDefault),D=_==null?void 0:_.info.trackID,b=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(Y=>(Y==null?void 0:Y.trackID)===D),A={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(f=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:f.height},U=b.pointList.map(Y=>V.transferCanvas2World(Y,A)),k=B.getModifiedRectangleCoordinates(U,C,P),G=k[0],et=k[2],gt=B.getLineCenterPoint([G,et]),Wt=_.info.center.z-_.info.depth/2,ft=O(L({},_.info),{center:{x:gt.x,y:gt.y,z:Wt+x/2},width:P,height:C,depth:x,valid:!0}),Zt=tt([ft]);M({omitView:y["3D"],polygon:b,boxParams:ft,newPointCloudBoxList:Zt})}},X=(n,s,p,r,l,f)=>rt(void 0,null,function*(){const P=Z==null?void 0:Z.url,x={[y.Side]:()=>{vt(p,s,i,P,f)},[y.Back]:()=>{d&&bt(p,s,d,P,f)},[y.Top]:()=>{It(p,s,t,o)}};Object.keys(x).forEach(C=>{C!==n&&x[C]()}),r&&(o==null||o.updateCameraZoom(r)),Ot(p)}),M=n=>rt(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:f}=n,P=Z==null?void 0:Z.url;f&&(yield e.syncAllViewPointCloudColor(f));const x={[y.Side]:()=>{Bt(r,p,i,P)},[y.Back]:()=>{d&&wt(r,p,d,P)},[y.Top]:()=>{at(r,p,t,o)}};Object.keys(x).forEach(C=>{C!==s&&x[C]()}),l&&(o==null||o.updateCameraZoom(l)),Vt(r)});return{topViewAddSphere:kt,topViewAddBox:Rt,topViewSelectedChanged:Ut,topViewUpdatePoint:Et,sideViewUpdatePoint:zt,backViewUpdatePoint:Tt,topViewUpdateBox:Ft,sideViewUpdateBox:jt,backViewUpdateBox:Nt,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=V.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>rt(void 0,[...n],function*(s=Z){var p,r,l,f,P,x;if(!(s==null?void 0:s.url)||!o)return;W([]),Ct(H,!0),Pt(H,!0),yield o.loadPCDFile(s.url,(p=S==null?void 0:S.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let C=[],D=[],w=[],b=[];o.updateTopCamera();const A=(l=(r=it(s.result))==null?void 0:r.valid)!=null?l:!0;if(e.setPointCloudValid(A),(f=e.sideViewInstance)==null||f.clearAllData(),(P=e.backViewInstance)==null||P.clearAllData(),s.result){if(C=V.getBoxParamsFromResultList(s.result),(C==null?void 0:C.length)>0&&s.isPreResult&&(S==null?void 0:S.lowerLimitPointsNumInBox)>0){C=yield o==null?void 0:o.filterPreResult(s.url,S,C);const U=it(s.result);U[Gt].result=C,s.result=JSON.stringify(U),e.setPointCloudResult(C)}w=V.getPolygonListFromResultList(s.result),D=V.getLineListFromResultList(s.result),b=V.getSphereParamsFromResultList(s.result),t.updateData(s.url,s.result,{radius:(x=S==null?void 0:S.radius)!=null?x:K}),o==null||o.generateBoxes(C),o==null||o.generateSpheres(b),yield e.syncAllViewPointCloudColor(C,[])}E({pointCloudBoxList:C,polygonList:w,lineList:D,pointCloudSphereList:b}),Ct(H,!1),Pt(H,!1)}),updateViewsByDefaultSize:Ht,generateRects:$,update2DViewRect:At}};export{bt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,wt as synchronizeBackView,Bt as synchronizeSideView,at as synchronizeTopView,lt as topViewPoint2PointCloud,dt as topViewPolygon2PointCloud,go as usePointCloudViews};
1
+ import{EPointCloudName as st,TagUtils as oo,MathUtils as w,getCuboidFromPointCloudBox as eo}from"@labelbee/lb-annotation";import{EPerspectiveView as X,PointCloudUtils as O,POINT_CLOUD_DEFAULT_STEP as no,DEFAULT_SPHERE_PARAMS as io}from"@labelbee/lb-utils";import{useContext as mt,useCallback as xt}from"react";import{PointCloudContext as ht}from"../PointCloudContext.js";import{useSingleBox as so}from"./useSingleBox.js";import{useSphere as ro}from"./useSphere.js";import{pick as lo}from"lodash";import{useSelector as ao,useDispatch as co}from"../../../store/ctx.js";import uo from"../../../utils/StepUtils.js";import{EPointCloudBoxRenderTrigger as rt}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{jsonParser as lt,generatePointCloudBoxRects as po}from"../../../utils/index.js";import{PreDataProcess as dt,SetAnnotationLoading as Lt,SetLoadPCDFileLoading as vt}from"../../../store/annotation/actionCreators.js";import{useHistory as go}from"./useHistory.js";import{usePolygon as fo}from"./usePolygon.js";import{useLatest as $}from"ahooks";var Co=Object.defineProperty,Po=Object.defineProperties,mo=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,xo=Object.prototype.hasOwnProperty,ho=Object.prototype.propertyIsEnumerable,Bt=(e,n,t)=>n in e?Co(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,L=(e,n)=>{for(var t in n||(n={}))xo.call(n,t)&&Bt(e,t,n[t]);if(yt)for(var t of yt(n))ho.call(n,t)&&Bt(e,t,n[t]);return e},A=(e,n)=>Po(e,mo(n)),bt=(e,n,t)=>new Promise((c,p)=>{var o=d=>{try{u(t.next(d))}catch(x){p(x)}},f=d=>{try{u(t.throw(d))}catch(x){p(x)}},u=d=>d.done?c(d.value):Promise.resolve(d.value).then(o,f);u((t=t.apply(e,n)).next())});const tt=5,ot=90,wt=.01,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},at=(e,n,t,c,p)=>{const{x:o,y:f}=O.transferCanvas2World(e,n),{defaultZ:u}=io,d={center:{x:o,y:f,z:u},id:e.id},x=c?L(L({},c),d):A(L({},d),{attribute:"",valid:!0});return p&&Object.assign(x,p),x},ct=(e,n,t,c,p,o)=>{let f=e.pointList.map(I=>O.transferCanvas2World(I,n)),u=0,d=1,x={};if(t){const I=t.getSensesPointZAxisInPolygon(f,void 0,o);o&&I.fittedCoordinates.length>0&&(f=I.fittedCoordinates),u=(I.maxZ+I.minZ)/2,d=I.maxZ-I.minZ,x={count:I.zCount}}const[P,v,T]=f,V=w.getLineCenterPoint([P,T]),D=w.getLineLength(P,v),U=w.getLineLength(v,T),N=w.getRadiusFromQuadrangle(e.pointList);c&&(u=c.center.z,d=c.depth);const z={center:{x:V.x,y:V.y,z:u},width:o?U+wt:U,height:o?D+wt:D,depth:d,rotation:N,id:e.id},j=L(c?L(L({},c),z):A(L({},z),{attribute:"",valid:!0}),x);p&&Object.assign(j,p);const M=f.map(I=>O.transferWorld2Canvas(I,n));return{boxParams:j,newPointList:M}},It=(e,n,t)=>{const c={x:e.x-n.x,y:e.y-n.y};return A(L({},t),{center:{x:t.center.x-c.x,y:t.center.y,z:t.center.z-c.y}})},Dt=(e,n,t,c)=>{const[p,o,f]=e.pointList,[u,d,x]=n.pointList,P=w.getLineCenterPoint([p,f]),v=w.getLineCenterPoint([u,x]),V={x:{x:P.x-v.x,y:P.y-v.y}.x,y:0,z:P.y-v.y},D=w.getLineLength(p,o),U=w.getLineLength(u,d),N=D-U,z=w.getLineLength(o,f),j=w.getLineLength(d,x),M=z-j,{newBoxParams:I}=c.getNewBoxBySideUpdate(V,M,N,t);return I},Lo=(e,n,t)=>{const c={x:e.x-n.x,y:e.y-n.y};return A(L({},t),{center:{x:t.center.x,y:t.center.y-c.x,z:t.center.z-c.y}})},vo=(e,n,t,c)=>{const[p,o,f]=e.pointList,[u,d,x]=n.pointList,P=w.getLineCenterPoint([p,f]),v=w.getLineCenterPoint([u,x]),V={x:{x:P.x-v.x,y:P.y-v.y}.x,y:0,z:P.y-v.y},D=w.getLineLength(p,o),U=w.getLineLength(u,d),N=D-U,z=w.getLineLength(o,f),j=w.getLineLength(d,x),M=z-j;let{newBoxParams:I}=c.getNewBoxByBackUpdate(V,M,N,t);return I},St=(e,n,t,c,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(c,(o=p==null?void 0:p.radius)!=null?o:ot);const{cameraPositionVector:d}=u.updateOrthoCameraBySphere(e,X.Left);u.setInitCameraPosition(d);const{point2d:x,zoom:P}=u.getSphereSidePoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(L(L({},n),x),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Rt=(e,n,t,c)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(c,e,{width:tt,depth:tt});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Left);o.setInitCameraPosition(f);const{polygon2d:u,zoom:d}=o.getBoxSidePolygon2DCoordinate(e);o.camera.zoom=d,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},_t=(e,n,t,c,p)=>{var o;if(!t)return;const{toolInstance:f,pointCloudInstance:u}=t;u.loadPCDFile(c,(o=p==null?void 0:p.radius)!=null?o:ot);const{cameraPositionVector:d}=u.updateOrthoCameraBySphere(e,X.Back);u.setInitCameraPosition(d);const{point2d:x,zoom:P}=u.getSphereBackPoint2DCoordinate(e);u.camera.zoom=P,u.camera.updateProjectionMatrix(),u.render(),f.initPosition(),f.zoomChangeOnCenter(P),f.setResult([A(L(L({},n),x),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),f.setSelectedID(n.id)},Vt=(e,n,t,c)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:o}=t;o.loadPCDFileByBox(c,e,{height:tt,depth:tt});const{cameraPositionVector:f}=o.updateOrthoCamera(e,X.Back);o.setInitCameraPosition(f);const{polygon2d:u,zoom:d}=o.getBoxBackPolygon2DCoordinate(e);o.camera.zoom=d,o.camera.updateProjectionMatrix(),o.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:e.valid,pointList:u,textAttribute:"",isRect:!0,attribute:e.attribute}],n.id)},kt=(e,n,t,c)=>{if(!t||!c)return;c.generateSphere(e),c.updateCameraBySphere(e,X.Top),c.render();const{toolInstance:p,pointCloudInstance:o}=t,{point2d:f}=o.getSphereTopPoint2DCoordinate(e),u=[...p.pointList].map(d=>d.id===n.id?A(L(L({},n),f),{valid:e.valid,textAttribute:"",attribute:e.attribute}):d);p.setResult(u),p.setSelectedID(n.id)},ut=(e,n,t,c)=>{var p,o;if(!t||!c)return;c.generateBox(e,n.id),c.render();const{pointCloud2dOperation:f,pointCloudInstance:u}=t,{polygon2d:d}=u.getBoxTopPolygon2DCoordinate(e),x=[...f.polygonList],P=x.find(v=>v.id===n.id);P?(P.pointList=d,P.valid=(p=e.valid)!=null?p:!0):x.push({id:n.id,pointList:d,textAttribute:"",isRect:!0,valid:(o=e.valid)!=null?o:!0}),f.setResultAndSelectedID(x,n.id)},yo=e=>{const n=mt(ht),{topViewInstance:t,sideViewInstance:c,backViewInstance:p,mainViewInstance:o,addPointCloudBox:f,addPointCloudSphere:u,setSelectedIDs:d,selectedIDs:x,pointCloudBoxList:P,pointCloudSphereList:v,hideAttributes:T,setHighlight2DDataList:V,cuboidBoxIn2DView:D,imageSizes:U,history:N,linkageImageNameRectMap:z}=n,{addHistory:j,initHistory:M,pushHistoryUnderUpdatePolygon:I}=go(),{selectedPolygon:Ot}=fo(),{getPointCloudSphereByID:At,updatePointCloudSphere:pt,selectedSphere:Y}=ro(),{currentData:H,config:B}=ao(s=>{const{stepList:i,step:a,imgList:r,imgIndex:l}=s.annotation;return{currentData:r[l],config:lt(uo.getCurrentStepInfo(a,i).config)}}),F=co(),Tt=$(D),Ut=$(z),zt=xt((s,i)=>{const a=Ut.current,r=i.id;return s.filter(g=>{if(!g)return!1;const C=a.get(g.imageName);return C===void 0?!0:Boolean(C.get(r))})},[]),et=s=>{const{enableAutoMap2DRect:i=!1}=B;if(!Tt.current||i){const{mappingImgList:a=[]}=H;po({pointCloudBox:s,mappingImgList:a,imageSizes:U},{prepareRectsFn:zt})}},{selectedBox:k,updateSelectedBox:Nt,updateSelectedBoxes:nt,getPointCloudByID:jt}=so({generateRects:et}),gt=k==null?void 0:k.info;if(!t||!c||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:it}=t,Et=s=>{o==null||o.generateSphere(s),o==null||o.controls.update(),o==null||o.render()},Mt=({newPoint:s,size:i,zoom:a,trackConfigurable:r})=>{var l;const g={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(g,{trackID:O.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const C=at(s,i,it,void 0,g);d(s.id);const m=u(C);G(y.Top,s,C,a,m,B),j({newSphereParams:C})},Ft=({polygon:s,size:i,imgList:a,trackConfigurable:r,zoom:l,intelligentFit:g})=>{var C,m,b;const S={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(S,{trackID:O.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:v})});const _=t==null?void 0:t.toolInstance,R=L({},s);let{boxParams:h,newPointList:E}=ct(R,i,it,void 0,S,g);h=F(dt({tool:st.PointCloud,dataList:[h],stepConfig:B,action:"viewUpdateBox"}))[0],g&&(E==null?void 0:E.length)&&(R.pointList=E);const Z=T.includes(R.attribute);et(h);const Q=f(h),q=(m=n==null?void 0:n.polygonList)!=null?m:[];h.subAttribute=oo.getDefaultResultByConfig((B==null?void 0:B.secondaryAttributeConfigurable)?(b=B==null?void 0:B.inputList)!=null?b:[]:[]),t==null||t.updatePolygonList(Q!=null?Q:[],q),Z?d([]):(d(h.id),_.selection.setSelectedIDs(R.id),W({omitView:y.Top,polygon:R,boxParams:h,zoom:l,newPointCloudBoxList:Q}),g&&ut(h,R,t,o)),j({newBoxParams:h})},Ht=s=>{const{boxID:i,imageName:a,width:r,height:l,x:g,y:C}=s,m=P.find(h=>h.id===i);if(!(m==null?void 0:m.rects)||!m.rects.find(h=>h.imageName===a))return;const S=m.rects.map(h=>h.imageName===a?A(L({},h),{width:r,height:l,x:g,y:C}):h),_=A(L({},m),{rects:S}),R=P.map(h=>h.id===i?_:h);return t==null||t.updatePolygonList(R!=null?R:[]),R},Wt=s=>{const{boxID:i,imageName:a}=s,r=P.find(m=>m.id===i);if(!(r==null?void 0:r.rects))return;const l=r.rects.filter(m=>m.imageName!==a),g=A(L({},r),{rects:l}),C=P.map(m=>m.id===i?g:m);return t==null||t.updatePolygonList(C!=null?C:[]),C},Zt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:a,newSphereList:r})=>{var l;const g=t==null?void 0:t.toolInstance;if(!(x.length===0||!g)){if(s||(k==null?void 0:k.info)){const C=s!=null?s:k==null?void 0:k.info;(l=g==null?void 0:g.selection)==null||l.setSelectedIDs(x[0]);const m=g.selectedPolygon;if(x.length===1&&C){W({omitView:y.Top,polygon:m,boxParams:C,newPointCloudBoxList:i});return}}if((a||Y)&&x.length===1){const C=a!=null?a:Y;g.setSelectedID(x[0]);const m=g.selectedPoint;C&&G(y.Top,m,C,void 0,r,B)}}},ft=(s,i,a)=>{if(gt){let r,l;switch(a){case y.Back:r=vo;break;case y.Side:r=Dt;break;default:r=Dt;break}if(l=r(s,i,gt,c.pointCloudInstance),o){const{count:S}=o.getSensesPointZAxisInPolygon(eo(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=A(L({},l),{count:S})}const C=F(dt({tool:st.PointCloud,dataList:[l],stepConfig:B,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;l=C;const b=Nt(l);return l=b.find(S=>S.id===l.id),W({omitView:m?void 0:a,polygon:s,boxParams:l,newPointCloudBoxList:b}),b}},Ct=(s,i,a)=>{if(Y){let r,l;switch(a){case y.Back:r=Lo;break;case y.Side:r=It;break;default:r=It;break}l=r(s,i,Y);const g=pt(l);return G(a,s,l,void 0,g,B),g}},Gt=(s,i)=>{Ct(s,i,y.Side)},Jt=(s,i)=>{Ct(s,i,y.Back)},Qt=(s,i)=>{ft(s,i,y.Side)},Xt=(s,i)=>{ft(s,i,y.Back)},Yt=(s,i)=>{const a=At(s.id),r=at(s,i,it,a),l=pt(r);G(y.Top,s,r,void 0,l,B)},qt=(s,i)=>{if(Ot){const r=L({},s[0].newPolygon);r.pointList=r.pointList.map(l=>O.transferCanvas2World(l,i)),I(r);return}let a=s.map(({newPolygon:r})=>{const l=jt(r.id),{boxParams:g}=ct(r,i,t.pointCloudInstance,l);return g});if(a=F(dt({tool:st.PointCloud,dataList:a,stepConfig:B,action:"viewUpdateBox"})),a.length===1){const{newPolygon:r}=s[0],l=nt(a);W({polygon:r,boxParams:a[0],newPointCloudBoxList:l})}else{const r=nt(a);r&&n.syncAllViewPointCloudColor(rt.MultiMove,r)}},Kt=s=>{var i,a,r,l,g;if(k){const C=Number(s.widthDefault),m=Number(s.depthDefault),b=Number(s.heightDefault),S=k==null?void 0:k.info.trackID,R=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(K=>(K==null?void 0:K.trackID)===S),h={width:(r=(a=t==null?void 0:t.toolInstance)==null?void 0:a.basicImgInfo)==null?void 0:r.width,height:(g=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:g.height},E=R.pointList.map(K=>O.transferCanvas2World(K,h)),J=w.getModifiedRectangleCoordinates(E,b,C),Z=J[0],Q=J[2],q=w.getLineCenterPoint([Z,Q]),$t=k.info.center.z-k.info.depth/2,Pt=A(L({},k.info),{center:{x:q.x,y:q.y,z:$t+m/2},width:C,height:b,depth:m,valid:!0}),to=nt([Pt]);W({omitView:y["3D"],polygon:R,boxParams:Pt,newPointCloudBoxList:to})}},G=(s,i,a,r,l,g)=>bt(void 0,null,function*(){const C=H==null?void 0:H.url,m={[y.Side]:()=>{St(a,i,c,C,g)},[y.Back]:()=>{p&&_t(a,i,p,C,g)},[y.Top]:()=>{kt(a,i,t,o)}};Object.keys(m).forEach(b=>{b!==s&&m[b]()}),r&&(o==null||o.updateCameraZoom(r)),Et(a)}),W=(s,i=rt.Default)=>{const{omitView:a,polygon:r,boxParams:l,zoom:g,newPointCloudBoxList:C}=s,m=H==null?void 0:H.url;C&&n.syncAllViewPointCloudColor(i,C);const b={[y.Side]:()=>{Rt(l,r,c,m)},[y.Back]:()=>{p&&Vt(l,r,p,m)},[y.Top]:()=>{ut(l,r,t,o)}};Object.keys(b).forEach(S=>{S!==a&&b[S]()}),g&&(o==null||o.updateCameraZoom(g))};return{topViewAddSphere:Mt,topViewAddBox:Ft,topViewSelectedChanged:Zt,topViewUpdatePoint:Yt,sideViewUpdatePoint:Gt,backViewUpdatePoint:Jt,topViewUpdateBox:qt,sideViewUpdateBox:Qt,backViewUpdateBox:Xt,syncPointCloudViews:W,syncPointCloudPoint:G,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),o==null||o.generateBoxes(s)},initPointCloud3d:s=>{if(!o)return;const i=O.getDefaultOrthographicParams(s);o.initOrthographicCamera(i),o.initRenderer(),o.render()},updatePointCloudData:(...s)=>bt(void 0,[...s],function*(i=H){var a,r,l,g,C,m,b,S;if(!(i==null?void 0:i.url)||!o)return;V([]),Lt(F,!0),vt(F,!0),(a=e==null?void 0:e.setResourceLoading)==null||a.call(e,!0),yield o.loadPCDFile(i.url,(r=B==null?void 0:B.radius)!=null?r:ot),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let _=[],R=[],h=[],E=[];o.updateTopCamera();const J=(g=(l=lt(i.result))==null?void 0:l.valid)!=null?g:!0;if(n.setPointCloudValid(J),(C=n.sideViewInstance)==null||C.clearAllData(),(m=n.backViewInstance)==null||m.clearAllData(),i.result){if(_=O.getBoxParamsFromResultList(i.result),(_==null?void 0:_.length)>0&&i.isPreResult&&(B==null?void 0:B.lowerLimitPointsNumInBox)>0){_=yield o==null?void 0:o.filterPreResult(i.url,B,_);const Z=lt(i.result);Z[no].result=_,i.result=JSON.stringify(Z),n.setPointCloudResult(_)}h=O.getPolygonListFromResultList(i.result),R=O.getLineListFromResultList(i.result),E=O.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(b=B==null?void 0:B.radius)!=null?b:ot}),o==null||o.generateBoxes(_),o==null||o.generateSpheres(E),yield n.syncAllViewPointCloudColor(rt.Default,_,[])}M({pointCloudBoxList:_,polygonList:h,lineList:R,pointCloudSphereList:E}),Lt(F,!1),vt(F,!1),(S=e==null?void 0:e.setResourceLoading)==null||S.call(e,!1)}),updateViewsByDefaultSize:Kt,generateRects:et,update2DViewRect:Ht,remove2DViewRect:Wt}},Bo=()=>{const{pointCloudBoxList:e,rectList:n,setPointCloudResult:t}=mt(ht),c=$(e),p=$(n);return{syncToPointCloudBoxList:xt(()=>{const f=c.current,u=p.current;if(u.length===0)return null;const d=new Map,x=new Set;if(u.filter(P=>P.extId!==void 0).forEach(P=>{const v=P.extId,T=P.imageName,V=lo(P,["x","y","width","height"]);let D=d.get(v);D||(D=new Map,d.set(v,D)),D.set(T,V),x.add(v)}),d.size){const P=f.map(v=>{var T;const V=v.id;if(x.has(V)){const D=L({},v);return(T=D.rects)==null||T.forEach(U=>{var N;const z=U.imageName;Object.assign(U,(N=d.get(V))==null?void 0:N.get(z))}),D}return v});return t(P),P}return null},[])}};export{_t as syncBackViewByPoint,St as syncSideViewByPoint,kt as syncTopViewByPoint,Vt as synchronizeBackView,Rt as synchronizeSideView,ut as synchronizeTopView,at as topViewPoint2PointCloud,ct as topViewPolygon2PointCloud,yo as usePointCloudViews,Bo as useSyncRectPositionDimensionToPointCloudList};
@@ -1 +1 @@
1
- import{useContext as c}from"react";import{PointCloudContext as P}from"../PointCloudContext.js";import{useHistory as u}from"./useHistory.js";var f=Object.defineProperty,g=Object.defineProperties,_=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,a=(e,o,t)=>o in e?f(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,p=(e,o)=>{for(var t in o||(o={}))m.call(o,t)&&a(e,t,o[t]);if(l)for(var t of l(o))O.call(o,t)&&a(e,t,o[t]);return e},w=(e,o)=>g(e,_(o));const v=()=>{const{polygonList:e,setPolygonList:o,selectedID:t}=c(P),{addHistory:d,pushHistoryWithList:y}=u(),i=e.find(r=>r.id===t);return{addPolygon:r=>{o(e.concat(r)),d({newPolygon:r})},deletePolygon:r=>{const s=e.filter(n=>n.id!==r).map(n=>p({},n));o(s),y({polygonList:s})},selectedPolygon:i,updateSelectedPolygon:r=>{i&&o(e.map(s=>s.id===t?r:s))},updatePolygonValidByID:r=>{e.find(n=>n.id===r)&&o(e.map(n=>n.id===r?w(p({},n),{valid:!n.valid}):n))}}};export{v as usePolygon};
1
+ import{useContext as f}from"react";import{PointCloudContext as g}from"../PointCloudContext.js";import{useHistory as _}from"./useHistory.js";var m=Object.defineProperty,O=Object.defineProperties,w=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,y=(o,t,e)=>t in o?m(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,p=(o,t)=>{for(var e in t||(t={}))x.call(t,e)&&y(o,e,t[e]);if(c)for(var e of c(t))C.call(t,e)&&y(o,e,t[e]);return o},L=(o,t)=>O(o,w(t));const h=()=>{const{polygonList:o,pointCloudBoxList:t,setPolygonList:e,selectedID:a}=f(g),{addHistory:u,pushHistoryWithList:P}=_(),d=o.find(r=>r.id===a);return{addPolygon:r=>{e(o.concat(r)),u({newPolygon:r})},deletePolygon:r=>{const i=o.filter(s=>s.id!==r).map(s=>p({},s));e(i);const n={polygonList:i};try{const s=t.filter(l=>l.id!==r).map(l=>p({},l));s.length<t.length&&(n.pointCloudBoxList=s)}catch(s){console.error("exec update history pointCloudBoxList error:",s)}P(n)},selectedPolygon:d,updateSelectedPolygon:r=>{d&&e(o.map(i=>i.id===a?r:i))},updatePolygonValidByID:r=>{o.find(n=>n.id===r)&&e(o.map(n=>n.id===r?L(p({},n),{valid:!n.valid}):n))}}};export{h as usePolygon};
@@ -1 +1 @@
1
- import{useContext as p}from"react";import{synchronizeSideView as C,synchronizeBackView as P}from"./usePointCloudViews.js";import{useSingleBox as w}from"./useSingleBox.js";import{PointCloudContext as x}from"../PointCloudContext.js";import{cAnnotation as f}from"@labelbee/lb-annotation";import{PointCloudUtils as b}from"@labelbee/lb-utils";import{useThrottleFn as V}from"ahooks";const{ERotateDirection:g}=f,y=({currentData:t})=>{const e=p(x),{selectedBox:i,updateSelectedBox:u}=w(),{run:a}=V(l=>{const{topViewInstance:s,mainViewInstance:n,syncAllViewPointCloudColor:d}=e;if(!s||!n)return;const{pointCloud2dOperation:r}=s,o=i==null?void 0:i.info;if(!o||!(t==null?void 0:t.url)||!e.backViewInstance)return;const m=u({rotation:b.restrictAngleRange(o.rotation+Number(Math.PI*l)/180)});r.rotatePolygon(l,g.Anticlockwise);const c=r.selectedPolygon;n.generateBox(o),d(m),C(o,c,e.sideViewInstance,t.url),P(o,c,e.backViewInstance,t.url),n.render()},{wait:800});return{updateRotate:a}};export{y as useRotate};
1
+ import{useContext as p}from"react";import{synchronizeSideView as C,synchronizeBackView as P}from"./usePointCloudViews.js";import{useSingleBox as x}from"./useSingleBox.js";import{PointCloudContext as w}from"../PointCloudContext.js";import{cAnnotation as f}from"@labelbee/lb-annotation";import{PointCloudUtils as g}from"@labelbee/lb-utils";import{EPointCloudBoxRenderTrigger as b}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import{useThrottleFn as B}from"ahooks";const{ERotateDirection:V}=f,y=({currentData:t})=>{const e=p(w),{selectedBox:i,updateSelectedBox:u}=x(),{run:d}=B(l=>{const{topViewInstance:r,mainViewInstance:n,syncAllViewPointCloudColor:a}=e;if(!r||!n)return;const{pointCloud2dOperation:s}=r,o=i==null?void 0:i.info;if(!o||!(t==null?void 0:t.url)||!e.backViewInstance)return;const m=u({rotation:g.restrictAngleRange(o.rotation+Number(Math.PI*l)/180)});s.rotatePolygon(l,V.Anticlockwise);const c=s.selectedPolygon;n.generateBox(o),a(b.SingleRotate,m),C(o,c,e.sideViewInstance,t.url),P(o,c,e.backViewInstance,t.url),n.render()},{wait:800});return{updateRotate:d}};export{y as useRotate};
@@ -0,0 +1 @@
1
+ import{useContext as g}from"react";import{synchronizeSideView as m,synchronizeBackView as P}from"./usePointCloudViews.js";import{useSingleBox as h}from"./useSingleBox.js";import{PointCloudContext as w}from"../PointCloudContext.js";import{useThrottleFn as x}from"ahooks";import{PointCloudUtils as C}from"@labelbee/lb-utils";const f=({currentData:t})=>{const e=g(w),{selectedBox:l,updateSelectedBox:c}=h(),{run:u}=x(a=>{const{topViewInstance:r,mainViewInstance:i}=e;if(!r||!i)return;const{pointCloud2dOperation:s}=r,o=l==null?void 0:l.info;if(!o||!(t==null?void 0:t.url)||!e.backViewInstance)return;const n=s.selectedPolygon.pointList||[],p=n.shift();n.push(p),c({newPointList:n,rotation:C.restrictAngleRange(o.rotation+Number(Math.PI*a)/180),width:o.height,height:o.width}),s.rotatePolygonEdge(n);const d=s.selectedPolygon;i.generateBox(o),m(o,d,e.sideViewInstance,t.url),P(o,d,e.backViewInstance,t.url),i.render()},{wait:800});return{updateRotateEdge:u}};export{f as useRotateEdge};
@@ -1 +1 @@
1
- import{useContext as G,useMemo as h,useCallback as u}from"react";import f from"lodash";import{PointCloudContext as J}from"../PointCloudContext.js";import{EToolName as D,cAnnotation as Q}from"@labelbee/lb-annotation";import{useHistory as U}from"./useHistory.js";import{usePolygon as X}from"./usePolygon.js";var Y=Object.defineProperty,Z=Object.defineProperties,$=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable,S=(i,e,l)=>e in i?Y(i,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[e]=l,ne=(i,e)=>{for(var l in e||(e={}))ee.call(e,l)&&S(i,l,e[l]);if(L)for(var l of L(e))oe.call(e,l)&&S(i,l,e[l]);return i},te=(i,e)=>Z(i,$(e));const{ESortDirection:y}=Q,ie=i=>{const{pointCloudBoxList:e,setPointCloudResult:l,topViewInstance:d,backViewInstance:g,sideViewInstance:C,selectedIDs:P,selectedID:m,mainViewInstance:c,setSelectedIDs:j,syncAllViewPointCloudColor:I,polygonList:R,pointCloudPattern:B}=G(J),{selectedPolygon:a,updateSelectedPolygon:A,updatePolygonValidByID:E,deletePolygon:N}=X(),{pushHistoryWithList:_}=U(),r=h(()=>{const o=e.findIndex(t=>t.id===m);if(o>-1)return{info:e[o],index:o}},[m,e]),O=u(o=>{var t;if(r==null?void 0:r.info){(t=i==null?void 0:i.generateRects)==null||t.call(i,o),e.splice(r.index,1,f.merge(r.info,o));const n=f.cloneDeep(e);return l(n),_({pointCloudBoxList:n}),n}return e},[m,e]),H=u((o,t)=>{const n=e.findIndex(s=>s.id===t);if(n>-1){e.splice(n,1,f.merge(e[n],o));const s=f.cloneDeep(e);return l(s),s}return e},[e]),v=u(o=>{d==null||d.pointCloud2dOperation.setPolygonValidAndRender(o,!0),C==null||C.pointCloud2dOperation.setPolygonValidAndRender(o,!0),g==null||g.pointCloud2dOperation.setPolygonValidAndRender(o,!0)},[d,C,g]),T=u(()=>{if(r==null?void 0:r.info){const{id:o,valid:t=!0}=r.info,n=O({valid:!t});I(n),v(o)}a&&(A(te(ne({},a),{valid:!a.valid})),d==null||d.pointCloud2dOperation.setPolygonValidAndRender(a.id,!0))},[v,r,a]),k=u(o=>{const t=e.find(n=>n.id===o);if(t){const{id:n,valid:s=!0}=t,x=H({valid:!s},n);return v(n),x}E(o)},[v,e,R]),b=u((o=y.ascend,t=!1)=>{if(!d||P.length>1)return;if(B!==D.Rect&&B!==D.Polygon){t&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:o!==y.ascend}));return}const{pointCloud2dOperation:n}=d,s=n.switchToNextPolygon(o);s&&j(s)},[d,B,d==null?void 0:d.toolInstance]),K=(o=!1)=>{b(y.descend,o)},M=(o=!1)=>{b(y.ascend,o)},V=o=>{const t=e.filter(n=>n.id!==o);l(t),c==null||c.removeObjectByName(o,"box"),c==null||c.render(),I(t)},W=()=>{r&&(V(r.info.id),d==null||d.pointCloud2dOperation.deletePolygon(r.info.id)),a&&(N(a.id),d==null||d.pointCloud2dOperation.deletePolygon(a.id))},q=h(()=>e.filter(o=>P.includes(o.id)),[P,e]),z=u(o=>{var t;const n=f.cloneDeep(e);let s=!1;for(const x of o){const w=n.findIndex(p=>p.id===x.id);if(w>-1){const p=f.merge(n[w],x);(t=i==null?void 0:i.generateRects)==null||t.call(i,p),n.splice(w,1,p),c==null||c.generateBox(p),s=!0}}if(s)return l(n),_({pointCloudBoxList:n}),c==null||c.render(),n},[P,e]),F=u(o=>e.find(t=>t.id===o),[e]);return{selectedBox:r,updateSelectedBox:O,changeSelectedBoxValid:T,changeValidByID:k,selectNextBox:M,selectPrevBox:K,deletePointCloudBox:V,selectedBoxes:q,updateSelectedBoxes:z,getPointCloudByID:F,deleteSelectedPointCloudBoxAndPolygon:W}};export{ie as useSingleBox};
1
+ import{useContext as de,useMemo as A,useCallback as f}from"react";import m from"lodash";import{PointCloudContext as le}from"../PointCloudContext.js";import{EToolName as T,cAnnotation as re}from"@labelbee/lb-annotation";import{useHistory as se}from"./useHistory.js";import{usePolygon as ae}from"./usePolygon.js";import{EPointCloudBoxRenderTrigger as H}from"../../../utils/ToolPointCloudBoxRenderHelper.js";var ce=Object.defineProperty,ue=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,k=(d,t,l)=>t in d?ce(d,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):d[t]=l,xe=(d,t)=>{for(var l in t||(t={}))pe.call(t,l)&&k(d,l,t[l]);if(M)for(var l of M(t))ge.call(t,l)&&k(d,l,t[l]);return d},Pe=(d,t)=>ue(d,fe(t));const{ESortDirection:B}=re,ve=d=>{const{pointCloudBoxList:t,setPointCloudResult:l,topViewInstance:s,backViewInstance:_,sideViewInstance:h,selectedIDs:y,selectedID:O,mainViewInstance:p,setSelectedIDs:K,syncAllViewPointCloudColor:V,polygonList:U,pointCloudPattern:R,rectList:S,updateRectIn2DView:me,removeRectIn2DView:F,addRectIn2DView:W,updateRectListByReducer:D}=de(le),{selectedPolygon:g,updateSelectedPolygon:q,updatePolygonValidByID:z,deletePolygon:G}=ae(),{pushHistoryWithList:b}=se(),a=A(()=>{const e=t.findIndex(n=>n.id===O);if(e>-1)return{info:t[e],index:e}},[O,t]),L=f(e=>{var n;if(a==null?void 0:a.info){(n=d==null?void 0:d.generateRects)==null||n.call(d,e),t.splice(a.index,1,m.merge(a.info,e));const o=m.cloneDeep(t);return l(o),b({pointCloudBoxList:o}),o}return t},[O,t]),J=f((e,n)=>{const o=t.findIndex(i=>i.id===n);if(o>-1){t.splice(o,1,m.merge(t[o],e));const i=m.cloneDeep(t);return l(i),i}return t},[t]),w=f(e=>{s==null||s.pointCloud2dOperation.setPolygonValidAndRender(e,!0),h==null||h.pointCloud2dOperation.setPolygonValidAndRender(e,!0),_==null||_.pointCloud2dOperation.setPolygonValidAndRender(e,!0)},[s,h,_]),Q=f(()=>{if(a==null?void 0:a.info){const{id:e,valid:n=!0}=a.info,o=L({valid:!n});V(H.SingleToggleValid,o),w(e)}g&&(q(Pe(xe({},g),{valid:!g.valid})),s==null||s.pointCloud2dOperation.setPolygonValidAndRender(g.id,!0))},[w,a,g]),X=f(e=>{const n=t.find(o=>o.id===e);if(n){const{id:o,valid:i=!0}=n,c=J({valid:!i},o);return w(o),c}z(e)},[w,t,U]),E=f((e=B.ascend,n=!1)=>{if(!s||y.length>1)return;if(R!==T.Rect&&R!==T.Polygon){n&&document.dispatchEvent(new KeyboardEvent("keydown",{keyCode:9,shiftKey:e!==B.ascend}));return}const{pointCloud2dOperation:o}=s,i=o.switchToNextPolygon(e);i&&K(i)},[s,R,s==null?void 0:s.toolInstance]),Y=(e=!1)=>{E(B.descend,e)},Z=(e=!1)=>{E(B.ascend,e)},N=(e,n=!0)=>{const o=t.filter(i=>i.id!==e);if(l(o),p==null||p.removeObjectByName(e,"box"),p==null||p.render(),V(H.SingleDelete,o),n){const i=S.filter(r=>r.extId===e),c=new Set(i.map(r=>r.id));D(j(c))}},j=e=>(n,o)=>{let i=!1;const c=n.map(r=>e.has(r.id)?(i=!0,o(r)):r);return i?c:n},$=f((e,n)=>{var o,i;const c=new Set((i=(o=n.mappingImgList)==null?void 0:o.map(u=>u.path))!=null?i:[]),r=new Map;e.forEach(u=>{const I=u.id;(u.rects||[]).forEach(C=>{const{imageName:v}=C;if(c.has(v)){let P=r.get(v);P||(P=new Set,r.set(v,P)),P.add(I)}})});const x=S.filter(u=>{var I;const C=u.extId,v=u.imageName;if(v!==void 0&&C!==void 0){const P=r.get(v);return(I=P==null?void 0:P.has(C))!=null?I:!1}return!1}),ie=new Set(x.map(u=>u.id));D(j(ie))},[S,F,W]),ee=e=>{a&&(N(a.info.id,!1),s==null||s.pointCloud2dOperation.deletePolygon(a.info.id),$([a.info],e)),g&&(G(g.id),s==null||s.pointCloud2dOperation.deletePolygon(g.id))},te=A(()=>t.filter(e=>y.includes(e.id)),[y,t]),oe=f(e=>{var n;const o=m.cloneDeep(t);let i=!1;for(const c of e){const r=o.findIndex(x=>x.id===c.id);if(r>-1){const x=m.merge(o[r],c);(n=d==null?void 0:d.generateRects)==null||n.call(d,x),o.splice(r,1,x),p==null||p.generateBox(x),i=!0}}if(i)return l(o),b({pointCloudBoxList:o}),p==null||p.render(),o},[y,t]),ne=f(e=>t.find(n=>n.id===e),[t]);return{selectedBox:a,updateSelectedBox:L,changeSelectedBoxValid:Q,changeValidByID:X,selectNextBox:Z,selectPrevBox:Y,deletePointCloudBox:N,selectedBoxes:te,updateSelectedBoxes:oe,getPointCloudByID:ne,deleteSelectedPointCloudBoxAndPolygon:ee}};export{ve as useSingleBox};
@@ -1 +1 @@
1
- import{useContext as I,useMemo as P}from"react";import{PointCloudContext as E}from"../PointCloudContext.js";import{cTool as x}from"@labelbee/lb-annotation";import{useHistory as A}from"./useHistory.js";import{EPointCloudPattern as C}from"@labelbee/lb-utils";const{EToolName:o,EPolygonPattern:p}=x,T=()=>{const{topViewInstance:r,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,setPointCloudResult:v,setPointCloudSphereList:h,setPolygonList:m,setRectList:b,pointCloudPattern:c,setPointCloudPattern:n,syncAllViewPointCloudColor:L,globalPattern:l,setLineList:w}=I(E),{pushHistoryWithList:y}=A(),f=()=>{e==null||e.clearAllBox(),e==null||e.clearAllSphere(),e==null||e.render(),v([]),m([]),h([]),w([]),b([]),r==null||r.toolScheduler.clearStatusAndResult(),L([]),y({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},g=d=>{if(d===c)return;const s=[r,a,u];switch(d){case o.Rect:i(),s.forEach(t=>{t==null||t.switchToCanvas(o.PointCloudPolygon),t==null||t.toolInstance.setPattern(p.Rect)}),n(o.Rect);break;case o.Polygon:i(),s.forEach(t=>{t==null||t.switchToCanvas(o.PointCloudPolygon),t==null||t.toolInstance.setPattern(p.Normal)}),n(o.Polygon);break;case o.Point:i(),s.forEach(t=>{t==null||t.switchToCanvas(o.Point)}),n(o.Point);break;case o.Line:i(),s.forEach(t=>{t==null||t.switchToCanvas(o.Line)}),n(o.Line);break}},R=P(()=>l===C.Detection,[l]),S=P(()=>l===C.Segmentation,[l]);return{clearAllResult:f,updatePointCloudPattern:g,pointCloudPattern:c,isPointCloudDetectionPattern:R,isPointCloudSegmentationPattern:S}};export{T as useStatus};
1
+ import{useContext as x,useMemo as P}from"react";import{PointCloudContext as E}from"../PointCloudContext.js";import{cTool as I}from"@labelbee/lb-annotation";import{useHistory as T}from"./useHistory.js";import{EPointCloudPattern as C}from"@labelbee/lb-utils";import{EPointCloudBoxRenderTrigger as A}from"../../../utils/ToolPointCloudBoxRenderHelper.js";const{EToolName:t,EPolygonPattern:p}=I,V=()=>{const{topViewInstance:s,sideViewInstance:a,backViewInstance:u,mainViewInstance:e,setPointCloudResult:m,setPointCloudSphereList:v,setPolygonList:h,setRectList:b,pointCloudPattern:c,setPointCloudPattern:l,syncAllViewPointCloudColor:g,globalPattern:n,setLineList:L}=x(E),{pushHistoryWithList:R}=T(),f=()=>{e==null||e.clearAllBox(),e==null||e.clearAllSphere(),e==null||e.render(),m([]),h([]),v([]),L([]),b([]),s==null||s.toolScheduler.clearStatusAndResult(),g(A.ClearAll,[]),R({pointCloudBoxList:[],polygonList:[],pointCloudSphereList:[]})},i=()=>{a==null||a.toolInstance.clearResult(),u==null||u.toolInstance.clearResult()},w=d=>{if(d===c)return;const r=[s,a,u];switch(d){case t.Rect:i(),r.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(p.Rect)}),l(t.Rect);break;case t.Polygon:i(),r.forEach(o=>{o==null||o.switchToCanvas(t.PointCloudPolygon),o==null||o.toolInstance.setPattern(p.Normal)}),l(t.Polygon);break;case t.Point:i(),r.forEach(o=>{o==null||o.switchToCanvas(t.Point)}),l(t.Point);break;case t.Line:i(),r.forEach(o=>{o==null||o.switchToCanvas(t.Line)}),l(t.Line);break}},y=P(()=>n===C.Detection,[n]),S=P(()=>n===C.Segmentation,[n]);return{clearAllResult:f,updatePointCloudPattern:w,pointCloudPattern:c,isPointCloudDetectionPattern:y,isPointCloudSegmentationPattern:S}};export{V as useStatus};
@@ -0,0 +1 @@
1
+ import{useRef as f,useCallback as n,useEffect as i}from"react";import{useMemoizedFn as a}from"ahooks";const o=r=>typeof r=="number",l=(r,e)=>{const c=a(r),u=f(null),t=n(()=>{u.current&&clearTimeout(u.current)},[]),s=n((...m)=>{!o(e)||e<0||(t(),u.current=setTimeout(()=>c(...m),e))},[e]);return i(()=>t,[t]),{fn:s,clear:t}};export{l as default,o as isNumber};
@@ -0,0 +1 @@
1
+ import{useContext as w}from"react";import{useDispatch as D}from"../../../store/ctx.js";import{useSingleBox as b}from"./useSingleBox.js";import{PointCloudContext as T}from"../PointCloudContext.js";import{EPointCloudName as R}from"@labelbee/lb-annotation";import{PreDataProcess as E}from"../../../store/annotation/actionCreators.js";import{usePointCloudViews as H}from"./usePointCloudViews.js";import{useSphere as L}from"./useSphere.js";import{useHistory as _}from"./useHistory.js";import{EPointCloudBoxRenderTrigger as f}from"../../../utils/ToolPointCloudBoxRenderHelper.js";const P={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},k=(v,a)=>{const r=w(T),{topViewInstance:d,selectedIDs:e,pointCloudBoxList:l,mainViewInstance:c,selectedID:g}=r,h=D(),{selectedSphere:p}=L(),{syncPointCloudViews:C,syncPointCloudPoint:m,generateRects:V}=H({setResourceLoading:v}),{selectedBox:u,updateSelectedBox:j}=b({generateRects:V}),{pushHistoryWithList:x}=_(),y=({newSelectedSphere:n,newSphereList:o})=>{const t=d==null?void 0:d.toolInstance;if((n||p)&&e.length===1){const i=n!=null?n:p;t.setSelectedID(e[0]);const s=t.selectedPoint;i&&(m==null||m(P.Top,s,i,void 0,o,a))}},I=({trigger:n,newSelectedBox:o})=>{const t=d==null?void 0:d.toolInstance;if(!(e.length===0||!t)&&(o||(u==null?void 0:u.info))){const i=o!=null?o:u==null?void 0:u.info,s=o;if(i){C==null||C({omitView:P.Top,polygon:s,boxParams:i},n);return}}};return{updatePointCloudColor:n=>{if(l.forEach(o=>{var t,i,s;if(o&&e.includes(o.id)){o.attribute=n;const S=h(E({tool:R.PointCloud,dataList:[o],stepConfig:a,action:"viewUpdateBox"}));o.valid=S[0].valid,j(o),(s=(i=(t=r==null?void 0:r.topViewInstance)==null?void 0:t.pointCloud2dOperation)==null?void 0:i.setPolygonValidAndRender)==null||s.call(i,o.id,!0,o.valid),y({})}}),c){const o=e&&e.length>1?f.MulitSelect:f.Single;r.syncAllViewPointCloudColor(o,l),l.forEach(t=>{I({trigger:o,newSelectedBox:t})}),c.generateBoxes(l)}g||x({pointCloudBoxList:l})}}};export{k as useUpdatePointCloudColor};
@@ -0,0 +1 @@
1
+ import{useRef as l,useCallback as i,useEffect as a,useMemo as f}from"react";import"../utils/event-polyfill.js";const c=()=>()=>{},L=()=>({appendEventListener:c,preappendEventListener:c,addEventListener:c}),w=()=>{},v=()=>{const t=l([]),p=i(e=>{const n=t.current,s=n.findIndex(d=>d===e);s>-1&&n.splice(s,1)},[]),r=i((e,n)=>e?(n(e),()=>{p(e)}):(console.warn("invalid listener"),w),[p]),o=i(e=>r(e,n=>{t.current.push(n)}),[r]),u=i(e=>r(e,n=>{t.current.unshift(n)}),[r]);return a(()=>()=>{t.current.length=0},[]),a(()=>{const e=n=>{const s=t.current.slice(0);for(let d of s){if(n.isImmediatePropagationStopped())break;d(n)}};return window.addEventListener("keydown",e,!1),()=>{window.removeEventListener("keydown",e,!1)}},[]),f(()=>({appendEventListener:o,preappendEventListener:u,addEventListener:o}),[o,u])};export{v as default,L as getEmptyUseWindowKeydownListener};
@@ -1 +1 @@
1
- import{getClassName as n}from"../../utils/dom.js";import t,{useContext as T,useState as y,useEffect as C}from"react";import _ from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import R from"./PointCloud2DView.js";import M from"./PointCloudListener.js";import G from"./PointCloudSegmentListener.js";import O from"./PointCloudSegment.js";import Z from"./PointCloudSegmentStatus.js";import U from"./PointCloudSegmentToolbar.js";import W from"./PointCloudSegment2DView.js";import{connect as $}from"react-redux";import{LabelBeeContext as q,useDispatch as z}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as H,AnnotatedAttributesPanelFixedRight as J}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as K}from"./PointCloudContext.js";import{PointCloudUtils as Q,EPointCloudPattern as X}from"@labelbee/lb-utils";import{useCustomToolInstance as Y}from"../../hooks/annotation.js";import{jsonParser as tt}from"../../utils/index.js";import{a2MapStateToProps as et}from"../../store/annotation/map.js";import L from"classnames";import ot from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as nt}from"../../store/annotation/actionCreators.js";const it=E=>{const{currentData:a,imgList:S,drawLayerSlot:d,checkMode:i,intelligentFit:w,imgIndex:x,config:b,measureVisible:j}=E,e=T(K),{globalPattern:p,setGlobalPattern:v,selectedIDs:P}=e,V=z(),[l,f]=y(!1),h=(P==null?void 0:P.length)>0&&l,D=tt(a.result),{toolInstanceRef:r,clearToolInstance:A}=Y({basicInfo:D});if(C(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==p&&(v(o),e.clearAllDetectionInstance(),A())}},[p]),C(()=>{var o;if(nt(V,!0),a){const{boxParamsList:s,polygonList:m,lineList:u,sphereParamsList:c,segmentation:N,rectList:I}=Q.parsePointCloudCurrentResult((o=a==null?void 0:a.result)!=null?o:"");e.setPointCloudResult(s),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(c),e.setRectList(I),e.setSegmentation(N)}},[x]),C(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,s,m,u,c;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(s=e.lineList)!=null?s:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(c=e.segmentation)!=null?c:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),S.length===0)return null;if(p===X.Segmentation)return t.createElement(t.Fragment,null,t.createElement(G,{checkMode:i,toolInstanceRef:r}),t.createElement(U,null),t.createElement("div",{className:n("point-cloud-layout")},t.createElement(O,{checkMode:i}),t.createElement(W,null)),t.createElement(Z,{config:b}),d==null?void 0:d({direct:!0}));let g=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(k,{checkMode:i}),t.createElement(F,{checkMode:i}));return l&&(g=t.createElement(ot,{selectAndEnlarge:h,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(M,{checkMode:i,toolInstanceRef:r}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(H,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(_,null),g),t.createElement("div",{className:L({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(B,{drawLayerSlot:d,checkMode:i,intelligentFit:w,setIsEnlargeTopView:f,onExitZoom:()=>{f(!1)},isEnlargeTopView:l}),t.createElement("div",{className:L({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(R,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i,measureVisible:j})))),t.createElement(J,null))))};var lt=$(et,null,null,{context:q})(it);export{lt as default};
1
+ import{getClassName as n}from"../../utils/dom.js";import t,{useContext as y,useState as R,useEffect as C}from"react";import _ from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import M from"./PointCloud2DView.js";import G from"./PointCloudListener.js";import O from"./PointCloudSegmentListener.js";import Z from"./PointCloudSegment.js";import U from"./PointCloudSegmentStatus.js";import W from"./PointCloudSegmentToolbar.js";import $ from"./PointCloudSegment2DView.js";import{connect as q}from"react-redux";import{LabelBeeContext as z,useDispatch as H}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as J,AnnotatedAttributesPanelFixedRight as K}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as Q}from"./PointCloudContext.js";import{PointCloudUtils as X,EPointCloudPattern as Y}from"@labelbee/lb-utils";import{useCustomToolInstance as tt}from"../../hooks/annotation.js";import{jsonParser as et}from"../../utils/index.js";import{a2MapStateToProps as ot}from"../../store/annotation/map.js";import L from"classnames";import nt from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as it}from"../../store/annotation/actionCreators.js";const lt=E=>{const{currentData:s,imgList:S,drawLayerSlot:d,checkMode:i,intelligentFit:w,imgIndex:x,config:b,measureVisible:j,setResourceLoading:v}=E,e=y(Q),{globalPattern:p,setGlobalPattern:V,selectedIDs:P}=e,h=H(),[l,f]=R(!1),D=(P==null?void 0:P.length)>0&&l,A=et(s.result),{toolInstanceRef:r,clearToolInstance:N}=tt({basicInfo:A});if(C(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==p&&(V(o),e.clearAllDetectionInstance(),N())}},[p]),C(()=>{var o;if(it(h,!0),s){const{boxParamsList:a,polygonList:m,lineList:u,sphereParamsList:c,segmentation:I,rectList:T}=X.parsePointCloudCurrentResult((o=s==null?void 0:s.result)!=null?o:"");e.setPointCloudResult(a),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(c),e.setRectList(T),e.setSegmentation(I)}},[x]),C(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,a,m,u,c;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(a=e.lineList)!=null?a:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(c=e.segmentation)!=null?c:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),S.length===0)return null;if(p===Y.Segmentation)return t.createElement(t.Fragment,null,t.createElement(O,{checkMode:i,toolInstanceRef:r}),t.createElement(W,null),t.createElement("div",{className:n("point-cloud-layout")},t.createElement(Z,{checkMode:i}),t.createElement($,null)),t.createElement(U,{config:b}),d==null?void 0:d({direct:!0}));let g=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(k,{checkMode:i}),t.createElement(F,{checkMode:i}));return l&&(g=t.createElement(nt,{selectAndEnlarge:D,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(G,{checkMode:i,toolInstanceRef:r,setResourceLoading:v}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(J,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(_,null),g),t.createElement("div",{className:L({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(B,{drawLayerSlot:d,checkMode:i,intelligentFit:w,setIsEnlargeTopView:f,onExitZoom:()=>{f(!1)},isEnlargeTopView:l}),t.createElement("div",{className:L({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(M,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i,measureVisible:j})))),t.createElement(K,null))))};var rt=q(ot,null,null,{context:z})(lt);export{rt as default};
@@ -0,0 +1 @@
1
+ const stopImmediatePropagationOriginal=Event.prototype.stopImmediatePropagation;Event.prototype.isImmediatePropagationStopped=()=>!1,Event.prototype.stopImmediatePropagation=function(t){stopImmediatePropagationOriginal.bind(this).call(t),this.isImmediatePropagationStopped=()=>!0};
@@ -0,0 +1 @@
1
+ const s=(n,r,d,a)=>{let e=n.get(r);e||(e=new Map,n.set(r,e));let t=e.get(d);return t||(t=new WeakSet,e.set(d,t)),t.add(a),n};export{s as addMapIndirectWeakSetItem};
@@ -1 +1 @@
1
- import{Button as v,message as c}from"antd";import p from"react";import{useTranslation as y}from"react-i18next";import{connect as S}from"react-redux";import k from"../../../assets/predictTracking/icon.svg.js";import{useSingleBox as B}from"../../pointCloudView/hooks/useSingleBox.js";import{ChangeSave as C,GetBoxesByID as I,SetPointCloudLoading as D,SetPredictResult as T,SetPredictResultVisible as R}from"../../../store/annotation/actionCreators.js";import{LabelBeeContext as b,useDispatch as j}from"../../../store/ctx.js";import{predict as V}from"../previewResult/util.js";import{useStatus as w}from"../../pointCloudView/hooks/useStatus.js";var _=(o,n,e)=>new Promise((d,l)=>{var u=t=>{try{s(e.next(t))}catch(i){l(i)}},r=t=>{try{s(e.throw(t))}catch(i){l(i)}},s=t=>t.done?d(t.value):Promise.resolve(t.value).then(u,r);s((e=e.apply(o,n)).next())});const E=o=>{const n=j(),{t:e}=y(),{isPointCloudSegmentationPattern:d}=w(),{loading:l,predictionResultVisible:u}=o,{selectedBox:r}=B(),s=()=>_(void 0,null,function*(){if(l||u)return;const t=r==null?void 0:r.info.trackID;if(!t){c.error(e("BeforePredictStarting"));return}yield n(C);const i=r==null?void 0:r.info.id,a=yield n(I(t,i));if(a.length<2){c.error(e("MarkOnlyOne"));return}const x=a.findIndex(h=>h.id===i),m=a[x-1],f=a[x],g=f.index-m.index;if(g<2){c.error(e("HaveNoNeed"));return}if(g>8){c.error(e("ThePredictedPointCloud"));return}c.success(e("PredictingDataFrom",{startPage:m.index+1,endPage:f.index+1,selectedBoxTrackID:t})),D(n,!0);const P=V(m,f);T(n,P),R(n,!0)});return d?null:p.createElement(v,{type:"link",onClick:s,style:{display:"flex",flexDirection:"column",height:"auto",alignItems:"center"}},p.createElement("img",{src:k,style:{alignSelf:"center"}}),p.createElement("span",{style:{color:"#797979"}},e("ComplementaryTracking")))},L=o=>({loading:o.annotation.loading,predictionResultVisible:o.annotation.predictionResultVisible});var N=S(L,null,null,{context:b})(E);export{N as default};
1
+ import{Button as v,message as c}from"antd";import p from"react";import{useTranslation as y}from"react-i18next";import{connect as S}from"react-redux";import k from"../../../assets/predictTracking/icon.svg.js";import{useSingleBox as B}from"../../pointCloudView/hooks/useSingleBox.js";import{ChangeSave as I,GetBoxesByID as C,SetAnnotationLoading as D,SetPredictResult as T,SetPredictResultVisible as R}from"../../../store/annotation/actionCreators.js";import{LabelBeeContext as b,useDispatch as j}from"../../../store/ctx.js";import{predict as V}from"../previewResult/util.js";import{useStatus as w}from"../../pointCloudView/hooks/useStatus.js";var _=(o,n,e)=>new Promise((d,l)=>{var u=t=>{try{s(e.next(t))}catch(i){l(i)}},r=t=>{try{s(e.throw(t))}catch(i){l(i)}},s=t=>t.done?d(t.value):Promise.resolve(t.value).then(u,r);s((e=e.apply(o,n)).next())});const E=o=>{const n=j(),{t:e}=y(),{isPointCloudSegmentationPattern:d}=w(),{loading:l,predictionResultVisible:u}=o,{selectedBox:r}=B(),s=()=>_(void 0,null,function*(){if(l||u)return;const t=r==null?void 0:r.info.trackID;if(!t){c.error(e("BeforePredictStarting"));return}yield n(I);const i=r==null?void 0:r.info.id,a=yield n(C(t,i));if(a.length<2){c.error(e("MarkOnlyOne"));return}const x=a.findIndex(h=>h.id===i),m=a[x-1],f=a[x],g=f.index-m.index;if(g<2){c.error(e("HaveNoNeed"));return}if(g>8){c.error(e("ThePredictedPointCloud"));return}c.success(e("PredictingDataFrom",{startPage:m.index+1,endPage:f.index+1,selectedBoxTrackID:t})),D(n,!0);const P=V(m,f);T(n,P),R(n,!0)});return d?null:p.createElement(v,{type:"link",onClick:s,style:{display:"flex",flexDirection:"column",height:"auto",alignItems:"center"}},p.createElement("img",{src:k,style:{alignSelf:"center"}}),p.createElement("span",{style:{color:"#797979"}},e("ComplementaryTracking")))},L=o=>({loading:o.annotation.loading,predictionResultVisible:o.annotation.predictionResultVisible});var N=S(L,null,null,{context:b})(E);export{N as default};
@@ -1 +1 @@
1
- import b from"classnames";import n,{useState as j,useRef as S,useEffect as F}from"react";import{useTranslation as w}from"react-i18next";import{connect as L}from"react-redux";import{PointCloudContext as B}from"../../pointCloudView/PointCloudContext.js";import{SetPredictResultVisible as D,SetPredictResult as T,SetPointCloudLoading as v,BatchUpdateImgListResultByPredictResult as I}from"../../../store/annotation/actionCreators.js";import{LabelBeeContext as U,useDispatch as E}from"../../../store/ctx.js";import{getClassName as o}from"../../../utils/dom.js";import{PointCloud as $}from"@labelbee/lb-annotation";import{PointCloudUtils as z,toolStyleConverter as A}from"@labelbee/lb-utils";import{views as G,sleep as Z,getViewsDataUrl as q}from"./util.js";var H=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,N=(i,e,t)=>e in i?H(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,W=(i,e)=>{for(var t in e||(e={}))M.call(e,t)&&N(i,t,e[t]);if(k)for(var t of k(e))Q.call(e,t)&&N(i,t,e[t]);return i},X=(i,e)=>J(i,K(e)),O=(i,e,t)=>new Promise((d,r)=>{var s=a=>{try{c(t.next(a))}catch(u){r(u)}},l=a=>{try{c(t.throw(a))}catch(u){r(u)}},c=a=>a.done?d(a.value):Promise.resolve(a.value).then(s,l);c((t=t.apply(i,e)).next())});const Y=i=>{const{predictionResult:e,predictionResultVisible:t,imgList:d}=i,[r,s]=j([]),l=E(),{t:c}=w(),a=()=>{D(l,!1),T(l,[]),s([])},u=()=>O(void 0,null,function*(){v(l,!0),yield l(I()),v(l,!1),a()});return t?n.createElement(n.Fragment,null,r.length>0&&n.createElement("div",{className:o("point-cloud-predict-tracking-container")},n.createElement("div",{className:o("point-cloud-predict-tracking-container","bar")},n.createElement("div",{className:o("point-cloud-predict-tracking-container","title")},n.createElement("div",null,c("ComplementaryTrackingPrediction"),r.length>0?`\uFF08${r.length}\uFF09`:""),n.createElement("div",{className:o("point-cloud-predict-tracking-container","option")},n.createElement("div",{className:b([o("point-cloud-predict-tracking-container","cancelOption"),o("point-cloud-predict-tracking-container","button")]),onClick:a},c("Cancel")),n.createElement("div",{className:b([o("point-cloud-predict-tracking-container","okOption"),o("point-cloud-predict-tracking-container","button")]),onClick:u},c("Apply")))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","content")},n.createElement(ee,{list:r})))),e.length>0&&n.createElement(te,{result:e,imgList:d,setList:s})):null},ee=i=>{const{list:e}=i,{t}=w(),d=[t("TopView"),t("SideView"),t("BackView")];return n.createElement(n.Fragment,null,n.createElement("div",{className:o("point-cloud-predict-tracking-container","left")},d.map(r=>n.createElement("div",{className:o("point-cloud-predict-tracking-container","title"),key:r},r))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","right")},e.map(r=>n.createElement("div",{className:o("point-cloud-predict-tracking-container","item"),key:r.id},G.map(s=>{const l=r[s];return n.createElement("div",{className:o("point-cloud-predict-tracking-container","view"),key:`${r.id}-${s}`},n.createElement("img",{src:l}))})))))},te=i=>{const e=n.useContext(B),t=E(),{result:d,imgList:r,setList:s}=i,l=S(null),c={width:600,height:600};return F(()=>{(()=>O(void 0,null,function*(){var u,P,h,y,_,C;const f=(u=e.mainViewInstance)==null?void 0:u.config;if(f&&l.current){const R=z.getDefaultOrthographicParams(c),p=new $({container:l.current,isOrthographicCamera:!0,orthographicParams:R,config:f});p.setShowDirection(!1);for(const m of d){const{index:g}=m,x=r[g].url?r[g].url:(_=(y=(h=(P=r[g])==null?void 0:P.webPointCloudFile)==null?void 0:h.lidar)==null?void 0:y.url)!=null?_:"";yield p.loadPCDFileByBox(x,m,{width:2,height:2,depth:2}),yield p.updateCameraZoom(e.zoom);const V=(C=A.getColorFromConfig({attribute:m.attribute},X(W({},f),{attributeConfigurable:!0}),{}))==null?void 0:C.fill;p.generateBox(m,V),yield Z(500),yield q(p,m,e.zoom),yield p.removeObjectByName(m.id,"box"),yield p.clearPointCloudAndRender()}s(d),v(t,!1)}}))()},[]),n.createElement("div",{style:c,ref:l,className:"generate-view"})},ne=i=>({predictionResult:i.annotation.predictionResult,predictionResultVisible:i.annotation.predictionResultVisible,imgList:i.annotation.imgList});var ie=L(ne,null,null,{context:U})(Y);export{ie as default};
1
+ import w from"classnames";import n,{useState as j,useRef as S,useEffect as F}from"react";import{useTranslation as C}from"react-i18next";import{connect as L}from"react-redux";import{PointCloudContext as B}from"../../pointCloudView/PointCloudContext.js";import{SetPredictResultVisible as D,SetPredictResult as T,SetAnnotationLoading as v,BatchUpdateImgListResultByPredictResult as I}from"../../../store/annotation/actionCreators.js";import{LabelBeeContext as U,useDispatch as E}from"../../../store/ctx.js";import{getClassName as o}from"../../../utils/dom.js";import{PointCloud as $}from"@labelbee/lb-annotation";import{PointCloudUtils as z,toolStyleConverter as A}from"@labelbee/lb-utils";import{views as G,sleep as Z,getViewsDataUrl as q}from"./util.js";var H=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,N=(i,e,t)=>e in i?H(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,W=(i,e)=>{for(var t in e||(e={}))M.call(e,t)&&N(i,t,e[t]);if(k)for(var t of k(e))Q.call(e,t)&&N(i,t,e[t]);return i},X=(i,e)=>J(i,K(e)),O=(i,e,t)=>new Promise((d,r)=>{var s=l=>{try{c(t.next(l))}catch(u){r(u)}},a=l=>{try{c(t.throw(l))}catch(u){r(u)}},c=l=>l.done?d(l.value):Promise.resolve(l.value).then(s,a);c((t=t.apply(i,e)).next())});const Y=i=>{const{predictionResult:e,predictionResultVisible:t,imgList:d}=i,[r,s]=j([]),a=E(),{t:c}=C(),l=()=>{D(a,!1),T(a,[]),s([])},u=()=>O(void 0,null,function*(){v(a,!0),yield a(I()),v(a,!1),l()});return t?n.createElement(n.Fragment,null,r.length>0&&n.createElement("div",{className:o("point-cloud-predict-tracking-container")},n.createElement("div",{className:o("point-cloud-predict-tracking-container","bar")},n.createElement("div",{className:o("point-cloud-predict-tracking-container","title")},n.createElement("div",null,c("ComplementaryTrackingPrediction"),r.length>0?`\uFF08${r.length}\uFF09`:""),n.createElement("div",{className:o("point-cloud-predict-tracking-container","option")},n.createElement("div",{className:w([o("point-cloud-predict-tracking-container","cancelOption"),o("point-cloud-predict-tracking-container","button")]),onClick:l},c("Cancel")),n.createElement("div",{className:w([o("point-cloud-predict-tracking-container","okOption"),o("point-cloud-predict-tracking-container","button")]),onClick:u},c("Apply")))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","content")},n.createElement(ee,{list:r})))),e.length>0&&n.createElement(te,{result:e,imgList:d,setList:s})):null},ee=i=>{const{list:e}=i,{t}=C(),d=[t("TopView"),t("SideView"),t("BackView")];return n.createElement(n.Fragment,null,n.createElement("div",{className:o("point-cloud-predict-tracking-container","left")},d.map(r=>n.createElement("div",{className:o("point-cloud-predict-tracking-container","title"),key:r},r))),n.createElement("div",{className:o("point-cloud-predict-tracking-container","right")},e.map(r=>n.createElement("div",{className:o("point-cloud-predict-tracking-container","item"),key:r.id},G.map(s=>{const a=r[s];return n.createElement("div",{className:o("point-cloud-predict-tracking-container","view"),key:`${r.id}-${s}`},n.createElement("img",{src:a}))})))))},te=i=>{const e=n.useContext(B),t=E(),{result:d,imgList:r,setList:s}=i,a=S(null),c={width:600,height:600};return F(()=>{(()=>O(void 0,null,function*(){var u,P,h,y,_,b;const f=(u=e.mainViewInstance)==null?void 0:u.config;if(f&&a.current){const R=z.getDefaultOrthographicParams(c),p=new $({container:a.current,isOrthographicCamera:!0,orthographicParams:R,config:f});p.setShowDirection(!1);for(const m of d){const{index:g}=m,x=r[g].url?r[g].url:(_=(y=(h=(P=r[g])==null?void 0:P.webPointCloudFile)==null?void 0:h.lidar)==null?void 0:y.url)!=null?_:"";yield p.loadPCDFileByBox(x,m,{width:2,height:2,depth:2}),yield p.updateCameraZoom(e.zoom);const V=(b=A.getColorFromConfig({attribute:m.attribute},X(W({},f),{attributeConfigurable:!0}),{}))==null?void 0:b.fill;p.generateBox(m,V),yield Z(500),yield q(p,m,e.zoom),yield p.removeObjectByName(m.id,"box"),yield p.clearPointCloudAndRender()}s(d),v(t,!1)}}))()},[]),n.createElement("div",{style:c,ref:a,className:"generate-view"})},ne=i=>({predictionResult:i.annotation.predictionResult,predictionResultVisible:i.annotation.predictionResultVisible,imgList:i.annotation.imgList});var ie=L(ne,null,null,{context:U})(Y);export{ie as default};
@@ -0,0 +1 @@
1
+ import o,{useEffect as g}from"react";import{Checkbox as y,Select as u,Divider as x}from"antd";import{I18nextProvider as S,useTranslation as _}from"react-i18next";import E from"../attributeList/index.js";import{i18n as v}from"@labelbee/lb-utils";var h=Object.defineProperty,s=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,f=(t,a,r)=>a in t?h(t,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[a]=r,P=(t,a)=>{for(var r in a||(a={}))w.call(a,r)&&f(t,r,a[r]);if(s)for(var r of s(a))O.call(a,r)&&f(t,r,a[r]);return t};const k={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},C=t=>{const{subAttributeList:a,setSubAttribute:r,getValue:i,lang:p}=t,{t:c}=_();g(()=>{var e;p&&((e=v)==null||e.changeLanguage(p))},[]);const m=(e,n)=>{if(Array.isArray(n)){r(e,n.join(";"));return}r(e,n)},d=e=>{const n=i(e);return(e==null?void 0:e.isMulti)?n?n==null?void 0:n.split(";"):[]:n};return o.createElement(o.Fragment,null,a.map(e=>{var n;return(e==null?void 0:e.subSelected)&&o.createElement("div",{style:{marginTop:12},key:e.value},o.createElement("div",{style:k},c("SubAttribute"),"-",e.key),((n=e.subSelected)==null?void 0:n.length)<5?(e==null?void 0:e.isMulti)?o.createElement(y.Group,{style:{padding:"0px 20px 16px 16px"},options:e.subSelected.map(l=>({label:l.key,value:l.value})),value:d(e),onChange:l=>m(e.value,l)}):o.createElement(E,{list:e.subSelected.map(l=>({label:l.key,value:l.value})),selectedAttribute:i(e),num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:l=>r(e.value,l),style:{marginBottom:12}}):o.createElement(u,{style:{margin:"0px 20px 16px 16px",width:"87%"},mode:(e==null?void 0:e.isMulti)?"multiple":void 0,value:d(e),placeholder:c("PleaseSelect"),onChange:l=>m(e.value,l),allowClear:!0},e.subSelected.map(l=>o.createElement(u.Option,{key:l.value,value:l.value},l.key))),o.createElement(x,{style:{margin:0}}))}))},L=t=>o.createElement(S,{i18n:v},o.createElement(C,P({},t)));export{L as default};