@labelbee/lb-annotation 1.0.0-alpha.1

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 (241) hide show
  1. package/README.md +210 -0
  2. package/dist/_virtual/MathUtilsWorker.js +1 -0
  3. package/dist/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -0
  4. package/dist/_virtual/filterBoxWorker.js +1 -0
  5. package/dist/_virtual/highlightWorker.js +1 -0
  6. package/dist/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -0
  7. package/dist/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -0
  8. package/dist/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -0
  9. package/dist/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -0
  10. package/dist/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -0
  11. package/dist/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -0
  12. package/dist/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -0
  13. package/dist/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -0
  14. package/dist/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -0
  15. package/dist/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -0
  16. package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -0
  17. package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -0
  18. package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -0
  19. package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -0
  20. package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +12 -0
  21. package/dist/assets/attributeIcon/icon_editFEN.svg.js +1 -0
  22. package/dist/assets/attributeIcon/icon_editHUANG.svg.js +1 -0
  23. package/dist/assets/attributeIcon/icon_editLAN.svg.js +1 -0
  24. package/dist/assets/attributeIcon/icon_editLV.svg.js +1 -0
  25. package/dist/assets/attributeIcon/icon_editQING.svg.js +1 -0
  26. package/dist/constant/annotation.js +1 -0
  27. package/dist/constant/annotationTask.js +1 -0
  28. package/dist/constant/defaultConfig.js +1 -0
  29. package/dist/constant/keyCode.js +1 -0
  30. package/dist/constant/style.js +1 -0
  31. package/dist/constant/tool.js +1 -0
  32. package/dist/core/index.js +1 -0
  33. package/dist/core/pointCloud/OrbitControls.js +1 -0
  34. package/dist/core/pointCloud/PCDLoader.js +2 -0
  35. package/dist/core/pointCloud/annotation.js +1 -0
  36. package/dist/core/pointCloud/cache.js +1 -0
  37. package/dist/core/pointCloud/index.js +11 -0
  38. package/dist/core/pointCloud/matrix.js +1 -0
  39. package/dist/core/scheduler.js +1 -0
  40. package/dist/core/toolOperation/LineToolOperation.js +1 -0
  41. package/dist/core/toolOperation/ScribbleTool.js +1 -0
  42. package/dist/core/toolOperation/TextToolOperation.js +1 -0
  43. package/dist/core/toolOperation/ViewOperation.js +1 -0
  44. package/dist/core/toolOperation/basicToolOperation.js +1 -0
  45. package/dist/core/toolOperation/checkOperation.js +1 -0
  46. package/dist/core/toolOperation/cuboidOperation.js +1 -0
  47. package/dist/core/toolOperation/cuboidToggleButtonClass.js +31 -0
  48. package/dist/core/toolOperation/eventListener.js +1 -0
  49. package/dist/core/toolOperation/measureOperation.js +1 -0
  50. package/dist/core/toolOperation/pointCloud2dOperation.js +1 -0
  51. package/dist/core/toolOperation/pointOperation.js +1 -0
  52. package/dist/core/toolOperation/polygonOperation.js +1 -0
  53. package/dist/core/toolOperation/rectOperation.js +1 -0
  54. package/dist/core/toolOperation/segmentByRect.js +1 -0
  55. package/dist/core/toolOperation/tagOperation.js +19 -0
  56. package/dist/core/toolOperation/textAttributeClass.js +37 -0
  57. package/dist/index.js +1 -0
  58. package/dist/locales/constants.js +1 -0
  59. package/dist/locales/en_US/message.js +1 -0
  60. package/dist/locales/index.js +1 -0
  61. package/dist/locales/zh_CN/message.js +1 -0
  62. package/dist/newCore/CanvasScheduler.js +1 -0
  63. package/dist/types/constant/annotation.d.ts +118 -0
  64. package/dist/types/constant/annotationTask.d.ts +16 -0
  65. package/dist/types/constant/defaultConfig.d.ts +273 -0
  66. package/dist/types/constant/keyCode.d.ts +33 -0
  67. package/dist/types/constant/style.d.ts +50 -0
  68. package/dist/types/constant/tool.d.ts +194 -0
  69. package/dist/types/core/index.d.ts +105 -0
  70. package/dist/types/core/pointCloud/OrbitControls.d.ts +60 -0
  71. package/dist/types/core/pointCloud/PCDLoader.d.ts +12 -0
  72. package/dist/types/core/pointCloud/annotation.d.ts +86 -0
  73. package/dist/types/core/pointCloud/cache.d.ts +26 -0
  74. package/dist/types/core/pointCloud/filterBoxWorker.d.ts +1 -0
  75. package/dist/types/core/pointCloud/highlightWorker.d.ts +1 -0
  76. package/dist/types/core/pointCloud/index.d.ts +374 -0
  77. package/dist/types/core/pointCloud/matrix.d.ts +63 -0
  78. package/dist/types/core/scheduler.d.ts +88 -0
  79. package/dist/types/core/toolOperation/LineToolOperation.d.ts +443 -0
  80. package/dist/types/core/toolOperation/ScribbleTool.d.ts +65 -0
  81. package/dist/types/core/toolOperation/TextToolOperation.d.ts +41 -0
  82. package/dist/types/core/toolOperation/ViewOperation.d.ts +102 -0
  83. package/dist/types/core/toolOperation/basicToolOperation.d.ts +266 -0
  84. package/dist/types/core/toolOperation/checkOperation.d.ts +37 -0
  85. package/dist/types/core/toolOperation/cuboidOperation.d.ts +174 -0
  86. package/dist/types/core/toolOperation/cuboidToggleButtonClass.d.ts +38 -0
  87. package/dist/types/core/toolOperation/eventListener.d.ts +33 -0
  88. package/dist/types/core/toolOperation/measureOperation.d.ts +8 -0
  89. package/dist/types/core/toolOperation/pointCloud2dOperation.d.ts +119 -0
  90. package/dist/types/core/toolOperation/pointOperation.d.ts +135 -0
  91. package/dist/types/core/toolOperation/polygonOperation.d.ts +201 -0
  92. package/dist/types/core/toolOperation/rectOperation.d.ts +175 -0
  93. package/dist/types/core/toolOperation/segmentByRect.d.ts +31 -0
  94. package/dist/types/core/toolOperation/tagOperation.d.ts +44 -0
  95. package/dist/types/core/toolOperation/textAttributeClass.d.ts +65 -0
  96. package/dist/types/index.d.ts +37 -0
  97. package/dist/types/locales/constants.d.ts +19 -0
  98. package/dist/types/locales/en_US/message.d.ts +2 -0
  99. package/dist/types/locales/index.d.ts +4 -0
  100. package/dist/types/locales/zh_CN/message.d.ts +2 -0
  101. package/dist/types/newCore/CanvasScheduler.d.ts +31 -0
  102. package/dist/types/newCore/index.d.ts +1 -0
  103. package/dist/types/utils/ActionsHistory.d.ts +32 -0
  104. package/dist/types/utils/EventBus.d.ts +40 -0
  105. package/dist/types/utils/ImgUtils.d.ts +3 -0
  106. package/dist/types/utils/MathUtils.d.ts +172 -0
  107. package/dist/types/utils/MathUtilsWorker.d.ts +29 -0
  108. package/dist/types/utils/VectorUtils.d.ts +16 -0
  109. package/dist/types/utils/tool/AttributeUtils.d.ts +94 -0
  110. package/dist/types/utils/tool/AxisUtils.d.ts +238 -0
  111. package/dist/types/utils/tool/CanvasUtils.d.ts +46 -0
  112. package/dist/types/utils/tool/CommonToolUtils.d.ts +105 -0
  113. package/dist/types/utils/tool/CuboidUtils.d.ts +267 -0
  114. package/dist/types/utils/tool/DblClickEventListener.d.ts +47 -0
  115. package/dist/types/utils/tool/DrawUtils.d.ts +196 -0
  116. package/dist/types/utils/tool/EnhanceCommonToolUtils.d.ts +23 -0
  117. package/dist/types/utils/tool/ImgPosUtils.d.ts +34 -0
  118. package/dist/types/utils/tool/LineToolUtils.d.ts +105 -0
  119. package/dist/types/utils/tool/MarkerUtils.d.ts +27 -0
  120. package/dist/types/utils/tool/PolygonUtils.d.ts +120 -0
  121. package/dist/types/utils/tool/RectUtils.d.ts +69 -0
  122. package/dist/types/utils/tool/RenderDomClass.d.ts +24 -0
  123. package/dist/types/utils/tool/RenderDomUtils.d.ts +3 -0
  124. package/dist/types/utils/tool/StyleUtils.d.ts +15 -0
  125. package/dist/types/utils/tool/TagUtils.d.ts +54 -0
  126. package/dist/types/utils/tool/UnitUtils.d.ts +4 -0
  127. package/dist/types/utils/tool/ZoomUtils.d.ts +16 -0
  128. package/dist/types/utils/tool/polygonTool.d.ts +32 -0
  129. package/dist/types/utils/uuid.d.ts +1 -0
  130. package/dist/utils/ActionsHistory.js +1 -0
  131. package/dist/utils/ImgUtils.js +1 -0
  132. package/dist/utils/MathUtils.js +2 -0
  133. package/dist/utils/VectorUtils.js +1 -0
  134. package/dist/utils/tool/AttributeUtils.js +1 -0
  135. package/dist/utils/tool/AxisUtils.js +1 -0
  136. package/dist/utils/tool/CanvasUtils.js +1 -0
  137. package/dist/utils/tool/CommonToolUtils.js +1 -0
  138. package/dist/utils/tool/CuboidUtils.js +1 -0
  139. package/dist/utils/tool/DblClickEventListener.js +1 -0
  140. package/dist/utils/tool/DrawUtils.js +3 -0
  141. package/dist/utils/tool/EnhanceCommonToolUtils.js +1 -0
  142. package/dist/utils/tool/ImgPosUtils.js +1 -0
  143. package/dist/utils/tool/LineToolUtils.js +1 -0
  144. package/dist/utils/tool/MarkerUtils.js +1 -0
  145. package/dist/utils/tool/PolygonUtils.js +1 -0
  146. package/dist/utils/tool/RectUtils.js +1 -0
  147. package/dist/utils/tool/RenderDomClass.js +20 -0
  148. package/dist/utils/tool/RenderDomUtils.js +16 -0
  149. package/dist/utils/tool/StyleUtils.js +1 -0
  150. package/dist/utils/tool/TagUtils.js +1 -0
  151. package/dist/utils/tool/UnitUtils.js +1 -0
  152. package/dist/utils/tool/ZoomUtils.js +1 -0
  153. package/dist/utils/tool/polygonTool.js +1 -0
  154. package/dist/utils/uuid.js +1 -0
  155. package/es/_virtual/MathUtilsWorker.js +1 -0
  156. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -0
  157. package/es/_virtual/filterBoxWorker.js +1 -0
  158. package/es/_virtual/highlightWorker.js +1 -0
  159. package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -0
  160. package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -0
  161. package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -0
  162. package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -0
  163. package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -0
  164. package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -0
  165. package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -0
  166. package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -0
  167. package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -0
  168. package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -0
  169. package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -0
  170. package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -0
  171. package/es/assets/attributeIcon/icon_cuboidMore.svg.js +5 -0
  172. package/es/assets/attributeIcon/icon_cuboidRight.svg.js +5 -0
  173. package/es/assets/attributeIcon/icon_cuboidTop.svg.js +12 -0
  174. package/es/assets/attributeIcon/icon_editFEN.svg.js +1 -0
  175. package/es/assets/attributeIcon/icon_editHUANG.svg.js +1 -0
  176. package/es/assets/attributeIcon/icon_editLAN.svg.js +1 -0
  177. package/es/assets/attributeIcon/icon_editLV.svg.js +1 -0
  178. package/es/assets/attributeIcon/icon_editQING.svg.js +1 -0
  179. package/es/constant/annotation.js +1 -0
  180. package/es/constant/annotationTask.js +1 -0
  181. package/es/constant/defaultConfig.js +1 -0
  182. package/es/constant/keyCode.js +1 -0
  183. package/es/constant/style.js +1 -0
  184. package/es/constant/tool.js +1 -0
  185. package/es/core/index.js +1 -0
  186. package/es/core/pointCloud/OrbitControls.js +1 -0
  187. package/es/core/pointCloud/PCDLoader.js +2 -0
  188. package/es/core/pointCloud/annotation.js +1 -0
  189. package/es/core/pointCloud/cache.js +1 -0
  190. package/es/core/pointCloud/index.js +11 -0
  191. package/es/core/pointCloud/matrix.js +1 -0
  192. package/es/core/scheduler.js +1 -0
  193. package/es/core/toolOperation/LineToolOperation.js +1 -0
  194. package/es/core/toolOperation/ScribbleTool.js +1 -0
  195. package/es/core/toolOperation/TextToolOperation.js +1 -0
  196. package/es/core/toolOperation/ViewOperation.js +1 -0
  197. package/es/core/toolOperation/basicToolOperation.js +1 -0
  198. package/es/core/toolOperation/checkOperation.js +1 -0
  199. package/es/core/toolOperation/cuboidOperation.js +1 -0
  200. package/es/core/toolOperation/cuboidToggleButtonClass.js +31 -0
  201. package/es/core/toolOperation/eventListener.js +1 -0
  202. package/es/core/toolOperation/measureOperation.js +1 -0
  203. package/es/core/toolOperation/pointCloud2dOperation.js +1 -0
  204. package/es/core/toolOperation/pointOperation.js +1 -0
  205. package/es/core/toolOperation/polygonOperation.js +1 -0
  206. package/es/core/toolOperation/rectOperation.js +1 -0
  207. package/es/core/toolOperation/segmentByRect.js +1 -0
  208. package/es/core/toolOperation/tagOperation.js +19 -0
  209. package/es/core/toolOperation/textAttributeClass.js +37 -0
  210. package/es/index.js +1 -0
  211. package/es/locales/constants.js +1 -0
  212. package/es/locales/en_US/message.js +1 -0
  213. package/es/locales/index.js +1 -0
  214. package/es/locales/zh_CN/message.js +1 -0
  215. package/es/newCore/CanvasScheduler.js +1 -0
  216. package/es/utils/ActionsHistory.js +1 -0
  217. package/es/utils/ImgUtils.js +1 -0
  218. package/es/utils/MathUtils.js +2 -0
  219. package/es/utils/VectorUtils.js +1 -0
  220. package/es/utils/tool/AttributeUtils.js +1 -0
  221. package/es/utils/tool/AxisUtils.js +1 -0
  222. package/es/utils/tool/CanvasUtils.js +1 -0
  223. package/es/utils/tool/CommonToolUtils.js +1 -0
  224. package/es/utils/tool/CuboidUtils.js +1 -0
  225. package/es/utils/tool/DblClickEventListener.js +1 -0
  226. package/es/utils/tool/DrawUtils.js +3 -0
  227. package/es/utils/tool/EnhanceCommonToolUtils.js +1 -0
  228. package/es/utils/tool/ImgPosUtils.js +1 -0
  229. package/es/utils/tool/LineToolUtils.js +1 -0
  230. package/es/utils/tool/MarkerUtils.js +1 -0
  231. package/es/utils/tool/PolygonUtils.js +1 -0
  232. package/es/utils/tool/RectUtils.js +1 -0
  233. package/es/utils/tool/RenderDomClass.js +20 -0
  234. package/es/utils/tool/RenderDomUtils.js +16 -0
  235. package/es/utils/tool/StyleUtils.js +1 -0
  236. package/es/utils/tool/TagUtils.js +1 -0
  237. package/es/utils/tool/UnitUtils.js +1 -0
  238. package/es/utils/tool/ZoomUtils.js +1 -0
  239. package/es/utils/tool/polygonTool.js +1 -0
  240. package/es/utils/uuid.js +1 -0
  241. package/package.json +103 -0
