@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,19 @@
1
+ export declare enum EMessage {
2
+ NoRotateNotice = "noRotateNotice",
3
+ RectErrorSizeNotice = "rectErrorSizeNotice",
4
+ TextCheckNumberErrorNotice = "textCheckNumberErrorNotice",
5
+ TextCheckEnglishErrorNotice = "textCheckEnglishErrorNotice",
6
+ TextCheckCustomErrorNotice = "textCheckCustomErrorNotice",
7
+ UpperLimitErrorNotice = "UpperLimitErrorNotice",
8
+ LowerLimitErrorNotice = "LowerLimitErrorNotice",
9
+ InvalidImage = "InvalidImage",
10
+ DisableDelete = "DisableDelete",
11
+ ClearPartialData = "ClearPartialData",
12
+ MarkerFinish = "MarkerFinish",
13
+ LowerLimitPoint = "LowerLimitPoint",
14
+ NoRotateInDependence = "noRotateInDependence",
15
+ UnableToReannotation = "unableToReannotation",
16
+ ForbiddenCreationOutsideBoundary = "ForbiddenCreationOutsideBoundary",
17
+ SuccessfulEdgeAdsorption = "SuccessfulEdgeAdsorption",
18
+ ForbidAddNewPoint = "ForbidAddNewPoint"
19
+ }
@@ -0,0 +1,2 @@
1
+ declare const message: Record<string, string>;
2
+ export default message;
@@ -0,0 +1,4 @@
1
+ declare class Locale {
2
+ static getMessagesByLocale: (key: string, locale: string) => string;
3
+ }
4
+ export default Locale;
@@ -0,0 +1,2 @@
1
+ declare const message: Record<string, string>;
2
+ export default message;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @file Scheduling creation for multi-layer canvas
3
+ * @createdate 2022-06-22
4
+ * @author Ron <ron.f.luo@gmail.com>
5
+ */
6
+ interface ICanvasBasicOperation {
7
+ createCanvas(id: string, options?: {
8
+ size?: {
9
+ width: number;
10
+ height: number;
11
+ };
12
+ }): HTMLCanvasElement;
13
+ createCanvas(canvas: HTMLCanvasElement): HTMLCanvasElement;
14
+ destroyCanvas(id: string): HTMLElement | null;
15
+ switchOrder?: (key: string) => void;
16
+ }
17
+ interface ICavnasSchdulerProps {
18
+ container: HTMLElement;
19
+ }
20
+ declare class CanvasScheduler implements ICanvasBasicOperation {
21
+ private container;
22
+ constructor(props: ICavnasSchdulerProps);
23
+ createCanvas(id: string | HTMLCanvasElement, options?: {
24
+ size?: {
25
+ width: number;
26
+ height: number;
27
+ };
28
+ }): HTMLCanvasElement;
29
+ destroyCanvas(id: string): HTMLElement | null;
30
+ }
31
+ export { CanvasScheduler };
@@ -0,0 +1 @@
1
+ export * from './CanvasScheduler';
@@ -0,0 +1,32 @@
1
+ export default class ActionsHistory {
2
+ record: any[];
3
+ recordIndex: number;
4
+ callback?: () => void;
5
+ minRecordIndex: number;
6
+ /** 历史改变后触发的更新 */
7
+ historyChanged?: (undoEnabled: boolean, redoEnabled: boolean) => void;
8
+ constructor(historyChanged?: (undoEnabled: boolean, redoEnabled: boolean) => void);
9
+ get undoEnabled(): boolean;
10
+ get redoEnabled(): boolean;
11
+ emitHistoryChanged: () => void;
12
+ pushHistory(action: any): void;
13
+ updateHistory(newRecord: any): void;
14
+ /**
15
+ * 应用属性到所有记录
16
+ * @param key
17
+ * @param value
18
+ */
19
+ applyAttribute(id: string | undefined, key: string, value: any): void;
20
+ /** 撤销 */
21
+ undo(): any;
22
+ /** 重做 */
23
+ redo(): any;
24
+ init(): void;
25
+ empty(): void;
26
+ /**
27
+ * 设置已经保存的数据
28
+ * @param minIndex
29
+ * @param isExitData 用于空数组下的赋值
30
+ */
31
+ initRecord(data: any, isExitData?: boolean): void;
32
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * EventBus 事件传递,用于组件间的事件监听/传递
3
+ */
4
+ declare class EventBus {
5
+ private _events;
6
+ constructor();
7
+ /**
8
+ * 事件绑定。(注:相同的事件下的相同方法不支持多次绑定)
9
+ * @param eventName 事件名字
10
+ * @param callback 事件回调
11
+ */
12
+ on(eventName: string, callback: () => void): void;
13
+ /**
14
+ * 单独的事件绑定,一个事件仅支持绑定一个函数
15
+ *
16
+ * @param {string} eventName
17
+ * @param {() => void} callback
18
+ * @memberof EventBus
19
+ */
20
+ singleOn(eventName: string, callback: () => void): void;
21
+ /**
22
+ * 事件广播
23
+ * @param eventName 事件名字
24
+ * @param callback 事件回调
25
+ */
26
+ emit(eventName: string): void;
27
+ /**
28
+ * 事件解绑,对某一事件进行事件解绑
29
+ * @param eventName 需要解绑的事件名字
30
+ * @param callback 需要解绑的方法
31
+ */
32
+ unbind(eventName: string, callback: () => void): void;
33
+ /**
34
+ * 解绑事件
35
+ * @param eventName
36
+ */
37
+ unbindAll(eventName: string): void;
38
+ }
39
+ declare const _default: EventBus;
40
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export default class ImgUtils {
2
+ static load(src: string): Promise<HTMLImageElement>;
3
+ }
@@ -0,0 +1,172 @@
1
+ /**
2
+ * 各类的数学运算
3
+ */
4
+ import { TAnnotationViewData } from '@labelbee/lb-utils';
5
+ import { IPolygonPoint } from '@/types/tool/polygon';
6
+ /**
7
+ * 基础的三角运算
8
+ */
9
+ export declare class Trigonometric {
10
+ static tanAPlusB(tanA: number, tanB: number): number;
11
+ static sinAPlusB(sinA: number, cosA: number, sinB: number, cosB: number): number;
12
+ static cosAPlusB(sinA: number, cosA: number, sinB: number, cosB: number): number;
13
+ }
14
+ export default class MathUtils {
15
+ /**
16
+ * 是否在指定范围内
17
+ * @param value 需要判断的值
18
+ * @param range 范围
19
+ * @returns {boolean} 是否在范围内
20
+ */
21
+ static isInRange: (value: number | number[], range: number[]) => boolean;
22
+ /**
23
+ * 限制点在范围,返回
24
+ * @param value
25
+ * @param range
26
+ * @returns {ICoordinate} 在范围内的点
27
+ */
28
+ static withinRange: (value: number, range: number[]) => number;
29
+ static getRotate(rotate: number): number;
30
+ static getLineLength(point1: ICoordinate, point2: ICoordinate): number;
31
+ /**
32
+ * 计算坐标点的视窗范围
33
+ * @param array 坐标值数组
34
+ * @returns 视窗范围 { top, left, right, bottom }
35
+ */
36
+ static calcViewportBoundaries: (array: ICoordinate[] | undefined, isCurve?: boolean, numberOfSegments?: number, zoom?: number) => {
37
+ top: number;
38
+ bottom: number;
39
+ left: number;
40
+ right: number;
41
+ };
42
+ /**
43
+ * 获取当前左边举例线段的最短路径,建议配合 isHoverLine 使用
44
+ *
45
+ * @export
46
+ * @param {ICoordinate} pt
47
+ * @param {ICoordinate} begin
48
+ * @param {ICoordinate} end
49
+ * @param {boolean} ignoreRatio
50
+ * @returns
51
+ */
52
+ static getFootOfPerpendicular: (pt: ICoordinate, begin: ICoordinate, end: ICoordinate, useAxisRange?: boolean, allowOverRange?: boolean) => any;
53
+ /**
54
+ * 获取当前文本的背景面积
55
+ * @param canvas
56
+ * @param text
57
+ * @param maxWidth
58
+ * @param lineHeight
59
+ * @returns
60
+ */
61
+ static getTextArea(canvas: HTMLCanvasElement, text: string, maxWidth?: number, font?: string, lineHeight?: number): {
62
+ width: number;
63
+ height: number;
64
+ lineHeight?: undefined;
65
+ fontHeight?: undefined;
66
+ } | {
67
+ width: number;
68
+ height: number;
69
+ lineHeight: number;
70
+ fontHeight: number;
71
+ };
72
+ /**
73
+ * 获取线条中心点
74
+ * @param line
75
+ * @returns
76
+ */
77
+ static getLineCenterPoint(line: [ICoordinate, ICoordinate]): {
78
+ x: number;
79
+ y: number;
80
+ };
81
+ /**
82
+ * 获取线条的垂线
83
+ * @param line
84
+ * @returns
85
+ */
86
+ static getPerpendicularLine(line: ICoordinate[]): ICoordinate[] | undefined;
87
+ /**
88
+ * 获取当前垂直于直线的最后一个点的垂线点
89
+ * @param line
90
+ * @param coordinate
91
+ * @returns
92
+ */
93
+ static getPerpendicularFootOfLine(line: ICoordinate[], coordinate: ICoordinate): any;
94
+ /**
95
+ * 从正三角形获取正四边形
96
+ * @param triangle
97
+ * @returns
98
+ */
99
+ static getQuadrangleFromTriangle(triangle: ICoordinate[]): ICoordinate[];
100
+ /**
101
+ * 矩形拖动线,实现横向的扩大缩小
102
+ * @param dragStartCoord
103
+ * @param currentCoord
104
+ * @param basicLine
105
+ * @returns
106
+ */
107
+ static getRectPerpendicularOffset(dragStartCoord: ICoordinate, currentCoord: ICoordinate, basicLine: [ICoordinate, ICoordinate]): {
108
+ x: number;
109
+ y: number;
110
+ };
111
+ /**
112
+ * 获取当前真实 Index
113
+ * @param index
114
+ * @param len
115
+ * @returns
116
+ */
117
+ static getArrayIndex(index: number, len: number): number;
118
+ /**
119
+ * 在矩形点集拖动一个点时,需要进行一直维持矩形
120
+ * @param pointList
121
+ * @param changePointIndex
122
+ * @param offset
123
+ * @returns
124
+ */
125
+ static getPointListFromPointOffset(pointList: [ICoordinate, ICoordinate, ICoordinate, ICoordinate], changePointIndex: number, offset: ICoordinate): ICoordinate[];
126
+ /**
127
+ * 获取矩形框旋转中心
128
+ * @param rectPointList
129
+ * @returns
130
+ */
131
+ static getRectCenterPoint(rectPointList: [ICoordinate, ICoordinate, ICoordinate, ICoordinate]): {
132
+ x: number;
133
+ y: number;
134
+ };
135
+ /**
136
+ * 获取按指定的 angle 旋转的角度后的矩形
137
+ * @param rotate
138
+ * @param rectPointList
139
+ * @returns
140
+ */
141
+ static rotateRectPointList(angle: number | undefined, rectPointList: [ICoordinate, ICoordinate, ICoordinate, ICoordinate]): {
142
+ x: number;
143
+ y: number;
144
+ }[];
145
+ /**
146
+ * 通过当前坐标 + 已知两点获取正多边形
147
+ * @param coordinate
148
+ * @param pointList
149
+ * @returns
150
+ */
151
+ static getRectangleByRightAngle(coordinate: ICoordinate, pointList: IPolygonPoint[]): ICoordinate[];
152
+ /**
153
+ * Get the radius from quadrangle under top-view
154
+ *
155
+ * Return Range [0 , 2PI]
156
+ * @param points
157
+ * @returns
158
+ */
159
+ static getRadiusFromQuadrangle(points: [ICoordinate, ICoordinate, ICoordinate, ICoordinate]): number;
160
+ /**
161
+ * Rewrite the CollectionPoint Calculation (Diff`from getCollectionPointByAnnotationData)
162
+ * @param annotations
163
+ * @returns
164
+ */
165
+ static getCollectionPointByAnnotationDataPromise(annotations: TAnnotationViewData[]): {
166
+ promise: Promise<unknown>;
167
+ close: () => void;
168
+ };
169
+ static getCollectionPointByAnnotationData(annotations: TAnnotationViewData[]): {
170
+ connectionPoints: ICoordinate[];
171
+ };
172
+ }
@@ -0,0 +1,29 @@
1
+ declare function getClosestPoint(coordinate: any, polygonList: any, lineType: number | undefined, range: number | undefined, option: any): {
2
+ dropFoot: any;
3
+ closestEdgeIndex: number;
4
+ closestPolygonID: string;
5
+ hasClosed: boolean;
6
+ };
7
+ declare class CommonToolUtils {
8
+ static findAllLine(pointList: any, isClose?: boolean): {
9
+ point1: any;
10
+ point2: any;
11
+ pointIndex: number;
12
+ }[];
13
+ }
14
+ declare class MathUtils {
15
+ static isInRange(value: any, range: any): boolean;
16
+ static getLineLength(point1: any, point2: any): number;
17
+ static isOutOfRange(coordinate: any, point1: any, point2: any, range: any): boolean;
18
+ static cross(vector1: any, vector2: any): number;
19
+ static getFootOfPerpendicular(pt: any, begin: any, end: any, useAxisRange?: boolean): {
20
+ x: number;
21
+ y: number;
22
+ } | {
23
+ footPoint: {
24
+ x: number;
25
+ y: number;
26
+ };
27
+ length: number;
28
+ };
29
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 向量运算
3
+ * @author laoluo
4
+ */
5
+ export default class Vector {
6
+ static add(vector1: ICoordinate, vector2: ICoordinate): {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ static getVector(point1: ICoordinate, point2: ICoordinate): {
11
+ x: number;
12
+ y: number;
13
+ };
14
+ static len(vector: ICoordinate): number;
15
+ static dotProduct(vector1: ICoordinate, vector2: ICoordinate): number;
16
+ }
@@ -0,0 +1,94 @@
1
+ import { ELang } from '../../constant/annotation';
2
+ import { IPolygonData } from '../../types/tool/polygon';
3
+ import { ETextType } from '../../constant/tool';
4
+ export declare const ATTRIBUTE_COLORS: string[];
5
+ export declare const REGEXP_NUMBER = "^[0-9]+$";
6
+ export declare const REGEXP_ENGLISH = "^[A-Za-z]+$";
7
+ export default class AttributeUtils {
8
+ /**
9
+ * 获取属性icon
10
+ * @param attribute
11
+ * @param attributeList
12
+ */
13
+ static getAttributeIcon(attribute: string, attributeList: IInputList[], valid?: boolean): HTMLImageElement;
14
+ /**
15
+ * 获取正则校验的string
16
+ * @param textCheckType
17
+ * @param customFormat
18
+ */
19
+ static checkString(textCheckType: number, customFormat: string): string;
20
+ /**
21
+ *
22
+ * @param value 检测的值
23
+ * @param checkString RegExp string
24
+ */
25
+ static checkTextAttibute(value: string | undefined, checkStrings: string): boolean;
26
+ /**
27
+ * 获取属性标注显示的数据
28
+ * @param attribute
29
+ * @param attributeList
30
+ * @returns {string} 标注属性
31
+ */
32
+ static getAttributeShowText(attribute: string | undefined, attributeList?: IInputList[]): string | undefined;
33
+ /**
34
+ * 获取属性标注的索引
35
+ * @param attribute
36
+ * @param attributeList
37
+ * @returns {number} 属性索引
38
+ */
39
+ static getAttributeIndex(attribute: string | undefined, attributeList: IInputList[]): number;
40
+ /**
41
+ * 获取属性标注的索引
42
+ * @param attribute
43
+ * @param attributeList
44
+ * @returns {string} 颜色hex值
45
+ */
46
+ static getAttributeColor(attribute: string | undefined, attributeList: IInputList[]): string;
47
+ /**
48
+ * 文本标注:自动获取下一个序号(取当前数据的最大值 + 1)
49
+ * @param toolResultList 工具的结果集
50
+ * @param textCheckType
51
+ */
52
+ static getTextAttribute(toolResultList: IRect[] | IPolygonData[] | IPoint[] | ILine[], textCheckType: number): string;
53
+ /**
54
+ * 更改数据的textAttribute
55
+ * @param value
56
+ * @param selectedID 工具中选中数据的ID
57
+ * @param toolList 工具的结果集
58
+ */
59
+ static textChange(value: string | undefined, selectedID: string, toolList: any[]): any[];
60
+ /**
61
+ * 获取错误提示的文案
62
+ * @param textCheckType
63
+ */
64
+ static getErrorNotice(textCheckType: number, lang: ELang): string;
65
+ static textAttributeValidate(textCheckType: number, customFormat: string, text: string): boolean | undefined;
66
+ /**
67
+ * 检查结果的文本标注数据是否可以通过
68
+ * @param textCheckType
69
+ * @param customFormat
70
+ * @param resultList 需要检查的结果集
71
+ */
72
+ static checkTextAttribute(textCheckType: ETextType, customFormat: string, resultList: any[], selectedID?: string): boolean;
73
+ /**
74
+ * 改变文本标注后 修改全部的LOG
75
+ * @param toolLog LOG数据
76
+ * @param toolList 工具的数据集
77
+ */
78
+ static changeTextAttributeInLog(toolLog: any[][], toolList: any[]): any[][];
79
+ static getTextIconSvg(attribute: string | undefined, attributeList: IInputList[], attributeConfigurable: boolean | undefined, baseIcon: any): any;
80
+ static generateIconAttribute({ fill, width, height, xmlns, xlink, }: {
81
+ fill?: string;
82
+ width?: number;
83
+ height?: number;
84
+ xmlns?: string;
85
+ xlink?: string;
86
+ }): string;
87
+ /**
88
+ * 根据keycode返回attribute, 没有匹配到时为undefined
89
+ * @param keyCode
90
+ * @param attributeList
91
+ * @returns {undefined|string} 没有匹配到时为undefined
92
+ */
93
+ static getAttributeByKeycode(keyCode: number, attributeList: IInputList[]): string | undefined;
94
+ }