@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,238 @@
1
+ import { EToolName, ELineTypes } from '@/constant/tool';
2
+ import type { ICuboid, IDrawingCuboid, IPlanePoints } from '@/types/tool/cuboid';
3
+ import { IPolygonPoint, IPolygonData, IPolygonConfig } from '../../types/tool/polygon';
4
+ export default class AxisUtils {
5
+ /**
6
+ * 获取原图坐标下,相对当前图片的偏移值
7
+ * @param coordinate
8
+ * @param currentPos
9
+ * @param zoom
10
+ */
11
+ static getOffsetCoordinate(coordinate: ICoordinate, currentPos: ICoordinate, zoom: number): {
12
+ x: number;
13
+ y: number;
14
+ };
15
+ static changeDrawOutsideTarget(coord: ICoordinate, currentPos: ICoordinate, imgInfo: ISize, drawOutsideTarget?: boolean, basicResult?: IRect, zoom?: number): ICoordinate;
16
+ static changeCoordinateByRotate(coordinate: ICoordinate, rotate: number, imgSize: ISize): ICoordinate;
17
+ /**
18
+ * 计算点在 zoom 和 currentPos 的转换
19
+ * @param rect
20
+ * @param zoom
21
+ * @param currentPos
22
+ * @returns
23
+ */
24
+ static changeRectByZoom(rect: IRect, zoom: number, currentPos?: ICoordinate): {
25
+ x: number;
26
+ y: number;
27
+ width: number;
28
+ height: number;
29
+ id: string;
30
+ sourceID: string;
31
+ valid: boolean;
32
+ order?: number | undefined;
33
+ attribute: string;
34
+ textAttribute: string;
35
+ disableDelete?: boolean | undefined;
36
+ label?: string | undefined;
37
+ };
38
+ /**
39
+ * 计算点在 zoom 和 currentPos 的转换
40
+ * @param point
41
+ * @param zoom
42
+ * @param currentPos
43
+ * @returns
44
+ */
45
+ static changePointByZoom(point: IPoint | IPolygonPoint, zoom: number, currentPos?: ICoordinate): {
46
+ x: number;
47
+ y: number;
48
+ specialPoint?: boolean | undefined;
49
+ specialEdge?: boolean | undefined;
50
+ } | {
51
+ x: number;
52
+ y: number;
53
+ };
54
+ /**
55
+ * 计算点集在 zoom 和 currentPos 的转换
56
+ * @param pointList
57
+ * @param zoom
58
+ * @param currentPos
59
+ * @returns
60
+ */
61
+ static changePointListByZoom(pointList: IPoint[] | IPolygonPoint[], zoom: number, currentPos?: ICoordinate): ({
62
+ x: number;
63
+ y: number;
64
+ specialPoint?: boolean | undefined;
65
+ specialEdge?: boolean | undefined;
66
+ } | {
67
+ x: number;
68
+ y: number;
69
+ })[];
70
+ static changePlanePointByZoom(planePoints: IPlanePoints, zoom: number, currentPos?: ICoordinate): IPlanePoints;
71
+ static changeCuboidByZoom(cuboid: ICuboid | IDrawingCuboid, zoom: number, currentPos?: ICoordinate): ICuboid | IDrawingCuboid;
72
+ static transformPlain2PointList({ tl, tr, br, bl }: IPlanePoints): any[];
73
+ /**
74
+ * 扩大点的热区范围
75
+ * @param axis
76
+ * @param radius
77
+ * @returns
78
+ */
79
+ static axisArea(axis: ICoordinate, radius?: number): {
80
+ x: number;
81
+ y: number;
82
+ }[];
83
+ /**
84
+ * 计算当前坐标相对于原图的坐标
85
+ * @param coord 在 canvas 内的相对坐标
86
+ */
87
+ static getOriginCoordinateWithOffsetCoordinate(coord: ICoordinate, zoom?: number, currentPos?: {
88
+ x: number;
89
+ y: number;
90
+ }): {
91
+ x: number;
92
+ y: number;
93
+ };
94
+ /**
95
+ * 获取当前坐标是否在当前点
96
+ * 注意:checkPoint 为原图的坐标
97
+ *
98
+ * @export
99
+ * @param {IPolygonPoint} checkPoint
100
+ * @param {IPolygonPoint[]} polygonPoints
101
+ * @param {number} [scope=3]
102
+ * @returns {number}
103
+ */
104
+ static returnClosePointIndex(checkPoint: IPolygonPoint | ICoordinate, polygonPoints: IPolygonPoint[] | ICoordinate[], scope?: number): number;
105
+ /**
106
+ * Judge the mousePoint is in the hoverRange of cuboid.
107
+ * @param checkPoint
108
+ * @param cuboid
109
+ * @param options
110
+ * @returns
111
+ */
112
+ static isCloseCuboid(checkPoint: ICoordinate, cuboid: ICuboid, options?: Partial<{
113
+ scope: number;
114
+ zoom: number;
115
+ }>): boolean;
116
+ /**
117
+ * Judge the mousePoint is in the hoverRange of cuboidList.
118
+ * @param checkPoint
119
+ * @param cuboid
120
+ * @param options
121
+ * @returns
122
+ */
123
+ static isCloseCuboidList(checkPoint: ICoordinate, cuboidList: ICuboid[], options?: Partial<{
124
+ scope: number;
125
+ zoom: number;
126
+ }>): boolean;
127
+ /**
128
+ * Point > Line
129
+ * @param checkPoint
130
+ * @param cuboid
131
+ * @param scope
132
+ */
133
+ static returnClosePointOrLineInCuboid(checkPoint: ICoordinate, cuboid: ICuboid, options?: Partial<{
134
+ scope: number;
135
+ zoom: number;
136
+ }>): {
137
+ type: string;
138
+ points: ({
139
+ x: number;
140
+ y: number;
141
+ specialPoint?: boolean | undefined;
142
+ specialEdge?: boolean | undefined;
143
+ } | {
144
+ x: number;
145
+ y: number;
146
+ })[];
147
+ originCuboid: ICuboid;
148
+ positions: import("@/types/tool/cuboid").ICuboidPosition[];
149
+ }[] | undefined;
150
+ /**
151
+ * 对比两个点是否在一范围内
152
+ *
153
+ * @export
154
+ * @param {IPolygonPoint} currentCoord
155
+ * @param {IPolygonPoint} targetCoord
156
+ * @param {number} scope
157
+ * @returns
158
+ */
159
+ static getIsInScope(currentCoord: ICoordinate, targetCoord: ICoordinate, scope: number): boolean;
160
+ }
161
+ export declare class CoordinateUtils {
162
+ private currentPos;
163
+ private zoom;
164
+ private basicImgInfo;
165
+ private basicResult?;
166
+ private dependToolConfig?;
167
+ private dependToolName;
168
+ constructor(props: any);
169
+ get isDependPolygon(): boolean;
170
+ get isDependRect(): boolean;
171
+ get isDependOriginalImage(): boolean;
172
+ /**
173
+ * 渲染坐标 => 绝对坐标
174
+ * @param renderCoordinate
175
+ */
176
+ getAbsCoord(renderCoord: ICoordinate): {
177
+ x: number;
178
+ y: number;
179
+ };
180
+ /**
181
+ * 绝对坐标 => 渲染坐标
182
+ * @param absoluteCoordinate
183
+ */
184
+ getRenderCoord(absCoord: ICoordinate): {
185
+ x: number;
186
+ y: number;
187
+ };
188
+ /**
189
+ * 在矩形内的点
190
+ * @param absCoord
191
+ * @param rect
192
+ */
193
+ coordInsideRect(absCoord: ICoordinate, rect: {
194
+ x: number;
195
+ y: number;
196
+ height: number;
197
+ width: number;
198
+ }): {
199
+ x: number;
200
+ y: number;
201
+ };
202
+ getPolygonPointList(lineType: ELineTypes, pointList: IPoint[]): any[];
203
+ /**
204
+ * 计算线段与线段的交点
205
+ * @param curCoord
206
+ * @param preCoord
207
+ * @param polygonPointListToLineList
208
+ */
209
+ getIntersection(curCoord: ICoordinate, preCoord: ICoordinate, polygonPointListToLineList: IPoint[]): {
210
+ point: ICoordinate;
211
+ minDistance?: undefined;
212
+ } | {
213
+ point: IPoint;
214
+ minDistance: number;
215
+ } | undefined;
216
+ /**
217
+ * 在多边形内的点
218
+ * @param absCoord
219
+ * @param rect
220
+ */
221
+ coordInsidePolygon(curCoord: ICoordinate, preCoord: ICoordinate, polygon: IPolygonData, polygonToolConfig: IPolygonConfig): ICoordinate;
222
+ coordInsideImage(coord: ICoordinate): {
223
+ x: number;
224
+ y: number;
225
+ };
226
+ /**
227
+ * 根据依赖工具计算下一个点的绝对坐标
228
+ * @param curAbsCoord
229
+ * @param preAbsCoord
230
+ */
231
+ getNextCoordByDependTool(curAbsCoord: ICoordinate, preAbsCoord: ICoordinate): ICoordinate | undefined;
232
+ setDependInfo(dependToolName: EToolName | '', dependToolConfig?: IRectConfig | IPolygonConfig): void;
233
+ setBasicImgInfo(basicImgInfo: any): void;
234
+ setBasicResult(basicResult: any): void;
235
+ setZoomAndCurrentPos(zoom: number, currentPos: ICoordinate): void;
236
+ isCoordInsideTarget(coord: ICoordinate): boolean;
237
+ isInBasicPolygon(coord: ICoordinate): boolean;
238
+ }
@@ -0,0 +1,46 @@
1
+ export default class CanvasUtils {
2
+ static getMousePositionOnCanvasFromEvent(event: MouseEvent, canvas: HTMLCanvasElement): {
3
+ x: number;
4
+ y: number;
5
+ } | null;
6
+ static getClientRect(canvas: HTMLCanvasElement): {
7
+ x: number;
8
+ y: number;
9
+ width: number;
10
+ height: number;
11
+ } | null;
12
+ static getSize(canvas: HTMLCanvasElement): {
13
+ width: number;
14
+ height: number;
15
+ } | null;
16
+ /**
17
+ * 点在视野内
18
+ * @param coord
19
+ * @param viewPort
20
+ */
21
+ static inViewPort(coord: ICoordinate | undefined, viewPort: {
22
+ top: number;
23
+ bottom: number;
24
+ left: number;
25
+ right: number;
26
+ }): boolean;
27
+ /**
28
+ * 计算视野边界点
29
+ * @param canvas
30
+ * @param originOffset
31
+ * @param zoom
32
+ * @returns
33
+ */
34
+ static getViewPort: (canvas: HTMLCanvasElement | ISize, originOffset: ICoordinate, zoom: number) => {
35
+ top: number;
36
+ bottom: number;
37
+ left: number;
38
+ right: number;
39
+ };
40
+ /**
41
+ * 获取当前的渲染像素比例
42
+ * @param context
43
+ * @returns
44
+ */
45
+ static getPixelRatio: (context: any) => number;
46
+ }
@@ -0,0 +1,105 @@
1
+ import { IPolygonPoint } from '../../types/tool/polygon';
2
+ import { ESortDirection } from '../../constant/annotation';
3
+ type point = {
4
+ id: string;
5
+ x: number;
6
+ y: number;
7
+ };
8
+ export default class CommonToolUtils {
9
+ /**
10
+ * 找到指定步骤的数据
11
+ * @param step 获取的步骤
12
+ * @param stepList 步骤列表
13
+ * @returns 步骤配置
14
+ */
15
+ static getStepInfo(step: number, stepList: IStepInfo[]): IStepInfo;
16
+ /**
17
+ * 获取当前步骤的步骤配置信息,用于当前标注配置的获取
18
+ * 注意: 需要与 getStepInfo 区分,因为 getStepInfo 拿取的是直接的步骤信息
19
+ * @export
20
+ * @param {number} currentStep
21
+ * @param {IStepInfo[]} stepList
22
+ * @returns {*}
23
+ */
24
+ static getCurrentStepInfo(currentStep: number, stepList: IStepInfo[]): any;
25
+ static jsonParser: (content: any, defaultValue?: any) => any;
26
+ /**
27
+ * 获取结果中最大的order
28
+ *
29
+ * @export
30
+ * @param {any[]} result
31
+ * @returns {number}
32
+ */
33
+ static getMaxOrder(result: any[]): number;
34
+ /**
35
+ * 表单控件控件判断 返回 Boolean
36
+ * hotkey is effective only whene filter return true
37
+ * @param event
38
+ * @returns {boolean}
39
+ */
40
+ static hotkeyFilter(event: any): boolean;
41
+ static getNextSelectedRectID(rectList: point[], sort?: ESortDirection, selectedID?: string): point;
42
+ static getNextSelectedRectIDByEvent(pointList: point[], event: KeyboardEvent, selectedID?: string): point;
43
+ /**
44
+ * 计算当前状态下需要展示的结果集合
45
+ * @param T 当前图片的结果框
46
+ * @param sourceID 当前状态依赖的框体,若依赖原图则返回 '0'
47
+ * @param attributeLockList 当前展示的属性
48
+ * @param selectedID 是否含有选中逻辑
49
+ * @returns
50
+ */
51
+ static getRenderResultList<T = any>(resultList: any[], sourceID: string, attributeLockList?: string[], selectedID?: string): [T[], T | undefined];
52
+ /**
53
+ * 获取当前依赖情况下的 sourceID 提取
54
+ */
55
+ static getSourceID(basicResult?: any): any;
56
+ /**
57
+ * 获取当前点集的所有线条
58
+ * @param pointList
59
+ * @returns
60
+ */
61
+ static findAllLine(pointList: IPolygonPoint[] | point[], isClose?: boolean): {
62
+ point1: IPolygonPoint | point;
63
+ point2: IPolygonPoint | point;
64
+ pointIndex: number;
65
+ }[];
66
+ /**
67
+ * 转换当前依赖 sourceID
68
+ * @param sourceID
69
+ * @returns
70
+ */
71
+ static translateSourceID(sourceID: string | number | undefined): string | number;
72
+ /**
73
+ * 兼容判断 sourceID 为 空字符串、不存在、数字的情况
74
+ * @param sourceA
75
+ * @param sourceB
76
+ * @returns
77
+ */
78
+ static isDifferSourceID(sourceIDA: string | number, sourceIDB: string | number): boolean;
79
+ /**
80
+ * 兼容判断是否为相同类型的 sourceID
81
+ * @param sourceIDA
82
+ * @param sourceIDB
83
+ * @returns
84
+ */
85
+ static isSameSourceID(sourceIDA: string | number | undefined, sourceIDB: string | number | undefined): boolean;
86
+ /**
87
+ * 获取下一个列表标记的值和位置
88
+ * @param resultList
89
+ * @param markerList
90
+ * @param markerIndex
91
+ * @returns
92
+ */
93
+ static getNextMarker(resultList: Array<IPointUnit | IRect>, markerList?: IInputList[], markerIndex?: number): {
94
+ label: string;
95
+ index: number;
96
+ } | undefined;
97
+ /**
98
+ * 获取当前值在列表标注的位置
99
+ * @param label
100
+ * @param markerList
101
+ * @returns
102
+ */
103
+ static getCurrentMarkerIndex(label: string, markerList?: IInputList[]): number;
104
+ }
105
+ export {};
@@ -0,0 +1,267 @@
1
+ import { ECuboidLineDirection, ECuboidPlain, ECuboidPosition, EDragTarget, ECuboidDirection } from '@/constant/annotation';
2
+ import type { ICuboid, ICuboidConfig, ICuboidPosition, IDrawingCuboid, IPlanePoints } from '@/types/tool/cuboid';
3
+ /**
4
+ * Get the basicInfo of cuboid-frontPoints.
5
+ * @param param0
6
+ * @returns
7
+ */
8
+ export declare function getPlanePointsBasicInfo({ tr, tl, br }: IPlanePoints): {
9
+ width: number;
10
+ height: number;
11
+ centerPoints: {
12
+ x: number;
13
+ y: number;
14
+ };
15
+ };
16
+ export declare function getCuboidBasicInfo({ frontPoints, backPoints, }: {
17
+ frontPoints: IPlanePoints;
18
+ backPoints: IPlanePoints;
19
+ }): {
20
+ frontCenter: {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ backCenter: {
25
+ x: number;
26
+ y: number;
27
+ };
28
+ frontWidth: number;
29
+ frontHeight: number;
30
+ backWidth: number;
31
+ backHeight: number;
32
+ isLeftSide: boolean;
33
+ };
34
+ /**
35
+ * Use two diagonalPoints to create Regular Rect(Plain)
36
+ * @param p1
37
+ * @param p2
38
+ * @returns
39
+ */
40
+ export declare function getPlainPointsByDiagonalPoints(p1: ICoordinate, p2: ICoordinate): IPlanePoints;
41
+ /**
42
+ * Get the max external quadrilateral by points.
43
+ * @param points
44
+ * @returns
45
+ */
46
+ export declare function getMaxExternalQuadrilateral(points: IPlanePoints): {
47
+ tl: {
48
+ x: any;
49
+ y: any;
50
+ };
51
+ tr: {
52
+ x: any;
53
+ y: any;
54
+ };
55
+ bl: {
56
+ x: any;
57
+ y: any;
58
+ };
59
+ br: {
60
+ x: any;
61
+ y: any;
62
+ };
63
+ };
64
+ export declare function judgeCuboidLineIsRowOrColumn(pointList: [ICuboidPosition, ICuboidPosition]): ECuboidLineDirection | undefined;
65
+ /**
66
+ * Copy the plain through points and new bottomRightPoint.
67
+ * @param param0
68
+ * @returns
69
+ */
70
+ export declare function getPointsByBottomRightPoint({ coord, points, }: {
71
+ coord: ICoordinate;
72
+ points: IPlanePoints;
73
+ }): IPlanePoints;
74
+ /**
75
+ * Copy the plain through points and new bottomLeftPoint.
76
+ *
77
+ * Notice: currentPoints is just regular rectangle.
78
+ *
79
+ * @param param0
80
+ * @returns
81
+ */
82
+ export declare function getPointsByBottomLeftPoint({ coord, points, }: {
83
+ coord: ICoordinate;
84
+ points: IPlanePoints;
85
+ }): IPlanePoints;
86
+ /**
87
+ * The showing sideline is line that connects the front and back planes.
88
+ * @param param0
89
+ * @returns
90
+ */
91
+ export declare function getCuboidShowingSideLine({ frontPoints, backPoints, }: {
92
+ frontPoints: IPlanePoints;
93
+ backPoints: IPlanePoints;
94
+ }): {
95
+ top: {
96
+ p1: ICoordinate;
97
+ p2: ICoordinate;
98
+ };
99
+ bottom: {
100
+ p1: ICoordinate;
101
+ p2: ICoordinate;
102
+ };
103
+ };
104
+ /**
105
+ * Get the intersections from frontPoints & backPoints.
106
+ *
107
+ * @param param0
108
+ * @returns
109
+ */
110
+ export declare function getPointsByIntersection({ frontPoints, backPoints, }: {
111
+ frontPoints: IPlanePoints;
112
+ backPoints: IPlanePoints;
113
+ }): {
114
+ backPoints: {
115
+ bl: ICoordinate;
116
+ tl: ICoordinate;
117
+ br: ICoordinate;
118
+ tr: ICoordinate;
119
+ };
120
+ };
121
+ /**
122
+ * When the point
123
+ * @param frontPoints
124
+ * @param backPoints
125
+ */
126
+ export declare function getBackPointsByFrontPoints({ frontPoints, backPoints, }: {
127
+ frontPoints: IPlanePoints;
128
+ backPoints: IPlanePoints;
129
+ }): {
130
+ frontPoints: IPlanePoints;
131
+ backPoints: {
132
+ bl: ICoordinate;
133
+ tl: ICoordinate;
134
+ br: ICoordinate;
135
+ tr: ICoordinate;
136
+ };
137
+ };
138
+ export declare function getFrontPointsByBackPoints({ frontPoints, backPoints, }: {
139
+ frontPoints: IPlanePoints;
140
+ backPoints: IPlanePoints;
141
+ }): {
142
+ frontPoints: {
143
+ bl: ICoordinate;
144
+ tl: ICoordinate;
145
+ br: ICoordinate;
146
+ tr: ICoordinate;
147
+ };
148
+ backPoints: IPlanePoints;
149
+ };
150
+ /**
151
+ * Get SideLine By FrontPoints & BackPoints
152
+ * @param param0
153
+ * @returns
154
+ */
155
+ export declare function getCuboidAllSideLine({ frontPoints, backPoints }: ICuboid): {
156
+ p1: ICoordinate;
157
+ p2: ICoordinate;
158
+ }[];
159
+ export declare function getHighlightLines(cuboid: ICuboid): ({
160
+ p1: ICoordinate;
161
+ p2: ICoordinate;
162
+ positions: {
163
+ plain: ECuboidPlain;
164
+ position: ECuboidPosition;
165
+ }[];
166
+ plain?: undefined;
167
+ } | {
168
+ p1: ICoordinate;
169
+ p2: ICoordinate;
170
+ plain: ECuboidPlain;
171
+ positions: {
172
+ plain: ECuboidPlain;
173
+ position: ECuboidPosition;
174
+ }[];
175
+ })[];
176
+ /**
177
+ * Just showing the points which can be adjusted
178
+ * @param cuboid
179
+ * @returns
180
+ */
181
+ export declare function getHighlightPoints(cuboid: ICuboid): {
182
+ point: ICoordinate;
183
+ positions: ICuboidPosition[];
184
+ }[];
185
+ /**
186
+ * Get the range of Cuboid in 2D.
187
+ *
188
+ * @param param0
189
+ * @returns
190
+ */
191
+ export declare function getCuboidHoverRange(cuboid: ICuboid): ICoordinate[];
192
+ /**
193
+ * Notice: positions just support point and line moving.
194
+ * @param param0
195
+ */
196
+ export declare function getNewPointsAfterOffset({ offset, frontPoints, backPoints, positions, }: {
197
+ frontPoints: IPlanePoints;
198
+ backPoints: IPlanePoints;
199
+ offset: ICoordinate;
200
+ positions?: ICuboidPosition[];
201
+ }): {
202
+ frontPoints: IPlanePoints;
203
+ backPoints: IPlanePoints;
204
+ };
205
+ /**
206
+ * Update cuboid when dragging.
207
+ * @param param0
208
+ * @returns
209
+ */
210
+ export declare function getCuboidDragMove({ offset, cuboid, dragTarget, positions, }: {
211
+ offset: ICoordinate;
212
+ cuboid: ICuboid;
213
+ dragTarget: EDragTarget;
214
+ positions?: ICuboidPosition[];
215
+ }): ICuboid | undefined;
216
+ /**
217
+ * Get the points of the corresponding faces by direction
218
+ * @param cuboid
219
+ * @returns
220
+ */
221
+ export declare function getPointListsByDirection({ direction, frontPoints, backPoints, }: {
222
+ direction: ECuboidDirection;
223
+ frontPoints: IPlanePoints;
224
+ backPoints: IPlanePoints;
225
+ }): any[] | undefined;
226
+ /**
227
+ * Get the offset of toggleDirection Dom.
228
+ *
229
+ * Calculation
230
+ * 1. FrontPoints left centerPoints.
231
+ * 2. Offset the size of toggleDom.
232
+ * @param param0
233
+ * @returns
234
+ */
235
+ export declare function getToggleDirectionButtonOffset({ cuboid, currentPos, zoom, }: {
236
+ cuboid: ICuboid;
237
+ currentPos: ICoordinate;
238
+ zoom: number;
239
+ }): {
240
+ left: number;
241
+ top: number;
242
+ };
243
+ /**
244
+ * The default offset is base on iconSvg.
245
+ *
246
+ * @param param0
247
+ * @returns
248
+ */
249
+ export declare function getCuboidTextAttributeOffset({ cuboid, currentPos, zoom, leftOffset, topOffset, }: {
250
+ cuboid: ICuboid | IDrawingCuboid;
251
+ currentPos: ICoordinate;
252
+ zoom: number;
253
+ leftOffset?: number;
254
+ topOffset?: number;
255
+ }): {
256
+ left: number;
257
+ top: number;
258
+ };
259
+ /**
260
+ * Judgement of minWidth & minHeight
261
+ * @param param0
262
+ * @returns
263
+ */
264
+ export declare function isCuboidWithInLimits({ cuboid, config }: {
265
+ cuboid: ICuboid | IDrawingCuboid;
266
+ config: ICuboidConfig;
267
+ }): boolean;
@@ -0,0 +1,47 @@
1
+ declare class DblClickEventListener {
2
+ private dom;
3
+ private setTimeFun?;
4
+ private clickCoord;
5
+ private isDoubleClick;
6
+ private rcTime;
7
+ private delay;
8
+ private mouseUp;
9
+ private mouseMove;
10
+ private dblclick;
11
+ private cacheFunction;
12
+ private mouseDownTime;
13
+ constructor(dom: HTMLElement, delay: number);
14
+ getRcTime(): number;
15
+ /**
16
+ * 获取当前的坐标,用于点击位置的快速获取
17
+ *
18
+ * @param {MouseEvent} e
19
+ * @returns
20
+ * @memberof DblClickEventListen
21
+ */
22
+ getCoord(e: MouseEvent): {
23
+ x: number;
24
+ y: number;
25
+ };
26
+ /**
27
+ * 删除绑定事件
28
+ *
29
+ * @returns
30
+ * @memberof DblClickEventListen
31
+ */
32
+ removeEvent(): void;
33
+ onMouseDown: () => void;
34
+ /**
35
+ * 用于添加鼠标单击事件, 左键双击事件,右键双击事件
36
+ *
37
+ * @param {*} singleClickFun
38
+ * @param {*} leftDblClick
39
+ * @param {*} rightDblClick
40
+ * @param {*} isAllowDouble 是否允许执行 double click,如果为 true 则进行的延迟,否则将立即执行,增加操作流畅性
41
+ * @returns {void}
42
+ * @memberof DblClickEventListen
43
+ */
44
+ addEvent(singleClickFun: any, leftDblClick: any, rightDblClick: any, isAllowDouble?: (e: any) => boolean): void;
45
+ clearRightDblClick(): void;
46
+ }
47
+ export default DblClickEventListener;