@labelbee/lb-annotation 1.14.0-alpha.3 → 1.14.0-alpha.5
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/_virtual/MathUtilsWorker.js +1 -8
- package/dist/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -35
- package/dist/_virtual/filterBoxWorker.js +1 -8
- package/dist/_virtual/highlightWorker.js +1 -8
- package/dist/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -5
- package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +12 -5
- package/dist/assets/attributeIcon/icon_editFEN.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editHUANG.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editLAN.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editLV.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editQING.svg.js +1 -5
- package/dist/constant/annotation.js +1 -127
- package/dist/constant/annotationTask.js +1 -30
- package/dist/constant/defaultConfig.js +1 -266
- package/dist/constant/keyCode.js +1 -38
- package/dist/constant/style.js +1 -98
- package/dist/constant/tool.js +1 -236
- package/dist/core/index.js +1 -150
- package/dist/core/pointCloud/OrbitControls.js +1 -665
- package/dist/core/pointCloud/PCDLoader.js +2 -260
- package/dist/core/pointCloud/annotation.js +1 -215
- package/dist/core/pointCloud/cache.js +1 -53
- package/dist/core/pointCloud/index.js +5 -991
- package/dist/core/pointCloud/matrix.js +1 -138
- package/dist/core/scheduler.js +1 -233
- package/dist/core/toolOperation/LineToolOperation.js +1 -1434
- package/dist/core/toolOperation/ScribbleTool.js +1 -292
- package/dist/core/toolOperation/TextToolOperation.js +1 -131
- package/dist/core/toolOperation/ViewOperation.js +1 -556
- package/dist/core/toolOperation/basicToolOperation.js +1 -881
- package/dist/core/toolOperation/checkOperation.js +1 -208
- package/dist/core/toolOperation/cuboidOperation.js +1 -754
- package/dist/core/toolOperation/cuboidToggleButtonClass.js +7 -152
- package/dist/core/toolOperation/eventListener.js +1 -37
- package/dist/core/toolOperation/measureOperation.js +1 -41
- package/dist/core/toolOperation/pointCloud2dOperation.js +1 -365
- package/dist/core/toolOperation/pointOperation.js +1 -696
- package/dist/core/toolOperation/polygonOperation.js +1 -1251
- package/dist/core/toolOperation/rectOperation.js +1 -1233
- package/dist/core/toolOperation/segmentByRect.js +1 -174
- package/dist/core/toolOperation/tagOperation.js +3 -201
- package/dist/core/toolOperation/textAttributeClass.js +16 -182
- package/dist/index.js +1 -185
- package/dist/locales/constants.js +1 -24
- package/dist/locales/en_US/message.js +1 -25
- package/dist/locales/index.js +1 -19
- package/dist/locales/zh_CN/message.js +1 -25
- package/dist/newCore/CanvasScheduler.js +1 -35
- package/dist/utils/ActionsHistory.js +1 -84
- package/dist/utils/ImgUtils.js +1 -23
- package/dist/utils/MathUtils.js +2 -385
- package/dist/utils/VectorUtils.js +1 -25
- package/dist/utils/tool/AttributeUtils.js +1 -218
- package/dist/utils/tool/AxisUtils.js +1 -340
- package/dist/utils/tool/CanvasUtils.js +1 -62
- package/dist/utils/tool/CommonToolUtils.js +1 -174
- package/dist/utils/tool/CuboidUtils.js +1 -704
- package/dist/utils/tool/DblClickEventListener.js +1 -102
- package/dist/utils/tool/DrawUtils.js +3 -492
- package/dist/utils/tool/EnhanceCommonToolUtils.js +1 -53
- package/dist/utils/tool/ImgPosUtils.js +1 -58
- package/dist/utils/tool/LineToolUtils.js +1 -261
- package/dist/utils/tool/MarkerUtils.js +1 -56
- package/dist/utils/tool/PolygonUtils.js +1 -460
- package/dist/utils/tool/RectUtils.js +1 -155
- package/dist/utils/tool/RenderDomClass.js +7 -57
- package/dist/utils/tool/RenderDomUtils.js +4 -21
- package/dist/utils/tool/StyleUtils.js +1 -31
- package/dist/utils/tool/TagUtils.js +1 -129
- package/dist/utils/tool/UnitUtils.js +1 -12
- package/dist/utils/tool/ZoomUtils.js +1 -72
- package/dist/utils/tool/polygonTool.js +1 -133
- package/dist/utils/uuid.js +1 -26
- package/es/_virtual/MathUtilsWorker.js +1 -6
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -31
- package/es/_virtual/filterBoxWorker.js +1 -6
- package/es/_virtual/highlightWorker.js +1 -6
- package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -3
- 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/assets/attributeIcon/icon_editFEN.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editHUANG.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editLAN.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editLV.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editQING.svg.js +1 -3
- package/es/constant/annotation.js +1 -113
- package/es/constant/annotationTask.js +1 -25
- package/es/constant/defaultConfig.js +1 -260
- package/es/constant/keyCode.js +1 -36
- package/es/constant/style.js +1 -74
- package/es/constant/tool.js +1 -220
- package/es/core/index.js +1 -148
- package/es/core/pointCloud/OrbitControls.js +1 -661
- package/es/core/pointCloud/PCDLoader.js +2 -256
- package/es/core/pointCloud/annotation.js +1 -211
- package/es/core/pointCloud/cache.js +1 -49
- package/es/core/pointCloud/index.js +5 -962
- package/es/core/pointCloud/matrix.js +1 -109
- package/es/core/scheduler.js +1 -228
- package/es/core/toolOperation/LineToolOperation.js +1 -1421
- package/es/core/toolOperation/ScribbleTool.js +1 -290
- package/es/core/toolOperation/TextToolOperation.js +1 -129
- package/es/core/toolOperation/ViewOperation.js +1 -549
- package/es/core/toolOperation/basicToolOperation.js +1 -877
- package/es/core/toolOperation/checkOperation.js +1 -206
- package/es/core/toolOperation/cuboidOperation.js +1 -752
- package/es/core/toolOperation/cuboidToggleButtonClass.js +7 -150
- package/es/core/toolOperation/eventListener.js +1 -35
- package/es/core/toolOperation/measureOperation.js +1 -39
- package/es/core/toolOperation/pointCloud2dOperation.js +1 -359
- package/es/core/toolOperation/pointOperation.js +1 -690
- package/es/core/toolOperation/polygonOperation.js +1 -1245
- package/es/core/toolOperation/rectOperation.js +1 -1228
- package/es/core/toolOperation/segmentByRect.js +1 -172
- package/es/core/toolOperation/tagOperation.js +3 -199
- package/es/core/toolOperation/textAttributeClass.js +16 -180
- package/es/index.js +1 -46
- package/es/locales/constants.js +1 -22
- package/es/locales/en_US/message.js +1 -23
- package/es/locales/index.js +1 -17
- package/es/locales/zh_CN/message.js +1 -23
- package/es/newCore/CanvasScheduler.js +1 -31
- package/es/utils/ActionsHistory.js +1 -78
- package/es/utils/ImgUtils.js +1 -21
- package/es/utils/MathUtils.js +2 -380
- package/es/utils/VectorUtils.js +1 -23
- package/es/utils/tool/AttributeUtils.js +1 -212
- package/es/utils/tool/AxisUtils.js +1 -335
- package/es/utils/tool/CanvasUtils.js +1 -60
- package/es/utils/tool/CommonToolUtils.js +1 -172
- package/es/utils/tool/CuboidUtils.js +1 -680
- package/es/utils/tool/DblClickEventListener.js +1 -100
- package/es/utils/tool/DrawUtils.js +3 -490
- package/es/utils/tool/EnhanceCommonToolUtils.js +1 -48
- package/es/utils/tool/ImgPosUtils.js +1 -56
- package/es/utils/tool/LineToolUtils.js +1 -255
- package/es/utils/tool/MarkerUtils.js +1 -54
- package/es/utils/tool/PolygonUtils.js +1 -458
- package/es/utils/tool/RectUtils.js +1 -153
- package/es/utils/tool/RenderDomClass.js +7 -55
- package/es/utils/tool/RenderDomUtils.js +4 -19
- package/es/utils/tool/StyleUtils.js +1 -29
- package/es/utils/tool/TagUtils.js +1 -127
- package/es/utils/tool/UnitUtils.js +1 -10
- package/es/utils/tool/ZoomUtils.js +1 -70
- package/es/utils/tool/polygonTool.js +1 -126
- package/es/utils/uuid.js +1 -24
- package/package.json +3 -4
- package/LICENSE +0 -203
- package/dist/core/pointCloud/segmentation.js +0 -144
- package/dist/core/pointCloud/selector/Sse3dLassoSelector.js +0 -26
- package/dist/core/pointCloud/selector/Sse3dSelector.js +0 -16
- package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
- package/dist/types/core/pointCloud/selector/Sse3dLassoSelector.d.ts +0 -0
- package/dist/types/core/pointCloud/selector/Sse3dSelector.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 -120
- package/es/core/pointCloud/selector/Sse3dLassoSelector.js +0 -24
- package/es/core/pointCloud/selector/Sse3dSelector.js +0 -14
- package/es/core/toolOperation/scribbleTool2.js +0 -249
|
@@ -1,108 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import cuboidFAB from '../../assets/attributeIcon/icon_cuboidFAB.svg.js';
|
|
3
|
-
import cuboidMore from '../../assets/attributeIcon/icon_cuboidMore.svg.js';
|
|
4
|
-
import cuboidRight from '../../assets/attributeIcon/icon_cuboidRight.svg.js';
|
|
5
|
-
import cuboidLeft from '../../assets/attributeIcon/icon_cuboidLeft.svg.js';
|
|
6
|
-
import cuboidTop from '../../assets/attributeIcon/icon_cuboidTop.svg.js';
|
|
7
|
-
|
|
8
|
-
const MORE_ICON_LISTS = [
|
|
9
|
-
{
|
|
10
|
-
icon: cuboidRight,
|
|
11
|
-
id: "cuboidRight"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
icon: cuboidLeft,
|
|
15
|
-
id: "cuboidLeft"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
icon: cuboidTop,
|
|
19
|
-
id: "cuboidTop"
|
|
20
|
-
}
|
|
21
|
-
];
|
|
22
|
-
class CuboidToggleButtonClass {
|
|
23
|
-
constructor(props) {
|
|
24
|
-
const {container, cuboidButtonMove, toggleDirection} = props;
|
|
25
|
-
this.container = container;
|
|
26
|
-
this.direction = ECuboidDirection.Front;
|
|
27
|
-
this.isFrontSide = true;
|
|
28
|
-
this.cuboidButtonMove = cuboidButtonMove;
|
|
29
|
-
this.onToggleDirection = toggleDirection;
|
|
30
|
-
this._cuboidButtonDOM = this.initCuboidButtonDOM();
|
|
31
|
-
this._cuboidFABDOM = this.initcuboidFABDOM(cuboidFAB);
|
|
32
|
-
this._cuboidMoreDOM = this.initcuboidMoreDOM(cuboidMore);
|
|
33
|
-
this._cuboidMoreListDOM = this.initcuboidMoreListDOM();
|
|
34
|
-
this.appendToContainer();
|
|
35
|
-
}
|
|
36
|
-
appendToContainer() {
|
|
37
|
-
if (!this._cuboidButtonDOM || !this._cuboidFABDOM || !this._cuboidMoreDOM) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
this.container.appendChild(this._cuboidButtonDOM);
|
|
41
|
-
this._cuboidButtonDOM.appendChild(this._cuboidFABDOM);
|
|
42
|
-
this._cuboidButtonDOM.appendChild(this._cuboidMoreDOM);
|
|
43
|
-
}
|
|
44
|
-
initCuboidButtonDOM() {
|
|
45
|
-
const _cuboidButtonDOM = document.createElement("div");
|
|
46
|
-
_cuboidButtonDOM.setAttribute("id", "LABELBEE_CUBOID_BUTTON_BOX");
|
|
47
|
-
_cuboidButtonDOM.setAttribute("style", `
|
|
1
|
+
import{ECuboidDirection as s}from"../../constant/annotation.js";import c from"../../assets/attributeIcon/icon_cuboidFAB.svg.js";import u from"../../assets/attributeIcon/icon_cuboidMore.svg.js";import a from"../../assets/attributeIcon/icon_cuboidRight.svg.js";import b from"../../assets/attributeIcon/icon_cuboidLeft.svg.js";import h from"../../assets/attributeIcon/icon_cuboidTop.svg.js";const r=[{icon:a,id:"cuboidRight"},{icon:b,id:"cuboidLeft"},{icon:h,id:"cuboidTop"}];class M{constructor(i){const{container:t,cuboidButtonMove:o,toggleDirection:e}=i;this.container=t,this.direction=s.Front,this.isFrontSide=!0,this.cuboidButtonMove=o,this.onToggleDirection=e,this._cuboidButtonDOM=this.initCuboidButtonDOM(),this._cuboidFABDOM=this.initcuboidFABDOM(c),this._cuboidMoreDOM=this.initcuboidMoreDOM(u),this._cuboidMoreListDOM=this.initcuboidMoreListDOM(),this.appendToContainer()}appendToContainer(){!this._cuboidButtonDOM||!this._cuboidFABDOM||!this._cuboidMoreDOM||(this.container.appendChild(this._cuboidButtonDOM),this._cuboidButtonDOM.appendChild(this._cuboidFABDOM),this._cuboidButtonDOM.appendChild(this._cuboidMoreDOM))}initCuboidButtonDOM(){const i=document.createElement("div");return i.setAttribute("id","LABELBEE_CUBOID_BUTTON_BOX"),i.setAttribute("style",`
|
|
48
2
|
width: 40px;
|
|
49
3
|
height: 74px;
|
|
50
4
|
border-radius: 10px;
|
|
51
5
|
background-color: #FFFFFF;
|
|
52
6
|
z-index: 10;
|
|
53
|
-
`);
|
|
54
|
-
_cuboidButtonDOM.addEventListener("mouseover", (e) => {
|
|
55
|
-
e.stopPropagation();
|
|
56
|
-
setTimeout(() => {
|
|
57
|
-
this.cuboidButtonMove("in");
|
|
58
|
-
}, 100);
|
|
59
|
-
});
|
|
60
|
-
_cuboidButtonDOM.addEventListener("mouseleave", (e) => {
|
|
61
|
-
e.stopPropagation();
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
this.cuboidButtonMove("out");
|
|
64
|
-
}, 100);
|
|
65
|
-
});
|
|
66
|
-
return _cuboidButtonDOM;
|
|
67
|
-
}
|
|
68
|
-
initcuboidFABDOM(icon) {
|
|
69
|
-
const _cuboidFAB = document.createElement("div");
|
|
70
|
-
_cuboidFAB.setAttribute("id", "CUBOID_FORWARD_AND_BACK_SWITCH");
|
|
71
|
-
_cuboidFAB.innerHTML = icon;
|
|
72
|
-
_cuboidFAB.addEventListener("mouseup", (e) => {
|
|
73
|
-
e.stopPropagation();
|
|
74
|
-
this.isFrontSide = !this.isFrontSide;
|
|
75
|
-
this.direction = this.isFrontSide ? ECuboidDirection.Front : ECuboidDirection.Back;
|
|
76
|
-
this.onToggleDirection(this.direction);
|
|
77
|
-
});
|
|
78
|
-
return _cuboidFAB;
|
|
79
|
-
}
|
|
80
|
-
initcuboidMoreDOM(icon) {
|
|
81
|
-
const _iconDOM = document.createElement("div");
|
|
82
|
-
_iconDOM.setAttribute("id", "CUBOID_MORE_ICON");
|
|
83
|
-
_iconDOM.innerHTML = icon;
|
|
84
|
-
_iconDOM.addEventListener("mouseup", (e) => {
|
|
85
|
-
if (this._cuboidButtonDOM && this._cuboidMoreListDOM) {
|
|
86
|
-
if (this._cuboidButtonDOM.contains(this._cuboidMoreListDOM)) {
|
|
87
|
-
this.clearCuboidMoreListDOM();
|
|
88
|
-
} else {
|
|
89
|
-
this._cuboidButtonDOM.appendChild(this._cuboidMoreListDOM);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
e.stopPropagation();
|
|
93
|
-
});
|
|
94
|
-
_iconDOM.addEventListener("mousedown", (e) => {
|
|
95
|
-
e.stopPropagation();
|
|
96
|
-
});
|
|
97
|
-
_iconDOM.addEventListener("contextmenu", (e) => {
|
|
98
|
-
e.stopPropagation();
|
|
99
|
-
});
|
|
100
|
-
return _iconDOM;
|
|
101
|
-
}
|
|
102
|
-
initcuboidMoreListDOM() {
|
|
103
|
-
const cuboidMoreListDOM = document.createElement("div");
|
|
104
|
-
cuboidMoreListDOM.setAttribute("id", "CUBOID_MORE_LIST_ICON");
|
|
105
|
-
cuboidMoreListDOM.setAttribute("style", `
|
|
7
|
+
`),i.addEventListener("mouseover",t=>{t.stopPropagation(),setTimeout(()=>{this.cuboidButtonMove("in")},100)}),i.addEventListener("mouseleave",t=>{t.stopPropagation(),setTimeout(()=>{this.cuboidButtonMove("out")},100)}),i}initcuboidFABDOM(i){const t=document.createElement("div");return t.setAttribute("id","CUBOID_FORWARD_AND_BACK_SWITCH"),t.innerHTML=i,t.addEventListener("mouseup",o=>{o.stopPropagation(),this.isFrontSide=!this.isFrontSide,this.direction=this.isFrontSide?s.Front:s.Back,this.onToggleDirection(this.direction)}),t}initcuboidMoreDOM(i){const t=document.createElement("div");return t.setAttribute("id","CUBOID_MORE_ICON"),t.innerHTML=i,t.addEventListener("mouseup",o=>{this._cuboidButtonDOM&&this._cuboidMoreListDOM&&(this._cuboidButtonDOM.contains(this._cuboidMoreListDOM)?this.clearCuboidMoreListDOM():this._cuboidButtonDOM.appendChild(this._cuboidMoreListDOM)),o.stopPropagation()}),t.addEventListener("mousedown",o=>{o.stopPropagation()}),t.addEventListener("contextmenu",o=>{o.stopPropagation()}),t}initcuboidMoreListDOM(){const i=document.createElement("div");i.setAttribute("id","CUBOID_MORE_LIST_ICON"),i.setAttribute("style",`
|
|
106
8
|
height: 36px;
|
|
107
9
|
border-radius: 10px;
|
|
108
10
|
background-color: #FFFFFF;
|
|
@@ -112,43 +14,12 @@ class CuboidToggleButtonClass {
|
|
|
112
14
|
bottom: 0px;
|
|
113
15
|
left: 44px;
|
|
114
16
|
display: flex;
|
|
115
|
-
`);
|
|
116
|
-
let str = "";
|
|
117
|
-
const iconStyle = `margin-left:4px;margin-right:4px;display:flex;align-items:center;`;
|
|
118
|
-
MORE_ICON_LISTS.forEach((i, index) => {
|
|
119
|
-
const lastIconStyle = index === MORE_ICON_LISTS.length - 1 ? "margin-left:0px;margin-right:0px;" : "";
|
|
120
|
-
str += `<span id=${i.id} key=${index} style=${iconStyle}${lastIconStyle}>${i.icon}</span>`;
|
|
121
|
-
});
|
|
122
|
-
cuboidMoreListDOM.innerHTML = str;
|
|
123
|
-
cuboidMoreListDOM.childNodes.forEach((item) => {
|
|
124
|
-
item.addEventListener("click", (e) => {
|
|
125
|
-
e.stopPropagation();
|
|
126
|
-
switch (item == null ? void 0 : item.id) {
|
|
127
|
-
case "cuboidLeft":
|
|
128
|
-
this.onToggleDirection(ECuboidDirection.Left);
|
|
129
|
-
break;
|
|
130
|
-
case "cuboidRight":
|
|
131
|
-
this.onToggleDirection(ECuboidDirection.Right);
|
|
132
|
-
break;
|
|
133
|
-
case "cuboidTop":
|
|
134
|
-
this.onToggleDirection(ECuboidDirection.Top);
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
this.clearCuboidMoreListDOM();
|
|
138
|
-
this.cuboidButtonMove("out");
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
return cuboidMoreListDOM;
|
|
142
|
-
}
|
|
143
|
-
update(position) {
|
|
144
|
-
var _a;
|
|
145
|
-
const {left, top, color} = position;
|
|
146
|
-
(_a = this._cuboidButtonDOM) == null ? void 0 : _a.setAttribute("style", `
|
|
17
|
+
`);let t="";const o="margin-left:4px;margin-right:4px;display:flex;align-items:center;";return r.forEach((e,n)=>{const d=n===r.length-1?"margin-left:0px;margin-right:0px;":"";t+=`<span id=${e.id} key=${n} style=${o}${d}>${e.icon}</span>`}),i.innerHTML=t,i.childNodes.forEach(e=>{e.addEventListener("click",n=>{switch(n.stopPropagation(),e==null?void 0:e.id){case"cuboidLeft":this.onToggleDirection(s.Left);break;case"cuboidRight":this.onToggleDirection(s.Right);break;case"cuboidTop":this.onToggleDirection(s.Top);break}this.clearCuboidMoreListDOM(),this.cuboidButtonMove("out")})}),i}update(i){var t;const{left:o,top:e,color:n}=i;(t=this._cuboidButtonDOM)==null||t.setAttribute("style",`
|
|
147
18
|
position: absolute;
|
|
148
19
|
font-size: 14px;
|
|
149
|
-
left:${
|
|
150
|
-
top: ${
|
|
151
|
-
color: ${
|
|
20
|
+
left:${o}px;
|
|
21
|
+
top: ${e}px;
|
|
22
|
+
color: ${n};
|
|
152
23
|
width: 41px;
|
|
153
24
|
height: 74px;
|
|
154
25
|
border-radius: 10px;
|
|
@@ -157,18 +28,4 @@ class CuboidToggleButtonClass {
|
|
|
157
28
|
text-align: center;
|
|
158
29
|
padding-top: 10px;
|
|
159
30
|
z-index: 10;
|
|
160
|
-
`);
|
|
161
|
-
}
|
|
162
|
-
clearCuboidButtonDOM() {
|
|
163
|
-
if (this._cuboidButtonDOM && this.container.contains(this._cuboidButtonDOM)) {
|
|
164
|
-
this.container.removeChild(this._cuboidButtonDOM);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
clearCuboidMoreListDOM() {
|
|
168
|
-
if (this._cuboidButtonDOM && this._cuboidMoreListDOM && this._cuboidButtonDOM.contains(this._cuboidMoreListDOM)) {
|
|
169
|
-
this._cuboidButtonDOM.removeChild(this._cuboidMoreListDOM);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export { CuboidToggleButtonClass as default };
|
|
31
|
+
`)}clearCuboidButtonDOM(){this._cuboidButtonDOM&&this.container.contains(this._cuboidButtonDOM)&&this.container.removeChild(this._cuboidButtonDOM)}clearCuboidMoreListDOM(){this._cuboidButtonDOM&&this._cuboidMoreListDOM&&this._cuboidButtonDOM.contains(this._cuboidMoreListDOM)&&this._cuboidButtonDOM.removeChild(this._cuboidMoreListDOM)}}export{M as default};
|
|
@@ -1,35 +1 @@
|
|
|
1
|
-
class
|
|
2
|
-
constructor() {
|
|
3
|
-
this._events = new Map();
|
|
4
|
-
}
|
|
5
|
-
on(eventName, callback) {
|
|
6
|
-
const existEvents = this._events.get(eventName) || [];
|
|
7
|
-
if (!existEvents.some((fn) => fn === callback)) {
|
|
8
|
-
this._events.set(eventName, existEvents.concat(callback));
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
singleOn(eventName, callback) {
|
|
12
|
-
this._events.set(eventName, [callback]);
|
|
13
|
-
}
|
|
14
|
-
emit(eventName, ...args) {
|
|
15
|
-
const listener = this._events.get(eventName);
|
|
16
|
-
if (listener) {
|
|
17
|
-
listener.forEach((fn) => {
|
|
18
|
-
if (fn) {
|
|
19
|
-
fn(...args);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
unbind(eventName, callback) {
|
|
25
|
-
const existEvents = this._events.get(eventName);
|
|
26
|
-
if (existEvents) {
|
|
27
|
-
this._events.set(eventName, existEvents.filter((fn) => fn !== callback));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
unbindAll(eventName) {
|
|
31
|
-
this._events.delete(eventName);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export { EventListener as default };
|
|
1
|
+
class i{constructor(){this._events=new Map}on(t,e){const s=this._events.get(t)||[];s.some(n=>n===e)||this._events.set(t,s.concat(e))}singleOn(t,e){this._events.set(t,[e])}emit(t,...e){const s=this._events.get(t);s&&s.forEach(n=>{n&&n(...e)})}unbind(t,e){const s=this._events.get(t);s&&this._events.set(t,s.filter(n=>n!==e))}unbindAll(t){this._events.delete(t)}}export{i as default};
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
const config = {
|
|
23
|
-
textConfigurable: false,
|
|
24
|
-
attributeConfigurable: true,
|
|
25
|
-
attributeList: []
|
|
26
|
-
};
|
|
27
|
-
class MeasureOperation extends RectOperation {
|
|
28
|
-
constructor(props) {
|
|
29
|
-
super(__spreadProps(__spreadValues({}, props), {config: JSON.stringify(config)}));
|
|
30
|
-
}
|
|
31
|
-
setSelectedIdAfterAddingDrawingRect() {
|
|
32
|
-
if (!this.drawingRect) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
this.setSelectedRectID(this.drawingRect.id);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { MeasureOperation as default };
|
|
1
|
+
import{RectOperation as i}from"./rectOperation.js";var s=Object.defineProperty,n=Object.defineProperties,p=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,a=(r,e,t)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l=(r,e)=>{for(var t in e||(e={}))c.call(e,t)&&a(r,t,e[t]);if(o)for(var t of o(e))f.call(e,t)&&a(r,t,e[t]);return r},u=(r,e)=>n(r,p(e));const _={textConfigurable:!1,attributeConfigurable:!0,attributeList:[]};class d extends i{constructor(e){super(u(l({},e),{config:JSON.stringify(_)}))}setSelectedIdAfterAddingDrawingRect(){!this.drawingRect||this.setSelectedRectID(this.drawingRect.id)}}export{d as default};
|
|
@@ -1,359 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ESortDirection, EDragTarget } from '../../constant/annotation.js';
|
|
3
|
-
import { EPolygonPattern } from '../../constant/tool.js';
|
|
4
|
-
import AxisUtils from '../../utils/tool/AxisUtils.js';
|
|
5
|
-
import CommonToolUtils from '../../utils/tool/CommonToolUtils.js';
|
|
6
|
-
import DrawUtils from '../../utils/tool/DrawUtils.js';
|
|
7
|
-
import PolygonUtils from '../../utils/tool/PolygonUtils.js';
|
|
8
|
-
import { polygonConfig } from '../../constant/defaultConfig.js';
|
|
9
|
-
import _ from 'lodash';
|
|
10
|
-
import PolygonOperation from './polygonOperation.js';
|
|
11
|
-
import { BasicToolOperation } from './basicToolOperation.js';
|
|
12
|
-
|
|
13
|
-
var __defProp = Object.defineProperty;
|
|
14
|
-
var __defProps = Object.defineProperties;
|
|
15
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
16
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
17
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
19
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
20
|
-
var __spreadValues = (a, b) => {
|
|
21
|
-
for (var prop in b || (b = {}))
|
|
22
|
-
if (__hasOwnProp.call(b, prop))
|
|
23
|
-
__defNormalProp(a, prop, b[prop]);
|
|
24
|
-
if (__getOwnPropSymbols)
|
|
25
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
26
|
-
if (__propIsEnum.call(b, prop))
|
|
27
|
-
__defNormalProp(a, prop, b[prop]);
|
|
28
|
-
}
|
|
29
|
-
return a;
|
|
30
|
-
};
|
|
31
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
32
|
-
class PointCloud2dOperation extends PolygonOperation {
|
|
33
|
-
constructor(props) {
|
|
34
|
-
super(props);
|
|
35
|
-
this.selectedIDs = [];
|
|
36
|
-
this.rightMouseUp = (e) => {
|
|
37
|
-
var _a;
|
|
38
|
-
if (this.drawingPointList.length > 0) {
|
|
39
|
-
this.addDrawingPointToPolygonList();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (e.ctrlKey) {
|
|
43
|
-
this.emit("addSelectedIDs", this.hoverID);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
this.emit("setSelectedIDs", this.hoverID);
|
|
47
|
-
const hoverAttribute = (_a = this.polygonList.find((v) => v.id === this.hoverID)) == null ? void 0 : _a.attribute;
|
|
48
|
-
if (hoverAttribute && hoverAttribute !== this.defaultAttribute) {
|
|
49
|
-
this.emit("syncAttribute", hoverAttribute);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
this.onKeyDown = () => {
|
|
53
|
-
};
|
|
54
|
-
this.onKeyUp = () => {
|
|
55
|
-
};
|
|
56
|
-
this.renderSingleSelectedPolygon = (selectedPolygon) => {
|
|
57
|
-
var _a;
|
|
58
|
-
if (selectedPolygon) {
|
|
59
|
-
const color = this.getPointCloudLineColor(selectedPolygon);
|
|
60
|
-
const polygon = AxisUtils.changePointListByZoom(selectedPolygon.pointList, this.zoom, this.currentPos);
|
|
61
|
-
DrawUtils.drawSelectedPolygonWithFillAndLine(this.canvas, polygon, {
|
|
62
|
-
fillColor: "transparent",
|
|
63
|
-
strokeColor: color,
|
|
64
|
-
pointColor: "white",
|
|
65
|
-
thickness: 2,
|
|
66
|
-
lineCap: "round",
|
|
67
|
-
isClose: true,
|
|
68
|
-
lineType: (_a = this.config) == null ? void 0 : _a.lineType
|
|
69
|
-
});
|
|
70
|
-
if (selectedPolygon.isRect === true && this.showDirectionLine === true) {
|
|
71
|
-
this.renderRectPolygonDirection(polygon);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
this.emitUpdatePolygonByDrag = () => {
|
|
76
|
-
if (this.dragInfo) {
|
|
77
|
-
const {originPolygonList} = this.dragInfo;
|
|
78
|
-
if (this.selectedIDs.length > 0) {
|
|
79
|
-
const emitUpdateList = [];
|
|
80
|
-
this.polygonList.forEach((polygon) => {
|
|
81
|
-
if (this.selectedIDs.includes(polygon.id)) {
|
|
82
|
-
const originPolygon = originPolygonList.find((i) => i.id === polygon.id);
|
|
83
|
-
if (originPolygon) {
|
|
84
|
-
emitUpdateList.push({newPolygon: polygon, originPolygon});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
this.emit("updatePolygonByDrag", emitUpdateList);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
var _a, _b, _c, _d, _e, _f;
|
|
93
|
-
this.showDirectionLine = (_a = props.showDirectionLine) != null ? _a : true;
|
|
94
|
-
this.forbidAddNew = (_b = props.forbidAddNew) != null ? _b : false;
|
|
95
|
-
this.pointCloudConfig = (_c = CommonToolUtils.jsonParser(props.config)) != null ? _c : {};
|
|
96
|
-
this.hideAttributes = [];
|
|
97
|
-
this.checkMode = (_d = props.checkMode) != null ? _d : false;
|
|
98
|
-
if (this.forbidAddNew === false && props.checkMode === true) {
|
|
99
|
-
this.forbidAddNew = true;
|
|
100
|
-
}
|
|
101
|
-
this.config = __spreadProps(__spreadValues({}, polygonConfig), {
|
|
102
|
-
textConfigurable: false,
|
|
103
|
-
attributeConfigurable: true,
|
|
104
|
-
attributeList: (_f = (_e = this.pointCloudConfig) == null ? void 0 : _e.attributeList) != null ? _f : []
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
get getSelectedIDs() {
|
|
108
|
-
return this.selectedIDs;
|
|
109
|
-
}
|
|
110
|
-
get enableDrag() {
|
|
111
|
-
return Boolean(this.selectedIDs.length > 0 && this.dragInfo);
|
|
112
|
-
}
|
|
113
|
-
get visiblePolygonList() {
|
|
114
|
-
return this.polygonList.filter((i) => !this.hideAttributes.includes(i.attribute));
|
|
115
|
-
}
|
|
116
|
-
setHiddenAttributes(hideAttributes) {
|
|
117
|
-
this.hideAttributes = hideAttributes;
|
|
118
|
-
}
|
|
119
|
-
setConfig(config) {
|
|
120
|
-
var _a;
|
|
121
|
-
const newConfig = CommonToolUtils.jsonParser(config);
|
|
122
|
-
this.pointCloudConfig = newConfig;
|
|
123
|
-
this.config = __spreadProps(__spreadValues({}, this.config), {
|
|
124
|
-
attributeList: (_a = newConfig == null ? void 0 : newConfig.attributeList) != null ? _a : []
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
dragMouseDown(e) {
|
|
128
|
-
if (this.checkMode) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
super.dragMouseDown(e);
|
|
132
|
-
}
|
|
133
|
-
deletePolygon(id) {
|
|
134
|
-
if (this.checkMode) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
super.deletePolygon(id);
|
|
138
|
-
}
|
|
139
|
-
deletePolygonPoint(index) {
|
|
140
|
-
if (this.checkMode) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
super.deletePolygonPoint(index);
|
|
144
|
-
}
|
|
145
|
-
setSelectedIDs(selectedIDs) {
|
|
146
|
-
this.selectedIDs = selectedIDs;
|
|
147
|
-
if (this.selectedIDs.length < 2) {
|
|
148
|
-
this.setSelectedID(this.selectedIDs.length === 1 ? this.selectedIDs[0] : "");
|
|
149
|
-
}
|
|
150
|
-
this.render();
|
|
151
|
-
}
|
|
152
|
-
deleteSelectedID() {
|
|
153
|
-
super.deleteSelectedID();
|
|
154
|
-
this.selectedIDs = [];
|
|
155
|
-
this.emit("deleteSelectedIDs");
|
|
156
|
-
}
|
|
157
|
-
get selectedPolygons() {
|
|
158
|
-
return PolygonUtils.getPolygonByIDs(this.polygonList, this.selectedIDs);
|
|
159
|
-
}
|
|
160
|
-
updateSelectedPolygonsPoints(offset) {
|
|
161
|
-
var _a, _b;
|
|
162
|
-
if (this.selectedPolygons && ((_a = this.selectedPolygons) == null ? void 0 : _a.length) > 0) {
|
|
163
|
-
const originPolygonList = _.cloneDeep(this.selectedPolygons);
|
|
164
|
-
const updateList = [];
|
|
165
|
-
(_b = this.selectedPolygons) == null ? void 0 : _b.forEach((polygon, index) => {
|
|
166
|
-
polygon.pointList = polygon.pointList.map((point) => {
|
|
167
|
-
var _a2, _b2;
|
|
168
|
-
const {x, y} = point;
|
|
169
|
-
return __spreadProps(__spreadValues({}, point), {
|
|
170
|
-
x: x + ((_a2 = offset.x) != null ? _a2 : 0),
|
|
171
|
-
y: y + ((_b2 = offset.y) != null ? _b2 : 0)
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
updateList.push({originPolygon: originPolygonList[index], newPolygon: polygon});
|
|
175
|
-
});
|
|
176
|
-
this.emit("updateResult");
|
|
177
|
-
this.emit("updatePolygonByDrag", updateList);
|
|
178
|
-
this.render();
|
|
179
|
-
this.history.pushHistory(this.polygonList);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
getLineColor() {
|
|
183
|
-
return "rgba(0, 255, 255, 0.5)";
|
|
184
|
-
}
|
|
185
|
-
getPointCloudLineColor(polygon) {
|
|
186
|
-
return polygon.valid === false ? INVALID_COLOR : toolStyleConverter.getColorFromConfig({attribute: polygon.attribute}, __spreadProps(__spreadValues({}, this.pointCloudConfig), {attributeConfigurable: true}), {}).stroke;
|
|
187
|
-
}
|
|
188
|
-
renderStaticPolygon() {
|
|
189
|
-
var _a;
|
|
190
|
-
if (this.isHidden === false) {
|
|
191
|
-
(_a = this.visiblePolygonList) == null ? void 0 : _a.forEach((polygon) => {
|
|
192
|
-
var _a2, _b, _c;
|
|
193
|
-
if ([...this.selectedIDs, this.editPolygonID].includes(polygon.id)) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
const lineColor = this.getPointCloudLineColor(polygon);
|
|
197
|
-
const transformPointList = AxisUtils.changePointListByZoom(polygon.pointList || [], this.zoom, this.currentPos);
|
|
198
|
-
DrawUtils.drawPolygonWithFillAndLine(this.canvas, transformPointList, {
|
|
199
|
-
fillColor: "transparent",
|
|
200
|
-
strokeColor: lineColor,
|
|
201
|
-
pointColor: "white",
|
|
202
|
-
thickness: (_b = (_a2 = this.style) == null ? void 0 : _a2.width) != null ? _b : 2,
|
|
203
|
-
lineCap: "round",
|
|
204
|
-
isClose: true,
|
|
205
|
-
lineType: (_c = this.config) == null ? void 0 : _c.lineType
|
|
206
|
-
});
|
|
207
|
-
if (polygon.isRect === true && this.showDirectionLine === true) {
|
|
208
|
-
this.renderRectPolygonDirection(transformPointList);
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
renderSelectedPolygon() {
|
|
214
|
-
var _a;
|
|
215
|
-
(_a = this.selectedPolygons) == null ? void 0 : _a.forEach((polygon) => {
|
|
216
|
-
this.renderSingleSelectedPolygon(polygon);
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
renderRectPolygonDirection(polygon) {
|
|
220
|
-
if (polygon.length < 2) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
DrawUtils.drawLine(this.canvas, polygon[0], polygon[1], {
|
|
224
|
-
color: "white",
|
|
225
|
-
thickness: 3,
|
|
226
|
-
lineDash: [6]
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
get currentPolygonListByPattern() {
|
|
230
|
-
return this.polygonList.filter((v) => {
|
|
231
|
-
if (this.pattern === EPolygonPattern.Rect) {
|
|
232
|
-
return v.isRect === true;
|
|
233
|
-
}
|
|
234
|
-
if (this.pattern === EPolygonPattern.Normal) {
|
|
235
|
-
return v.isRect !== true;
|
|
236
|
-
}
|
|
237
|
-
return true;
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
getHoverID(e) {
|
|
241
|
-
var _a;
|
|
242
|
-
const coordinate = this.getCoordinateUnderZoom(e);
|
|
243
|
-
const currentPolygonList = this.currentPolygonListByPattern;
|
|
244
|
-
const polygonListWithZoom = currentPolygonList.map((polygon) => __spreadProps(__spreadValues({}, polygon), {
|
|
245
|
-
pointList: AxisUtils.changePointListByZoom(polygon.pointList, this.zoom)
|
|
246
|
-
}));
|
|
247
|
-
return PolygonUtils.getHoverPolygonID(coordinate, polygonListWithZoom, 10, (_a = this.config) == null ? void 0 : _a.lineType);
|
|
248
|
-
}
|
|
249
|
-
switchToNextPolygon(sort = ESortDirection.ascend) {
|
|
250
|
-
if (this.drawingPointList.length > 0) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
const sortList = this.currentPolygonListByPattern.map((v) => {
|
|
254
|
-
var _a, _b, _c, _d;
|
|
255
|
-
return __spreadProps(__spreadValues({}, v), {
|
|
256
|
-
x: (_b = (_a = v.pointList[0]) == null ? void 0 : _a.x) != null ? _b : 0,
|
|
257
|
-
y: (_d = (_c = v.pointList[0]) == null ? void 0 : _c.y) != null ? _d : 0
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
const nextSelectedResult = CommonToolUtils.getNextSelectedRectID(sortList, sort, this.selectedID);
|
|
261
|
-
if (nextSelectedResult) {
|
|
262
|
-
this.setSelectedIDs([nextSelectedResult.id]);
|
|
263
|
-
this.render();
|
|
264
|
-
return [nextSelectedResult.id];
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
setSelectedIdAfterAddingDrawing(newID) {
|
|
268
|
-
if (this.drawingPointList.length === 0) {
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
this.setSelectedID(newID);
|
|
272
|
-
}
|
|
273
|
-
updateTextAttribute(newID) {
|
|
274
|
-
var _a, _b;
|
|
275
|
-
const oldID = this.selectedID;
|
|
276
|
-
if (newID !== oldID && oldID) {
|
|
277
|
-
(_a = this._textAttributInstance) == null ? void 0 : _a.changeSelected();
|
|
278
|
-
}
|
|
279
|
-
if (!newID) {
|
|
280
|
-
(_b = this._textAttributInstance) == null ? void 0 : _b.clearTextAttribute();
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
setSelectedID(newID) {
|
|
284
|
-
this.updateTextAttribute(newID);
|
|
285
|
-
this.selectedID = newID;
|
|
286
|
-
this.render();
|
|
287
|
-
}
|
|
288
|
-
addPointInDrawing(e) {
|
|
289
|
-
if (this.forbidAddNew) {
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
super.addPointInDrawing(e);
|
|
293
|
-
}
|
|
294
|
-
setCanvasSize(size) {
|
|
295
|
-
var _a, _b;
|
|
296
|
-
const pixel = this.pixelRatio;
|
|
297
|
-
this.size = size;
|
|
298
|
-
this.setImgInfo(size);
|
|
299
|
-
this.updateCanvasBasicStyle(this.basicCanvas, size, 0);
|
|
300
|
-
this.updateCanvasBasicStyle(this.canvas, size, 10);
|
|
301
|
-
(_a = this.ctx) == null ? void 0 : _a.scale(pixel, pixel);
|
|
302
|
-
(_b = this.basicCtx) == null ? void 0 : _b.scale(pixel, pixel);
|
|
303
|
-
this.initImgPos();
|
|
304
|
-
this.renderBasicCanvas();
|
|
305
|
-
this.render();
|
|
306
|
-
}
|
|
307
|
-
setPolygonValidAndRender(id, isUpdate = false) {
|
|
308
|
-
if (isUpdate) {
|
|
309
|
-
super.setPolygonValidAndRender(id);
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
this.emit("validUpdate", id);
|
|
313
|
-
}
|
|
314
|
-
onDragMove(e) {
|
|
315
|
-
const newPolygonList = this.polygonList.map((v) => {
|
|
316
|
-
if (this.selectedIDs.includes(v.id)) {
|
|
317
|
-
const selectedPointList = this.dragPolygon(e, v);
|
|
318
|
-
if (!selectedPointList) {
|
|
319
|
-
return v;
|
|
320
|
-
}
|
|
321
|
-
const newData = __spreadProps(__spreadValues({}, v), {
|
|
322
|
-
pointList: selectedPointList
|
|
323
|
-
});
|
|
324
|
-
if (v.isRect === true && this.pattern === EPolygonPattern.Normal) {
|
|
325
|
-
Object.assign(newData, {isRect: false});
|
|
326
|
-
}
|
|
327
|
-
return newData;
|
|
328
|
-
}
|
|
329
|
-
return v;
|
|
330
|
-
});
|
|
331
|
-
this.dragInfo.dragPrevCoord = this.getCoordinateUnderZoom(e);
|
|
332
|
-
this.setPolygonList(newPolygonList);
|
|
333
|
-
this.render();
|
|
334
|
-
}
|
|
335
|
-
onMouseDown(e) {
|
|
336
|
-
if (BasicToolOperation.prototype.onMouseDown.call(this, e) || this.forbidMouseOperation || e.ctrlKey === true || e.button !== 0) {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
if (this.selectedIDs.length < 2) {
|
|
340
|
-
return super.onMouseDown(e);
|
|
341
|
-
}
|
|
342
|
-
const dragStartCoord = this.getCoordinateUnderZoom(e);
|
|
343
|
-
this.dragInfo = {
|
|
344
|
-
dragStartCoord,
|
|
345
|
-
dragTarget: EDragTarget.Plane,
|
|
346
|
-
initPointList: [],
|
|
347
|
-
changePointIndex: [0],
|
|
348
|
-
originPolygon: this.selectedPolygon,
|
|
349
|
-
dragPrevCoord: dragStartCoord,
|
|
350
|
-
originPolygonList: this.polygonList
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
setResultAndSelectedID(polygonList, selectedID) {
|
|
354
|
-
this.setPolygonList(polygonList);
|
|
355
|
-
this.setSelectedIDs([selectedID]);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
export { PointCloud2dOperation as default };
|
|
1
|
+
import{INVALID_COLOR as I,toolStyleConverter as b}from"@labelbee/lb-utils";import{ESortDirection as C,EDragTarget as _}from"../../constant/annotation.js";import{EPolygonPattern as P}from"../../constant/tool.js";import y from"../../utils/tool/AxisUtils.js";import p from"../../utils/tool/CommonToolUtils.js";import D from"../../utils/tool/DrawUtils.js";import m from"../../utils/tool/PolygonUtils.js";import{polygonConfig as w}from"../../constant/defaultConfig.js";import S from"lodash";import A from"./polygonOperation.js";import{BasicToolOperation as x}from"./basicToolOperation.js";var O=Object.defineProperty,R=Object.defineProperties,j=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,v=(a,t,e)=>t in a?O(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,u=(a,t)=>{for(var e in t||(t={}))T.call(t,e)&&v(a,e,t[e]);if(L)for(var e of L(t))U.call(t,e)&&v(a,e,t[e]);return a},g=(a,t)=>R(a,j(t));class B extends A{constructor(t){super(t);this.selectedIDs=[],this.rightMouseUp=r=>{var d;if(this.drawingPointList.length>0){this.addDrawingPointToPolygonList();return}if(r.ctrlKey){this.emit("addSelectedIDs",this.hoverID);return}this.emit("setSelectedIDs",this.hoverID);const l=(d=this.polygonList.find(c=>c.id===this.hoverID))==null?void 0:d.attribute;l&&l!==this.defaultAttribute&&this.emit("syncAttribute",l)},this.onKeyDown=()=>{},this.onKeyUp=()=>{},this.renderSingleSelectedPolygon=r=>{var d;if(r){const l=this.getPointCloudLineColor(r),c=y.changePointListByZoom(r.pointList,this.zoom,this.currentPos);D.drawSelectedPolygonWithFillAndLine(this.canvas,c,{fillColor:"transparent",strokeColor:l,pointColor:"white",thickness:2,lineCap:"round",isClose:!0,lineType:(d=this.config)==null?void 0:d.lineType}),r.isRect===!0&&this.showDirectionLine===!0&&this.renderRectPolygonDirection(c)}},this.emitUpdatePolygonByDrag=()=>{if(this.dragInfo){const{originPolygonList:r}=this.dragInfo;if(this.selectedIDs.length>0){const d=[];this.polygonList.forEach(l=>{if(this.selectedIDs.includes(l.id)){const c=r.find(f=>f.id===l.id);c&&d.push({newPolygon:l,originPolygon:c})}}),this.emit("updatePolygonByDrag",d)}}};var e,i,o,s,n,h;this.showDirectionLine=(e=t.showDirectionLine)!=null?e:!0,this.forbidAddNew=(i=t.forbidAddNew)!=null?i:!1,this.pointCloudConfig=(o=p.jsonParser(t.config))!=null?o:{},this.hideAttributes=[],this.checkMode=(s=t.checkMode)!=null?s:!1,this.forbidAddNew===!1&&t.checkMode===!0&&(this.forbidAddNew=!0),this.config=g(u({},w),{textConfigurable:!1,attributeConfigurable:!0,attributeList:(h=(n=this.pointCloudConfig)==null?void 0:n.attributeList)!=null?h:[]})}get getSelectedIDs(){return this.selectedIDs}get enableDrag(){return Boolean(this.selectedIDs.length>0&&this.dragInfo)}get visiblePolygonList(){return this.polygonList.filter(t=>!this.hideAttributes.includes(t.attribute))}setHiddenAttributes(t){this.hideAttributes=t}setConfig(t){var e;const i=p.jsonParser(t);this.pointCloudConfig=i,this.config=g(u({},this.config),{attributeList:(e=i==null?void 0:i.attributeList)!=null?e:[]})}dragMouseDown(t){this.checkMode||super.dragMouseDown(t)}deletePolygon(t){this.checkMode||super.deletePolygon(t)}deletePolygonPoint(t){this.checkMode||super.deletePolygonPoint(t)}setSelectedIDs(t){this.selectedIDs=t,this.selectedIDs.length<2&&this.setSelectedID(this.selectedIDs.length===1?this.selectedIDs[0]:""),this.render()}deleteSelectedID(){super.deleteSelectedID(),this.selectedIDs=[],this.emit("deleteSelectedIDs")}get selectedPolygons(){return m.getPolygonByIDs(this.polygonList,this.selectedIDs)}updateSelectedPolygonsPoints(t){var e,i;if(this.selectedPolygons&&((e=this.selectedPolygons)==null?void 0:e.length)>0){const o=S.cloneDeep(this.selectedPolygons),s=[];(i=this.selectedPolygons)==null||i.forEach((n,h)=>{n.pointList=n.pointList.map(r=>{var d,l;const{x:c,y:f}=r;return g(u({},r),{x:c+((d=t.x)!=null?d:0),y:f+((l=t.y)!=null?l:0)})}),s.push({originPolygon:o[h],newPolygon:n})}),this.emit("updateResult"),this.emit("updatePolygonByDrag",s),this.render(),this.history.pushHistory(this.polygonList)}}getLineColor(){return"rgba(0, 255, 255, 0.5)"}getPointCloudLineColor(t){return t.valid===!1?I:b.getColorFromConfig({attribute:t.attribute},g(u({},this.pointCloudConfig),{attributeConfigurable:!0}),{}).stroke}renderStaticPolygon(){var t;this.isHidden===!1&&((t=this.visiblePolygonList)==null||t.forEach(e=>{var i,o,s;if([...this.selectedIDs,this.editPolygonID].includes(e.id))return;const n=this.getPointCloudLineColor(e),h=y.changePointListByZoom(e.pointList||[],this.zoom,this.currentPos);D.drawPolygonWithFillAndLine(this.canvas,h,{fillColor:"transparent",strokeColor:n,pointColor:"white",thickness:(o=(i=this.style)==null?void 0:i.width)!=null?o:2,lineCap:"round",isClose:!0,lineType:(s=this.config)==null?void 0:s.lineType}),e.isRect===!0&&this.showDirectionLine===!0&&this.renderRectPolygonDirection(h)}))}renderSelectedPolygon(){var t;(t=this.selectedPolygons)==null||t.forEach(e=>{this.renderSingleSelectedPolygon(e)})}renderRectPolygonDirection(t){t.length<2||D.drawLine(this.canvas,t[0],t[1],{color:"white",thickness:3,lineDash:[6]})}get currentPolygonListByPattern(){return this.polygonList.filter(t=>this.pattern===P.Rect?t.isRect===!0:this.pattern===P.Normal?t.isRect!==!0:!0)}getHoverID(t){var e;const i=this.getCoordinateUnderZoom(t),s=this.currentPolygonListByPattern.map(n=>g(u({},n),{pointList:y.changePointListByZoom(n.pointList,this.zoom)}));return m.getHoverPolygonID(i,s,10,(e=this.config)==null?void 0:e.lineType)}switchToNextPolygon(t=C.ascend){if(this.drawingPointList.length>0)return;const e=this.currentPolygonListByPattern.map(o=>{var s,n,h,r;return g(u({},o),{x:(n=(s=o.pointList[0])==null?void 0:s.x)!=null?n:0,y:(r=(h=o.pointList[0])==null?void 0:h.y)!=null?r:0})}),i=p.getNextSelectedRectID(e,t,this.selectedID);if(i)return this.setSelectedIDs([i.id]),this.render(),[i.id]}setSelectedIdAfterAddingDrawing(t){this.drawingPointList.length!==0&&this.setSelectedID(t)}updateTextAttribute(t){var e,i;const o=this.selectedID;t!==o&&o&&((e=this._textAttributInstance)==null||e.changeSelected()),t||(i=this._textAttributInstance)==null||i.clearTextAttribute()}setSelectedID(t){this.updateTextAttribute(t),this.selectedID=t,this.render()}addPointInDrawing(t){this.forbidAddNew||super.addPointInDrawing(t)}setCanvasSize(t){var e,i;const o=this.pixelRatio;this.size=t,this.setImgInfo(t),this.updateCanvasBasicStyle(this.basicCanvas,t,0),this.updateCanvasBasicStyle(this.canvas,t,10),(e=this.ctx)==null||e.scale(o,o),(i=this.basicCtx)==null||i.scale(o,o),this.initImgPos(),this.renderBasicCanvas(),this.render()}setPolygonValidAndRender(t,e=!1){if(e){super.setPolygonValidAndRender(t);return}this.emit("validUpdate",t)}onDragMove(t){const e=this.polygonList.map(i=>{if(this.selectedIDs.includes(i.id)){const o=this.dragPolygon(t,i);if(!o)return i;const s=g(u({},i),{pointList:o});return i.isRect===!0&&this.pattern===P.Normal&&Object.assign(s,{isRect:!1}),s}return i});this.dragInfo.dragPrevCoord=this.getCoordinateUnderZoom(t),this.setPolygonList(e),this.render()}onMouseDown(t){if(x.prototype.onMouseDown.call(this,t)||this.forbidMouseOperation||t.ctrlKey===!0||t.button!==0)return;if(this.selectedIDs.length<2)return super.onMouseDown(t);const e=this.getCoordinateUnderZoom(t);this.dragInfo={dragStartCoord:e,dragTarget:_.Plane,initPointList:[],changePointIndex:[0],originPolygon:this.selectedPolygon,dragPrevCoord:e,originPolygonList:this.polygonList}}setResultAndSelectedID(t,e){this.setPolygonList(t),this.setSelectedIDs([e])}}export{B as default};
|