@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,135 @@
1
+ import { BasicToolOperation, IBasicToolOperationProps } from './basicToolOperation';
2
+ export interface IPointOperationProps extends IBasicToolOperationProps {
3
+ style: any;
4
+ forbidAddNew?: boolean;
5
+ forbidDelete?: boolean;
6
+ }
7
+ declare class PointOperation extends BasicToolOperation {
8
+ config: IPointToolConfig;
9
+ pointList: IPointUnit[];
10
+ hoverID?: string;
11
+ selectedID?: string;
12
+ markerIndex: number;
13
+ dragInfo?: {
14
+ dragStartCoord: ICoordinate;
15
+ originPointList: IPointUnit[];
16
+ };
17
+ forbidAddNew?: boolean;
18
+ forbidDelete?: boolean;
19
+ private _textAttributInstance?;
20
+ constructor(props: IPointOperationProps);
21
+ get dataList(): IPointUnit[];
22
+ get drawOutsideTarget(): boolean;
23
+ /**
24
+ * 向外部提供标记的更改
25
+ * @param markerIndex
26
+ */
27
+ setMarkerIndex: (markerIndex: number) => void;
28
+ /**
29
+ * 更改当前列表标注位置,并且设置为选中
30
+ * @param markerIndex
31
+ * @returns
32
+ */
33
+ setMarkerIndexAndSelect: (markerIndex: number) => void;
34
+ /**
35
+ * 设置下一个列表选择器
36
+ * @param pointList
37
+ */
38
+ setNextMarker(pointList?: IPointUnit[]): void;
39
+ setResult(pointList: IPointUnit[]): void;
40
+ /**
41
+ * 设置当前的结果集
42
+ * @param rectList
43
+ * @param isUpload
44
+ */
45
+ setPointList(pointList: IPointUnit[], isUpload?: boolean): void;
46
+ setConfig(config: string, isClear?: boolean): void;
47
+ clearResult(): void;
48
+ setDefaultAttribute(defaultAttribute?: string): void;
49
+ /**
50
+ * 外层 sidebar 调用
51
+ * @param v
52
+ * @returns
53
+ */
54
+ textChange: (v: string) => void;
55
+ get selectedText(): string | undefined;
56
+ setStyle(toolStyle: any): void;
57
+ setSelectedID(newID?: string): void;
58
+ /**
59
+ * 获取当前配置下的 icon svg
60
+ * @param attribute
61
+ */
62
+ getTextIconSvg(attribute?: string): any;
63
+ /**
64
+ * 清除所有的中间状态
65
+ */
66
+ clearActiveStatus(): void;
67
+ setBasicResult(basicResult: any): void;
68
+ /**
69
+ * Offset is under zooming.
70
+ * @param offset
71
+ */
72
+ onDragMoveAll(offset: ICoordinate): void;
73
+ onMouseDown(e: MouseEvent): true | undefined;
74
+ onMouseMove(e: MouseEvent): undefined;
75
+ onMouseUp(e: MouseEvent): true | undefined;
76
+ onDragMove(e: MouseEvent): void;
77
+ onKeyDown(e: KeyboardEvent): void;
78
+ isMinDistance: (coord: ICoordinate) => boolean;
79
+ createPoint(e: MouseEvent): void;
80
+ isInPoint(pos: ICoordinate, point: ICoordinate, zoom?: number): boolean;
81
+ getHoverId(): string | undefined;
82
+ get selectedPoint(): IPointUnit | undefined;
83
+ rightMouseUp(): void;
84
+ onTabKeyDown(e: KeyboardEvent): void;
85
+ /**
86
+ * 当前依赖状态下本页的所有的点
87
+ *
88
+ * @readonly
89
+ * @memberof RectOperation
90
+ */
91
+ get currentPageResult(): IPointUnit[];
92
+ /**
93
+ * 当前依赖状态下本页的所有框
94
+ *
95
+ * @readonly
96
+ * @memberof RectOperation
97
+ */
98
+ getCurrentPageResult(pointList: IPointUnit[]): IPointUnit[];
99
+ /**
100
+ * 导出结果
101
+ */
102
+ exportData(): any[];
103
+ deletePoint(): void;
104
+ /** 撤销 和 重做 */
105
+ undoAndRedo(name: 'undo' | 'redo'): void;
106
+ /** 撤销 */
107
+ undo(): void;
108
+ /** 重做 */
109
+ redo(): void;
110
+ getCurrentSelectedData(): {
111
+ width: number;
112
+ textAttribute: string;
113
+ color: any;
114
+ } | undefined;
115
+ /** 更新文本输入,并且进行关闭 */
116
+ updateSelectedTextAttribute(newTextAttribute?: string): void;
117
+ renderTextAttribute(): void;
118
+ /**
119
+ * 绘制标点
120
+ */
121
+ renderPoint(point: IPointUnit, isSelected?: boolean): void;
122
+ renderMultiSelectedPoint(): void;
123
+ renderPointList(): void;
124
+ /**
125
+ * render auxiliaryLine - markerConfigurable should be true
126
+ * 渲染辅助线-需开启列表标注
127
+ */
128
+ renderAuxiliaryLine(): void;
129
+ /**
130
+ * 顶层渲染图标
131
+ */
132
+ renderTop(): void;
133
+ render(): void;
134
+ }
135
+ export default PointOperation;
@@ -0,0 +1,201 @@
1
+ import { EDragTarget, ERotateDirection, ESortDirection } from '../../constant/annotation';
2
+ import { EPolygonPattern } from '../../constant/tool';
3
+ import { IPolygonConfig, IPolygonData, IPolygonPoint } from '../../types/tool/polygon';
4
+ import { BasicToolOperation, IBasicToolOperationProps } from './basicToolOperation';
5
+ import TextAttributeClass from './textAttributeClass';
6
+ export interface IPolygonOperationProps extends IBasicToolOperationProps {
7
+ }
8
+ declare class PolygonOperation extends BasicToolOperation {
9
+ config: IPolygonConfig;
10
+ drawingPointList: IPolygonPoint[];
11
+ polygonList: IPolygonData[];
12
+ hoverID?: string;
13
+ hoverPointIndex: number;
14
+ hoverEdgeIndex: number;
15
+ selectedID?: string;
16
+ editPolygonID?: string;
17
+ pattern: EPolygonPattern;
18
+ isCombined: boolean;
19
+ dragInfo?: {
20
+ dragStartCoord: ICoordinate;
21
+ initPointList: IPolygonPoint[];
22
+ changePointIndex?: number[];
23
+ dragTarget: EDragTarget;
24
+ originPolygon?: IPolygonData;
25
+ dragPrevCoord: ICoordinate;
26
+ originPolygonList: IPolygonData[];
27
+ };
28
+ private drawingHistory;
29
+ isCtrl: boolean;
30
+ isAlt: boolean;
31
+ _textAttributInstance?: TextAttributeClass;
32
+ forbidAddNewPolygonFuc?: (e: MouseEvent) => boolean;
33
+ constructor(props: IPolygonOperationProps);
34
+ eventBinding(): void;
35
+ eventUnbinding(): void;
36
+ destroy(): void;
37
+ get selectedPolygon(): IPolygonData | undefined;
38
+ get hoverPolygon(): IPolygonData | undefined;
39
+ get enableDrag(): boolean;
40
+ get visiblePolygonList(): IPolygonData[];
41
+ get polygonListUnderZoom(): {
42
+ pointList: ({
43
+ x: number;
44
+ y: number;
45
+ specialPoint?: boolean | undefined;
46
+ specialEdge?: boolean | undefined;
47
+ } | {
48
+ x: number;
49
+ y: number;
50
+ })[];
51
+ sourceID: string;
52
+ id: string;
53
+ valid: boolean;
54
+ order: number;
55
+ textAttribute: string;
56
+ attribute: string;
57
+ isRect?: boolean | undefined;
58
+ }[];
59
+ get selectedText(): string | undefined;
60
+ isAllowDouble: (e: MouseEvent) => boolean;
61
+ get dataList(): IPolygonData[];
62
+ setPattern(pattern: EPolygonPattern, isForce?: boolean): void;
63
+ /**
64
+ * 当前页面展示的框体
65
+ */
66
+ get currentShowList(): IPolygonData[];
67
+ /**
68
+ * 当前依赖状态下本页的所有框
69
+ *
70
+ * @readonly
71
+ * @memberof RectOperation
72
+ */
73
+ get currentPageResult(): IPolygonData[];
74
+ setResult(polygonList: IPolygonData[]): void;
75
+ /**
76
+ * 外层 sidabr 调用
77
+ * @param v
78
+ * @returns
79
+ */
80
+ textChange: (v: string) => void;
81
+ /**
82
+ * 设定指定多边形的信息
83
+ * @param id
84
+ * @param newPolygonData
85
+ * @returns
86
+ */
87
+ setPolygonDataByID(newPolygonData: Partial<IPolygonData>, id?: string): IPolygonData[];
88
+ rotatePolygon(angle?: number, direction?: ERotateDirection, selectedID?: string | undefined): void;
89
+ addPointInDrawing(e: MouseEvent): void;
90
+ clearResult(): void;
91
+ /**
92
+ * 清除多边形拖拽的中间状态
93
+ */
94
+ clearPolygonDrag(): void;
95
+ /**
96
+ * 清楚所有的中间状态
97
+ */
98
+ clearActiveStatus(): void;
99
+ clearDrawingStatus(): void;
100
+ setPolygonList(polygonList: IPolygonData[]): void;
101
+ setSelectedID(newID?: string): void;
102
+ setDefaultAttribute(defaultAttribute?: string): void;
103
+ setStyle(toolStyle: any): void;
104
+ setPolygonValidAndRender(id: string): void;
105
+ /**
106
+ * 初始化的添加的数据
107
+ * @returns
108
+ */
109
+ addDrawingPointToPolygonList(isRect?: boolean): void;
110
+ setSelectedIdAfterAddingDrawing(newID: string): void;
111
+ /**
112
+ * 获取当前 hover 多边形的 ID
113
+ * @param e
114
+ * @returns
115
+ */
116
+ getHoverID(e: MouseEvent): string;
117
+ getHoverEdgeIndex(e: MouseEvent): number;
118
+ getHoverPointIndex(e: MouseEvent): number;
119
+ deletePolygon(id?: string): void;
120
+ deletePolygonPoint(index: number): void;
121
+ spaceKeydown(): void;
122
+ onTabKeyDown(e: KeyboardEvent): void;
123
+ switchToNextPolygon(sort: ESortDirection): void;
124
+ onKeyDown(e: KeyboardEvent): void;
125
+ onKeyUp(e: KeyboardEvent): void;
126
+ rightMouseUp(e: MouseEvent): void;
127
+ onLeftDblClick(e: MouseEvent): void;
128
+ onRightDblClick(e: MouseEvent): void;
129
+ onMouseDown(e: MouseEvent): true | undefined;
130
+ /**
131
+ * Judgment of drag information during mousedown
132
+ * @param e
133
+ * @returns
134
+ */
135
+ dragMouseDown(e: MouseEvent): void;
136
+ segment(): void;
137
+ onCombinedExecute(): void;
138
+ combine(e: MouseEvent): void;
139
+ /**
140
+ * 判断是否在边界外
141
+ * @param selectedPointList
142
+ * @returns
143
+ */
144
+ isPolygonOutSide(selectedPointList: IPolygonPoint[]): boolean;
145
+ /**
146
+ * According to the mode of dragTarget, get the offset when dragging
147
+ * @param e {MouseEvent}
148
+ * @param selectedPolygon {IPolygonData}
149
+ * @returns
150
+ */
151
+ getDragOffset(e: MouseEvent, selectedPolygon: IPolygonData): {
152
+ x: number;
153
+ y: number;
154
+ };
155
+ dragPolygon(e: MouseEvent, selectedPolygon: IPolygonData): IPolygonPoint[] | undefined;
156
+ /**
157
+ * Update polygon position while enableDrag is true
158
+ * @param e {MouseEvent}
159
+ */
160
+ onDragMove(e: MouseEvent): void;
161
+ onMouseMove(e: MouseEvent): void;
162
+ /**
163
+ * Emit updateList for views update
164
+ * @Emit updateList {UpdatePolygonByDragList}
165
+ */
166
+ emitUpdatePolygonByDrag: () => void;
167
+ leftMouseUpdateValid(e: MouseEvent): boolean;
168
+ leftMouseUp(e: MouseEvent): void;
169
+ onMouseUp(e: MouseEvent): undefined;
170
+ dragMouseUp(): void;
171
+ exportData(): any[];
172
+ /**
173
+ * 获取当前配置下的 icon svg
174
+ * @param attribute
175
+ */
176
+ getTextIconSvg(attribute?: string): any;
177
+ getCurrentSelectedData(): {
178
+ width: number;
179
+ textAttribute: string;
180
+ color: any;
181
+ } | undefined;
182
+ /** 更新文本输入,并且进行关闭 */
183
+ updateSelectedTextAttribute(newTextAttribute?: string): void;
184
+ renderTextAttribute(): void;
185
+ renderStaticPolygon(): void;
186
+ /**
187
+ * Render selected polygon
188
+ * @param selectedPolygon
189
+ */
190
+ renderSelectedPolygon(): void;
191
+ renderHoverPolygon(): void;
192
+ renderPolygon(): void;
193
+ render(): void;
194
+ renderCursorLine(lineColor: string): void;
195
+ /** 撤销 */
196
+ undo(): void;
197
+ /** 重做 */
198
+ redo(): void;
199
+ deleteSelectedID(): void;
200
+ }
201
+ export default PolygonOperation;
@@ -0,0 +1,175 @@
1
+ import { BasicToolOperation, IBasicToolOperationProps } from './basicToolOperation';
2
+ interface IRectOperationProps extends IBasicToolOperationProps {
3
+ drawOutSideTarget: boolean;
4
+ style: any;
5
+ }
6
+ declare class RectOperation extends BasicToolOperation {
7
+ drawingRect?: IRect;
8
+ firstClickCoord?: ICoordinate;
9
+ firstCurrentPos?: ICoordinate;
10
+ rectList: IRect[];
11
+ drawOutSideTarget: boolean;
12
+ hoverRectID?: string;
13
+ hoverRectPointIndex: number;
14
+ hoverRectEdgeIndex: number;
15
+ selectedRectID?: string;
16
+ isFlow: boolean;
17
+ config: IRectConfig;
18
+ markerIndex: number;
19
+ private _textAttributInstance?;
20
+ private dragInfo?;
21
+ constructor(props: IRectOperationProps);
22
+ setResult(rectList: IRect[]): void;
23
+ destroy(): void;
24
+ setConfig(config: string, isClear?: boolean): void;
25
+ /**
26
+ * 设置当前的结果集
27
+ * @param rectList
28
+ * @param isUpload
29
+ */
30
+ setRectList(rectList: IRect[], isUpload?: boolean): void;
31
+ get selectedRect(): IRect | undefined;
32
+ get selectedID(): string | undefined;
33
+ get selectedText(): string | undefined;
34
+ get dataList(): IRect[];
35
+ /**
36
+ * 当前页面展示的框体
37
+ */
38
+ get currentShowList(): IRect[];
39
+ /**
40
+ * 当前依赖状态下本页的所有框
41
+ *
42
+ * @readonly
43
+ * @memberof RectOperation
44
+ */
45
+ get currentPageResult(): IRect[];
46
+ /**
47
+ * 当前依赖状态下本页的所有框
48
+ *
49
+ * @readonly
50
+ * @memberof RectOperation
51
+ */
52
+ getCurrentPageResult(rectList: IRect[]): IRect[];
53
+ setSelectedID(newID?: string): void;
54
+ setSelectedRectID(newID?: string): void;
55
+ setStyle(toolStyle: any): void;
56
+ /**
57
+ * 向外部提供标记的更改
58
+ * @param markerIndex
59
+ */
60
+ setMarkerIndex: (markerIndex: number) => void;
61
+ /**
62
+ * 更改当前列表标注位置,并且设置为选中
63
+ * @param markerIndex
64
+ * @returns
65
+ */
66
+ setMarkerIndexAndSelect: (markerIndex: number) => void;
67
+ /** 更新文本输入,并且进行关闭 */
68
+ updateSelectedRectTextAttribute(newTextAttribute?: string): void;
69
+ getHoverRectID: (e: MouseEvent) => string;
70
+ /**
71
+ * 获取当前的选中部分的hoverIndex
72
+ * ../../../param e
73
+ */
74
+ getHoverRectPointIndex(e: MouseEvent): number;
75
+ getHoverRectEdgeIndex(e: MouseEvent): number;
76
+ /**
77
+ * 获取当前配置下的 icon svg
78
+ * @param attribute
79
+ */
80
+ getTextIconSvg(attribute?: string): any;
81
+ multiMoveMouseDown(e: MouseEvent): boolean;
82
+ onMouseDown(e: MouseEvent): undefined;
83
+ /**
84
+ * Offset is under zooming.
85
+ * @param offset
86
+ */
87
+ onDragMoveAll(offset: ICoordinate): void;
88
+ onDragMove(coordinate: ICoordinate): void;
89
+ onMouseMove(e: MouseEvent): undefined;
90
+ setAttributeLockList(attributeLockList: string[]): void;
91
+ setBasicResult(basicResult: any): void;
92
+ setRectValidAndRender(id: string): void;
93
+ createNewDrawingRect(e: MouseEvent, basicSourceID: string): void;
94
+ /**
95
+ * 将绘制中的框体添加进 rectList 中
96
+ * @returns
97
+ */
98
+ addDrawingRectToRectList(): void;
99
+ setSelectedIdAfterAddingDrawingRect(): void;
100
+ getDrawingRectWithRectList(): IRect[];
101
+ /**
102
+ * mouseup 下的鼠标右键
103
+ * @param e
104
+ */
105
+ rightMouseUp(e: MouseEvent): void;
106
+ shiftRightMouseUp(e: MouseEvent): void;
107
+ onMouseUp(e: MouseEvent): true | undefined;
108
+ onRightDblClick(e: MouseEvent): void;
109
+ onKeyDown(e: KeyboardEvent): true | undefined;
110
+ onKeyUp(e: KeyboardEvent): void;
111
+ onWheel(e: MouseEvent): void;
112
+ textChange: (v: string) => void;
113
+ getCurrentSelectedData(): {
114
+ width: number;
115
+ textAttribute: string;
116
+ color: any;
117
+ } | undefined;
118
+ /**
119
+ * 获取当前渲染的样式
120
+ * @param rect
121
+ * @returns
122
+ */
123
+ getRenderStyle(rect: IRect): {
124
+ strokeColor: any;
125
+ fillColor: any;
126
+ textColor: any;
127
+ toolColor: any;
128
+ };
129
+ renderTextAttribute(): void;
130
+ renderSelectedRect(rect?: IRect): void;
131
+ /**
132
+ * 绘制当前框的
133
+ * @param rect 当前矩形框
134
+ * @param zoom 是否进行缩放
135
+ * @param isZoom 矩形框是否为缩放后的比例
136
+ */
137
+ renderDrawingRect(rect: IRect, zoom?: number, isZoom?: boolean): void;
138
+ /**
139
+ * Experiment. Render the multiSelected Rect
140
+ *
141
+ */
142
+ renderMultiSelectedRect(): void;
143
+ /**
144
+ * 渲染静态框体
145
+ */
146
+ renderStaticRect(): void;
147
+ /**
148
+ * 创建创建中的框体
149
+ * @returns
150
+ */
151
+ renderCreatingRect(): void;
152
+ /**
153
+ * 渲染矩形框体
154
+ */
155
+ renderRect(): void;
156
+ render(): void;
157
+ setDefaultAttribute(defaultAttribute?: string): void;
158
+ setValid(valid: boolean): void;
159
+ /**
160
+ * 清楚所有的中间状态
161
+ */
162
+ clearActiveStatus(): void;
163
+ clearResult(sendMessage?: boolean): void;
164
+ deleteRect(rectID?: string): void;
165
+ /**
166
+ * 导出结果
167
+ */
168
+ exportData(): any[];
169
+ /** 撤销 */
170
+ undo(): void;
171
+ /** 重做 */
172
+ redo(): void;
173
+ }
174
+ export { RectOperation, IRectOperationProps };
175
+ export default RectOperation;
@@ -0,0 +1,31 @@
1
+ import { RectOperation } from './rectOperation';
2
+ import type { IRectOperationProps } from './rectOperation';
3
+ type TRunPrediction = (params: {
4
+ point: ICoordinate;
5
+ rect: {
6
+ x: number;
7
+ y: number;
8
+ w: number;
9
+ h: number;
10
+ };
11
+ }) => Promise<unknown>;
12
+ interface ISegmentByRectProps extends IRectOperationProps {
13
+ runPrediction: TRunPrediction;
14
+ }
15
+ declare class SegmentByRect extends RectOperation {
16
+ isRunSegment: boolean;
17
+ runPrediction: TRunPrediction;
18
+ constructor(props: ISegmentByRectProps);
19
+ setRunPrediction(runPrediction: TRunPrediction): void;
20
+ eventBinding(): void;
21
+ onKeydown: (e: KeyboardEvent) => void;
22
+ clearPredictionInfo(): void;
23
+ onMouseUp(e: MouseEvent): undefined;
24
+ onMouseDown(e: MouseEvent): undefined;
25
+ renderCursorLine(): void;
26
+ renderDrawingRect(rect: IRect, zoom: number, isZoom?: boolean): void;
27
+ renderTextAttribute(): void;
28
+ renderSelectedRect(): void;
29
+ segmentPrediction: (e: MouseEvent) => Promise<void>;
30
+ }
31
+ export default SegmentByRect;
@@ -0,0 +1,44 @@
1
+ import { BasicToolOperation, IBasicToolOperationProps } from './basicToolOperation';
2
+ interface ITagOperationProps extends IBasicToolOperationProps {
3
+ config: string;
4
+ }
5
+ declare class TagOperation extends BasicToolOperation {
6
+ config: ITagConfig;
7
+ tagResult: ITagResult[];
8
+ labelSelectedList: number[];
9
+ constructor(props: ITagOperationProps);
10
+ destroy(): void;
11
+ /**
12
+ * 获取初始值结果列表
13
+ */
14
+ getInitResultList: (dataSourceStep: number, basicResultList: any[]) => {
15
+ id: string;
16
+ sourceID: any;
17
+ result: any;
18
+ }[];
19
+ setResult(tagResult: any[]): void;
20
+ /**
21
+ * 当前依赖状态下的结果集合
22
+ * 主要是跟其他工具同步,正常情况为 1
23
+ *
24
+ * @readonly
25
+ * @memberof RectOperation
26
+ */
27
+ get currentPageResult(): ITagResult[];
28
+ /**
29
+ * 当前页面的标注结果
30
+ */
31
+ get currentTagResult(): ITagResult;
32
+ get sourceID(): any;
33
+ onKeyDown(e: KeyboardEvent): void;
34
+ setLabel: (i: number, j: number) => void;
35
+ clearResult: (sendMessage?: boolean, value?: string) => void;
36
+ /**
37
+ * 清除当前渲染的标签
38
+ */
39
+ clearTag(): void;
40
+ renderTag(): void;
41
+ render(): void;
42
+ exportData(): any[];
43
+ }
44
+ export default TagOperation;
@@ -0,0 +1,65 @@
1
+ interface ITextareaData {
2
+ width?: number;
3
+ textAttribute: string;
4
+ color: string;
5
+ }
6
+ interface IBaseInfo {
7
+ getCurrentSelectedData: () => ITextareaData | undefined;
8
+ updateSelectedTextAttribute: (newTextAttribute: string) => void;
9
+ }
10
+ interface ITextAttributeProps {
11
+ container: HTMLElement;
12
+ width?: number;
13
+ icon: HTMLImageElement;
14
+ color: string;
15
+ }
16
+ export default class TextAttributeClass {
17
+ private container;
18
+ private _textareaDOM?;
19
+ private _textAttributeDOM?;
20
+ private _textDOM?;
21
+ private _iconDOM?;
22
+ private getCurrentSelectedData;
23
+ private updateSelectedTextAttribute;
24
+ constructor(props: ITextAttributeProps & IBaseInfo);
25
+ get isExit(): boolean;
26
+ get isExitTextareaDOM(): boolean;
27
+ updateIcon(icon: any): void;
28
+ appendToContainer(): void;
29
+ initTextAttributeDOM(): HTMLDivElement;
30
+ initTextDOM(width: number, lineHeight: number): HTMLSpanElement;
31
+ initIconDOM(icon: any): HTMLDivElement;
32
+ initTextareaDOM(width: number, color: string): HTMLTextAreaElement;
33
+ removeTextDOM(): void;
34
+ removeIconDOM(): void;
35
+ removeTextareaDOM(): void;
36
+ submitTextarea(): void;
37
+ textKeyDown: (e: KeyboardEvent) => void;
38
+ clearTextAttribute(): void;
39
+ private renderTextarea;
40
+ /**
41
+ * 更新当前文本定位、内容
42
+ * @param textAttribute
43
+ * @param position
44
+ */
45
+ update(textAttribute: string, position: {
46
+ left: number;
47
+ top: number;
48
+ color: string;
49
+ width?: number;
50
+ }): void;
51
+ /**
52
+ * 用于外层切换选中框调用
53
+ */
54
+ changeSelected(): void;
55
+ }
56
+ /**
57
+ * TextAttribute injection requires content changes.
58
+ *
59
+ * Custom Changes.
60
+ * 1. Need to init textAttribute when creating data.
61
+ */
62
+ export interface ITextAttributeFuc extends IBaseInfo {
63
+ selectedText: string;
64
+ }
65
+ export {};
@@ -0,0 +1,37 @@
1
+ import { RectOperation } from './core/toolOperation/rectOperation';
2
+ import TagOperation from './core/toolOperation/tagOperation';
3
+ import PointOperation from './core/toolOperation/pointOperation';
4
+ import LineToolOperation from './core/toolOperation/LineToolOperation';
5
+ import TextToolOperation from './core/toolOperation/TextToolOperation';
6
+ import PolygonOperation from './core/toolOperation/polygonOperation';
7
+ import MeasureOperation from './core/toolOperation/measureOperation';
8
+ import { BasicToolOperation } from './core/toolOperation/basicToolOperation';
9
+ import ViewOperation from './core/toolOperation/ViewOperation';
10
+ import ScribbleTool from './core/toolOperation/ScribbleTool';
11
+ import PointCloud2dOperation from './core/toolOperation/pointCloud2dOperation';
12
+ import * as cAnnotation from './constant/annotation';
13
+ import * as cAnnotationTask from './constant/annotationTask';
14
+ import * as cKeyCode from './constant/keyCode';
15
+ import * as cStyle from './constant/style';
16
+ import * as cTool from './constant/tool';
17
+ import TagUtils from './utils/tool/TagUtils';
18
+ import uuid from './utils/uuid';
19
+ import EnhanceCommonToolUtils from './utils/tool/EnhanceCommonToolUtils';
20
+ import MarkerUtils from './utils/tool/MarkerUtils';
21
+ import RectUtils from './utils/tool/RectUtils';
22
+ import AxisUtils from './utils/tool/AxisUtils';
23
+ import DrawUtils from './utils/tool/DrawUtils';
24
+ import ImgUtils from './utils/ImgUtils';
25
+ import MathUtils from './utils/MathUtils';
26
+ import AttributeUtils from './utils/tool/AttributeUtils';
27
+ import ActionsHistory from './utils/ActionsHistory';
28
+ import DblClickEventListener from './utils/tool/DblClickEventListener';
29
+ import AnnotationEngine from './core';
30
+ import UnitUtils from './utils/tool/UnitUtils';
31
+ import StyleUtils from './utils/tool/StyleUtils';
32
+ declare const CommonToolUtils: typeof EnhanceCommonToolUtils;
33
+ declare const toolUtils: typeof EnhanceCommonToolUtils;
34
+ export { RectOperation, TagOperation, PointOperation, LineToolOperation, PolygonOperation, TextToolOperation, BasicToolOperation, MeasureOperation, ViewOperation, PointCloud2dOperation, cAnnotation, cAnnotationTask, cKeyCode, cStyle, cTool, toolUtils, DblClickEventListener, CommonToolUtils, uuid, MarkerUtils, RectUtils, AxisUtils, TagUtils, DrawUtils, ImgUtils, MathUtils, AttributeUtils, AnnotationEngine, ScribbleTool, UnitUtils, StyleUtils, ActionsHistory, };
35
+ export * from './newCore';
36
+ export * from './constant/tool';
37
+ export * from './core/pointCloud';