@@ -0,0 +1,374 @@
1
+ /**
2
+ * @file POINTCLOUD - ALPHA - DEMO
3
+ * @createdate 2022-07-11
4
+ * @author Ron <ron.f.luo@gmail.com>
5
+ */
6
+ import * as THREE from 'three';
7
+ import { TMatrix4Tuple, EPerspectiveView, IVolume, IPointCloudBox, IPointCloudSphere, I3DSpaceCoord, IPointCloudConfig } from '@labelbee/lb-utils';
8
+ import { OrthographicCamera, PerspectiveCamera, Shader } from 'three';
9
+ import { IPolygonPoint } from '@/types/tool/polygon';
10
+ import { PCDLoader } from './PCDLoader';
11
+ import { OrbitControls } from './OrbitControls';
12
+ interface IOrthographicCamera {
13
+ left: number;
14
+ right: number;
15
+ top: number;
16
+ bottom: number;
17
+ near: number;
18
+ far: number;
19
+ }
20
+ interface IProps {
21
+ container: HTMLElement;
22
+ noAppend?: boolean;
23
+ isOrthographicCamera?: boolean;
24
+ orthographicParams?: IOrthographicCamera;
25
+ backgroundColor?: string;
26
+ config?: IPointCloudConfig;
27
+ }
28
+ export declare class PointCloud {
29
+ renderer: THREE.WebGLRenderer;
30
+ scene: THREE.Scene;
31
+ camera: THREE.OrthographicCamera | THREE.PerspectiveCamera;
32
+ controls: OrbitControls;
33
+ axesHelper: THREE.AxesHelper;
34
+ pcdLoader: PCDLoader;
35
+ config?: IPointCloudConfig;
36
+ /**
37
+ * zAxis Limit for filter point over a value
38
+ */
39
+ zAxisLimit: number;
40
+ initCameraPosition: THREE.Vector3;
41
+ private container;
42
+ private isOrthographicCamera;
43
+ private pointsUuid;
44
+ private sideMatrix?;
45
+ private backgroundColor;
46
+ private pointCloudObjectName;
47
+ private rangeObjectName;
48
+ private cacheInstance;
49
+ private showDirection;
50
+ private currentPCDSrc?;
51
+ /**
52
+ * Record the src of Highlight PCD.
53
+ *
54
+ * Avoiding src error problems caused by asynchronous
55
+ */
56
+ private highlightPCDSrc?;
57
+ constructor({ container, noAppend, isOrthographicCamera, orthographicParams, backgroundColor, // GRAY_BACKGROUND
58
+ config, }: IProps);
59
+ get DEFAULT_INIT_CAMERA_POSITION(): THREE.Vector3;
60
+ get containerWidth(): number;
61
+ get containerHeight(): number;
62
+ setInitCameraPosition(vector: THREE.Vector3): void;
63
+ setConfig(config: IPointCloudConfig): void;
64
+ /**
65
+ * Init OrthographicCamera to default config by size
66
+ * @param orthographicParams
67
+ * @returns
68
+ */
69
+ initOrthographicCamera(orthographicParams: IOrthographicCamera): void;
70
+ /**
71
+ * Init PerspectiveCamera to default config by size
72
+ * @returns
73
+ */
74
+ initPerspectiveCamera(): void;
75
+ initCamera(): void;
76
+ initControls(): void;
77
+ setDefaultControls(): void;
78
+ initRenderer(): void;
79
+ init(): void;
80
+ removeObjectByName(name: string): void;
81
+ /**
82
+ * Render box by params
83
+ * @param boxParams
84
+ * @param color
85
+ */
86
+ generateBox(boxParams: IPointCloudBox, color?: number): void;
87
+ getAllAttributeColor(boxes: IPointCloudBox[]): {
88
+ [k: string]: any;
89
+ };
90
+ /**
91
+ * add new sphere just like adding new box
92
+ * @param sphereParams
93
+ */
94
+ addSphereToSense: (sphereParams: IPointCloudSphere, color?: string) => void;
95
+ generateSphere: (sphereParams: IPointCloudSphere) => void;
96
+ generateSpheres: (spheres: IPointCloudSphere[]) => void;
97
+ AddBoxToSense: (boxParams: IPointCloudBox, color?: number) => void;
98
+ generateBoxes(boxes: IPointCloudBox[]): void;
99
+ /**
100
+ * Get OrthographicCamera Params to Change
101
+ * @param boxParams
102
+ * @returns
103
+ */
104
+ getOrthographicCamera(boxParams: IPointCloudBox): {
105
+ left: number;
106
+ right: number;
107
+ top: number;
108
+ bottom: number;
109
+ near: number;
110
+ far: number;
111
+ zoom: number;
112
+ };
113
+ updateCameraZoom(zoom: number): void;
114
+ /**
115
+ * Update Camera position & target
116
+ * @param boxParams
117
+ * @param perspectiveView
118
+ * @param customCameraVector Provide a custom way.
119
+ */
120
+ updateCameraByBox(boxParams: IPointCloudBox, perspectiveView: EPerspectiveView, customCameraVector?: I3DSpaceCoord): THREE.Vector3;
121
+ updateCameraBySphere(sphereParams: IPointCloudSphere, perspectiveView: EPerspectiveView): THREE.Vector3;
122
+ updateOrthoCamera(boxParams: IPointCloudBox, perspectiveView: EPerspectiveView): {
123
+ cameraPositionVector: THREE.Vector3;
124
+ };
125
+ updateOrthoCameraBySphere(sphereParams: IPointCloudSphere, perspectiveView: EPerspectiveView): {
126
+ cameraPositionVector: THREE.Vector3;
127
+ };
128
+ /**
129
+ * Initialize the camera to the initial position
130
+ */
131
+ updateTopCamera(): void;
132
+ /**
133
+ * Update camera position & target
134
+ * @param position
135
+ * @param target
136
+ */
137
+ updateCamera(position: I3DSpaceCoord, target: I3DSpaceCoord): void;
138
+ /**
139
+ * Reset camera to center-top
140
+ */
141
+ resetCamera(): void;
142
+ /**
143
+ * Get camera target from matrix
144
+ * @param camera
145
+ * @returns
146
+ */
147
+ getOrthographicCameraTarget(camera: OrthographicCamera): THREE.Vector3;
148
+ applyCameraTarget: (camera: OrthographicCamera | PerspectiveCamera) => void;
149
+ createThreeMatrix4(matrix4: TMatrix4Tuple): THREE.Matrix4;
150
+ /**
151
+ * For pcd filter point under box
152
+ * @param boxParams
153
+ * @param points
154
+ * @param color
155
+ * @returns
156
+ */
157
+ filterPointsByBox(boxParams: IPointCloudBox, points?: Float32Array, color?: Float32Array): Promise<{
158
+ geometry: any;
159
+ num: number;
160
+ } | undefined>;
161
+ getCameraVector(centerPoint: I3DSpaceCoord, rotationZ: number, volume: IVolume, perspectiveView?: EPerspectiveView, defaultDistance?: number): THREE.Vector3;
162
+ createRange(radius: number): THREE.Line<THREE.BufferGeometry, THREE.LineBasicMaterial>;
163
+ overridePointShader: (shader: Shader) => void;
164
+ renderPointCloud(points: THREE.Points, radius?: number): void;
165
+ clearPointCloud(): void;
166
+ clearPointCloudAndRender(): void;
167
+ /**
168
+ *
169
+ * @param src
170
+ * @param radius Render the range of circle
171
+ */
172
+ loadPCDFile: (src: string, radius?: number) => Promise<void>;
173
+ /**
174
+ * It needs to be updated after load PointCloud's data.
175
+ * @param boxParams
176
+ * @returns
177
+ */
178
+ highlightOriginPointCloud(pointCloudBoxList?: IPointCloudBox[]): Promise<THREE.BufferAttribute[] | undefined> | undefined;
179
+ updateColor(color: any[]): void;
180
+ /**
181
+ * Load PCD File by box
182
+ * @param src
183
+ * @param boxParams
184
+ * @param scope
185
+ */
186
+ loadPCDFileByBox: (src: string, boxParams: IPointCloudBox, scope?: Partial<{
187
+ width: number;
188
+ height: number;
189
+ depth: number;
190
+ }>) => Promise<void>;
191
+ setShowDirection(showDirection: boolean): void;
192
+ generateRange: (radius: number) => void;
193
+ generateBoxArrow: ({ width }: IPointCloudBox) => THREE.ArrowHelper;
194
+ generateBoxTrackID: (boxParams: IPointCloudBox) => THREE.Sprite | undefined;
195
+ getTextCanvas(text: string): HTMLCanvasElement;
196
+ /**
197
+ * Filter road points and noise in all directions
198
+ * 1. The first 5% of the z-axis is used as the road coordinate
199
+ * 2. Filter out points 10cm above the road surface.
200
+ * 3. Filter out the first 0.5% of noise points in other directions
201
+ */
202
+ filterNoise(innerPointList: I3DSpaceCoord[]): I3DSpaceCoord[];
203
+ getFittedCoordinates(polygon: IPolygonPoint[], innerPointList: ICoordinate[]): import("@labelbee/lb-utils").ICoordinate[];
204
+ getSensesPointZAxisInPolygon(polygon: IPolygonPoint[], zScope?: [number, number], intelligentFit?: boolean): {
205
+ maxZ: number;
206
+ minZ: number;
207
+ count: number;
208
+ zCount: number;
209
+ fittedCoordinates: ICoordinate[];
210
+ };
211
+ /**
212
+ * ViewPort - Transformation
213
+ * @param vector
214
+ * @returns
215
+ */
216
+ getBasicCoordinate2Canvas(vector: THREE.Vector3): {
217
+ x: number;
218
+ y: number;
219
+ z: number;
220
+ };
221
+ get basicCoordinate2CanvasMatrix4(): THREE.Matrix4;
222
+ /**
223
+ * ViewPort - Transformation
224
+ * @param vector
225
+ * @returns
226
+ */
227
+ getCanvas2BasicCoordinate(vector: THREE.Vector3): THREE.Vector3;
228
+ /**
229
+ * The order of pointList is lt => lb => rb => rt
230
+ * The basic coordinate is top view(senseBee pointCloud topView coordinate)
231
+ * @param boxParams
232
+ * @returns
233
+ */
234
+ getPolygonSidePoints(boxParams: IPointCloudBox): {
235
+ x: number;
236
+ y: number;
237
+ z: number;
238
+ }[];
239
+ getPolygonBackPoints(boxParams: IPointCloudBox): {
240
+ x: number;
241
+ y: number;
242
+ z: number;
243
+ }[];
244
+ getPolygonTopPoints(boxParams: IPointCloudBox): {
245
+ x: number;
246
+ y: number;
247
+ z: number;
248
+ }[];
249
+ getModelTransformationMatrix(boxParams: IPointCloudBox): THREE.Matrix4;
250
+ /**
251
+ * Get Polygon from boxParams
252
+ *
253
+ * Notice.
254
+ * 1. You need to rotate camera to correct direction base because it uses matrixWorldInverse & projectionMatrix from camera
255
+ * @param boxParams
256
+ * @returns
257
+ */
258
+ getBoxSidePolygon2DCoordinate(boxParams: IPointCloudBox): {
259
+ polygon2d: THREE.Vector3[];
260
+ zoom: number;
261
+ };
262
+ getBoxBackPolygon2DCoordinate(boxParams: IPointCloudBox): {
263
+ polygon2d: THREE.Vector3[];
264
+ zoom: number;
265
+ };
266
+ getSphereSidePoint2DCoordinate(sphereParams: IPointCloudSphere): {
267
+ point2d: THREE.Vector3;
268
+ zoom: number;
269
+ };
270
+ getSphereBackPoint2DCoordinate(sphereParams: IPointCloudSphere): {
271
+ point2d: THREE.Vector3;
272
+ zoom: number;
273
+ };
274
+ boxParams2ViewPolygon(boxParams: IPointCloudBox, perspectiveView: EPerspectiveView): {
275
+ x: number;
276
+ y: number;
277
+ z: number;
278
+ }[];
279
+ /**
280
+ * Box to 2d Coordinate.
281
+ *
282
+ * Flow:
283
+ * 1. Model Translation
284
+ * 2. View Translation
285
+ * 3. Projection Translation
286
+ * 4. Viewport Translation
287
+ *
288
+ *
289
+ * @param boxParams
290
+ * @param perspectiveView
291
+ * @returns
292
+ */
293
+ getBoxPolygon2DCoordinate(boxParams: IPointCloudBox, perspectiveView: EPerspectiveView): {
294
+ polygon2d: THREE.Vector3[];
295
+ zoom: number;
296
+ };
297
+ getSpherePoint2DCoordinate(sphereParams: IPointCloudSphere): {
298
+ point2d: THREE.Vector3;
299
+ zoom: number;
300
+ };
301
+ getSphereTopPoint2DCoordinate(sphereParams: IPointCloudSphere): {
302
+ point2d: {
303
+ x: number;
304
+ y: number;
305
+ };
306
+ zoom: number;
307
+ };
308
+ getBoxTopPolygon2DCoordinate(boxParams: IPointCloudBox): {
309
+ polygon2d: {
310
+ x: number;
311
+ y: number;
312
+ }[];
313
+ zoom: number;
314
+ };
315
+ getNewBoxBySideUpdate(offsetCenterPoint: {
316
+ x: number;
317
+ y: number;
318
+ z: number;
319
+ }, // Just use x now.
320
+ offsetWidth: number, offsetDepth: number, selectedPointCloudBox: IPointCloudBox): {
321
+ newBoxParams: IPointCloudBox;
322
+ };
323
+ getNewBoxByBackUpdate(offsetCenterPoint: {
324
+ x: number;
325
+ y: number;
326
+ z: number;
327
+ }, offsetWidth: number, offsetDepth: number, selectedPointCloudBox: IPointCloudBox): {
328
+ newBoxParams: IPointCloudBox;
329
+ };
330
+ /**
331
+ * Get new Box by matrix , but it's work.
332
+ *
333
+ * Use it later.
334
+ * @param pointList
335
+ * @param offsetHeight
336
+ * @param offsetZ
337
+ * @returns
338
+ */
339
+ getNewBoxBySideUpdateByPoints(pointList: any[], offsetHeight: number, offsetZ: number, selectedPointCloudBox: IPointCloudBox): {
340
+ newBoxParams: {
341
+ center: {
342
+ x: number;
343
+ y: number;
344
+ z: number;
345
+ };
346
+ width: number;
347
+ height: number;
348
+ depth: number;
349
+ rotation: number;
350
+ attribute: string;
351
+ id: string;
352
+ valid: boolean;
353
+ trackID?: number | undefined;
354
+ subAttribute?: {
355
+ [k: string]: string;
356
+ } | undefined;
357
+ count?: number | undefined;
358
+ newPointList?: import("@labelbee/lb-utils").ICoordinate[] | undefined;
359
+ };
360
+ } | undefined;
361
+ /**
362
+ * Filter Point by z-aixs
363
+ */
364
+ filterZAxisPoints(pcdPoints?: any): void;
365
+ applyZAxisPoints: (zAxisLimit: number) => void;
366
+ /**
367
+ * Update point size
368
+ * @param zoomIn
369
+ */
370
+ updatePointSize: (zoomIn: boolean) => void;
371
+ render(): void;
372
+ }
373
+ export * from './matrix';
374
+ export * from './annotation';
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The set of Matrix multiplication
3
+ */
4
+ import * as THREE from 'three';
5
+ import { TMatrix4Tuple, IPointCloudBox, I3DSpaceCoord, TMatrix14Tuple, TMatrix13Tuple } from '@labelbee/lb-utils';
6
+ export declare function createThreeMatrix4(matrix4: TMatrix4Tuple): THREE.Matrix4;
7
+ /**
8
+ * Transfer the Kitti format (defined by array) to Three Matrix (flatten array)
9
+ * @param P
10
+ * @param R
11
+ * @param T
12
+ * @returns
13
+ */
14
+ export declare function transferKitti2Matrix(P: [TMatrix14Tuple, TMatrix14Tuple, TMatrix14Tuple], R: [TMatrix13Tuple, TMatrix13Tuple, TMatrix13Tuple], T: [TMatrix14Tuple, TMatrix14Tuple, TMatrix14Tuple]): {
15
+ composeMatrix4: THREE.Matrix4;
16
+ PM: THREE.Matrix4;
17
+ RM: THREE.Matrix4;
18
+ TM: THREE.Matrix4;
19
+ };
20
+ export declare function rotatePoint(points: {
21
+ x: number;
22
+ y: number;
23
+ z?: number;
24
+ }, centerPoint: I3DSpaceCoord, rotationZ: number): THREE.Vector3;
25
+ export declare function lidar2image(point: {
26
+ x: number;
27
+ y: number;
28
+ z: number;
29
+ }, composeMatrix4: THREE.Matrix4): THREE.Vector4 | undefined;
30
+ export declare function getCuboidFromPointCloudBox(boxParams: IPointCloudBox): {
31
+ polygonPointList: {
32
+ x: number;
33
+ y: number;
34
+ }[];
35
+ zMax: number;
36
+ zMin: number;
37
+ attribute: string;
38
+ center: I3DSpaceCoord;
39
+ id: string;
40
+ rotation: number;
41
+ valid: boolean;
42
+ trackID?: number | undefined;
43
+ subAttribute?: {
44
+ [k: string]: string;
45
+ } | undefined;
46
+ count?: number | undefined;
47
+ newPointList?: import("@labelbee/lb-utils").ICoordinate[] | undefined;
48
+ width: number;
49
+ height: number;
50
+ depth: number;
51
+ };
52
+ export declare function pointCloudLidar2image(boxParams: IPointCloudBox, cameraMatrix: {
53
+ P: [TMatrix14Tuple, TMatrix14Tuple, TMatrix14Tuple];
54
+ R: [TMatrix13Tuple, TMatrix13Tuple, TMatrix13Tuple];
55
+ T: [TMatrix14Tuple, TMatrix14Tuple, TMatrix14Tuple];
56
+ }): {
57
+ type: string;
58
+ pointList: {
59
+ id: string;
60
+ x: number;
61
+ y: number;
62
+ }[];
63
+ }[];
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @file For multi-level management of tools
3
+ * @createDate 2022-07-27
4
+ * @author Ron <ron.f.luo@gmail.com>
5
+ */
6
+ import { EToolName, THybridToolName } from '@/constant/tool';
7
+ import { RectOperation } from './toolOperation/rectOperation';
8
+ import PolygonOperation from './toolOperation/polygonOperation';
9
+ import SegmentByRect from './toolOperation/segmentByRect';
10
+ interface IToolSchedulerOperation {
11
+ }
12
+ interface IToolSchedulerProps {
13
+ container: HTMLElement;
14
+ size: ISize;
15
+ toolName: THybridToolName;
16
+ imgNode?: HTMLImageElement;
17
+ config?: string;
18
+ style?: any;
19
+ }
20
+ export declare class HybridToolUtils {
21
+ static isSingleTool(toolName: THybridToolName): boolean;
22
+ static isHybridTool(toolName: THybridToolName): boolean;
23
+ static getTopToolName: (toolName: THybridToolName) => EToolName;
24
+ }
25
+ export declare class ToolScheduler implements IToolSchedulerOperation {
26
+ private container;
27
+ private toolOperationList;
28
+ private toolOperationDom;
29
+ private toolOperationNameList;
30
+ private size;
31
+ private config;
32
+ private style;
33
+ private imgNode?;
34
+ constructor(props: IToolSchedulerProps);
35
+ setImgNode(imgNode: HTMLImageElement, basicImgInfo?: Partial<{
36
+ valid: boolean;
37
+ rotate: number;
38
+ }>): void;
39
+ setImgAttribute(imgAttribute: IImageAttribute): void;
40
+ setSize(size: ISize): void;
41
+ syncPosition(currentPos: ICoordinate, zoom: number, imgInfo: ISize, currentToolInstance: any): void;
42
+ get defaultSize(): {
43
+ width: number;
44
+ height: number;
45
+ };
46
+ createDom(): HTMLDivElement;
47
+ getEmptyImage(width: number, height: number): HTMLImageElement;
48
+ /**
49
+ * Unified creation of toolInstance
50
+ * @param tool
51
+ * @param imgNode
52
+ * @param config
53
+ * @returns
54
+ */
55
+ createOperation(tool?: EToolName, imgNode?: HTMLImageElement, config?: Object): any;
56
+ /**
57
+ * Notice & TODO. Temporary additions
58
+ * Just to switch last two canvas。
59
+ *
60
+ * It will be deleted later.
61
+ */
62
+ switchLastTwoCanvas(): RectOperation | PolygonOperation | undefined;
63
+ /**
64
+ * Notice & TODO. Temporary additions
65
+ * Just to set data to toolInstance.
66
+ * @returns
67
+ */
68
+ getFirstToolOperation(): RectOperation | PolygonOperation | SegmentByRect;
69
+ /**
70
+ * Switch to canvas by given toolName
71
+ * TODO: change operationList to operationMap
72
+ */
73
+ switchToCanvas(toolName: EToolName): RectOperation | PolygonOperation | undefined;
74
+ /**
75
+ *
76
+ * @param toolName
77
+ * @param result
78
+ * Update result by give toolName
79
+ * All the operation instances are maintained in toolOperationList,
80
+ * there is no more specific instance like pointCloud2dOperation you can reach,
81
+ * so if you need to update result in specific operation instance, you can try this.
82
+ */
83
+ updateDataByToolName(toolName: EToolName, result: any): void;
84
+ clearStatusAndResult(): void;
85
+ destroyAllLayer(): void;
86
+ init(): void;
87
+ }
88
+ export {};