@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,266 @@
1
+ import { IBasicText } from '@labelbee/lb-utils';
2
+ import { EOperationMode, EToolName } from '@/constant/tool';
3
+ import { IPolygonConfig, IPolygonData } from '@/types/tool/polygon';
4
+ import { CoordinateUtils } from '@/utils/tool/AxisUtils';
5
+ import { EDragStatus, EGrowthMode, ELang } from '../../constant/annotation';
6
+ import ActionsHistory from '../../utils/ActionsHistory';
7
+ import DblClickEventListener from '../../utils/tool/DblClickEventListener';
8
+ import EventListener from './eventListener';
9
+ interface IBasicToolOperationProps {
10
+ container: HTMLElement;
11
+ size: ISize;
12
+ imgNode?: HTMLImageElement;
13
+ style?: any;
14
+ rotate?: number;
15
+ imgAttribute?: any;
16
+ forbidOperation?: boolean;
17
+ config: string;
18
+ defaultAttribute?: string;
19
+ forbidCursorLine?: boolean;
20
+ showDefaultCursor?: boolean;
21
+ forbidBasicResultRender?: boolean;
22
+ isAppend?: boolean;
23
+ hiddenImg?: boolean;
24
+ }
25
+ /**
26
+ * 参考显示数据
27
+ */
28
+ interface IReferenceData {
29
+ toolName: EToolName.Polygon | EToolName.Line | EToolName.LineMarker;
30
+ result: IPolygonData[] | ILinePoint[];
31
+ config: any;
32
+ }
33
+ declare class BasicToolOperation extends EventListener {
34
+ container: HTMLElement;
35
+ canvas: HTMLCanvasElement;
36
+ basicCanvas: HTMLCanvasElement;
37
+ imgNode?: HTMLImageElement;
38
+ basicImgInfo: any;
39
+ isImgError: boolean;
40
+ basicResult?: any;
41
+ referenceData?: IReferenceData;
42
+ dependToolName?: EToolName;
43
+ history: ActionsHistory;
44
+ size: ISize;
45
+ isShowCursor: boolean;
46
+ forbidOperation: boolean;
47
+ forbidBasicResultRender: boolean;
48
+ style: any;
49
+ zoom: number;
50
+ currentPos: ICoordinate;
51
+ coord: ICoordinate;
52
+ imgInfo?: ISize;
53
+ isDrag: boolean;
54
+ isSpaceKey: boolean;
55
+ attributeLockList: string[];
56
+ dblClickListener: DblClickEventListener;
57
+ isHidden: boolean;
58
+ config: any;
59
+ dragStatus: EDragStatus;
60
+ defaultAttribute: string;
61
+ forbidCursorLine: boolean;
62
+ lang: ELang;
63
+ dataInjectionAtCreation?: TDataInjectionAtCreateion;
64
+ renderEnhance?: IRenderEnhance;
65
+ customRenderStyle?: (data: IRect | IPolygonData | IPoint | ILine | ITagResult | IBasicText) => IAnnotationStyle;
66
+ operationMode: EOperationMode;
67
+ private _firstClickCoordinate?;
68
+ private innerZoom;
69
+ private currentPosStorage?;
70
+ private basicZoom;
71
+ private isSpaceClick;
72
+ private isDragStart;
73
+ private startTime;
74
+ private _ctx?;
75
+ private _imgAttribute?;
76
+ private _invalidDOM?;
77
+ private showDefaultCursor;
78
+ private hiddenImg;
79
+ coordUtils: CoordinateUtils;
80
+ constructor(props: IBasicToolOperationProps);
81
+ onContextmenu(e: MouseEvent): void;
82
+ get ctx(): CanvasRenderingContext2D | null;
83
+ get basicCtx(): CanvasRenderingContext2D | null;
84
+ get rotate(): any;
85
+ get valid(): any;
86
+ get baseIcon(): any;
87
+ get defaultCursor(): string;
88
+ /** 数据列表,根据其判断是否可以旋转 */
89
+ get dataList(): any[];
90
+ get innerPosAndZoom(): {
91
+ innerZoom: number;
92
+ currentPosStorage: ICoordinate | undefined;
93
+ };
94
+ get isShowDefaultCursor(): boolean;
95
+ get isMultiMoveMode(): boolean;
96
+ /**
97
+ * 是否含有列表标注
98
+ */
99
+ get hasMarkerConfig(): any;
100
+ setZoom(zoom: number): void;
101
+ setCurrentPos(currentPos: ICoordinate): void;
102
+ setReferenceData(referenceData: IReferenceData): void;
103
+ setImgInfo(size: ISize): void;
104
+ setCurrentPosStorage(currentPosStorage: ICoordinate): void;
105
+ setOperationMode(operationMode: EOperationMode): void;
106
+ recoverOperationMode(): void;
107
+ /**
108
+ * 外界直接更改当前渲染位置
109
+ * @param zoom
110
+ * @param currentPos
111
+ */
112
+ updatePosition(params: {
113
+ zoom: number;
114
+ currentPos: ICoordinate;
115
+ }): void;
116
+ setLang(lang: ELang): void;
117
+ setShowDefaultCursor(showDefaultCursor: boolean): void;
118
+ setCustomCursor(cursor: string): void;
119
+ get forbidMouseOperation(): boolean;
120
+ get pixelRatio(): number;
121
+ init(): void;
122
+ destroy(): void;
123
+ updateCanvasBasicStyle(canvas: HTMLCanvasElement, size: ISize, zIndex: number): void;
124
+ createCanvas(size: ISize, isAppend?: boolean): void;
125
+ destroyCanvas(): void;
126
+ /**
127
+ * 设置框的样式
128
+ * @param lineWidth
129
+ * @param strokeColor
130
+ */
131
+ setStyle(toolStyle: any): void;
132
+ /**
133
+ * Notice. It needs to set the default imgInfo. Because it will needs to create info when it doesn't have
134
+ * @param imgNode
135
+ * @param basicImgInfo
136
+ */
137
+ setImgNode(imgNode: HTMLImageElement, basicImgInfo?: Partial<{
138
+ valid: boolean;
139
+ rotate: number;
140
+ }>): void;
141
+ setErrorImg(): void;
142
+ setBasicImgInfo(basicImgInfo: any): void;
143
+ setForbidOperation(forbidOperation: boolean): void;
144
+ setForbidCursorLine(forbidCursorLine: boolean): void;
145
+ setIsHidden(isHidden: boolean): void;
146
+ setDefaultAttribute(attribute: string): void;
147
+ getCoordinateInOrigin(e: MouseEvent): {
148
+ x: number;
149
+ y: number;
150
+ };
151
+ /**
152
+ * Get the textIconSvg by attribute.
153
+ * @param attribute
154
+ */
155
+ getTextIconSvg(attribute?: string): any;
156
+ /**
157
+ * 用于外界直接控制序号的是否展示
158
+ * @param isShowOrder
159
+ */
160
+ setIsShowOrder(isShowOrder: boolean): void;
161
+ /** 获取坐标值 */
162
+ getCoordinate(e: MouseEvent): {
163
+ x: number;
164
+ y: number;
165
+ };
166
+ /** 获取当前zoom 下的坐标 */
167
+ getCoordinateUnderZoom(e: MouseEvent): {
168
+ x: number;
169
+ y: number;
170
+ };
171
+ /**
172
+ * Get the coordinate based on zoom and rotate
173
+ *
174
+ *
175
+ * @param e
176
+ * @returns
177
+ */
178
+ getCoordinateUnderZoomByRotate(e: MouseEvent): {
179
+ x: number;
180
+ y: number;
181
+ };
182
+ getGetCenterCoordinate(): {
183
+ x: number;
184
+ y: number;
185
+ };
186
+ /** 用于初始化图片的位置 */
187
+ initImgPos: () => Promise<void>;
188
+ /**
189
+ * 用于依赖情况下的图片初始化
190
+ */
191
+ initPosition(): void;
192
+ getCurrentPos: (coord: any) => {
193
+ y: number;
194
+ x: number;
195
+ };
196
+ /** 撤销 */
197
+ undo(): void;
198
+ /** 重做 */
199
+ redo(): void;
200
+ clearCanvas(): void;
201
+ clearBasicCanvas(): void;
202
+ /** 事件绑定 */
203
+ eventBinding(): void;
204
+ eventUnbinding(): void;
205
+ clearImgDrag(): void;
206
+ clearCursorLine(): void;
207
+ onMouseDown(e: MouseEvent): void | boolean;
208
+ onMouseMove(e: MouseEvent): boolean | void;
209
+ onMouseUp(e: MouseEvent): boolean | void;
210
+ onMouseLeave(): void;
211
+ onClick(e: MouseEvent): void;
212
+ onLeftDblClick(e: MouseEvent): void;
213
+ onRightDblClick(e: MouseEvent): void;
214
+ onKeyDown(e: KeyboardEvent): boolean | void;
215
+ onKeyUp(e: KeyboardEvent): boolean | void;
216
+ /**
217
+ * 导出自定义数据
218
+ * @returns
219
+ */
220
+ exportCustomData(): {};
221
+ onWheel(e: any, isRender?: boolean): boolean | void;
222
+ wheelChangePos: (coord: ICoordinate, operator: 1 | -1 | 0, newZoom?: number) => void;
223
+ /**
224
+ * 通过ZOOM_LEVEL, 计算出下一个缩放的值。
225
+ * @param isZoomIn 是否为放大
226
+ */
227
+ zoomChanged: (isZoomIn: boolean, growthMode?: EGrowthMode) => void;
228
+ /**
229
+ * Update by center.
230
+ *
231
+ * @param newZoom
232
+ */
233
+ zoomChangeOnCenter: (newZoom: number) => void;
234
+ renderCursorLine(lineColor?: any): void;
235
+ drawImg: () => void;
236
+ /**
237
+ * 更改当前 canvas 整体的大小,需要重新初始化
238
+ * @param size
239
+ */
240
+ setSize(size: ISize): void;
241
+ setImgAttribute(imgAttribute: IImageAttribute): void;
242
+ clearResult(sendMessage?: boolean | string): void;
243
+ setValid(valid: boolean): void;
244
+ setRotate(rotate: number): void;
245
+ setBasicResult(basicResult: any): void;
246
+ setDependName(dependToolName: EToolName, dependToolConfig?: IRectConfig | IPolygonConfig): void;
247
+ setAttributeLockList(attributeLockList: string[]): void;
248
+ setConfig(config: string): void;
249
+ setDataInjectionAtCreation(dataInjectionAtCreation: TDataInjectionAtCreateion): void;
250
+ setRenderEnhance(renderEnhance: IRenderEnhance): void;
251
+ setCustomRenderStyle(customRenderStyle: (data: IRect | IPolygonData | IPoint | ILine | ITagResult | IBasicText) => IAnnotationStyle): void;
252
+ /**
253
+ * 进行图片旋转操作
254
+ * @returns
255
+ */
256
+ updateRotate(): false | undefined;
257
+ /** Get the current property color */
258
+ getColor(attribute?: string, config?: any): any;
259
+ getLineColor(attribute?: string): any;
260
+ clearInvalidPage(): void;
261
+ renderInvalidPage(): void;
262
+ renderBasicCanvas(): void;
263
+ render(): void;
264
+ changeStyle(newAttribute?: string): void;
265
+ }
266
+ export { IBasicToolOperationProps, BasicToolOperation };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * 查看模式 - 严格配置要求
3
+ */
4
+ import { EToolName } from '../../constant/tool';
5
+ import { IPolygonData } from '../../types/tool/polygon';
6
+ import { BasicToolOperation, IBasicToolOperationProps } from './basicToolOperation';
7
+ interface ICheckResult {
8
+ result: Array<IPolygonData | IRect | ITagResult>;
9
+ toolName: EToolName;
10
+ config: string[];
11
+ }
12
+ interface ICheckOperationProps extends IBasicToolOperationProps {
13
+ resultList: ICheckResult[];
14
+ }
15
+ declare class CheckOperation extends BasicToolOperation {
16
+ resultList: ICheckResult[];
17
+ hoverID: string[];
18
+ fillID: string[];
19
+ private mouseHoverID?;
20
+ constructor(props: ICheckOperationProps);
21
+ onMouseDown(e: MouseEvent): true | undefined;
22
+ updateRotate(): void;
23
+ onMouseMove(e: MouseEvent): void;
24
+ getHoverRectID: (e: MouseEvent) => string;
25
+ setResult(result: ICheckResult[]): void;
26
+ drawPolygon(polygonList: IPolygonData[], config: any): void;
27
+ drawRect(rectList: IRect[], config: any): void;
28
+ drawTag(tagList: ITagResult[], config: any): void;
29
+ setHoverID(hoverID: string[]): void;
30
+ setFillID(fillID: string[]): void;
31
+ render(): void;
32
+ /**
33
+ * 同步操作中的基础信息
34
+ */
35
+ exportData(): {}[];
36
+ }
37
+ export default CheckOperation;
@@ -0,0 +1,174 @@
1
+ import { ECuboidDirection } from '@/constant/annotation';
2
+ import type { ICuboid, ICuboidConfig, IDrawingCuboid } from '@/types/tool/cuboid';
3
+ import { BasicToolOperation } from './basicToolOperation';
4
+ import type { IBasicToolOperationProps } from './basicToolOperation';
5
+ import { ITextAttributeFuc } from './textAttributeClass';
6
+ type ICuboidOperationProps = IBasicToolOperationProps;
7
+ /**
8
+ * Just use for the drawing.
9
+ */
10
+ declare enum EDrawingStatus {
11
+ Ready = 1,
12
+ FirstPoint = 2,
13
+ Cuboid = 3
14
+ }
15
+ declare class CuboidOperation extends BasicToolOperation implements ITextAttributeFuc {
16
+ private toggleButtonInstance?;
17
+ drawingCuboid?: IDrawingCuboid;
18
+ /**
19
+ * The coordinates of the first click, used for creating a cuboid.
20
+ */
21
+ firstClickCoord?: ICoordinate;
22
+ drawingStatus: EDrawingStatus;
23
+ cuboidList: ICuboid[];
24
+ selectedID?: string;
25
+ config: ICuboidConfig;
26
+ hoverID: string;
27
+ private dragInfo?;
28
+ private highlightInfo?;
29
+ private _textAttributeInstance?;
30
+ get selectedText(): string;
31
+ constructor(props: ICuboidOperationProps);
32
+ destroy(): void;
33
+ /**
34
+ * Get the showing cuboidList which is needed to be shown.
35
+ *
36
+ * Filter Condition: (It is not enabled currently)
37
+ * 1. basicResult
38
+ * 2. attributeLockList
39
+ */
40
+ get currentShowList(): ICuboid[];
41
+ get selectedCuboid(): ICuboid | undefined;
42
+ get dataList(): ICuboid[];
43
+ get isNeedCheckCuboidSize(): boolean;
44
+ /**
45
+ * Whether the mouse is in the hover range.
46
+ * @param e
47
+ * @returns
48
+ */
49
+ getIsHoverSelectedCuboid(e: MouseEvent): boolean | undefined;
50
+ /**
51
+ * Forbidden to draw a cuboid if the backPlane is front than the frontPlane.
52
+ * @param e
53
+ * @param cuboid
54
+ * @returns
55
+ */
56
+ isForbiddenMove(e: MouseEvent, cuboid: ICuboid | IDrawingCuboid): boolean;
57
+ getHoverData: (e: MouseEvent) => {
58
+ hoverID: string;
59
+ hoverCuboid: ICuboid | undefined;
60
+ } | {
61
+ hoverID?: undefined;
62
+ hoverCuboid?: undefined;
63
+ };
64
+ updateSelectedCuboid(newCuboid: ICuboid): void;
65
+ getStylesToRender(attribute: string, valid: boolean): {
66
+ strokeColor: any;
67
+ toolColor: any;
68
+ fillColor: any;
69
+ lineWidth: any;
70
+ };
71
+ /**
72
+ * Get Selected Data.
73
+ *
74
+ * Exclusive: TextAttributeInstance.
75
+ * @param attribute
76
+ * @param valid
77
+ * @returns
78
+ */
79
+ getCurrentSelectedData(): {
80
+ width: number;
81
+ textAttribute: string;
82
+ color: any;
83
+ } | undefined;
84
+ /**
85
+ * Update text Input.
86
+ *
87
+ * Exclusive: TextAttributeInstance.
88
+ * @param attribute
89
+ * @param valid
90
+ * @returns
91
+ */
92
+ updateSelectedTextAttribute(newTextAttribute?: string): void;
93
+ setResult(cuboidList: ICuboid[]): void;
94
+ /**
95
+ * 获取当前页面标注结果
96
+ */
97
+ get currentPageResult(): ICuboid[];
98
+ clearResult(): void;
99
+ exportData(): any[];
100
+ setSelectedID(newID?: string): void;
101
+ setSelectedIDAndRender(newID?: string): void;
102
+ setCuboidValidAndRender(id: string): void;
103
+ onRightDblClick(e: MouseEvent): void;
104
+ setCuboidList(cuboidList: ICuboid[], isUpload?: boolean): void;
105
+ deleteCuboid(id: string): void;
106
+ onKeyDown(e: KeyboardEvent): void;
107
+ onKeyUp(e: KeyboardEvent): void;
108
+ onMouseDown(e: MouseEvent): void;
109
+ onMouseUp(e: MouseEvent): boolean | void;
110
+ onMouseMove(e: MouseEvent): boolean | void;
111
+ drawingFrontPlanesMove(e: MouseEvent): true | undefined;
112
+ drawingBackPlaneMove(e: MouseEvent): void;
113
+ onDragMove(e: MouseEvent): void;
114
+ /**
115
+ * onMouseMove in hover.
116
+ *
117
+ * Highlight the position of hover.
118
+ * @param e
119
+ */
120
+ onHoverMove(e: MouseEvent): void;
121
+ createNewDrawingCuboid(e: MouseEvent, basicSourceID: string): void;
122
+ /**
123
+ * Change Status
124
+ * From drawing frontPlane to backPlane
125
+ */
126
+ closeNewDrawingFrontPlane(): void;
127
+ closeAndCreateNewCuboid(): void;
128
+ deleteSelectedID(): void;
129
+ clearDrawingStatus(): void;
130
+ clearActiveStatus(): void;
131
+ rightMouseUp(e: MouseEvent): void;
132
+ /**
133
+ * Render the highlight components
134
+ *
135
+ * Situation:
136
+ * 1. hover
137
+ * 2. selected.
138
+ *
139
+ * Components:
140
+ * 1. 6 Points
141
+ * 2. 5 Lines.
142
+ *
143
+ * @param cuboid
144
+ */
145
+ renderHighlightCuboidCom(cuboid: ICuboid | IDrawingCuboid): void;
146
+ /**
147
+ * TODO - Need to optimize.
148
+ * @param cuboid
149
+ */
150
+ renderSingleCuboid(cuboid: ICuboid | IDrawingCuboid): void;
151
+ setDefaultAttribute(defaultAttribute?: string): void;
152
+ renderToggleButton(): void;
153
+ renderTextAttribute(): void;
154
+ renderDrawing(): void;
155
+ renderStatic(): void;
156
+ renderSelected(): void;
157
+ updateMouseOperation(type: 'in' | 'out'): void;
158
+ toggleDirection(direction: ECuboidDirection): void;
159
+ /**
160
+ * Notice: Hover is under selectedCuboid.
161
+ */
162
+ renderHover(): void;
163
+ renderCuboid(): void;
164
+ render(): void;
165
+ undo(): void;
166
+ redo(): void;
167
+ /**
168
+ * Sidebar Callback Function
169
+ * @param v
170
+ * @returns
171
+ */
172
+ textChange: (v: string) => void;
173
+ }
174
+ export default CuboidOperation;
@@ -0,0 +1,38 @@
1
+ import { ECuboidDirection } from '@/constant/annotation';
2
+ interface IBaseInfo {
3
+ cuboidButtonMove: (type: 'in' | 'out') => void;
4
+ toggleDirection: (direction: ECuboidDirection) => void;
5
+ }
6
+ interface ITextAttributeProps {
7
+ container: HTMLElement;
8
+ }
9
+ export default class CuboidToggleButtonClass {
10
+ private container;
11
+ private direction;
12
+ private _cuboidButtonDOM?;
13
+ private _cuboidFABDOM?;
14
+ private isFrontSide;
15
+ private _cuboidMoreDOM?;
16
+ private _cuboidMoreListDOM?;
17
+ private cuboidButtonMove;
18
+ private onToggleDirection;
19
+ constructor(props: ITextAttributeProps & IBaseInfo);
20
+ appendToContainer(): void;
21
+ initCuboidButtonDOM(): HTMLDivElement;
22
+ initcuboidFABDOM(icon: any): HTMLDivElement;
23
+ initcuboidMoreDOM(icon: any): HTMLDivElement;
24
+ initcuboidMoreListDOM(): HTMLDivElement;
25
+ /**
26
+ * Update current button (top)
27
+ * @param position
28
+ */
29
+ update(position: {
30
+ left: number;
31
+ top: number;
32
+ color: string;
33
+ width?: number;
34
+ }): void;
35
+ clearCuboidButtonDOM(): void;
36
+ clearCuboidMoreListDOM(): void;
37
+ }
38
+ export {};
@@ -0,0 +1,33 @@
1
+ export default class EventListener {
2
+ private _events;
3
+ constructor();
4
+ /**
5
+ * 事件绑定。(注:相同的事件下的相同方法不支持多次绑定)
6
+ * @param eventName 事件名字
7
+ * @param callback 事件回调
8
+ */
9
+ on(eventName: string, callback: (...args: any[]) => void): void;
10
+ /**
11
+ * 单独的事件绑定,一个事件仅支持绑定一个函数
12
+ * @param eventName
13
+ * @param callback
14
+ */
15
+ singleOn(eventName: string, callback: (...args: any[]) => void): void;
16
+ /**
17
+ * 事件广播
18
+ * @param eventName 事件名字
19
+ * @param callback 事件回调
20
+ */
21
+ emit(eventName: string, ...args: any[]): void;
22
+ /**
23
+ * 事件解绑,对某一事件进行事件解绑
24
+ * @param eventName 需要解绑的事件名字
25
+ * @param callback 需要解绑的方法
26
+ */
27
+ unbind(eventName: string, callback: (...params: any[]) => void): void;
28
+ /**
29
+ * 解绑事件
30
+ * @param eventName
31
+ */
32
+ unbindAll(eventName: string): void;
33
+ }
@@ -0,0 +1,8 @@
1
+ import { RectOperation, IRectOperationProps } from './rectOperation';
2
+ interface IMeasureOpeartion extends IRectOperationProps {
3
+ }
4
+ declare class MeasureOperation extends RectOperation {
5
+ constructor(props: IMeasureOpeartion);
6
+ setSelectedIdAfterAddingDrawingRect(): void;
7
+ }
8
+ export default MeasureOperation;
@@ -0,0 +1,119 @@
1
+ /**
2
+ * It can expand various types of operations
3
+ *
4
+ * @file PointCloud 2D Operation
5
+ * @createdate 2022-07-11
6
+ * @author Ron <ron.f.luo@gmail.com>
7
+ */
8
+ import { IPointCloudConfig } from '@labelbee/lb-utils';
9
+ import { ESortDirection } from '@/constant/annotation';
10
+ import { IPolygonData, IPolygonPoint } from '@/types/tool/polygon';
11
+ import PolygonOperation, { IPolygonOperationProps } from './polygonOperation';
12
+ interface IPointCloud2dOperationProps {
13
+ showDirectionLine?: boolean;
14
+ forbidAddNew?: boolean;
15
+ checkMode?: boolean;
16
+ }
17
+ declare class PointCloud2dOperation extends PolygonOperation {
18
+ showDirectionLine: boolean;
19
+ hideAttributes: string[];
20
+ forbidAddNew: boolean;
21
+ pointCloudConfig: IPointCloudConfig;
22
+ private checkMode;
23
+ private selectedIDs;
24
+ constructor(props: IPolygonOperationProps & IPointCloud2dOperationProps);
25
+ get getSelectedIDs(): string[];
26
+ get enableDrag(): boolean;
27
+ get visiblePolygonList(): IPolygonData[];
28
+ setHiddenAttributes(hideAttributes: string[]): void;
29
+ setConfig(config: string): void;
30
+ dragMouseDown(e: MouseEvent): void;
31
+ deletePolygon(id?: string): void;
32
+ deletePolygonPoint(index: number): void;
33
+ /**
34
+ * Update selectedIDs and rerender
35
+ * @param selectedIDs
36
+ */
37
+ setSelectedIDs(selectedIDs: string[]): void;
38
+ deleteSelectedID(): void;
39
+ /**
40
+ * Right click event
41
+ * @override
42
+ */
43
+ rightMouseUp: (e: MouseEvent) => void;
44
+ get selectedPolygons(): IPolygonData[] | undefined;
45
+ updateSelectedPolygonsPoints(offset: Partial<ICoordinate>): void;
46
+ /**
47
+ * keydown event
48
+ * @override
49
+ */
50
+ onKeyDown: () => void;
51
+ /**
52
+ * keyup event
53
+ * @override
54
+ */
55
+ onKeyUp: () => void;
56
+ getLineColor(): string;
57
+ /** 获取当前属性颜色 */
58
+ getPointCloudLineColor(polygon: IPolygonData): string;
59
+ /**
60
+ * Add direction
61
+ * @override
62
+ * */
63
+ renderStaticPolygon(): void;
64
+ /**
65
+ * Update the show
66
+ * @override
67
+ * */
68
+ renderSelectedPolygon(): void;
69
+ renderSingleSelectedPolygon: (selectedPolygon: IPolygonData) => void;
70
+ renderRectPolygonDirection(polygon: IPolygonPoint[]): void;
71
+ get currentPolygonListByPattern(): IPolygonData[];
72
+ /**
73
+ * Filter the polygon by Pattern
74
+ * @override
75
+ * */
76
+ getHoverID(e: MouseEvent): string;
77
+ /**
78
+ * Filter the polygon by Pattern
79
+ * @override
80
+ * */
81
+ switchToNextPolygon(sort?: ESortDirection): string[] | undefined;
82
+ /**
83
+ * Be selected after created.
84
+ * @override
85
+ */
86
+ setSelectedIdAfterAddingDrawing(newID: string): void;
87
+ updateTextAttribute(newID?: string): void;
88
+ /**
89
+ * Overwrite and prevent selectedChange emit
90
+ * @override
91
+ */
92
+ setSelectedID(newID?: string): void;
93
+ addPointInDrawing(e: MouseEvent): void;
94
+ /**
95
+ * Update canvas size directly
96
+ * @param size
97
+ */
98
+ setCanvasSize(size: ISize): void;
99
+ /**
100
+ * If the operation is triggered internally, it will emit validUpdate.
101
+ *
102
+ * The Invalid update needs to be added a params.
103
+ * @override
104
+ * @param id
105
+ * @param forbidEmit
106
+ * @returns
107
+ */
108
+ setPolygonValidAndRender(id: string, isUpdate?: boolean): void;
109
+ onDragMove(e: MouseEvent): void;
110
+ onMouseDown(e: MouseEvent): true | undefined;
111
+ /**
112
+ * Just Update Data. Not Clear Status
113
+ * @param polygonList
114
+ */
115
+ setResultAndSelectedID(polygonList: IPolygonData[], selectedID: string): void;
116
+ emitUpdatePolygonByDrag: () => void;
117
+ }
118
+ export default PointCloud2dOperation;
119
+ export { IPointCloud2dOperationProps };