@labelbee/lb-annotation 1.7.2-alpha.2 → 1.8.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.
@@ -14,6 +14,7 @@ interface IProps {
14
14
  export default class AnnotationEngine {
15
15
  toolInstance: any;
16
16
  toolName: EToolName;
17
+ i18nLanguage: 'en' | 'cn';
17
18
  private container;
18
19
  private size;
19
20
  private config;
@@ -1,6 +1,7 @@
1
1
  /**
2
- * @file 实现线条工具的交互
3
- * @author lijingchi <lijingchi1@sensetime.com>
2
+ * @author Glenfiddish <edwinlee0927@hotmail.com>
3
+ * @file Implement LineTool's interaction
4
+ * @date 2022-06-02
4
5
  */
5
6
  import { BasicToolOperation, IBasicToolOperationProps } from './basicToolOperation';
6
7
  declare enum EStatus {
@@ -30,7 +31,7 @@ declare class LineToolOperation extends BasicToolOperation {
30
31
  * @param coord 当前的坐标
31
32
  * @param e 鼠标事件
32
33
  */
33
- drawActivatedLine: (coord?: ICoordinate | undefined, e?: MouseEvent | undefined, hideTempAxis?: boolean | undefined) => void;
34
+ drawActivatedLine: (coord?: ICoordinate, e?: MouseEvent, hideTempAxis?: boolean) => void;
34
35
  /** 线条是否被选中 */
35
36
  get isLineSelected(): "" | ILinePoint[] | undefined;
36
37
  /** 选中点线条的点 */
@@ -168,7 +169,7 @@ declare class LineToolOperation extends BasicToolOperation {
168
169
  /**
169
170
  * 渲染已经绘制的线段
170
171
  */
171
- render: (nextPoint?: IPoint | undefined) => void;
172
+ render: (nextPoint?: IPoint) => void;
172
173
  /** 重新计算并渲染热区 */
173
174
  updateActiveArea(): void;
174
175
  getActiveArea(): {
@@ -17,7 +17,7 @@ declare class TextToolOperation extends BasicToolOperation {
17
17
  get currentPageResult(): ITextResult[];
18
18
  setResult(textResultList: ITextResult[]): void;
19
19
  /** 获取单个初始值 */
20
- getSingleResult: (sourceID?: string | undefined) => ITextResult;
20
+ getSingleResult: (sourceID?: string) => ITextResult;
21
21
  /**
22
22
  * 获取初始值结果列表
23
23
  */
@@ -169,7 +169,7 @@ declare class BasicToolOperation extends EventListener {
169
169
  onKeyDown(e: KeyboardEvent): boolean | void;
170
170
  onKeyUp(e: KeyboardEvent): boolean | void;
171
171
  onWheel(e: any, isRender?: boolean): boolean | void;
172
- wheelChangePos: (coord: ICoordinate, operator: 1 | -1 | 0, newZoom?: number | undefined) => void;
172
+ wheelChangePos: (coord: ICoordinate, operator: 1 | -1 | 0, newZoom?: number) => void;
173
173
  /**
174
174
  * 通过ZOOM_LEVEL, 计算出下一个缩放的值。
175
175
  * @param isZoomIn 是否为放大
@@ -14,6 +14,7 @@ declare class PolygonOperation extends BasicToolOperation {
14
14
  selectedID?: string;
15
15
  editPolygonID?: string;
16
16
  pattern: EPolygonPattern;
17
+ isCombined: boolean;
17
18
  private dragInfo?;
18
19
  private drawingHistory;
19
20
  private isCtrl;
@@ -111,6 +112,9 @@ declare class PolygonOperation extends BasicToolOperation {
111
112
  onLeftDblClick(e: MouseEvent): void;
112
113
  onRightDblClick(e: MouseEvent): void;
113
114
  onMouseDown(e: MouseEvent): true | undefined;
115
+ segment(): void;
116
+ onCombinedExecute(): void;
117
+ combine(e: MouseEvent): void;
114
118
  /**
115
119
  * 判断是否在边界外
116
120
  * @param selectedPointList
@@ -138,6 +142,7 @@ declare class PolygonOperation extends BasicToolOperation {
138
142
  renderTextAttribute(): void;
139
143
  renderPolygon(): void;
140
144
  render(): void;
145
+ renderCursorLine(lineColor: string): void;
141
146
  /** 撤销 */
142
147
  undo(): void;
143
148
  /** 重做 */
@@ -32,7 +32,7 @@ declare class TagOperation extends BasicToolOperation {
32
32
  get sourceID(): any;
33
33
  onKeyDown(e: KeyboardEvent): void;
34
34
  setLabel: (i: number, j: number) => void;
35
- clearResult: (sendMessage?: boolean, value?: string | undefined) => void;
35
+ clearResult: (sendMessage?: boolean, value?: string) => void;
36
36
  /**
37
37
  * 清除当前渲染的标签
38
38
  */
@@ -66,4 +66,51 @@ export default class PolygonUtils {
66
66
  x: number;
67
67
  y: number;
68
68
  }[];
69
+ static deletePolygonLastPoint(acc: any, cur: any[], index: number, array: string | any[]): any;
70
+ static concatBeginAndEnd(array: any[]): any[];
71
+ static segmentPolygonByPolygon(pointList: IPolygonPoint[], polygonList: IPolygonData[]): IPolygonPoint[][] | void;
72
+ /**
73
+ * 获取当前多边形的点集
74
+ *
75
+ * @export
76
+ * @param {string} selectedPolygonID
77
+ * @param {IPolygonData[]} polygonList
78
+ * @returns
79
+ */
80
+ static getPolygonPointList(selectedPolygonID: string, polygonList: IPolygonData[]): IPolygonPoint[];
81
+ /**
82
+ * 获取包裹当前 polygon 的 index
83
+ * @param pointList
84
+ * @param polygonList
85
+ * @returns
86
+ */
87
+ static getWrapPolygonIndex(pointList: IPolygonPoint[], polygonList: IPolygonData[]): number;
88
+ /**
89
+ * 获取内部切割后的多边形合体点集
90
+ * @param pointList
91
+ * @param wrapPointList
92
+ * @returns
93
+ */
94
+ static clipPolygonFromWrapPolygon(pointList: IPolygonPoint[], wrapPointList: IPolygonPoint[]): IPolygonPoint[];
95
+ /**
96
+ * 难点:判断凹多边形的方向
97
+ *
98
+ * https://www.huaweicloud.com/articles/12463693.html
99
+ * @param p
100
+ * @returns
101
+ */
102
+ static isPolygonClosewise(p: IPolygonPoint[]): 0 | 1 | -1;
103
+ /**
104
+ * 获取当前点与多边形点集最近的点,并返回 Index
105
+ */
106
+ static getClosePointDistanceFromPolygon(point: ICoordinate, pointList: IPolygonPoint[]): number;
107
+ /**
108
+ * 多边形合成多边形
109
+ * @param selectedPolygon
110
+ * @param combinedPolygon
111
+ */
112
+ static combinePolygonWithPolygon(selectedPolygon: IPolygonData, combinedPolygon: IPolygonData): {
113
+ newPolygon: IPolygonData;
114
+ unionList: string[];
115
+ } | undefined;
69
116
  }
package/es/.DS_Store ADDED
Binary file