@labelbee/lb-annotation 1.13.1-alpha.0 → 1.14.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.
- 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/core/toolOperation/pointOperation.js +1 -1
- package/dist/index.js +1 -1
- 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 +16 -3
- package/dist/types/core/pointCloud/index.d.ts +45 -10
- package/dist/types/core/pointCloud/matrix.d.ts +1 -0
- package/dist/types/core/scheduler.d.ts +18 -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 +174 -0
- package/dist/types/core/toolOperation/cuboidToggleButtonClass.d.ts +38 -0
- package/dist/types/core/toolOperation/pointOperation.d.ts +6 -1
- package/dist/types/core/toolOperation/textAttributeClass.d.ts +9 -0
- package/dist/types/index.d.ts +2 -1
- 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 +32 -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/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -3
- package/es/assets/attributeIcon/icon_cuboidMore.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidRight.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidTop.svg.js +12 -3
- 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/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 -736
- package/es/core/toolOperation/cuboidToggleButtonClass.js +7 -150
- package/es/core/toolOperation/pointOperation.js +1 -1
- package/es/index.js +1 -1
- 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 -663
- package/es/utils/tool/DrawUtils.js +3 -3
- package/es/utils/tool/EnhanceCommonToolUtils.js +1 -1
- package/package.json +3 -3
- package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +0 -12
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +0 -7
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +0 -11
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +0 -18
- package/es/core/pointCloud/segmentation.js +0 -50
- package/es/core/toolOperation/scribbleTool2.js +0 -249
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { ECuboidDirection } from '@/constant/annotation';
|
|
2
|
+
import type { ICuboid, ICuboidConfig, IDrawingCuboid } from '@/types/tool/cuboid';
|
|
3
|
+
import { BasicToolOperation } from './basicToolOperation';
|
|
4
|
+
import type { IBasicToolOperationProps } from './basicToolOperation';
|
|
5
|
+
import { ITextAttributeFuc } from './textAttributeClass';
|
|
6
|
+
type ICuboidOperationProps = IBasicToolOperationProps;
|
|
7
|
+
/**
|
|
8
|
+
* Just use for the drawing.
|
|
9
|
+
*/
|
|
10
|
+
declare enum EDrawingStatus {
|
|
11
|
+
Ready = 1,
|
|
12
|
+
FirstPoint = 2,
|
|
13
|
+
Cuboid = 3
|
|
14
|
+
}
|
|
15
|
+
declare class CuboidOperation extends BasicToolOperation implements ITextAttributeFuc {
|
|
16
|
+
private toggleButtonInstance?;
|
|
17
|
+
drawingCuboid?: IDrawingCuboid;
|
|
18
|
+
/**
|
|
19
|
+
* The coordinates of the first click, used for creating a cuboid.
|
|
20
|
+
*/
|
|
21
|
+
firstClickCoord?: ICoordinate;
|
|
22
|
+
drawingStatus: EDrawingStatus;
|
|
23
|
+
cuboidList: ICuboid[];
|
|
24
|
+
selectedID?: string;
|
|
25
|
+
config: ICuboidConfig;
|
|
26
|
+
hoverID: string;
|
|
27
|
+
private dragInfo?;
|
|
28
|
+
private highlightInfo?;
|
|
29
|
+
private _textAttributeInstance?;
|
|
30
|
+
get selectedText(): string;
|
|
31
|
+
constructor(props: ICuboidOperationProps);
|
|
32
|
+
destroy(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Get the showing cuboidList which is needed to be shown.
|
|
35
|
+
*
|
|
36
|
+
* Filter Condition: (It is not enabled currently)
|
|
37
|
+
* 1. basicResult
|
|
38
|
+
* 2. attributeLockList
|
|
39
|
+
*/
|
|
40
|
+
get currentShowList(): ICuboid[];
|
|
41
|
+
get selectedCuboid(): ICuboid | undefined;
|
|
42
|
+
get dataList(): ICuboid[];
|
|
43
|
+
get isNeedCheckCuboidSize(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the mouse is in the hover range.
|
|
46
|
+
* @param e
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
getIsHoverSelectedCuboid(e: MouseEvent): boolean | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Forbidden to draw a cuboid if the backPlane is front than the frontPlane.
|
|
52
|
+
* @param e
|
|
53
|
+
* @param cuboid
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
isForbiddenMove(e: MouseEvent, cuboid: ICuboid | IDrawingCuboid): boolean;
|
|
57
|
+
getHoverData: (e: MouseEvent) => {
|
|
58
|
+
hoverID: string;
|
|
59
|
+
hoverCuboid: ICuboid | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
hoverID?: undefined;
|
|
62
|
+
hoverCuboid?: undefined;
|
|
63
|
+
};
|
|
64
|
+
updateSelectedCuboid(newCuboid: ICuboid): void;
|
|
65
|
+
getStylesToRender(attribute: string, valid: boolean): {
|
|
66
|
+
strokeColor: any;
|
|
67
|
+
toolColor: any;
|
|
68
|
+
fillColor: any;
|
|
69
|
+
lineWidth: any;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Get Selected Data.
|
|
73
|
+
*
|
|
74
|
+
* Exclusive: TextAttributeInstance.
|
|
75
|
+
* @param attribute
|
|
76
|
+
* @param valid
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
getCurrentSelectedData(): {
|
|
80
|
+
width: number;
|
|
81
|
+
textAttribute: string;
|
|
82
|
+
color: any;
|
|
83
|
+
} | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Update text Input.
|
|
86
|
+
*
|
|
87
|
+
* Exclusive: TextAttributeInstance.
|
|
88
|
+
* @param attribute
|
|
89
|
+
* @param valid
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
updateSelectedTextAttribute(newTextAttribute?: string): void;
|
|
93
|
+
setResult(cuboidList: ICuboid[]): void;
|
|
94
|
+
/**
|
|
95
|
+
* 获取当前页面标注结果
|
|
96
|
+
*/
|
|
97
|
+
get currentPageResult(): ICuboid[];
|
|
98
|
+
clearResult(): void;
|
|
99
|
+
exportData(): any[];
|
|
100
|
+
setSelectedID(newID?: string): void;
|
|
101
|
+
setSelectedIDAndRender(newID?: string): void;
|
|
102
|
+
setCuboidValidAndRender(id: string): void;
|
|
103
|
+
onRightDblClick(e: MouseEvent): void;
|
|
104
|
+
setCuboidList(cuboidList: ICuboid[], isUpload?: boolean): void;
|
|
105
|
+
deleteCuboid(id: string): void;
|
|
106
|
+
onKeyDown(e: KeyboardEvent): void;
|
|
107
|
+
onKeyUp(e: KeyboardEvent): void;
|
|
108
|
+
onMouseDown(e: MouseEvent): void;
|
|
109
|
+
onMouseUp(e: MouseEvent): boolean | void;
|
|
110
|
+
onMouseMove(e: MouseEvent): boolean | void;
|
|
111
|
+
drawingFrontPlanesMove(e: MouseEvent): true | undefined;
|
|
112
|
+
drawingBackPlaneMove(e: MouseEvent): void;
|
|
113
|
+
onDragMove(e: MouseEvent): void;
|
|
114
|
+
/**
|
|
115
|
+
* onMouseMove in hover.
|
|
116
|
+
*
|
|
117
|
+
* Highlight the position of hover.
|
|
118
|
+
* @param e
|
|
119
|
+
*/
|
|
120
|
+
onHoverMove(e: MouseEvent): void;
|
|
121
|
+
createNewDrawingCuboid(e: MouseEvent, basicSourceID: string): void;
|
|
122
|
+
/**
|
|
123
|
+
* Change Status
|
|
124
|
+
* From drawing frontPlane to backPlane
|
|
125
|
+
*/
|
|
126
|
+
closeNewDrawingFrontPlane(): void;
|
|
127
|
+
closeAndCreateNewCuboid(): void;
|
|
128
|
+
deleteSelectedID(): void;
|
|
129
|
+
clearDrawingStatus(): void;
|
|
130
|
+
clearActiveStatus(): void;
|
|
131
|
+
rightMouseUp(e: MouseEvent): void;
|
|
132
|
+
/**
|
|
133
|
+
* Render the highlight components
|
|
134
|
+
*
|
|
135
|
+
* Situation:
|
|
136
|
+
* 1. hover
|
|
137
|
+
* 2. selected.
|
|
138
|
+
*
|
|
139
|
+
* Components:
|
|
140
|
+
* 1. 6 Points
|
|
141
|
+
* 2. 5 Lines.
|
|
142
|
+
*
|
|
143
|
+
* @param cuboid
|
|
144
|
+
*/
|
|
145
|
+
renderHighlightCuboidCom(cuboid: ICuboid | IDrawingCuboid): void;
|
|
146
|
+
/**
|
|
147
|
+
* TODO - Need to optimize.
|
|
148
|
+
* @param cuboid
|
|
149
|
+
*/
|
|
150
|
+
renderSingleCuboid(cuboid: ICuboid | IDrawingCuboid): void;
|
|
151
|
+
setDefaultAttribute(defaultAttribute?: string): void;
|
|
152
|
+
renderToggleButton(): void;
|
|
153
|
+
renderTextAttribute(): void;
|
|
154
|
+
renderDrawing(): void;
|
|
155
|
+
renderStatic(): void;
|
|
156
|
+
renderSelected(): void;
|
|
157
|
+
updateMouseOperation(type: 'in' | 'out'): void;
|
|
158
|
+
toggleDirection(direction: ECuboidDirection): void;
|
|
159
|
+
/**
|
|
160
|
+
* Notice: Hover is under selectedCuboid.
|
|
161
|
+
*/
|
|
162
|
+
renderHover(): void;
|
|
163
|
+
renderCuboid(): void;
|
|
164
|
+
render(): void;
|
|
165
|
+
undo(): void;
|
|
166
|
+
redo(): void;
|
|
167
|
+
/**
|
|
168
|
+
* Sidebar Callback Function
|
|
169
|
+
* @param v
|
|
170
|
+
* @returns
|
|
171
|
+
*/
|
|
172
|
+
textChange: (v: string) => void;
|
|
173
|
+
}
|
|
174
|
+
export default CuboidOperation;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ECuboidDirection } from '@/constant/annotation';
|
|
2
|
+
interface IBaseInfo {
|
|
3
|
+
cuboidButtonMove: (type: 'in' | 'out') => void;
|
|
4
|
+
toggleDirection: (direction: ECuboidDirection) => void;
|
|
5
|
+
}
|
|
6
|
+
interface ITextAttributeProps {
|
|
7
|
+
container: HTMLElement;
|
|
8
|
+
}
|
|
9
|
+
export default class CuboidToggleButtonClass {
|
|
10
|
+
private container;
|
|
11
|
+
private direction;
|
|
12
|
+
private _cuboidButtonDOM?;
|
|
13
|
+
private _cuboidFABDOM?;
|
|
14
|
+
private isFrontSide;
|
|
15
|
+
private _cuboidMoreDOM?;
|
|
16
|
+
private _cuboidMoreListDOM?;
|
|
17
|
+
private cuboidButtonMove;
|
|
18
|
+
private onToggleDirection;
|
|
19
|
+
constructor(props: ITextAttributeProps & IBaseInfo);
|
|
20
|
+
appendToContainer(): void;
|
|
21
|
+
initCuboidButtonDOM(): HTMLDivElement;
|
|
22
|
+
initcuboidFABDOM(icon: any): HTMLDivElement;
|
|
23
|
+
initcuboidMoreDOM(icon: any): HTMLDivElement;
|
|
24
|
+
initcuboidMoreListDOM(): HTMLDivElement;
|
|
25
|
+
/**
|
|
26
|
+
* Update current button (top)
|
|
27
|
+
* @param position
|
|
28
|
+
*/
|
|
29
|
+
update(position: {
|
|
30
|
+
left: number;
|
|
31
|
+
top: number;
|
|
32
|
+
color: string;
|
|
33
|
+
width?: number;
|
|
34
|
+
}): void;
|
|
35
|
+
clearCuboidButtonDOM(): void;
|
|
36
|
+
clearCuboidMoreListDOM(): void;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BasicToolOperation, IBasicToolOperationProps } from './basicToolOperation';
|
|
2
2
|
export interface IPointOperationProps extends IBasicToolOperationProps {
|
|
3
3
|
style: any;
|
|
4
|
+
forbidAddNew?: boolean;
|
|
5
|
+
forbidDelete?: boolean;
|
|
4
6
|
}
|
|
5
7
|
declare class PointOperation extends BasicToolOperation {
|
|
6
8
|
config: IPointToolConfig;
|
|
@@ -12,6 +14,8 @@ declare class PointOperation extends BasicToolOperation {
|
|
|
12
14
|
dragStartCoord: ICoordinate;
|
|
13
15
|
originPointList: IPointUnit[];
|
|
14
16
|
};
|
|
17
|
+
forbidAddNew?: boolean;
|
|
18
|
+
forbidDelete?: boolean;
|
|
15
19
|
private _textAttributInstance?;
|
|
16
20
|
constructor(props: IPointOperationProps);
|
|
17
21
|
get dataList(): IPointUnit[];
|
|
@@ -43,7 +47,7 @@ declare class PointOperation extends BasicToolOperation {
|
|
|
43
47
|
clearResult(): void;
|
|
44
48
|
setDefaultAttribute(defaultAttribute?: string): void;
|
|
45
49
|
/**
|
|
46
|
-
* 外层
|
|
50
|
+
* 外层 sidebar 调用
|
|
47
51
|
* @param v
|
|
48
52
|
* @returns
|
|
49
53
|
*/
|
|
@@ -75,6 +79,7 @@ declare class PointOperation extends BasicToolOperation {
|
|
|
75
79
|
createPoint(e: MouseEvent): void;
|
|
76
80
|
isInPoint(pos: ICoordinate, point: ICoordinate, zoom?: number): boolean;
|
|
77
81
|
getHoverId(): string | undefined;
|
|
82
|
+
get selectedPoint(): IPointUnit | undefined;
|
|
78
83
|
rightMouseUp(): void;
|
|
79
84
|
onTabKeyDown(e: KeyboardEvent): void;
|
|
80
85
|
/**
|
|
@@ -53,4 +53,13 @@ export default class TextAttributeClass {
|
|
|
53
53
|
*/
|
|
54
54
|
changeSelected(): void;
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* TextAttribute injection requires content changes.
|
|
58
|
+
*
|
|
59
|
+
* Custom Changes.
|
|
60
|
+
* 1. Need to init textAttribute when creating data.
|
|
61
|
+
*/
|
|
62
|
+
export interface ITextAttributeFuc extends IBaseInfo {
|
|
63
|
+
selectedText: string;
|
|
64
|
+
}
|
|
56
65
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -28,9 +28,10 @@ import ActionsHistory from './utils/ActionsHistory';
|
|
|
28
28
|
import DblClickEventListener from './utils/tool/DblClickEventListener';
|
|
29
29
|
import AnnotationEngine from './core';
|
|
30
30
|
import UnitUtils from './utils/tool/UnitUtils';
|
|
31
|
+
import StyleUtils from './utils/tool/StyleUtils';
|
|
31
32
|
declare const CommonToolUtils: typeof EnhanceCommonToolUtils;
|
|
32
33
|
declare const toolUtils: typeof EnhanceCommonToolUtils;
|
|
33
|
-
export { RectOperation, TagOperation, PointOperation, LineToolOperation, PolygonOperation, TextToolOperation, BasicToolOperation, MeasureOperation, ViewOperation, PointCloud2dOperation, cAnnotation, cAnnotationTask, cKeyCode, cStyle, cTool, toolUtils, DblClickEventListener, CommonToolUtils, uuid, MarkerUtils, RectUtils, AxisUtils, TagUtils, DrawUtils, ImgUtils, MathUtils, AttributeUtils, AnnotationEngine, ScribbleTool, UnitUtils, ActionsHistory, };
|
|
34
|
+
export { RectOperation, TagOperation, PointOperation, LineToolOperation, PolygonOperation, TextToolOperation, BasicToolOperation, MeasureOperation, ViewOperation, PointCloud2dOperation, cAnnotation, cAnnotationTask, cKeyCode, cStyle, cTool, toolUtils, DblClickEventListener, CommonToolUtils, uuid, MarkerUtils, RectUtils, AxisUtils, TagUtils, DrawUtils, ImgUtils, MathUtils, AttributeUtils, AnnotationEngine, ScribbleTool, UnitUtils, StyleUtils, ActionsHistory, };
|
|
34
35
|
export * from './newCore';
|
|
35
36
|
export * from './constant/tool';
|
|
36
37
|
export * from './core/pointCloud';
|
|
@@ -49,7 +49,7 @@ export default class MathUtils {
|
|
|
49
49
|
* @param {boolean} ignoreRatio
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
|
-
static getFootOfPerpendicular: (pt: ICoordinate, begin: ICoordinate, end: ICoordinate, useAxisRange?: boolean) => any;
|
|
52
|
+
static getFootOfPerpendicular: (pt: ICoordinate, begin: ICoordinate, end: ICoordinate, useAxisRange?: boolean, allowOverRange?: boolean) => any;
|
|
53
53
|
/**
|
|
54
54
|
* 获取当前文本的背景面积
|
|
55
55
|
* @param canvas
|
|
@@ -77,6 +77,13 @@ export default class AttributeUtils {
|
|
|
77
77
|
*/
|
|
78
78
|
static changeTextAttributeInLog(toolLog: any[][], toolList: any[]): any[][];
|
|
79
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;
|
|
80
87
|
/**
|
|
81
88
|
* 根据keycode返回attribute, 没有匹配到时为undefined
|
|
82
89
|
* @param keyCode
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EToolName, ELineTypes } from '@/constant/tool';
|
|
2
|
+
import type { ICuboid, IDrawingCuboid, IPlanePoints } from '@/types/tool/cuboid';
|
|
2
3
|
import { IPolygonPoint, IPolygonData, IPolygonConfig } from '../../types/tool/polygon';
|
|
3
4
|
export default class AxisUtils {
|
|
4
5
|
/**
|
|
@@ -66,6 +67,9 @@ export default class AxisUtils {
|
|
|
66
67
|
x: number;
|
|
67
68
|
y: number;
|
|
68
69
|
})[];
|
|
70
|
+
static changePlanePointByZoom(planePoints: IPlanePoints, zoom: number, currentPos?: ICoordinate): IPlanePoints;
|
|
71
|
+
static changeCuboidByZoom(cuboid: ICuboid | IDrawingCuboid, zoom: number, currentPos?: ICoordinate): ICuboid | IDrawingCuboid;
|
|
72
|
+
static transformPlain2PointList({ tl, tr, br, bl }: IPlanePoints): any[];
|
|
69
73
|
/**
|
|
70
74
|
* 扩大点的热区范围
|
|
71
75
|
* @param axis
|
|
@@ -97,7 +101,52 @@ export default class AxisUtils {
|
|
|
97
101
|
* @param {number} [scope=3]
|
|
98
102
|
* @returns {number}
|
|
99
103
|
*/
|
|
100
|
-
static returnClosePointIndex(checkPoint: IPolygonPoint, polygonPoints: IPolygonPoint[], scope?: number): number;
|
|
104
|
+
static returnClosePointIndex(checkPoint: IPolygonPoint | ICoordinate, polygonPoints: IPolygonPoint[] | ICoordinate[], scope?: number): number;
|
|
105
|
+
/**
|
|
106
|
+
* Judge the mousePoint is in the hoverRange of cuboid.
|
|
107
|
+
* @param checkPoint
|
|
108
|
+
* @param cuboid
|
|
109
|
+
* @param options
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
112
|
+
static isCloseCuboid(checkPoint: ICoordinate, cuboid: ICuboid, options?: Partial<{
|
|
113
|
+
scope: number;
|
|
114
|
+
zoom: number;
|
|
115
|
+
}>): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Judge the mousePoint is in the hoverRange of cuboidList.
|
|
118
|
+
* @param checkPoint
|
|
119
|
+
* @param cuboid
|
|
120
|
+
* @param options
|
|
121
|
+
* @returns
|
|
122
|
+
*/
|
|
123
|
+
static isCloseCuboidList(checkPoint: ICoordinate, cuboidList: ICuboid[], options?: Partial<{
|
|
124
|
+
scope: number;
|
|
125
|
+
zoom: number;
|
|
126
|
+
}>): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Point > Line
|
|
129
|
+
* @param checkPoint
|
|
130
|
+
* @param cuboid
|
|
131
|
+
* @param scope
|
|
132
|
+
*/
|
|
133
|
+
static returnClosePointOrLineInCuboid(checkPoint: ICoordinate, cuboid: ICuboid, options?: Partial<{
|
|
134
|
+
scope: number;
|
|
135
|
+
zoom: number;
|
|
136
|
+
}>): {
|
|
137
|
+
type: string;
|
|
138
|
+
points: ({
|
|
139
|
+
x: number;
|
|
140
|
+
y: number;
|
|
141
|
+
specialPoint?: boolean | undefined;
|
|
142
|
+
specialEdge?: boolean | undefined;
|
|
143
|
+
} | {
|
|
144
|
+
x: number;
|
|
145
|
+
y: number;
|
|
146
|
+
})[];
|
|
147
|
+
originCuboid: ICuboid;
|
|
148
|
+
positions: import("@/types/tool/cuboid").ICuboidPosition[];
|
|
149
|
+
}[] | undefined;
|
|
101
150
|
/**
|
|
102
151
|
* 对比两个点是否在一范围内
|
|
103
152
|
*
|
|
@@ -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
|
+
* Get the intersections from frontPoints & backPoints.
|
|
106
|
+
*
|
|
107
|
+
* @param param0
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
110
|
+
export declare function getPointsByIntersection({ frontPoints, backPoints, }: {
|
|
111
|
+
frontPoints: IPlanePoints;
|
|
112
|
+
backPoints: IPlanePoints;
|
|
113
|
+
}): {
|
|
114
|
+
backPoints: {
|
|
115
|
+
bl: ICoordinate;
|
|
116
|
+
tl: ICoordinate;
|
|
117
|
+
br: ICoordinate;
|
|
118
|
+
tr: ICoordinate;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* When the point
|
|
123
|
+
* @param frontPoints
|
|
124
|
+
* @param backPoints
|
|
125
|
+
*/
|
|
126
|
+
export declare function getBackPointsByFrontPoints({ frontPoints, backPoints, }: {
|
|
127
|
+
frontPoints: IPlanePoints;
|
|
128
|
+
backPoints: IPlanePoints;
|
|
129
|
+
}): {
|
|
130
|
+
frontPoints: IPlanePoints;
|
|
131
|
+
backPoints: {
|
|
132
|
+
bl: ICoordinate;
|
|
133
|
+
tl: ICoordinate;
|
|
134
|
+
br: ICoordinate;
|
|
135
|
+
tr: ICoordinate;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
export declare function getFrontPointsByBackPoints({ frontPoints, backPoints, }: {
|
|
139
|
+
frontPoints: IPlanePoints;
|
|
140
|
+
backPoints: IPlanePoints;
|
|
141
|
+
}): {
|
|
142
|
+
frontPoints: {
|
|
143
|
+
bl: ICoordinate;
|
|
144
|
+
tl: ICoordinate;
|
|
145
|
+
br: ICoordinate;
|
|
146
|
+
tr: ICoordinate;
|
|
147
|
+
};
|
|
148
|
+
backPoints: IPlanePoints;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Get SideLine By FrontPoints & BackPoints
|
|
152
|
+
* @param param0
|
|
153
|
+
* @returns
|
|
154
|
+
*/
|
|
155
|
+
export declare function getCuboidAllSideLine({ frontPoints, backPoints }: ICuboid): {
|
|
156
|
+
p1: ICoordinate;
|
|
157
|
+
p2: ICoordinate;
|
|
158
|
+
}[];
|
|
159
|
+
export declare function getHighlightLines(cuboid: ICuboid): ({
|
|
160
|
+
p1: ICoordinate;
|
|
161
|
+
p2: ICoordinate;
|
|
162
|
+
positions: {
|
|
163
|
+
plain: ECuboidPlain;
|
|
164
|
+
position: ECuboidPosition;
|
|
165
|
+
}[];
|
|
166
|
+
plain?: undefined;
|
|
167
|
+
} | {
|
|
168
|
+
p1: ICoordinate;
|
|
169
|
+
p2: ICoordinate;
|
|
170
|
+
plain: ECuboidPlain;
|
|
171
|
+
positions: {
|
|
172
|
+
plain: ECuboidPlain;
|
|
173
|
+
position: ECuboidPosition;
|
|
174
|
+
}[];
|
|
175
|
+
})[];
|
|
176
|
+
/**
|
|
177
|
+
* Just showing the points which can be adjusted
|
|
178
|
+
* @param cuboid
|
|
179
|
+
* @returns
|
|
180
|
+
*/
|
|
181
|
+
export declare function getHighlightPoints(cuboid: ICuboid): {
|
|
182
|
+
point: ICoordinate;
|
|
183
|
+
positions: ICuboidPosition[];
|
|
184
|
+
}[];
|
|
185
|
+
/**
|
|
186
|
+
* Get the range of Cuboid in 2D.
|
|
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, ICuboidConfig, 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,35 @@ 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;
|
|
178
|
+
/**
|
|
179
|
+
* Draw Cuboid and Text in header & bottom.
|
|
180
|
+
* @param canvas
|
|
181
|
+
* @param cuboid
|
|
182
|
+
* @param options
|
|
183
|
+
* @param dataConfig
|
|
184
|
+
*/
|
|
185
|
+
static drawCuboidWithText(canvas: HTMLCanvasElement, cuboid: ICuboid | IDrawingCuboid, options: {
|
|
186
|
+
strokeColor: string;
|
|
187
|
+
fillColor?: string;
|
|
188
|
+
thickness?: number;
|
|
189
|
+
}, dataConfig: {
|
|
190
|
+
config: ICuboidConfig;
|
|
191
|
+
hiddenText?: boolean;
|
|
192
|
+
currentPos: ICoordinate;
|
|
193
|
+
zoom: number;
|
|
194
|
+
selectedID?: string;
|
|
195
|
+
headerText?: string;
|
|
196
|
+
bottomText?: string;
|
|
197
|
+
}): void;
|
|
166
198
|
}
|
|
@@ -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;
|