@labelbee/lb-annotation 1.13.0 → 1.14.0-alpha.0
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.
- package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -0
- package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -0
- package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -0
- package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -0
- package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +12 -0
- package/dist/constant/annotation.js +1 -1
- package/dist/constant/tool.js +1 -1
- package/dist/core/pointCloud/annotation.js +1 -1
- package/dist/core/pointCloud/index.js +2 -2
- package/dist/core/scheduler.js +1 -1
- package/dist/core/toolOperation/ViewOperation.js +1 -1
- package/dist/core/toolOperation/basicToolOperation.js +1 -1
- package/dist/core/toolOperation/cuboidOperation.js +1 -0
- package/dist/core/toolOperation/cuboidToggleButtonClass.js +31 -0
- package/dist/types/constant/annotation.d.ts +45 -1
- package/dist/types/constant/tool.d.ts +6 -1
- package/dist/types/core/index.d.ts +1 -2
- package/dist/types/core/pointCloud/annotation.d.ts +11 -1
- package/dist/types/core/pointCloud/index.d.ts +11 -1
- package/dist/types/core/pointCloud/matrix.d.ts +1 -0
- package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
- package/dist/types/core/scheduler.d.ts +7 -2
- package/dist/types/core/toolOperation/ViewOperation.d.ts +3 -2
- package/dist/types/core/toolOperation/basicToolOperation.d.ts +11 -1
- package/dist/types/core/toolOperation/cuboidOperation.d.ts +155 -0
- package/dist/types/core/toolOperation/cuboidToggleButtonClass.d.ts +38 -0
- package/dist/types/utils/MathUtils.d.ts +1 -1
- package/dist/types/utils/tool/AttributeUtils.d.ts +7 -0
- package/dist/types/utils/tool/AxisUtils.d.ts +50 -1
- package/dist/types/utils/tool/CuboidUtils.d.ts +267 -0
- package/dist/types/utils/tool/DrawUtils.d.ts +12 -0
- package/dist/types/utils/tool/EnhanceCommonToolUtils.d.ts +4 -2
- package/dist/types/utils/tool/PolygonUtils.d.ts +5 -2
- package/dist/utils/MathUtils.js +2 -2
- package/dist/utils/tool/AttributeUtils.js +1 -1
- package/dist/utils/tool/AxisUtils.js +1 -1
- package/dist/utils/tool/CuboidUtils.js +1 -0
- package/dist/utils/tool/DrawUtils.js +3 -3
- package/dist/utils/tool/EnhanceCommonToolUtils.js +1 -1
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
- package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -0
- package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -0
- package/es/assets/attributeIcon/icon_cuboidMore.svg.js +5 -0
- package/es/assets/attributeIcon/icon_cuboidRight.svg.js +5 -0
- package/es/assets/attributeIcon/icon_cuboidTop.svg.js +12 -0
- package/es/constant/annotation.js +1 -1
- package/es/constant/tool.js +1 -1
- package/es/core/pointCloud/annotation.js +1 -1
- package/es/core/pointCloud/index.js +2 -2
- package/es/core/pointCloud/segmentation.js +50 -0
- package/es/core/scheduler.js +1 -1
- package/es/core/toolOperation/ViewOperation.js +1 -1
- package/es/core/toolOperation/basicToolOperation.js +1 -1
- package/es/core/toolOperation/cuboidOperation.js +1 -0
- package/es/core/toolOperation/cuboidToggleButtonClass.js +31 -0
- package/es/core/toolOperation/scribbleTool2.js +249 -0
- package/es/utils/MathUtils.js +2 -2
- package/es/utils/tool/AttributeUtils.js +1 -1
- package/es/utils/tool/AxisUtils.js +1 -1
- package/es/utils/tool/CuboidUtils.js +1 -0
- package/es/utils/tool/DrawUtils.js +3 -3
- package/es/utils/tool/EnhanceCommonToolUtils.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { ECuboidLineDirection, ECuboidPlain, ECuboidPosition, EDragTarget, ECuboidDirection } from '@/constant/annotation';
|
|
2
|
+
import type { ICuboid, ICuboidConfig, ICuboidPosition, IDrawingCuboid, IPlanePoints } from '@/types/tool/cuboid';
|
|
3
|
+
/**
|
|
4
|
+
* Get the basicInfo of cuboid-frontPoints.
|
|
5
|
+
* @param param0
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPlanePointsBasicInfo({ tr, tl, br }: IPlanePoints): {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
centerPoints: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function getCuboidBasicInfo({ frontPoints, backPoints, }: {
|
|
17
|
+
frontPoints: IPlanePoints;
|
|
18
|
+
backPoints: IPlanePoints;
|
|
19
|
+
}): {
|
|
20
|
+
frontCenter: {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
};
|
|
24
|
+
backCenter: {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
};
|
|
28
|
+
frontWidth: number;
|
|
29
|
+
frontHeight: number;
|
|
30
|
+
backWidth: number;
|
|
31
|
+
backHeight: number;
|
|
32
|
+
isLeftSide: boolean;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Use two diagonalPoints to create Regular Rect(Plain)
|
|
36
|
+
* @param p1
|
|
37
|
+
* @param p2
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
export declare function getPlainPointsByDiagonalPoints(p1: ICoordinate, p2: ICoordinate): IPlanePoints;
|
|
41
|
+
/**
|
|
42
|
+
* Get the max external quadrilateral by points.
|
|
43
|
+
* @param points
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
export declare function getMaxExternalQuadrilateral(points: IPlanePoints): {
|
|
47
|
+
tl: {
|
|
48
|
+
x: any;
|
|
49
|
+
y: any;
|
|
50
|
+
};
|
|
51
|
+
tr: {
|
|
52
|
+
x: any;
|
|
53
|
+
y: any;
|
|
54
|
+
};
|
|
55
|
+
bl: {
|
|
56
|
+
x: any;
|
|
57
|
+
y: any;
|
|
58
|
+
};
|
|
59
|
+
br: {
|
|
60
|
+
x: any;
|
|
61
|
+
y: any;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare function judgeCuboidLineIsRowOrColumn(pointList: [ICuboidPosition, ICuboidPosition]): ECuboidLineDirection | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Copy the plain through points and new bottomRightPoint.
|
|
67
|
+
* @param param0
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
export declare function getPointsByBottomRightPoint({ coord, points, }: {
|
|
71
|
+
coord: ICoordinate;
|
|
72
|
+
points: IPlanePoints;
|
|
73
|
+
}): IPlanePoints;
|
|
74
|
+
/**
|
|
75
|
+
* Copy the plain through points and new bottomLeftPoint.
|
|
76
|
+
*
|
|
77
|
+
* Notice: currentPoints is just regular rectangle.
|
|
78
|
+
*
|
|
79
|
+
* @param param0
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
export declare function getPointsByBottomLeftPoint({ coord, points, }: {
|
|
83
|
+
coord: ICoordinate;
|
|
84
|
+
points: IPlanePoints;
|
|
85
|
+
}): IPlanePoints;
|
|
86
|
+
/**
|
|
87
|
+
* The showing sideline is line that connects the front and back planes.
|
|
88
|
+
* @param param0
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
export declare function getCuboidShowingSideLine({ frontPoints, backPoints, }: {
|
|
92
|
+
frontPoints: IPlanePoints;
|
|
93
|
+
backPoints: IPlanePoints;
|
|
94
|
+
}): {
|
|
95
|
+
top: {
|
|
96
|
+
p1: ICoordinate;
|
|
97
|
+
p2: ICoordinate;
|
|
98
|
+
};
|
|
99
|
+
bottom: {
|
|
100
|
+
p1: ICoordinate;
|
|
101
|
+
p2: ICoordinate;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @param param0
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
109
|
+
export declare function getPointsByIntersection({ frontPoints, backPoints, }: {
|
|
110
|
+
frontPoints: IPlanePoints;
|
|
111
|
+
backPoints: IPlanePoints;
|
|
112
|
+
}): {
|
|
113
|
+
backPoints: {
|
|
114
|
+
bl: ICoordinate;
|
|
115
|
+
tl: ICoordinate;
|
|
116
|
+
br: ICoordinate;
|
|
117
|
+
tr: ICoordinate;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* When the point
|
|
122
|
+
* @param frontPoints
|
|
123
|
+
* @param backPoints
|
|
124
|
+
*/
|
|
125
|
+
export declare function getBackPointsByFrontPoints({ frontPoints, backPoints, }: {
|
|
126
|
+
frontPoints: IPlanePoints;
|
|
127
|
+
backPoints: IPlanePoints;
|
|
128
|
+
}): {
|
|
129
|
+
frontPoints: IPlanePoints;
|
|
130
|
+
backPoints: {
|
|
131
|
+
bl: ICoordinate;
|
|
132
|
+
tl: ICoordinate;
|
|
133
|
+
br: ICoordinate;
|
|
134
|
+
tr: ICoordinate;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export declare function getFrontPointsByBackPoints({ frontPoints, backPoints, }: {
|
|
138
|
+
frontPoints: IPlanePoints;
|
|
139
|
+
backPoints: IPlanePoints;
|
|
140
|
+
}): {
|
|
141
|
+
frontPoints: {
|
|
142
|
+
bl: ICoordinate;
|
|
143
|
+
tl: ICoordinate;
|
|
144
|
+
br: ICoordinate;
|
|
145
|
+
tr: ICoordinate;
|
|
146
|
+
};
|
|
147
|
+
backPoints: IPlanePoints;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Get SideLine By FrontPoints & BackPoints
|
|
151
|
+
* @param param0
|
|
152
|
+
* @returns
|
|
153
|
+
*/
|
|
154
|
+
export declare function getCuboidAllSideLine({ frontPoints, backPoints }: ICuboid): {
|
|
155
|
+
p1: ICoordinate;
|
|
156
|
+
p2: ICoordinate;
|
|
157
|
+
}[];
|
|
158
|
+
export declare function getHighlightLines(cuboid: ICuboid): ({
|
|
159
|
+
p1: ICoordinate;
|
|
160
|
+
p2: ICoordinate;
|
|
161
|
+
positions: {
|
|
162
|
+
plain: ECuboidPlain;
|
|
163
|
+
position: ECuboidPosition;
|
|
164
|
+
}[];
|
|
165
|
+
plain?: undefined;
|
|
166
|
+
} | {
|
|
167
|
+
p1: ICoordinate;
|
|
168
|
+
p2: ICoordinate;
|
|
169
|
+
plain: ECuboidPlain;
|
|
170
|
+
positions: {
|
|
171
|
+
plain: ECuboidPlain;
|
|
172
|
+
position: ECuboidPosition;
|
|
173
|
+
}[];
|
|
174
|
+
})[];
|
|
175
|
+
/**
|
|
176
|
+
* Just showing the points which can be adjusted
|
|
177
|
+
* @param cuboid
|
|
178
|
+
* @returns
|
|
179
|
+
*/
|
|
180
|
+
export declare function getHighlightPoints(cuboid: ICuboid): {
|
|
181
|
+
point: ICoordinate;
|
|
182
|
+
positions: ICuboidPosition[];
|
|
183
|
+
}[];
|
|
184
|
+
/**
|
|
185
|
+
* Get the range of Cuboid in 2D.
|
|
186
|
+
*
|
|
187
|
+
*
|
|
188
|
+
* @param param0
|
|
189
|
+
* @returns
|
|
190
|
+
*/
|
|
191
|
+
export declare function getCuboidHoverRange(cuboid: ICuboid): ICoordinate[];
|
|
192
|
+
/**
|
|
193
|
+
* Notice: positions just support point and line moving.
|
|
194
|
+
* @param param0
|
|
195
|
+
*/
|
|
196
|
+
export declare function getNewPointsAfterOffset({ offset, frontPoints, backPoints, positions, }: {
|
|
197
|
+
frontPoints: IPlanePoints;
|
|
198
|
+
backPoints: IPlanePoints;
|
|
199
|
+
offset: ICoordinate;
|
|
200
|
+
positions?: ICuboidPosition[];
|
|
201
|
+
}): {
|
|
202
|
+
frontPoints: IPlanePoints;
|
|
203
|
+
backPoints: IPlanePoints;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Update cuboid when dragging.
|
|
207
|
+
* @param param0
|
|
208
|
+
* @returns
|
|
209
|
+
*/
|
|
210
|
+
export declare function getCuboidDragMove({ offset, cuboid, dragTarget, positions, }: {
|
|
211
|
+
offset: ICoordinate;
|
|
212
|
+
cuboid: ICuboid;
|
|
213
|
+
dragTarget: EDragTarget;
|
|
214
|
+
positions?: ICuboidPosition[];
|
|
215
|
+
}): ICuboid | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* Get the points of the corresponding faces by direction
|
|
218
|
+
* @param cuboid
|
|
219
|
+
* @returns
|
|
220
|
+
*/
|
|
221
|
+
export declare function getPointListsByDirection({ direction, frontPoints, backPoints, }: {
|
|
222
|
+
direction: ECuboidDirection;
|
|
223
|
+
frontPoints: IPlanePoints;
|
|
224
|
+
backPoints: IPlanePoints;
|
|
225
|
+
}): any[] | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* Get the offset of toggleDirection Dom.
|
|
228
|
+
*
|
|
229
|
+
* Calculation
|
|
230
|
+
* 1. FrontPoints left centerPoints.
|
|
231
|
+
* 2. Offset the size of toggleDom.
|
|
232
|
+
* @param param0
|
|
233
|
+
* @returns
|
|
234
|
+
*/
|
|
235
|
+
export declare function getToggleDirectionButtonOffset({ cuboid, currentPos, zoom, }: {
|
|
236
|
+
cuboid: ICuboid;
|
|
237
|
+
currentPos: ICoordinate;
|
|
238
|
+
zoom: number;
|
|
239
|
+
}): {
|
|
240
|
+
left: number;
|
|
241
|
+
top: number;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* The default offset is base on iconSvg.
|
|
245
|
+
*
|
|
246
|
+
* @param param0
|
|
247
|
+
* @returns
|
|
248
|
+
*/
|
|
249
|
+
export declare function getCuboidTextAttributeOffset({ cuboid, currentPos, zoom, leftOffset, topOffset, }: {
|
|
250
|
+
cuboid: ICuboid | IDrawingCuboid;
|
|
251
|
+
currentPos: ICoordinate;
|
|
252
|
+
zoom: number;
|
|
253
|
+
leftOffset?: number;
|
|
254
|
+
topOffset?: number;
|
|
255
|
+
}): {
|
|
256
|
+
left: number;
|
|
257
|
+
top: number;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Judgement of minWidth & minHeight
|
|
261
|
+
* @param param0
|
|
262
|
+
* @returns
|
|
263
|
+
*/
|
|
264
|
+
export declare function isCuboidWithInLimits({ cuboid, config }: {
|
|
265
|
+
cuboid: ICuboid | IDrawingCuboid;
|
|
266
|
+
config: ICuboidConfig;
|
|
267
|
+
}): boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ICuboid, IDrawingCuboid } from '@/types/tool/cuboid';
|
|
1
2
|
import { ELineTypes } from '../../constant/tool';
|
|
2
3
|
import { IPolygonPoint } from '../../types/tool/polygon';
|
|
3
4
|
export interface IDrawTextConfig {
|
|
@@ -163,4 +164,15 @@ export default class DrawUtils {
|
|
|
163
164
|
theta: number;
|
|
164
165
|
headLen: number;
|
|
165
166
|
}>): void;
|
|
167
|
+
/**
|
|
168
|
+
* Expansion of other base draw.
|
|
169
|
+
*
|
|
170
|
+
* Simple Version.
|
|
171
|
+
* @param param0
|
|
172
|
+
*/
|
|
173
|
+
static drawCuboid(canvas: HTMLCanvasElement, cuboid: ICuboid | IDrawingCuboid, options?: Partial<{
|
|
174
|
+
strokeColor: string;
|
|
175
|
+
fillColor: string;
|
|
176
|
+
thickness: number;
|
|
177
|
+
}>): void;
|
|
166
178
|
}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { ECheckModel, EToolName } from '@/constant/tool';
|
|
7
7
|
import ScribbleTool from '@/core/toolOperation/ScribbleTool';
|
|
8
|
+
import CuboidOperation from '@/core/toolOperation/cuboidOperation';
|
|
9
|
+
import PointCloud2dOperation from '@/core/toolOperation/pointCloud2dOperation';
|
|
8
10
|
import CheckOperation from '../../core/toolOperation/checkOperation';
|
|
9
11
|
import PolygonOperation from '../../core/toolOperation/polygonOperation';
|
|
10
12
|
import RectOperationAsNewName from '../../core/toolOperation/rectOperation';
|
|
@@ -13,9 +15,9 @@ import LineToolOperation from '../../core/toolOperation/LineToolOperation';
|
|
|
13
15
|
import PointOperation from '../../core/toolOperation/pointOperation';
|
|
14
16
|
import TextToolOperation from '../../core/toolOperation/TextToolOperation';
|
|
15
17
|
import CommonToolUtils from './CommonToolUtils';
|
|
16
|
-
declare const getCurrentOperation: (toolName: EToolName | ECheckModel) => typeof RectOperationAsNewName | typeof TagOperation | typeof PointOperation | typeof LineToolOperation | typeof TextToolOperation | typeof PolygonOperation | typeof ScribbleTool | typeof CheckOperation;
|
|
18
|
+
declare const getCurrentOperation: (toolName: EToolName | ECheckModel) => typeof RectOperationAsNewName | typeof TagOperation | typeof PointOperation | typeof LineToolOperation | typeof TextToolOperation | typeof PolygonOperation | typeof ScribbleTool | typeof PointCloud2dOperation | typeof CuboidOperation | typeof CheckOperation;
|
|
17
19
|
declare class EnhanceCommonToolUtils extends CommonToolUtils {
|
|
18
|
-
static getCurrentOperation: (toolName: EToolName | ECheckModel) => typeof RectOperationAsNewName | typeof TagOperation | typeof PointOperation | typeof LineToolOperation | typeof TextToolOperation | typeof PolygonOperation | typeof ScribbleTool | typeof CheckOperation;
|
|
20
|
+
static getCurrentOperation: (toolName: EToolName | ECheckModel) => typeof RectOperationAsNewName | typeof TagOperation | typeof PointOperation | typeof LineToolOperation | typeof TextToolOperation | typeof PolygonOperation | typeof ScribbleTool | typeof PointCloud2dOperation | typeof CuboidOperation | typeof CheckOperation;
|
|
19
21
|
}
|
|
20
22
|
export { getCurrentOperation };
|
|
21
23
|
export default EnhanceCommonToolUtils;
|
|
@@ -2,14 +2,17 @@ import { ERotateDirection } from '@/constant/annotation';
|
|
|
2
2
|
import { IPolygonData, IPolygonPoint } from '../../types/tool/polygon';
|
|
3
3
|
import { ELineTypes } from '../../constant/tool';
|
|
4
4
|
export default class PolygonUtils {
|
|
5
|
-
static getHoverPolygonID(checkPoint: IPolygonPoint, polygonPoints:
|
|
5
|
+
static getHoverPolygonID(checkPoint: IPolygonPoint, polygonPoints: {
|
|
6
|
+
pointList: IPolygonPoint[];
|
|
7
|
+
id: string;
|
|
8
|
+
}[], scope?: number, lineType?: ELineTypes): string;
|
|
6
9
|
/**
|
|
7
10
|
* 计算多边形面积(Shoelace Theorem,鞋带定理)
|
|
8
11
|
* @param pointList
|
|
9
12
|
* @returns
|
|
10
13
|
*/
|
|
11
14
|
static calcPolygonSize(pointList?: IPolygonPoint[]): number;
|
|
12
|
-
static isInPolygon(checkPoint: IPolygonPoint, polygonPoints: IPolygonPoint[], lineType?: ELineTypes): boolean;
|
|
15
|
+
static isInPolygon(checkPoint: IPolygonPoint, polygonPoints: (IPolygonPoint | ICoordinate)[], lineType?: ELineTypes): boolean;
|
|
13
16
|
/**
|
|
14
17
|
* 通过数据转换为平滑曲线的点提交 [{x: number, y: number}...] => [x, ...smoothCurvePoints ,y]
|
|
15
18
|
* @param pointList
|
package/dist/utils/MathUtils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MathUtilsWorker=require("../_virtual/MathUtilsWorker.js"),tool=require("../constant/tool.js"),polygonTool=require("./tool/polygonTool.js"),PolygonUtils=require("./tool/PolygonUtils.js"),VectorUtils=require("./VectorUtils.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__spreadValues=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));class Trigonometric{static tanAPlusB(t,o){return(t+o)/(1-t*o)}static sinAPlusB(t,o,s,r){return r*t+o*s}static cosAPlusB(t,o,s,r){return o*r-t*s}}const _MathUtils=class{static getRotate(e){return e+90>=360?e+90-360:e+90}static getLineLength(e,t){return Math.sqrt(Math.pow(t.y-e.y,2)+Math.pow(t.x-e.x,2))}static getTextArea(e,t,o=tool.DEFAULT_TEXT_MAX_WIDTH,s=tool.DEFAULT_FONT,r){if(typeof t!="string")return{width:0,height:0};const i=e.getContext("2d");i.font=s;let n=0;typeof r=="undefined"&&(r=e&&parseInt(window.getComputedStyle(e).lineHeight,10)||parseInt(window.getComputedStyle(document.body).lineHeight,10));const
|
|
2
|
-
`);let l=0;for(let u=0;u<
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MathUtilsWorker=require("../_virtual/MathUtilsWorker.js"),tool=require("../constant/tool.js"),polygonTool=require("./tool/polygonTool.js"),PolygonUtils=require("./tool/PolygonUtils.js"),VectorUtils=require("./VectorUtils.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__spreadValues=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));class Trigonometric{static tanAPlusB(t,o){return(t+o)/(1-t*o)}static sinAPlusB(t,o,s,r){return r*t+o*s}static cosAPlusB(t,o,s,r){return o*r-t*s}}const _MathUtils=class{static getRotate(e){return e+90>=360?e+90-360:e+90}static getLineLength(e,t){return Math.sqrt(Math.pow(t.y-e.y,2)+Math.pow(t.x-e.x,2))}static getTextArea(e,t,o=tool.DEFAULT_TEXT_MAX_WIDTH,s=tool.DEFAULT_FONT,r){if(typeof t!="string")return{width:0,height:0};const i=e.getContext("2d");i.font=s;let n=0;typeof r=="undefined"&&(r=e&&parseInt(window.getComputedStyle(e).lineHeight,10)||parseInt(window.getComputedStyle(document.body).lineHeight,10));const a=e&&parseInt(window.getComputedStyle(e).fontSize,10)||parseInt(window.getComputedStyle(document.body).fontSize,10)||0,c=t.split(`
|
|
2
|
+
`);let l=0;for(let u=0;u<c.length;u++){const p=c[u].split("");let g="";for(let y=0;y<p.length;y++){const f=g+p[y],h=i.measureText(f).width;h>o&&y>0?(g=p[y],n+=r,l=o):(g=f,h>l&&(l=h))}u!==c.length-1&&(n+=r)}return{width:l,height:n+a,lineHeight:r,fontHeight:a}}static getLineCenterPoint(e){const[t,o]=e,s=VectorUtils.getVector(t,o);return{x:t.x+s.x/2,y:t.y+s.y/2}}static getPerpendicularLine(e){if(e.length!==2)return;const[t,o]=e,s={x:o.x+o.y-t.y,y:o.y-(o.x-t.x)};return[o,s]}static getPerpendicularFootOfLine(e,t){if(e.length!==2)return e;const o=this.getPerpendicularLine(e);if(!o)return e;const[s,r]=o;return this.getFootOfPerpendicular(t,s,r).footPoint}static getQuadrangleFromTriangle(e){if(e.length!==3)return e;const[t,o,s]=e,r={x:s.x+t.x-o.x,y:s.y+t.y-o.y};return[t,o,s,r]}static getRectPerpendicularOffset(e,t,o){const[s,r]=o,i=this.getFootOfPerpendicular(e,s,r).footPoint,n=this.getFootOfPerpendicular(t,s,r).footPoint,a={x:i.x-n.x,y:i.y-n.y},c=VectorUtils.add(t,a);return VectorUtils.getVector(e,c)}static getArrayIndex(e,t){return e<0?t+e:e>=t?e-t:e}static getPointListFromPointOffset(e,t,o){const s=this.getArrayIndex(t-1,e.length),r=this.getArrayIndex(t+1,e.length),i=this.getArrayIndex(t-2,e.length),n=[...e];n[t]=VectorUtils.add(n[t],o);const a=this.getFootOfPerpendicular(n[t],n[i],n[s]).footPoint,c=this.getFootOfPerpendicular(n[t],n[r],n[i]).footPoint;return n[s]=a,n[r]=c,n}static getRectCenterPoint(e){const[t,,o]=e;return{x:(t.x+o.x)/2,y:(t.y+o.y)/2}}static rotateRectPointList(e=5,t){const o=this.getRectCenterPoint(t),{PI:s}=Math,r=Math.sin(e*s/180),i=Math.cos(e*s/180);return t.map(n=>{const a=VectorUtils.getVector(o,n),c=VectorUtils.len(a),l=a.y/c,u=a.x/c;return{x:c*Trigonometric.cosAPlusB(l,u,r,i)+o.x,y:c*Trigonometric.sinAPlusB(l,u,r,i)+o.y}})}static getRectangleByRightAngle(e,t){if(t.length!==2)return t;const o=_MathUtils.getPerpendicularFootOfLine(t,e);return _MathUtils.getQuadrangleFromTriangle([...t,o])}static getRadiusFromQuadrangle(e){const[,t,o]=e,s=o.y-t.y,r=t.x-o.x,i=this.getLineLength(t,o),n=s/i,a=Math.acos(n);return r>0?Math.PI*2-a:a}static getCollectionPointByAnnotationDataPromise(e){const t=e.filter(r=>r.type==="point").map(r=>r.annotation),o=e.filter(r=>!!["polygon","line"].includes(r.type)).map(r=>r.type==="polygon"?__spreadProps(__spreadValues({},r.annotation),{pointList:PolygonUtils.concatBeginAndEnd(r.annotation.pointList)}):r.annotation),s=new MathUtilsWorker;return{promise:new Promise(function(i){s.postMessage({points:t,backgroundList:o}),s.onmessage=n=>{i(n.data),s.terminate()}}),close:()=>{s.terminate()}}}static getCollectionPointByAnnotationData(e){const t=[],o=new Set,s=e.filter(n=>n.type==="point").map(n=>n.annotation),r=e.filter(n=>!!["polygon","line"].includes(n.type)).map(n=>n.type==="polygon"?__spreadProps(__spreadValues({},n.annotation),{pointList:PolygonUtils.concatBeginAndEnd(n.annotation.pointList)}):n.annotation),i=(n,a)=>{const{dropFoot:c}=PolygonUtils.getClosestPoint(n,a,tool.ELineTypes.Line,1,{isClose:!1});if(c!==n){const l=`${c.x} + ${c.y}`;o.has(l)||t.push(n),o.add(l)}};return s.forEach(n=>{i(n,r)}),r.forEach(n=>{let a="";a=n.id,r.forEach((c,l)=>{if(c.id===a)return;const u=[...r];u.splice(l,1),c.pointList.forEach(p=>{i(p,u)})})}),{connectionPoints:t}}};let MathUtils=_MathUtils;MathUtils.isInRange=(e,t)=>{const o=Math.min(...t),s=Math.max(...t),r=n=>n<=s&&n>=o;return(Array.isArray(e)?e:[e]).every(n=>r(n))},MathUtils.withinRange=(e,t)=>{const o=Math.min(...t),s=Math.max(...t);return e>s?s:e<o?o:e},MathUtils.calcViewportBoundaries=(e,t=!1,o=tool.SEGMENT_NUMBER,s=1)=>{if(!e)return{top:0,bottom:0,left:0,right:0};const r=20/s,i=[],n=[];let a=e;t&&(a=polygonTool.createSmoothCurvePointsFromPointList(e,o)),a.forEach(({x:f,y:d})=>{i.push(f),n.push(d)});let c=Math.min(...i),l=Math.max(...i),u=Math.min(...n),p=Math.max(...n);const g=l-c,y=p-u;if(g<r){const f=(r-g)/2;c-=f,l+=f}if(y<r){const f=(r-y)/2;u-=f,p+=f}return{top:u,bottom:p,left:c,right:l}},MathUtils.getFootOfPerpendicular=(e,t,o,s=!1,r=!1)=>{let i={x:0,y:0};const n=t.x-o.x,a=t.y-o.y;if(Math.abs(n)<1e-8&&Math.abs(a)<1e-8)return i=t,i;let c=(e.x-t.x)*(t.x-o.x)+(e.y-t.y)*(t.y-o.y);c/=n*n+a*a,i.x=t.x+c*n,i.y=t.y+c*a;const l=_MathUtils.getLineLength(e,i),u=2,p=Math.min(t.x,o.x),g=Math.max(t.x,o.x),y=Math.min(t.y,o.y),f=Math.max(t.y,o.y),d=!(_MathUtils.isInRange(e.x,[p,g])||_MathUtils.isInRange(e.y,[y,f])),h=e.x>g+u||e.x<p-u||e.y>f+u||e.y<y-u;return!r&&(s?d:h)?{footPoint:i,length:Infinity}:{footPoint:i,length:l}};var MathUtils$1=MathUtils;exports.Trigonometric=Trigonometric,exports.default=MathUtils$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),style=require("../../constant/style.js"),tool=require("../../constant/tool.js"),index=require("../../locales/index.js"),constants=require("../../locales/constants.js"),MathUtils=require("../MathUtils.js"),icon_canvasEdit_miss=require("../../assets/attributeIcon/icon_canvasEdit_miss.svg.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),lbUtils=require("@labelbee/lb-utils"),style=require("../../constant/style.js"),tool=require("../../constant/tool.js"),index=require("../../locales/index.js"),constants=require("../../locales/constants.js"),MathUtils=require("../MathUtils.js"),icon_canvasEdit_miss=require("../../assets/attributeIcon/icon_canvasEdit_miss.svg.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(s,t,e)=>t in s?__defProp(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,__spreadValues=(s,t)=>{for(var e in t||(t={}))__hasOwnProp.call(t,e)&&__defNormalProp(s,e,t[e]);if(__getOwnPropSymbols)for(var e of __getOwnPropSymbols(t))__propIsEnum.call(t,e)&&__defNormalProp(s,e,t[e]);return s},__spreadProps=(s,t)=>__defProps(s,__getOwnPropDescs(t));const REGEXP_NUMBER="^[0-9]+$",REGEXP_ENGLISH="^[A-Za-z]+$";class AttributeUtils{static getAttributeIcon(t,e,r=!0){var n;const a=e.findIndex(l=>l.value===t);let i=(n=style.ICON_ARRAY[a%style.ICON_ARRAY.length])!=null?n:style.NULL_ICON;r||(i=icon_canvasEdit_miss),i="";const u=new Image;return u.src=i,u}static checkString(t,e){let r="";switch(t){case tool.ETextType.Order:case tool.ETextType.NumberOnly:r=REGEXP_NUMBER;break;case tool.ETextType.EnglishOnly:r=REGEXP_ENGLISH;break;case tool.ETextType.CustomFormat:r=e;break}return r}static checkTextAttibute(t,e){if(t===void 0||t==="")return!0;try{return new RegExp(e).test(t)}catch(r){return!1}}static getAttributeShowText(t,e=[]){var r,n;try{const a=e.findIndex(i=>i.value===t);return(n=(r=e[a])==null?void 0:r.key)!=null?n:t}catch(a){return t}}static getAttributeIndex(t,e){try{const r=e.findIndex(n=>n.value===t);return r>=8?r%8:r}catch(r){return-1}}static getAttributeColor(t,e){try{const r=this.getAttributeIndex(t,e);return r===-1?style.NULL_COLOR:style.COLORS_ARRAY[r%style.COLORS_ARRAY.length]}catch(r){return style.NULL_COLOR}}static getTextAttribute(t,e){try{if(e===tool.ETextType.Order){const r=t.map(a=>parseInt(a.textAttribute,10)).filter(a=>_.isNumber(a)&&a<Number.MAX_SAFE_INTEGER&&a>=0);return r.sort((a,i)=>a-i),`${(r.pop()||0)+1}`}return""}catch(r){return""}}static textChange(t,e,r){return r.map(n=>n.id===e?__spreadProps(__spreadValues({},n),{textAttribute:t}):n)}static getErrorNotice(t,e){switch(t){case tool.ETextType.Order:case tool.ETextType.NumberOnly:return index.getMessagesByLocale(constants.EMessage.TextCheckNumberErrorNotice,e);case tool.ETextType.EnglishOnly:return index.getMessagesByLocale(constants.EMessage.TextCheckEnglishErrorNotice,e);case tool.ETextType.CustomFormat:return index.getMessagesByLocale(constants.EMessage.TextCheckCustomErrorNotice,e);default:return""}}static textAttributeValidate(t,e,r){try{return new RegExp(this.checkString(t,e)).test(r)}catch(n){}}static checkTextAttribute(t,e,r,n){let a=!1;return r.forEach(i=>{(i==null?void 0:i.textAttribute)===void 0||(i==null?void 0:i.textAttribute)===""||(n?i.id===n:!0)&&!this.textAttributeValidate(t,e,i.textAttribute)&&(a=!0)}),!!a}static changeTextAttributeInLog(t,e){return t==null?void 0:t.map(r=>r==null?void 0:r.map(n=>{if((e==null?void 0:e.findIndex(a=>(a==null?void 0:a.id)===(n==null?void 0:n.id)))>-1){const a=e==null?void 0:e.find(i=>(i==null?void 0:i.id)===(n==null?void 0:n.id));return __spreadProps(__spreadValues({},n),{textAttribute:a==null?void 0:a.textAttribute})}return n}))}static getTextIconSvg(t="",e,r=!1,n){var a;if(r===!0){const i=(e==null?void 0:e.findIndex(l=>(l==null?void 0:l.value)===t))%style.COLORS_ARRAY.length+1,u=(a=e==null?void 0:e.find(l=>l.value===t))==null?void 0:a.color;if(u){const l=lbUtils.ToolStyleUtils.rgbaStringToHex(u);return this.generateIconAttribute({fill:l})}return style.ICON_ARRAY[i]}return n}static generateIconAttribute({fill:t,width:e=16,height:r=16,xmlns:n="http://www.w3.org/2000/svg",xlink:a="http://www.w3.org/1999/xlink"}){return`<span style={color:${t}}><svg xmlns=${n} xmlns:xlink=${a} width=${e} height=${r} viewBox="0 0 16 16"><defs><clipPath id="a"><path d="M0,0H16V-16H0Z" fill="none"/></clipPath><clipPath id="b"><path d="M13.75-2.937H2.25a.5.5,0,0,0-.5.5v.563a.125.125,0,0,0,.125.125h12.25a.125.125,0,0,0,.125-.125v-.562A.5.5,0,0,0,13.75-2.937ZM4.027-4.25a.632.632,0,0,0,.094-.008l2.628-.461a.153.153,0,0,0,.083-.044l6.623-6.623a.156.156,0,0,0,0-.22l-2.6-2.6a.155.155,0,0,0-.111-.045.155.155,0,0,0-.111.045L4.012-7.581a.159.159,0,0,0-.044.083L3.508-4.87a.524.524,0,0,0,.147.466.529.529,0,0,0,.372.155Z" fill="none"/></clipPath></defs><g transform="translate(0 16)"><g clip-path="url(#a)"><path d="M-5-21H21V5H-5Z" fill="rgba(0,0,0,0)"/></g><g clip-path="url(#b)"><path d="M-3.25-19.25h22.5V3.25H-3.25Z" fill='currentColor'/></g></g></svg></span>`}static getAttributeByKeycode(t,e){var r;let n;return MathUtils.default.isInRange(t,[48,57])&&(n=t-48),MathUtils.default.isInRange(t,[96,105])&&(n=t-96),n===0?"":n?(r=e[n-1])==null?void 0:r.value:void 0}}exports.REGEXP_ENGLISH=REGEXP_ENGLISH,exports.REGEXP_NUMBER=REGEXP_NUMBER,exports.default=AttributeUtils;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tool=require("../../constant/tool.js"),MathUtils=require("../MathUtils.js"),PolygonUtils=require("./PolygonUtils.js"),LineToolUtils=require("./LineToolUtils.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tool=require("../../constant/tool.js"),MathUtils=require("../MathUtils.js"),PolygonUtils=require("./PolygonUtils.js"),LineToolUtils=require("./LineToolUtils.js"),CuboidUtils=require("./CuboidUtils.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(h,t,e)=>t in h?__defProp(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e,__spreadValues=(h,t)=>{for(var e in t||(t={}))__hasOwnProp.call(t,e)&&__defNormalProp(h,e,t[e]);if(__getOwnPropSymbols)for(var e of __getOwnPropSymbols(t))__propIsEnum.call(t,e)&&__defNormalProp(h,e,t[e]);return h},__spreadProps=(h,t)=>__defProps(h,__getOwnPropDescs(t));class AxisUtils{static getOffsetCoordinate(t,e,i){return{x:t.x*i+e.x,y:t.y*i+e.y}}static changeDrawOutsideTarget(t,e,i,s,n,o){return typeof s=="boolean"&&!s&&(n&&o?(t.x-e.x>(n.x+n.width)*o&&(t.x=(n.x+n.width)*o+e.x),t.x-e.x<n.x*o&&(t.x=n.x*o+e.x),t.y-e.y>(n.y+n.height)*o&&(t.y=(n.y+n.height)*o+e.y),t.y-e.y<n.y*o&&(t.y=n.y*o+e.y)):(t.x-e.x>i.width&&(t.x=i.width+e.x),t.x-e.x<0&&(t.x=e.x),t.y-e.y>i.height&&(t.y=i.height+e.y),t.y-e.y<0&&(t.y=e.y))),t}static changeCoordinateByRotate(t,e,i){const{width:s,height:n}=i,{x:o,y:r}=t;switch(e%360){case 90:return{x:n-r,y:o};case 180:return{x:s-o,y:n-r};case 270:return{x:r,y:s-o};default:return t}}static changeRectByZoom(t,e,i={x:0,y:0}){return __spreadProps(__spreadValues({},t),{x:t.x*e+i.x,y:t.y*e+i.y,width:t.width*e,height:t.height*e})}static changePointByZoom(t,e,i={x:0,y:0}){return __spreadProps(__spreadValues({},t),{x:t.x*e+i.x,y:t.y*e+i.y})}static changePointListByZoom(t,e,i={x:0,y:0}){return t.map(s=>this.changePointByZoom(s,e,i))}static changePlanePointByZoom(t,e,i={x:0,y:0}){return Object.entries(t).reduce((s,[n,o])=>{const r=AxisUtils.changePointByZoom(o,e,i);return __spreadProps(__spreadValues({},s),{[n]:r})},{})}static changeCuboidByZoom(t,e,i={x:0,y:0}){return __spreadProps(__spreadValues({},t),{frontPoints:this.changePlanePointByZoom(t.frontPoints,e,i),backPoints:t.backPoints?this.changePlanePointByZoom(t.backPoints,e,i):t.backPoints})}static transformPlain2PointList({tl:t,tr:e,br:i,bl:s}){return[t,e,i,s]}static axisArea(t,e=3){const{x:i,y:s}=t,n=[];for(let o=i-e;o<i+e;o+=e/3)for(let r=s-e;r<s+e;r+=e/3)n.push({x:o,y:r});return n}static getOriginCoordinateWithOffsetCoordinate(t,e=1,i={x:0,y:0}){return{x:(t.x-i.x)/e,y:(t.y-i.y)/e}}static returnClosePointIndex(t,e,i=3){let s=-1;for(let n=0;n<e.length;n++){const o=e[n];this.getIsInScope(t,o,i)&&(s=n)}return s}static isCloseCuboid(t,e,i={scope:5,zoom:1}){const s=CuboidUtils.getHighlightPoints(e),{scope:n=5}=i;for(let r=0;r<s.length;r++){const g=s[r];if(this.getIsInScope(t,g.point,n))return!0}const o=CuboidUtils.getHighlightLines(e);for(let r=0;r<o.length;r++){const g=o[r],{length:y}=MathUtils.default.getFootOfPerpendicular(t,g.p1,g.p2,!0);if(y<n)return!0}return!!PolygonUtils.isInPolygon(t,CuboidUtils.getCuboidHoverRange(e))}static isCloseCuboidList(t,e,i={scope:5,zoom:1}){return e.some(s=>this.isCloseCuboid(t,s,i))}static returnClosePointOrLineInCuboid(t,e,i={scope:5,zoom:1}){const s=CuboidUtils.getHighlightPoints(e),{scope:n=5,zoom:o=1}=i;for(let a=0;a<s.length;a++){const l=s[a];if(this.getIsInScope(t,l.point,n))return[{type:"point",points:[this.changePointByZoom(s[a].point,o)],originCuboid:e,positions:l.positions}]}let r=n;const g=CuboidUtils.getHighlightLines(e);let y;for(let a=0;a<g.length;a++){const l=g[a],{length:p}=MathUtils.default.getFootOfPerpendicular(t,l.p1,l.p2,!0);p<r&&(r=p,y=[{type:"line",points:this.changePointListByZoom([l.p1,l.p2],o),originCuboid:e,positions:l.positions}])}if(y)return y}static getIsInScope(t,e,i){return Math.abs(t.x-e.x)<i&&Math.abs(t.y-e.y)<i}}class CoordinateUtils{constructor(t){this.currentPos=t.currentPos,this.zoom=t.zoom,this.basicImgInfo=t.basicImgInfo,this.dependToolName=""}get isDependPolygon(){return this.dependToolName===tool.EToolName.Polygon}get isDependRect(){return this.dependToolName===tool.EToolName.Rect}get isDependOriginalImage(){return this.dependToolName===""}getAbsCoord(t){return{x:(t.x-this.currentPos.x)/this.zoom,y:(t.y-this.currentPos.y)/this.zoom}}getRenderCoord(t){return{x:t.x*this.zoom+this.currentPos.x,y:t.y*this.zoom+this.currentPos.y}}coordInsideRect(t,e){const{x:i,y:s,width:n,height:o}=e;return{x:MathUtils.default.withinRange(t.x,[i,i+n]),y:MathUtils.default.withinRange(t.y,[s,s+o])}}getPolygonPointList(t,e){return t===tool.ELineTypes.Curve?PolygonUtils.createSmoothCurvePointsFromPointList(e):e}getIntersection(t,e,i){const s=this.getRenderCoord(e),n=this.getRenderCoord(t),o={pointA:s,pointB:n};return LineToolUtils.default.calcOptimalIntersection(i,o,s,LineToolUtils.POINT_RADIUS,this.zoom)}coordInsidePolygon(t,e,i,s){const{pointList:n}=i,o=s==null?void 0:s.lineType;if(n.length===0)return t;const r=this.getPolygonPointList(o,n);if(PolygonUtils.isInPolygon(t,r))return t;const y=r.concat(r[0]).map(l=>this.getRenderCoord(l)),a=this.getIntersection(t,e,y);return a?this.getAbsCoord(a==null?void 0:a.point):t}coordInsideImage(t){return this.coordInsideRect(t,__spreadProps(__spreadValues({},this.basicImgInfo),{x:0,y:0}))}getNextCoordByDependTool(t,e){if(this.isDependRect)return this.coordInsideRect(t,this.basicResult);if(this.isDependPolygon)return this.coordInsidePolygon(t,e,this.basicResult,this.dependToolConfig);if(this.isDependOriginalImage)return this.coordInsideImage(t)}setDependInfo(t,e){this.dependToolName=t!=null?t:"",this.dependToolConfig=t?e:void 0}setBasicImgInfo(t){this.basicImgInfo=t}setBasicResult(t){this.basicResult=t}setZoomAndCurrentPos(t,e){this.zoom=t,this.currentPos=e}isCoordInsideTarget(t){if(this.isDependPolygon)return this.isInBasicPolygon(t);if(this.isDependRect){const{x:e,y:i,width:s,height:n}=this.basicResult,o=[e,e+s],r=[i,i+n];return MathUtils.default.isInRange(t.x,o)&&MathUtils.default.isInRange(t.y,r)}return MathUtils.default.isInRange(t.x,[0,this.basicImgInfo.width])&&MathUtils.default.isInRange(t.y,[0,this.basicImgInfo.height])}isInBasicPolygon(t){var e,i;return PolygonUtils.isInPolygon(t,((e=this.basicResult)==null?void 0:e.pointList)||[],(i=this.dependToolConfig)==null?void 0:i.lineType)}}exports.CoordinateUtils=CoordinateUtils,exports.default=AxisUtils;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),annotation=require("../../constant/annotation.js"),AxisUtils=require("./AxisUtils.js"),VectorUtils=require("../VectorUtils.js"),LineToolUtils=require("./LineToolUtils.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,t,n)=>t in i?__defProp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,__spreadValues=(i,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(i,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(i,n,t[n]);return i},__spreadProps=(i,t)=>__defProps(i,__getOwnPropDescs(t));function getPlanePointsBasicInfo({tr:i,tl:t,br:n}){return{width:Math.abs(i.x-t.x),height:Math.abs(n.y-i.y),centerPoints:{x:(t.x+n.x)/2,y:(t.y+n.y)/2}}}function getCuboidBasicInfo({frontPoints:i,backPoints:t}){const{width:n,height:o,centerPoints:s}=getPlanePointsBasicInfo(i),{width:e,height:r,centerPoints:l}=getPlanePointsBasicInfo(t);return{frontCenter:s,backCenter:l,frontWidth:n,frontHeight:o,backWidth:e,backHeight:r,isLeftSide:l.x<s.x}}function getPlainPointsByDiagonalPoints(i,t){return{tl:{x:Math.min(i.x,t.x),y:Math.min(i.y,t.y)},tr:{x:Math.max(i.x,t.x),y:Math.min(i.y,t.y)},bl:{x:Math.min(i.x,t.x),y:Math.max(i.y,t.y)},br:{x:Math.max(i.x,t.x),y:Math.max(i.y,t.y)}}}function getMaxExternalQuadrilateral(i){const t=Object.values(i).reduce((e,r)=>r.x<e?r.x:e,Number.MAX_SAFE_INTEGER),n=Object.values(i).reduce((e,r)=>r.x>e?r.x:e,0),o=Object.values(i).reduce((e,r)=>r.y<e?r.y:e,Number.MAX_SAFE_INTEGER),s=Object.values(i).reduce((e,r)=>r.y>e?r.y:e,0);return{tl:{x:t,y:o},tr:{x:n,y:o},bl:{x:t,y:s},br:{x:n,y:s}}}function judgeCuboidLineIsRowOrColumn(i){const[t,n]=i;if(annotation.CUBOID_ROW[t.position]===n.position)return annotation.ECuboidLineDirection.Row;if(annotation.CUBOID_COLUMN[t.position]===n.position)return annotation.ECuboidLineDirection.Column}function getPointsByBottomRightPoint({coord:i,points:t}){const{width:n,height:o}=getPlanePointsBasicInfo(t);return{br:i,tr:{x:i.x,y:i.y-o},tl:{x:i.x-n,y:i.y-o},bl:{x:i.x-n,y:i.y}}}function getPointsByBottomLeftPoint({coord:i,points:t}){const{width:n,height:o}=getPlanePointsBasicInfo(t);return{bl:i,tr:{x:i.x+n,y:i.y-o},tl:{x:i.x,y:i.y-o},br:{x:i.x+n,y:i.y}}}function getCuboidShowingSideLine({frontPoints:i,backPoints:t}){const{isLeftSide:n}=getCuboidBasicInfo({frontPoints:i,backPoints:t});return n?{top:{p1:i.tl,p2:t.tl},bottom:{p1:i.bl,p2:t.bl}}:{top:{p1:i.tr,p2:t.tr},bottom:{p1:i.br,p2:t.br}}}function getPointsByIntersection({frontPoints:i,backPoints:t}){const{isLeftSide:n}=getCuboidBasicInfo({frontPoints:i,backPoints:t});let o=__spreadValues({},t);const s=getCuboidShowingSideLine({frontPoints:i,backPoints:t}),e=LineToolUtils.default.lineIntersection({pointA:s.bottom.p1,pointB:s.bottom.p2},{pointA:s.top.p1,pointB:s.top.p2});if(n){const r=LineToolUtils.default.lineIntersection({pointA:t.bl,pointB:t.br},{pointA:i.br,pointB:e});r&&(o=__spreadProps(__spreadValues({},t),{br:r,tr:{x:r.x,y:t.tl.y}}))}else{const r=LineToolUtils.default.lineIntersection({pointA:t.bl,pointB:t.br},{pointA:i.bl,pointB:e});r&&(o=__spreadProps(__spreadValues({},t),{bl:r,tl:{x:r.x,y:t.tr.y}}))}return{backPoints:o}}function getBackPointsByFrontPoints({frontPoints:i,backPoints:t}){const{isLeftSide:n,frontHeight:o,backHeight:s}=getCuboidBasicInfo({frontPoints:i,backPoints:t});let e=__spreadValues({},t);return n?e=getPointsByBottomLeftPoint({coord:t.bl,points:i}):e=getPointsByBottomRightPoint({coord:t.br,points:i}),o>s&&(e=getPointsByIntersection({frontPoints:i,backPoints:t}).backPoints),{frontPoints:i,backPoints:e}}function getFrontPointsByBackPoints({frontPoints:i,backPoints:t}){const{isLeftSide:n,frontHeight:o,backHeight:s,frontWidth:e,backWidth:r}=getCuboidBasicInfo({frontPoints:i,backPoints:t});let l=__spreadValues({},i),u=t;return n||r>e?l=getPointsByBottomLeftPoint({coord:i.bl,points:t}):l=getPointsByBottomRightPoint({coord:i.br,points:t}),o>s&&(l.tl.y=i.tl.y,l.tr.y=i.tr.y,u=getPointsByIntersection({backPoints:t,frontPoints:i}).backPoints),e>=r&&Object.keys(l).forEach(a=>{l[a].x=i[a].x}),{frontPoints:l,backPoints:u}}function getCuboidAllSideLine({frontPoints:i,backPoints:t}){return[{p1:i.bl,p2:t.bl},{p1:i.tl,p2:t.tl},{p1:i.tr,p2:t.tr},{p1:i.br,p2:t.br}]}function getHighlightLines(i){const{frontPoints:t,backPoints:n}=i,{isLeftSide:o}=getCuboidBasicInfo(i),s=[{p1:t.tl,p2:t.tr,positions:[{plain:annotation.ECuboidPlain.Front,position:annotation.ECuboidPosition.TL},{plain:annotation.ECuboidPlain.Front,position:annotation.ECuboidPosition.TR}]},{p1:t.tr,p2:t.br,plain:annotation.ECuboidPlain.Front,positions:[{plain:annotation.ECuboidPlain.Front,position:annotation.ECuboidPosition.TR},{plain:annotation.ECuboidPlain.Front,position:annotation.ECuboidPosition.BR}]},{p1:t.br,p2:t.bl,plain:annotation.ECuboidPlain.Front,positions:[{plain:annotation.ECuboidPlain.Front,position:annotation.ECuboidPosition.BR},{plain:annotation.ECuboidPlain.Front,position:annotation.ECuboidPosition.BL}]},{p1:t.bl,p2:t.tl,plain:annotation.ECuboidPlain.Front,positions:[{plain:annotation.ECuboidPlain.Front,position:annotation.ECuboidPosition.BL},{plain:annotation.ECuboidPlain.Front,position:annotation.ECuboidPosition.TL}]}];return o?[...s,{p1:n.tl,p2:n.bl,positions:[{plain:annotation.ECuboidPlain.Back,position:annotation.ECuboidPosition.TL},{plain:annotation.ECuboidPlain.Back,position:annotation.ECuboidPosition.BL}]}]:[...s,{p1:n.tr,p2:n.br,positions:[{plain:annotation.ECuboidPlain.Back,position:annotation.ECuboidPosition.TR},{plain:annotation.ECuboidPlain.Back,position:annotation.ECuboidPosition.BR}]}]}function getHighlightPoints(i){const{backPoints:t}=i,{isLeftSide:n}=getCuboidBasicInfo(i),o=Object.entries(i.frontPoints).map(([s,e])=>({positions:[{plain:annotation.ECuboidPlain.Front,position:s}],point:e}));return n?[{point:t.tl,positions:[{position:annotation.ECuboidPosition.TL,plain:annotation.ECuboidPlain.Back}]},{point:t.bl,positions:[{position:annotation.ECuboidPosition.BL,plain:annotation.ECuboidPlain.Back}]},...o]:[{point:t.tr,positions:[{position:annotation.ECuboidPosition.TR,plain:annotation.ECuboidPlain.Back}]},{point:t.br,positions:[{position:annotation.ECuboidPosition.BR,plain:annotation.ECuboidPlain.Back}]},...o]}function getCuboidHoverRange(i){const{frontPoints:t,backPoints:n}=i,{backCenter:o,frontCenter:s,frontHeight:e,frontWidth:r,backHeight:l,backWidth:u,isLeftSide:a}=getCuboidBasicInfo(i),c=Math.abs(r-u),p=Math.abs(e-l),x=Math.abs(s.x-o.x),f=Math.abs(s.y-o.y),d=x>c,b=f>p;return d||b?b&&!d?[t.tl,n.tl,n.tr,t.tr,t.br,t.bl]:d&&!b?a?[t.tl,t.tr,t.br,t.bl,n.bl,n.tl]:[t.tl,t.tr,n.tr,n.br,t.br,t.bl]:d&&b?a?[n.tl,n.tr,t.tr,t.br,t.bl,n.bl]:[t.tl,n.tl,n.tr,n.br,t.br,t.bl]:[]:[t.tl,t.tr,t.br,t.bl]}function getNewPointsAfterOffset({offset:i,frontPoints:t,backPoints:n,positions:o}){let s=_.cloneDeep(t),e=_.cloneDeep(n);if((o==null?void 0:o.length)===2){const r=o.every(b=>b.plain===annotation.ECuboidPlain.Front),l=!r,u=judgeCuboidLineIsRowOrColumn([o[0],o[1]]),a=u===annotation.ECuboidLineDirection.Row,c=u===annotation.ECuboidLineDirection.Column;let p=i;a&&(p={x:0,y:i.y}),c&&(p={y:0,x:i.x}),r&&(o==null||o.forEach(({position:b})=>{const g=s,P=g[b];g[b]={x:P.x+p.x,y:P.y+p.y}}),s=getMaxExternalQuadrilateral(s),e=getMaxExternalQuadrilateral(e)),l&&Object.keys(e).forEach(b=>{e[b]={x:e[b].x+p.x,y:e[b].y+p.y}});const x=r?getBackPointsByFrontPoints:getFrontPointsByBackPoints,{frontPoints:f,backPoints:d}=x({frontPoints:s,backPoints:e});s=f,e=d}return{frontPoints:s,backPoints:e}}function getCuboidDragMove({offset:i,cuboid:t,dragTarget:n,positions:o}){const{frontPoints:s,backPoints:e}=t;switch(n){case annotation.EDragTarget.Cuboid:{const r=Object.entries(s).reduce((u,[a,c])=>__spreadProps(__spreadValues({},u),{[a]:{x:c.x+i.x,y:c.y+i.y}}),{}),l=Object.entries(e).reduce((u,[a,c])=>__spreadProps(__spreadValues({},u),{[a]:{x:c.x+i.x,y:c.y+i.y}}),{});return __spreadProps(__spreadValues({},t),{frontPoints:r,backPoints:l})}case annotation.EDragTarget.Line:{const{frontPoints:r,backPoints:l}=getNewPointsAfterOffset({offset:i,frontPoints:s,backPoints:e,positions:o});return __spreadProps(__spreadValues({},t),{frontPoints:r,backPoints:l})}case annotation.EDragTarget.Point:{if(!(o==null?void 0:o[0]))return;const r=o[0],l=r.plain===annotation.ECuboidPlain.Front,u=l?s:e;let a=u[r.position];const c=u[annotation.DIAGONAL_POINT[r.position]];if(!a||!c)return;a=VectorUtils.add(a,i);const p=getPlainPointsByDiagonalPoints(a,c),x=l?getBackPointsByFrontPoints:getFrontPointsByBackPoints;let f={frontPoints:s,backPoints:p};l&&(f={frontPoints:p,backPoints:e});const{frontPoints:d,backPoints:b}=x(f);return __spreadProps(__spreadValues({},t),{frontPoints:d,backPoints:b})}default:{console.error("No DragTarget");break}}}function getPointListsByDirection({direction:i,frontPoints:t,backPoints:n}){if(i&&t&&n){let o=t;switch(i){case annotation.ECuboidDirection.Back:o=n;break;case annotation.ECuboidDirection.Left:o={bl:n.bl,br:t.bl,tl:n.tl,tr:t.tl};break;case annotation.ECuboidDirection.Right:o={bl:n.br,br:t.br,tl:n.tr,tr:t.tr};break;case annotation.ECuboidDirection.Top:o={bl:n.tl,br:t.tl,tl:n.tr,tr:t.tr};break;default:o=t;break}return AxisUtils.default.transformPlain2PointList(o)}}function getToggleDirectionButtonOffset({cuboid:i,currentPos:t,zoom:n}){const{frontPoints:o}=i,s={width:40,height:74},e={x:(o.bl.x+o.tl.x)/2,y:(o.bl.y+o.tl.y)/2},r=s.width+10,l=s.height/2,u={x:e.x,y:e.y},a=AxisUtils.default.getOffsetCoordinate(u,t,n);return{left:a.x-r,top:a.y-l}}function getCuboidTextAttributeOffset({cuboid:i,currentPos:t,zoom:n,leftOffset:o=16,topOffset:s=2}){const{frontPoints:e}=i,r={x:e.bl.x,y:e.bl.y},l=AxisUtils.default.getOffsetCoordinate(r,t,n);return{left:l.x+o,top:l.y+s}}function isCuboidWithInLimits({cuboid:i,config:t}){const{minHeight:n,minWidth:o}=t,{width:s,height:e}=getPlanePointsBasicInfo(i.frontPoints);return s>=o&&e>=n}exports.getBackPointsByFrontPoints=getBackPointsByFrontPoints,exports.getCuboidAllSideLine=getCuboidAllSideLine,exports.getCuboidBasicInfo=getCuboidBasicInfo,exports.getCuboidDragMove=getCuboidDragMove,exports.getCuboidHoverRange=getCuboidHoverRange,exports.getCuboidShowingSideLine=getCuboidShowingSideLine,exports.getCuboidTextAttributeOffset=getCuboidTextAttributeOffset,exports.getFrontPointsByBackPoints=getFrontPointsByBackPoints,exports.getHighlightLines=getHighlightLines,exports.getHighlightPoints=getHighlightPoints,exports.getMaxExternalQuadrilateral=getMaxExternalQuadrilateral,exports.getNewPointsAfterOffset=getNewPointsAfterOffset,exports.getPlainPointsByDiagonalPoints=getPlainPointsByDiagonalPoints,exports.getPlanePointsBasicInfo=getPlanePointsBasicInfo,exports.getPointListsByDirection=getPointListsByDirection,exports.getPointsByBottomLeftPoint=getPointsByBottomLeftPoint,exports.getPointsByBottomRightPoint=getPointsByBottomRightPoint,exports.getPointsByIntersection=getPointsByIntersection,exports.getToggleDirectionButtonOffset=getToggleDirectionButtonOffset,exports.isCuboidWithInLimits=isCuboidWithInLimits,exports.judgeCuboidLineIsRowOrColumn=judgeCuboidLineIsRowOrColumn;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var tool=require("../../constant/tool.js"),PolygonUtils=require("./PolygonUtils.js"),UnitUtils=require("./UnitUtils.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(
|
|
2
|
-
`,""))!=null?
|
|
3
|
-
`);for(let a=0;a<c.length;a++){const
|
|
1
|
+
"use strict";var tool=require("../../constant/tool.js"),PolygonUtils=require("./PolygonUtils.js"),UnitUtils=require("./UnitUtils.js"),AxisUtils=require("./AxisUtils.js"),CuboidUtils=require("./CuboidUtils.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,t,i)=>t in r?__defProp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[t]=i,__spreadValues=(r,t)=>{for(var i in t||(t={}))__hasOwnProp.call(t,i)&&__defNormalProp(r,i,t[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(t))__propIsEnum.call(t,i)&&__defNormalProp(r,i,t[i]);return r},__spreadProps=(r,t)=>__defProps(r,__getOwnPropDescs(t));const DEFAULT_ZOOM=1,DEFAULT_CURRENT_POS={x:0,y:0},DEFAULT_ROTATE=0,DEFAULT_COLOR="",_DrawUtils=class{static drawLine(r,t,i,e={}){const o=r.getContext("2d"),{color:s=DEFAULT_COLOR,thickness:l=1,lineCap:c="round",lineDash:a}=e;o.save(),o.strokeStyle=s,o.lineWidth=l,o.lineCap=c,a&&o.setLineDash(a),o.beginPath(),o.moveTo(t.x,t.y),o.lineTo(i.x+1,i.y+1),o.stroke(),o.restore()}static drawRect(r,t,i={}){const e=r.getContext("2d"),{color:o=DEFAULT_COLOR,thickness:s=1,lineCap:l="round",hiddenText:c=!1,lineDash:a}=i;if(e.save(),e.strokeStyle=o,e.lineWidth=s,e.lineCap=l,Array.isArray(a)&&e.setLineDash(a),e.fillStyle=o,e.strokeRect(t.x,t.y,t.width,t.height),c===!1){let n="";if(t.attribute&&(n=`${n} ${t.attribute}`),this.drawText(r,{x:t.x,y:t.y-5},n),t.textAttribute){const d=`${~~t.width} * ${~~t.height}`.length*7,y=0,u=Math.max(20,t.width-d);this.drawText(r,{x:t.x,y:t.y+t.height+20+y},t.textAttribute,{textMaxWidth:u})}}e.restore()}static drawRectWithFill(r,t,i={}){const e=r.getContext("2d"),{color:o=DEFAULT_COLOR}=i;e.save(),e.fillStyle=o,e.fillRect(t.x,t.y,t.width,t.height),e.restore()}static drawTagByDom(r,t,i){const e=r;if(!((t==null?void 0:t.length)>0))return;const o=document.createElement("div");return o.innerHTML=t,o.setAttribute("id",i),e==null||e.appendChild(o),o}static drawTag(r,t){var i;const e=r==null?void 0:r.parentNode,o=window.self.document.getElementById("tagToolTag");if(o&&e&&e.contains(o)&&(e==null||e.removeChild(o)),!((t==null?void 0:t.length)>0))return;const s=document.createElement("div");return s.innerHTML=(i=t.reduce((l,c)=>`${l}${c.keyName}: ${c.value.join(" \u3001 ")}
|
|
2
|
+
`,""))!=null?i:"",s.setAttribute("id","tagToolTag"),e==null||e.appendChild(s),s}static drawLineWithPointList(r,t,i={}){if(t.length<2)return;const e=r.getContext("2d"),{color:o=DEFAULT_COLOR,thickness:s=1,lineCap:l="round",lineType:c=tool.ELineTypes.Line,lineDash:a,hoverEdgeIndex:n}=i;e.save(),(()=>{e.strokeStyle=o,e.lineWidth=s,e.lineCap=l,Array.isArray(a)?e.setLineDash(a):e.setLineDash([])})(),c===tool.ELineTypes.Curve?(n!==void 0&&n>-1&&t.push(t[0]),t=PolygonUtils.createSmoothCurvePointsFromPointList([...t],tool.SEGMENT_NUMBER),n!==void 0&&n>-1&&(t=t.slice((tool.SEGMENT_NUMBER+1)*n,(tool.SEGMENT_NUMBER+1)*(n+1)))):n!==void 0&&n>-1&&(t=[...t,t[0]],t=t.slice(n,n+2));const d=[];e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let h=0;h<t.length-1;h++)t[h].specialEdge&&d.push({i1:h,i2:h+1}),e.lineTo(t[h+1].x,t[h+1].y);e.stroke(),e.save(),e.lineWidth=s*.8,e.lineCap="butt",e.strokeStyle="white",e.setLineDash([3,3]),d.forEach(h=>{const w=t[h.i1],g=t[h.i2];e.beginPath(),e.moveTo(w.x,w.y),e.lineTo(g.x,g.y),e.stroke()}),e.restore();const y=4,u=2;return t.forEach(h=>{h.specialPoint&&(this.drawSpecialPoint(r,h,y+u,o),this.drawSpecialPoint(r,h,y,"white"))}),e.restore(),t}static drawCircle(r,t,i,e={}){const o=r.getContext("2d"),{startAngleDeg:s=0,endAngleDeg:l=360,thickness:c=1,color:a=DEFAULT_COLOR,fill:n=DEFAULT_COLOR}=e,f=UnitUtils.deg2rad(s),d=UnitUtils.deg2rad(l);o.save(),o.beginPath(),o.strokeStyle=a,o.fillStyle=n,o.lineWidth=c,o.arc(t.x,t.y,i,f,d,!1),o.stroke(),n&&o.fill(),o.closePath(),o.restore()}static drawCircleWithFill(r,t,i=3,e={}){const o=r.getContext("2d"),{color:s=DEFAULT_COLOR}=e;o.save();const l=UnitUtils.deg2rad(0),c=UnitUtils.deg2rad(360);o.fillStyle=s,o.beginPath(),o.arc(t.x,t.y,i,l,c,!1),o.fill(),o.restore()}static drawSpecialPoint(r,t,i=6,e){const o=r.getContext("2d"),{x:s,y:l}=t;o.save(),o.beginPath(),o.fillStyle=e;const c=i*1.5,a=c*Math.sqrt(3)/2,n=c/2;o.moveTo(s,l-c),o.lineTo(s-a,l+n),o.lineTo(s+a,l+n),o.closePath(),o.fill(),o.restore()}static drawPolygon(r,t,i={}){const{isClose:e=!1,lineType:o=tool.ELineTypes.Line}=i;return e===!0&&(t=[...t,t[0]]),o===tool.ELineTypes.Curve&&(t=PolygonUtils.createSmoothCurvePointsFromPointList([...t])),this.drawLineWithPointList(r,t,__spreadProps(__spreadValues({},i),{lineType:tool.ELineTypes.Line})),t}static drawPolygonWithFill(r,t,i={}){if(t.length<2)return;const e=r.getContext("2d"),{color:o=DEFAULT_COLOR,lineType:s=tool.ELineTypes.Line}=i;e.save(),e.fillStyle=o,e.beginPath(),s===tool.ELineTypes.Curve&&(t=PolygonUtils.createSmoothCurvePointsFromPointList([...t,t[0]]));const[l,...c]=t;return e.moveTo(l.x,l.y),c.forEach(a=>{e.lineTo(a.x,a.y)}),e.fill(),e.restore(),t}static drawPolygonWithFillAndLine(r,t,i={}){const{strokeColor:e,fillColor:o,thickness:s,lineCap:l,isClose:c,lineType:a}=i,n=this.drawPolygon(r,t,{color:e,thickness:s,lineCap:l,isClose:c,lineType:a});return this.drawPolygonWithFill(r,t,{color:o,lineType:a}),n}static drawPolygonWithKeyPoint(r,t,i={}){const{pointColor:e="white",strokeColor:o}=i,s=this.drawPolygon(r,t,i);return s.forEach(l=>{this.drawCircleWithFill(r,l,4,{color:o}),this.drawCircleWithFill(r,l,3,{color:e})}),s}static drawSelectedPolygonWithFillAndLine(r,t,i={}){const{pointColor:e="white",strokeColor:o}=i,s=this.drawPolygonWithFillAndLine(r,t,i);return s.forEach(l=>{this.drawCircleWithFill(r,l,4,{color:o}),this.drawCircleWithFill(r,l,3,{color:e})}),s}static drawText(r,t,i,e={}){if(!i)return;const o=r.getContext("2d"),{color:s=DEFAULT_COLOR,font:l=tool.DEFAULT_FONT,shadowColor:c="",shadowBlur:a=0,shadowOffsetX:n=0,shadowOffsetY:f=0,textMaxWidth:d=164,offsetX:y=0,offsetY:u=0,textAlign:h="start",lineHeight:w}=e;o.save(),o.textAlign=h,o.fillStyle=s!=null?s:"white",o.font=l,o.shadowColor=c,o.shadowOffsetX=n,o.shadowOffsetY=f,o.shadowBlur=a,this.wrapText(r,`${i}`,t.x+y,t.y+u,d,w),o.restore()}static wrapText(r,t,i,e,o,s){if(typeof t!="string"||typeof i!="number"||typeof e!="number")return;const l=r.getContext("2d");typeof o=="undefined"&&(o=r&&r.width||300),typeof s=="undefined"&&(s=r&&parseInt(window.getComputedStyle(r).lineHeight,10)||parseInt(window.getComputedStyle(document.body).lineHeight,10));const c=t.split(`
|
|
3
|
+
`);for(let a=0;a<c.length;a++){const n=c[a].split("");let f="";for(let d=0;d<n.length;d++){const y=f+n[d],h=l.measureText(y).width;o||(o=300),h>o&&d>0?(l.fillText(f,i,e),f=n[d],e+=s):f=y}l.fillText(f,i,e),e+=s}}static drawArrow(r,t,i,e={}){const{color:o=DEFAULT_COLOR,thickness:s=1,lineCap:l="round",theta:c=30,headLen:a=10}=e,n=Math.atan2(t.y-i.y,t.x-i.x)*180/Math.PI,f=(n+c)*Math.PI/180,d=(n-c)*Math.PI/180,y=a*Math.cos(f),u=a*Math.sin(f),h=a*Math.cos(d),w=a*Math.sin(d);r.save(),r.strokeStyle=o,r.lineWidth=s,r.lineCap=l,r.beginPath(),r.moveTo(i.x+y,i.y+u),r.lineTo(i.x,i.y),r.lineTo(i.x+h,i.y+w),r.stroke(),r.restore()}static drawArrowByCanvas(r,t,i,e={}){const o=r.getContext("2d");this.drawArrow(o,t,i,e)}static drawCuboid(r,t,i={}){const{backPoints:e,direction:o,frontPoints:s}=t,{strokeColor:l,thickness:c,fillColor:a}=i,n={color:l,thickness:c};if(e){const d=AxisUtils.default.transformPlain2PointList(e);_DrawUtils.drawPolygon(r,d,__spreadProps(__spreadValues({},n),{isClose:!0}));const y=CuboidUtils.getCuboidAllSideLine(t);y==null||y.forEach(u=>{_DrawUtils.drawLine(r,u.p1,u.p2,__spreadValues({},n))})}const f=AxisUtils.default.transformPlain2PointList(s);if(o&&e&&s){const d=CuboidUtils.getPointListsByDirection({direction:o,frontPoints:s,backPoints:e});d&&_DrawUtils.drawPolygonWithFill(r,d,{color:a})}_DrawUtils.drawPolygon(r,f,__spreadProps(__spreadValues({},n),{isClose:!0}))}};let DrawUtils=_DrawUtils;DrawUtils.drawImg=(r,t,i={})=>{const e=r.getContext("2d"),{zoom:o=DEFAULT_ZOOM,currentPos:s=DEFAULT_CURRENT_POS,rotate:l=DEFAULT_ROTATE,imgAttribute:c}=i;switch(e.save(),l){case 0:e.translate(s.x,s.y);break;case 90:e.translate(s.x+t.height*o,s.y),e.rotate(90*Math.PI/180);break;case 180:e.translate(s.x+t.width*o,s.y+t.height*o),e.rotate(Math.PI);break;case 270:e.translate(s.x,s.y+t.width*o),e.rotate(270*Math.PI/180);break;default:e.translate(s.x,s.y);break}if(c){const{contrast:a,saturation:n,brightness:f}=c;e.filter=`saturate(${n+100}%) contrast(${a+100}%) brightness(${f+100}%)`}e.drawImage(t,0,0,t.width*o,t.height*o),e.restore()},module.exports=DrawUtils;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tool=require("../../constant/tool.js"),ScribbleTool=require("../../core/toolOperation/ScribbleTool.js"),checkOperation=require("../../core/toolOperation/checkOperation.js"),polygonOperation=require("../../core/toolOperation/polygonOperation.js"),rectOperation=require("../../core/toolOperation/rectOperation.js"),tagOperation=require("../../core/toolOperation/tagOperation.js"),LineToolOperation=require("../../core/toolOperation/LineToolOperation.js"),pointOperation=require("../../core/toolOperation/pointOperation.js"),TextToolOperation=require("../../core/toolOperation/TextToolOperation.js"),segmentByRect=require("../../core/toolOperation/segmentByRect.js"),CommonToolUtils=require("./CommonToolUtils.js");const getCurrentOperation=e=>{switch(e){case tool.EToolName.Rect:case tool.EToolName.RectTrack:return rectOperation.RectOperation;case tool.EToolName.SegmentByRect:return segmentByRect;case tool.EToolName.Tag:return tagOperation;case tool.EToolName.Polygon:return polygonOperation;case tool.ECheckModel.Check:return checkOperation;case tool.EToolName.Line:return LineToolOperation.default;case tool.EToolName.Point:return pointOperation;case tool.EToolName.Text:return TextToolOperation;case tool.EToolName.ScribbleTool:return ScribbleTool;default:throw new Error("not match tool")}};class EnhanceCommonToolUtils extends CommonToolUtils{}EnhanceCommonToolUtils.getCurrentOperation=getCurrentOperation,exports.default=EnhanceCommonToolUtils,exports.getCurrentOperation=getCurrentOperation;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tool=require("../../constant/tool.js"),ScribbleTool=require("../../core/toolOperation/ScribbleTool.js"),cuboidOperation=require("../../core/toolOperation/cuboidOperation.js"),pointCloud2dOperation=require("../../core/toolOperation/pointCloud2dOperation.js"),checkOperation=require("../../core/toolOperation/checkOperation.js"),polygonOperation=require("../../core/toolOperation/polygonOperation.js"),rectOperation=require("../../core/toolOperation/rectOperation.js"),tagOperation=require("../../core/toolOperation/tagOperation.js"),LineToolOperation=require("../../core/toolOperation/LineToolOperation.js"),pointOperation=require("../../core/toolOperation/pointOperation.js"),TextToolOperation=require("../../core/toolOperation/TextToolOperation.js"),segmentByRect=require("../../core/toolOperation/segmentByRect.js"),CommonToolUtils=require("./CommonToolUtils.js");const getCurrentOperation=e=>{switch(e){case tool.EToolName.Rect:case tool.EToolName.RectTrack:return rectOperation.RectOperation;case tool.EToolName.SegmentByRect:return segmentByRect;case tool.EToolName.Tag:return tagOperation;case tool.EToolName.Polygon:return polygonOperation;case tool.ECheckModel.Check:return checkOperation;case tool.EToolName.Line:return LineToolOperation.default;case tool.EToolName.Point:return pointOperation;case tool.EToolName.Text:return TextToolOperation;case tool.EToolName.ScribbleTool:return ScribbleTool;case tool.EToolName.Cuboid:return cuboidOperation;case tool.EToolName.PointCloudPolygon:return pointCloud2dOperation;default:throw new Error("not match tool")}};class EnhanceCommonToolUtils extends CommonToolUtils{}EnhanceCommonToolUtils.getCurrentOperation=getCurrentOperation,exports.default=EnhanceCommonToolUtils,exports.getCurrentOperation=getCurrentOperation;
|
package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createBase64WorkerFactory as createBase64WorkerFactory$1 } from './_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js';
|
|
2
|
+
import { createBase64WorkerFactory as createBase64WorkerFactory$2 } from './_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js';
|
|
3
|
+
import { isNodeJS } from './_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js';
|
|
4
|
+
|
|
5
|
+
function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
6
|
+
if (isNodeJS()) {
|
|
7
|
+
return createBase64WorkerFactory$1(base64, sourcemapArg, enableUnicodeArg);
|
|
8
|
+
}
|
|
9
|
+
return createBase64WorkerFactory$2(base64, sourcemapArg, enableUnicodeArg);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { createBase64WorkerFactory };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var WorkerClass = null;
|
|
2
|
+
|
|
3
|
+
try {
|
|
4
|
+
var WorkerThreads =
|
|
5
|
+
typeof module !== 'undefined' && typeof module.require === 'function' && module.require('worker_threads') ||
|
|
6
|
+
typeof __non_webpack_require__ === 'function' && __non_webpack_require__('worker_threads') ||
|
|
7
|
+
typeof require === 'function' && require('worker_threads');
|
|
8
|
+
WorkerClass = WorkerThreads.Worker;
|
|
9
|
+
} catch(e) {} // eslint-disable-line
|
|
10
|
+
|
|
11
|
+
export { WorkerClass };
|
package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WorkerClass } from './_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js';
|
|
2
|
+
|
|
3
|
+
function decodeBase64(base64, enableUnicode) {
|
|
4
|
+
return Buffer.from(base64, 'base64').toString(enableUnicode ? 'utf16' : 'utf8');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
8
|
+
var sourcemap = sourcemapArg === undefined ? null : sourcemapArg;
|
|
9
|
+
var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg;
|
|
10
|
+
var source = decodeBase64(base64, enableUnicode);
|
|
11
|
+
var start = source.indexOf('\n', 10) + 1;
|
|
12
|
+
var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : '');
|
|
13
|
+
return function WorkerFactory(options) {
|
|
14
|
+
return new WorkerClass(body, Object.assign({}, options, { eval: true }));
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { createBase64WorkerFactory };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var C=`<svg width="27" height="27" viewBox="0 0 27 27" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M13.5525 3.01367C7.75439 3.01367 3.03467 7.73076 3.03467 13.5289C3.0373 19.3297 7.75439 24.0468 13.5525 24.0468C19.3507 24.0468 24.0678 19.3297 24.0678 13.5315C24.0678 7.7334 19.3507 3.01367 13.5525 3.01367ZM19.3085 15.9072V15.9521C19.3085 15.9652 19.3059 15.9784 19.3059 15.9942C19.3059 16.0021 19.3059 16.0101 19.3032 16.018C19.3032 16.0312 19.3006 16.0443 19.2979 16.0575C19.2979 16.0654 19.2953 16.076 19.2953 16.0839C19.2927 16.0944 19.2927 16.105 19.29 16.1155C19.2874 16.1261 19.2848 16.1393 19.2848 16.1498C19.2821 16.1577 19.2821 16.1656 19.2795 16.1709C19.2769 16.1867 19.2716 16.2025 19.2689 16.2184C19.2689 16.221 19.2663 16.2236 19.2663 16.2263C19.2083 16.4504 19.0923 16.664 18.9156 16.8406L15.8386 19.9177C15.3112 20.445 14.449 20.445 13.9243 19.9177C13.397 19.3903 13.397 18.5281 13.9243 18.0034L14.6863 17.2414H9.14922C8.40303 17.2414 7.79394 16.6323 7.79394 15.8861C7.79394 15.1399 8.40303 14.5309 9.14922 14.5309H17.9559C18.3039 14.5309 18.652 14.6627 18.9156 14.9264C19.1793 15.19 19.3111 15.5381 19.3111 15.8861C19.3111 15.894 19.3085 15.902 19.3085 15.9072ZM19.3111 11.1743C19.3111 11.9205 18.7021 12.5296 17.9559 12.5296H9.14922C8.80117 12.5296 8.45312 12.3978 8.18945 12.1341C7.92578 11.8704 7.79394 11.5224 7.79394 11.1743V11.1532V11.111C7.79394 11.0979 7.79658 11.082 7.79658 11.0688C7.79658 11.0609 7.79658 11.053 7.79922 11.0451C7.79922 11.0319 7.80186 11.0187 7.80449 11.0056C7.80449 10.9977 7.80713 10.9871 7.80713 10.9792C7.80977 10.9687 7.80976 10.9581 7.8124 10.9476C7.81504 10.937 7.81768 10.9238 7.81768 10.9133C7.82031 10.9054 7.82031 10.8975 7.82295 10.8922C7.82559 10.8764 7.83086 10.8605 7.8335 10.8447C7.8335 10.8421 7.83613 10.8395 7.83613 10.8368C7.89414 10.6127 8.01016 10.3991 8.18682 10.2225L11.2612 7.14805C11.7886 6.6207 12.6508 6.6207 13.1755 7.14805C13.7028 7.67539 13.7028 8.5376 13.1755 9.0623L12.4187 9.82168H17.9559C18.6994 9.82168 19.3111 10.4308 19.3111 11.1743Z"
|
|
4
|
+
fill="#2C7EFF" />
|
|
5
|
+
</svg>`;export{C as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var L=`<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M16.425 5.04961C16.35 4.82461 16.2 4.67461 15.975 4.59961L9.525 1.14961C9.225 0.999609 8.85 0.999609 8.55 1.14961L2.025 4.59961C1.725 4.74961 1.5 5.12461 1.5 5.49961V12.2496C1.5 12.6246 1.725 12.9996 2.025 13.1496L8.475 16.5996C8.7 16.6746 8.925 16.7496 9.15 16.6746C9.225 16.6746 9.375 16.5996 9.45 16.5996L15.9 13.1496C16.275 12.9996 16.5 12.6246 16.5 12.2496V5.49961C16.5 5.34961 16.425 5.19961 16.425 5.04961ZM9.15 8.87461V15.2496L9 15.3996L2.85 12.0996V5.64961L9 2.34961L15.15 5.64961L9.15 8.87461Z"
|
|
4
|
+
fill="#2C7EFF" />
|
|
5
|
+
<path d="M9 8.5V2.5L8.5 2L2.5 5.5V12.5L9 8.5Z" fill="#2C7EFF" />
|
|
6
|
+
<path d="M15.5 6L15 5.5L14.5 6L9 8.5V15.5H9.5L15.5 12.5V6Z" fill="white" />
|
|
7
|
+
</svg>`;export{L as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var c=`<svg width="16" height="4" viewBox="0 0 16 4" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="2" cy="2" r="2" fill="#2C7EFF" />
|
|
3
|
+
<circle cx="8" cy="2" r="2" fill="#2C7EFF" />
|
|
4
|
+
<circle cx="14" cy="2" r="2" fill="#2C7EFF" />
|
|
5
|
+
</svg>`;export{c as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var C=`<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M16.425 5.04961C16.35 4.82461 16.2 4.67461 15.975 4.59961L9.525 1.14961C9.225 0.999609 8.85 0.999609 8.55 1.14961L2.025 4.59961C1.725 4.74961 1.5 5.12461 1.5 5.49961V12.2496C1.5 12.6246 1.725 12.9996 2.025 13.1496L8.475 16.5996C8.7 16.6746 8.925 16.7496 9.15 16.6746C9.225 16.6746 9.375 16.5996 9.45 16.5996L15.9 13.1496C16.275 12.9996 16.5 12.6246 16.5 12.2496V5.49961C16.5 5.34961 16.425 5.19961 16.425 5.04961ZM9.15 8.87461V15.2496L9 15.3996L2.85 12.0996V5.64961L9 2.34961L15.15 5.64961L9.15 8.87461Z"
|
|
4
|
+
fill="#2C7EFF" />
|
|
5
|
+
</svg>`;export{C as default};
|