@hzab/map-combine 0.4.1 → 0.4.2-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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/basic/BasicElement.ts +14 -14
- package/src/basic/BasicMarker.ts +32 -26
- package/src/basic/BasicMouseHandler.ts +4 -4
- package/src/basic/Point.ts +173 -173
- package/src/basic/Polygon.ts +81 -70
- package/src/basic/Polyline.ts +85 -75
- package/src/basic/ReactPopup.tsx +12 -10
- package/src/cesium/CesiumPoint.ts +69 -69
- package/src/cesium/CesiumPolygon.ts +181 -190
- package/src/cesium/CesiumPolyline.ts +369 -369
- package/src/mine/MinePoint.ts +70 -78
- package/src/mine/MinePolygon.ts +206 -216
- package/src/mine/MinePolyline.ts +193 -203
- package/src/mine/MineTile3D.ts +7 -11
- package/src/openlayer/OpenlayerPoint.ts +185 -177
- package/src/openlayer/OpenlayerPolygon.ts +302 -299
- package/src/openlayer/OpenlayerPolyline.ts +303 -289
- package/src/utils/Image.ts +16 -20
- package/src/utils/PolygonEditor.ts +78 -99
- package/src/utils/PolylineEditor.ts +75 -90
- package/src/utils/static.ts +3 -3
|
@@ -1,102 +1,108 @@
|
|
|
1
1
|
import { Polygon } from "../basic/Polygon";
|
|
2
2
|
import { ChainNode, PolygonEditor } from "../utils/PolygonEditor";
|
|
3
3
|
import { CesiumMap } from "./CesiumMap";
|
|
4
|
-
import iconPoint from
|
|
5
|
-
import iconAdd from
|
|
4
|
+
import iconPoint from "../assets/point.png";
|
|
5
|
+
import iconAdd from "../assets/add.png";
|
|
6
6
|
import { dealColor } from "../utils";
|
|
7
7
|
|
|
8
8
|
function createLineMaterial(e: Polygon<unknown>) {
|
|
9
9
|
return e.dash
|
|
10
10
|
? Cesium.Material.fromType("PolylineDash", {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
color: Cesium.Color.fromCssColorString(e.stroke),
|
|
12
|
+
dashLength: 10,
|
|
13
|
+
})
|
|
14
14
|
: Cesium.Material.fromType("Color", {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
color: Cesium.Color.fromCssColorString(e.stroke),
|
|
16
|
+
});
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function createFillMaterial(e: Polygon<unknown>) {
|
|
20
20
|
const [color, opacity] = dealColor(e.fill);
|
|
21
21
|
return Cesium.Material.fromType("Color", {
|
|
22
22
|
color: Cesium.Color.fromCssColorString(color).withAlpha(opacity),
|
|
23
|
-
})
|
|
23
|
+
});
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function cartesian3Tgeography(e: any): number[] {
|
|
27
|
-
const r = Cesium.Cartographic.fromCartesian(e)
|
|
28
|
-
return [Cesium.Math.toDegrees(r.longitude), Cesium.Math.toDegrees(r.latitude), r.height]
|
|
27
|
+
const r = Cesium.Cartographic.fromCartesian(e);
|
|
28
|
+
return [Cesium.Math.toDegrees(r.longitude), Cesium.Math.toDegrees(r.latitude), r.height];
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function geographyTcartesian3(e: number[]) {
|
|
32
|
-
return Cesium.Cartesian3.fromDegrees(e[0], e[1], e[2])
|
|
32
|
+
return Cesium.Cartesian3.fromDegrees(e[0], e[1], e[2] ?? 1);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const eyeOffset = new Cesium.Cartesian3(0, 0, -1)
|
|
35
|
+
const eyeOffset = new Cesium.Cartesian3(0, 0, -1);
|
|
36
36
|
|
|
37
37
|
export function drawPolygon(map: CesiumMap, polygon: Polygon<unknown>) {
|
|
38
|
-
const { event, viewer } = map
|
|
39
|
-
let status = 0
|
|
40
|
-
let skip = 0
|
|
38
|
+
const { event, viewer } = map;
|
|
39
|
+
let status = 0;
|
|
40
|
+
let skip = 0;
|
|
41
41
|
|
|
42
|
-
let cache: any[]
|
|
43
|
-
let activeNode: ChainNode<any, any
|
|
42
|
+
let cache: any[];
|
|
43
|
+
let activeNode: ChainNode<any, any>;
|
|
44
44
|
|
|
45
|
-
let primitiveFill: any
|
|
46
|
-
let primitiveLine: any
|
|
45
|
+
let primitiveFill: any;
|
|
46
|
+
let primitiveLine: any;
|
|
47
47
|
|
|
48
|
-
const collection = viewer.scene.primitives.add(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
const collection = viewer.scene.primitives.add(
|
|
49
|
+
new Cesium.PrimitiveCollection({
|
|
50
|
+
show: polygon.show,
|
|
51
|
+
destroyPrimitives: true,
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
52
54
|
|
|
53
55
|
const appearanceFill = new Cesium.MaterialAppearance({
|
|
54
|
-
material: createFillMaterial(polygon)
|
|
56
|
+
material: createFillMaterial(polygon),
|
|
55
57
|
});
|
|
56
58
|
|
|
57
59
|
const appearanceLine = new Cesium.PolylineMaterialAppearance({
|
|
58
60
|
material: createLineMaterial(polygon),
|
|
59
|
-
})
|
|
61
|
+
});
|
|
60
62
|
|
|
61
63
|
const markers = collection.add(
|
|
62
64
|
new Cesium.BillboardCollection({
|
|
63
|
-
show: polygon.show
|
|
64
|
-
})
|
|
65
|
+
show: polygon.show,
|
|
66
|
+
}),
|
|
65
67
|
);
|
|
66
68
|
|
|
67
69
|
const _event = {
|
|
68
70
|
cursor: polygon.cursor,
|
|
69
71
|
silent: polygon.silent,
|
|
70
72
|
onPointerIn() {
|
|
71
|
-
status == 2 && polygon.event.trigger(
|
|
73
|
+
status == 2 && polygon.event.trigger("pointer-in");
|
|
72
74
|
},
|
|
73
75
|
onPointerOut() {
|
|
74
|
-
status == 2 && polygon.event.trigger(
|
|
76
|
+
status == 2 && polygon.event.trigger("pointer-out");
|
|
75
77
|
},
|
|
76
78
|
onLClick() {
|
|
77
|
-
status == 2 && polygon.event.trigger(
|
|
79
|
+
status == 2 && polygon.event.trigger("left-click");
|
|
78
80
|
},
|
|
79
81
|
onRClick() {
|
|
80
82
|
if (polygon.menu) {
|
|
81
83
|
map.menu.show(polygon.menu);
|
|
82
84
|
}
|
|
83
|
-
status == 2 && polygon.event.trigger(
|
|
85
|
+
status == 2 && polygon.event.trigger("right-click");
|
|
84
86
|
},
|
|
85
87
|
onDbClick() {
|
|
86
|
-
polygon.editable &&
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
polygon.editable &&
|
|
89
|
+
status == 2 &&
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
polygon.event.trigger("start-edit");
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
};
|
|
91
95
|
|
|
92
96
|
const initPrimitive = () => {
|
|
93
97
|
primitiveFill && collection.remove(primitiveFill);
|
|
94
98
|
primitiveLine && collection.remove(primitiveLine);
|
|
95
99
|
|
|
96
100
|
if (cache.length > 2) {
|
|
97
|
-
const geometry = Cesium.PolygonGeometry.createGeometry(
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
const geometry = Cesium.PolygonGeometry.createGeometry(
|
|
102
|
+
new Cesium.PolygonGeometry({
|
|
103
|
+
polygonHierarchy: new Cesium.PolygonHierarchy(cache),
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
100
106
|
|
|
101
107
|
if (geometry) {
|
|
102
108
|
primitiveFill = new Cesium.Primitive({
|
|
@@ -105,59 +111,52 @@ export function drawPolygon(map: CesiumMap, polygon: Polygon<unknown>) {
|
|
|
105
111
|
geometry: geometry,
|
|
106
112
|
id: _event,
|
|
107
113
|
}),
|
|
108
|
-
appearance: appearanceFill
|
|
114
|
+
appearance: appearanceFill,
|
|
109
115
|
});
|
|
110
|
-
collection.add(primitiveFill)
|
|
116
|
+
collection.add(primitiveFill);
|
|
111
117
|
} else {
|
|
112
|
-
primitiveFill = undefined
|
|
118
|
+
primitiveFill = undefined;
|
|
113
119
|
}
|
|
114
120
|
} else {
|
|
115
|
-
primitiveFill = undefined
|
|
121
|
+
primitiveFill = undefined;
|
|
116
122
|
}
|
|
117
123
|
|
|
118
124
|
if (cache.length > 1) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
const geometry = Cesium.PolylineGeometry.createGeometry(
|
|
126
|
+
new Cesium.PolylineGeometry({
|
|
127
|
+
positions: [...cache, cache[0]],
|
|
128
|
+
width: polygon.lineWidth,
|
|
129
|
+
vertexFormat: Cesium.PolylineMaterialAppearance.VERTEX_FORMAT,
|
|
130
|
+
}),
|
|
131
|
+
);
|
|
125
132
|
if (geometry) {
|
|
126
133
|
primitiveLine = new Cesium.Primitive({
|
|
127
134
|
show: polygon.show,
|
|
128
135
|
asynchronous: false,
|
|
129
136
|
geometryInstances: new Cesium.GeometryInstance({
|
|
130
137
|
geometry,
|
|
131
|
-
|
|
132
138
|
}),
|
|
133
139
|
appearance: appearanceLine,
|
|
134
140
|
});
|
|
135
141
|
collection.add(primitiveLine);
|
|
136
142
|
} else {
|
|
137
|
-
primitiveLine = undefined
|
|
143
|
+
primitiveLine = undefined;
|
|
138
144
|
}
|
|
139
|
-
|
|
140
145
|
} else {
|
|
141
|
-
primitiveLine = undefined
|
|
146
|
+
primitiveLine = undefined;
|
|
142
147
|
}
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
148
|
+
};
|
|
146
149
|
|
|
147
150
|
if (polygon.coordinates) {
|
|
148
|
-
status = 2
|
|
149
|
-
cache = polygon.coordinates.map(
|
|
150
|
-
|
|
151
|
-
)
|
|
152
|
-
initPrimitive()
|
|
151
|
+
status = 2;
|
|
152
|
+
cache = polygon.coordinates.map(geographyTcartesian3);
|
|
153
|
+
initPrimitive();
|
|
153
154
|
}
|
|
154
155
|
|
|
156
|
+
const editor = new PolygonEditor<any, any>();
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
editor.on('create-node', (n) => {
|
|
160
|
-
if (n.type == 'node') {
|
|
158
|
+
editor.on("create-node", (n) => {
|
|
159
|
+
if (n.type == "node") {
|
|
161
160
|
const feature = markers.add({
|
|
162
161
|
position: new Cesium.Cartesian3(...n.position),
|
|
163
162
|
width: 16,
|
|
@@ -165,28 +164,27 @@ export function drawPolygon(map: CesiumMap, polygon: Polygon<unknown>) {
|
|
|
165
164
|
image: iconPoint,
|
|
166
165
|
eyeOffset,
|
|
167
166
|
id: {
|
|
168
|
-
cursor:
|
|
167
|
+
cursor: "move",
|
|
169
168
|
onPointerDown() {
|
|
170
|
-
status = 4
|
|
171
|
-
activeNode = n
|
|
172
|
-
map.moveable = false
|
|
169
|
+
status = 4;
|
|
170
|
+
activeNode = n;
|
|
171
|
+
map.moveable = false;
|
|
173
172
|
},
|
|
174
173
|
onPointerUp() {
|
|
175
174
|
if (status == 4) {
|
|
176
|
-
status = 3
|
|
177
|
-
map.moveable = true
|
|
178
|
-
activeNode = undefined
|
|
175
|
+
status = 3;
|
|
176
|
+
map.moveable = true;
|
|
177
|
+
activeNode = undefined;
|
|
179
178
|
}
|
|
180
179
|
},
|
|
181
180
|
onDbClick() {
|
|
182
|
-
n.destroy()
|
|
183
|
-
cache = editor.getCoordinates().map(e => new Cesium.Cartesian3(...e))
|
|
184
|
-
initPrimitive()
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
n.shape = feature
|
|
181
|
+
n.destroy();
|
|
182
|
+
cache = editor.getCoordinates().map((e) => new Cesium.Cartesian3(...e));
|
|
183
|
+
initPrimitive();
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
n.shape = feature;
|
|
190
188
|
} else {
|
|
191
189
|
const feature = markers.add({
|
|
192
190
|
position: new Cesium.Cartesian3(...n.position),
|
|
@@ -195,174 +193,167 @@ export function drawPolygon(map: CesiumMap, polygon: Polygon<unknown>) {
|
|
|
195
193
|
image: iconAdd,
|
|
196
194
|
eyeOffset,
|
|
197
195
|
id: {
|
|
198
|
-
cursor:
|
|
196
|
+
cursor: "pointer",
|
|
199
197
|
onPointerDown() {
|
|
200
|
-
status = 4
|
|
201
|
-
activeNode = n.insert()
|
|
202
|
-
map.cursor =
|
|
203
|
-
map.moveable = false
|
|
198
|
+
status = 4;
|
|
199
|
+
activeNode = n.insert();
|
|
200
|
+
map.cursor = "move";
|
|
201
|
+
map.moveable = false;
|
|
204
202
|
},
|
|
205
|
-
}
|
|
206
|
-
})
|
|
207
|
-
n.shape = feature
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
n.shape = feature;
|
|
208
206
|
}
|
|
209
|
-
})
|
|
207
|
+
});
|
|
210
208
|
|
|
211
|
-
editor.on(
|
|
212
|
-
n.shape.position = new Cesium.Cartesian3(...n.position)
|
|
213
|
-
})
|
|
214
|
-
editor.on(
|
|
215
|
-
markers.remove(n.shape)
|
|
216
|
-
})
|
|
217
|
-
editor.on(
|
|
209
|
+
editor.on("update-node", (n) => {
|
|
210
|
+
n.shape.position = new Cesium.Cartesian3(...n.position);
|
|
211
|
+
});
|
|
212
|
+
editor.on("remove-node", (n) => {
|
|
213
|
+
markers.remove(n.shape);
|
|
214
|
+
});
|
|
215
|
+
editor.on("empty", () => {
|
|
218
216
|
// markers.removeAll()
|
|
219
217
|
collection.remove(primitiveLine);
|
|
220
218
|
collection.remove(primitiveFill);
|
|
221
|
-
status = 0
|
|
222
|
-
})
|
|
219
|
+
status = 0;
|
|
220
|
+
});
|
|
223
221
|
|
|
224
222
|
const onUpdate = (e: Set<string>) => {
|
|
225
223
|
if (skip) {
|
|
226
|
-
skip
|
|
227
|
-
return
|
|
224
|
+
skip--;
|
|
225
|
+
return;
|
|
228
226
|
}
|
|
229
|
-
const keys = new Set()
|
|
230
|
-
e.forEach(key => {
|
|
227
|
+
const keys = new Set();
|
|
228
|
+
e.forEach((key) => {
|
|
231
229
|
switch (key) {
|
|
232
|
-
case
|
|
233
|
-
collection.show = polygon.show
|
|
230
|
+
case "show":
|
|
231
|
+
collection.show = polygon.show;
|
|
234
232
|
break;
|
|
235
|
-
case
|
|
233
|
+
case "editable":
|
|
236
234
|
break;
|
|
237
|
-
case
|
|
238
|
-
keys.add(
|
|
235
|
+
case "coordinates":
|
|
236
|
+
keys.add("Primitive");
|
|
239
237
|
break;
|
|
240
|
-
case
|
|
241
|
-
keys.add(
|
|
238
|
+
case "lineWidth":
|
|
239
|
+
keys.add("Primitive");
|
|
242
240
|
break;
|
|
243
|
-
case
|
|
241
|
+
case "stroke":
|
|
244
242
|
appearanceLine.material.uniforms.color = Cesium.Color.fromCssColorString(polygon.stroke);
|
|
245
243
|
break;
|
|
246
|
-
case
|
|
247
|
-
appearanceLine.material = createLineMaterial(polygon)
|
|
244
|
+
case "dash":
|
|
245
|
+
appearanceLine.material = createLineMaterial(polygon);
|
|
248
246
|
break;
|
|
249
247
|
default:
|
|
250
|
-
throw new Error(`${key} 还不支持修改`)
|
|
248
|
+
throw new Error(`${key} 还不支持修改`);
|
|
251
249
|
}
|
|
252
|
-
})
|
|
253
|
-
keys.forEach(key => {
|
|
250
|
+
});
|
|
251
|
+
keys.forEach((key) => {
|
|
254
252
|
switch (key) {
|
|
255
|
-
case
|
|
253
|
+
case "Primitive":
|
|
256
254
|
if (polygon.coordinates) {
|
|
257
|
-
cache = polygon.coordinates.map(e => geographyTcartesian3(e))
|
|
255
|
+
cache = polygon.coordinates.map((e) => geographyTcartesian3(e));
|
|
258
256
|
} else {
|
|
259
|
-
cache = []
|
|
260
|
-
markers.removeAll()
|
|
261
|
-
status = 0
|
|
257
|
+
cache = [];
|
|
258
|
+
markers.removeAll();
|
|
259
|
+
status = 0;
|
|
262
260
|
}
|
|
263
261
|
|
|
264
|
-
initPrimitive()
|
|
262
|
+
initPrimitive();
|
|
265
263
|
|
|
266
264
|
break;
|
|
267
265
|
}
|
|
268
|
-
})
|
|
269
|
-
}
|
|
266
|
+
});
|
|
267
|
+
};
|
|
270
268
|
|
|
271
269
|
const onStartEdit = () => {
|
|
272
|
-
|
|
273
270
|
switch (status) {
|
|
274
271
|
case 2:
|
|
275
|
-
status = 3
|
|
276
|
-
editor.setCoordinates(cache.map(e => [e.x, e.y, e.z]))
|
|
277
|
-
break
|
|
272
|
+
status = 3;
|
|
273
|
+
editor.setCoordinates(cache.map((e) => [e.x, e.y, e.z]));
|
|
274
|
+
break;
|
|
278
275
|
}
|
|
279
|
-
}
|
|
280
|
-
let temp: any
|
|
276
|
+
};
|
|
277
|
+
let temp: any;
|
|
281
278
|
const onMouseMove = () => {
|
|
282
|
-
const e = event.geography
|
|
279
|
+
const e = event.geography;
|
|
283
280
|
|
|
284
281
|
switch (status) {
|
|
285
282
|
case 1:
|
|
286
|
-
cache.pop()
|
|
287
|
-
cache.push(
|
|
288
|
-
initPrimitive()
|
|
289
|
-
break
|
|
283
|
+
cache.pop();
|
|
284
|
+
cache.push(geographyTcartesian3(e));
|
|
285
|
+
initPrimitive();
|
|
286
|
+
break;
|
|
290
287
|
case 4:
|
|
291
|
-
temp =
|
|
292
|
-
activeNode.update([temp.x, temp.y, temp.z])
|
|
293
|
-
cache = editor.getCoordinates().map(e => new Cesium.Cartesian3(...e))
|
|
294
|
-
initPrimitive()
|
|
288
|
+
temp = geographyTcartesian3(e);
|
|
289
|
+
activeNode.update([temp.x, temp.y, temp.z]);
|
|
290
|
+
cache = editor.getCoordinates().map((e) => new Cesium.Cartesian3(...e));
|
|
291
|
+
initPrimitive();
|
|
295
292
|
break;
|
|
296
293
|
}
|
|
297
|
-
}
|
|
294
|
+
};
|
|
298
295
|
|
|
299
296
|
const onClick = () => {
|
|
300
|
-
const e = event.geography
|
|
297
|
+
const e = event.geography;
|
|
301
298
|
switch (status) {
|
|
302
299
|
case 0:
|
|
303
|
-
status = 1
|
|
304
|
-
cache = [
|
|
305
|
-
cache.push(cache[0])
|
|
306
|
-
initPrimitive()
|
|
300
|
+
status = 1;
|
|
301
|
+
cache = [geographyTcartesian3(e)];
|
|
302
|
+
cache.push(cache[0]);
|
|
303
|
+
initPrimitive();
|
|
307
304
|
break;
|
|
308
305
|
case 1:
|
|
309
|
-
cache.push(cache[cache.length - 1])
|
|
306
|
+
cache.push(cache[cache.length - 1]);
|
|
310
307
|
// geometry.setCoordinates(cache)
|
|
311
|
-
initPrimitive()
|
|
312
|
-
break
|
|
308
|
+
initPrimitive();
|
|
309
|
+
break;
|
|
313
310
|
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
311
|
+
};
|
|
318
312
|
|
|
319
313
|
const onDbClick = () => {
|
|
320
314
|
switch (status) {
|
|
321
315
|
case 1:
|
|
322
|
-
status = 2
|
|
323
|
-
skip
|
|
324
|
-
cache.pop()
|
|
325
|
-
cache.pop()
|
|
316
|
+
status = 2;
|
|
317
|
+
skip++;
|
|
318
|
+
cache.pop();
|
|
319
|
+
cache.pop();
|
|
326
320
|
// geometry.setCoordinates(cache)
|
|
327
|
-
polygon.coordinates = cache.map(e => cartesian3Tgeography(e))
|
|
328
|
-
polygon.event.trigger(
|
|
329
|
-
polygon.event.trigger(
|
|
330
|
-
break
|
|
321
|
+
polygon.coordinates = cache.map((e) => cartesian3Tgeography(e));
|
|
322
|
+
polygon.event.trigger("data-loaded");
|
|
323
|
+
polygon.event.trigger("pointer-in");
|
|
324
|
+
break;
|
|
331
325
|
case 3:
|
|
332
|
-
polygon.event.trigger(
|
|
333
|
-
break
|
|
326
|
+
polygon.event.trigger("stop-edit");
|
|
327
|
+
break;
|
|
334
328
|
}
|
|
335
|
-
}
|
|
336
|
-
|
|
329
|
+
};
|
|
337
330
|
|
|
338
331
|
const onStopEdit = () => {
|
|
339
332
|
if (status == 3) {
|
|
340
|
-
status = 2
|
|
341
|
-
skip
|
|
342
|
-
polygon.coordinates = editor.getCoordinates().map(e => cartesian3Tgeography(e))
|
|
343
|
-
editor.setCoordinates([])
|
|
344
|
-
polygon.event.trigger(
|
|
333
|
+
status = 2;
|
|
334
|
+
skip++;
|
|
335
|
+
polygon.coordinates = editor.getCoordinates().map((e) => cartesian3Tgeography(e));
|
|
336
|
+
editor.setCoordinates([]);
|
|
337
|
+
polygon.event.trigger("pointer-in");
|
|
345
338
|
}
|
|
346
|
-
}
|
|
339
|
+
};
|
|
347
340
|
|
|
348
341
|
const onDestroy = () => {
|
|
349
|
-
viewer.scene.primitives.remove(collection)
|
|
350
|
-
event.off(
|
|
351
|
-
event.off(
|
|
352
|
-
event.off(
|
|
353
|
-
polygon.event.off(
|
|
354
|
-
polygon.event.off(
|
|
355
|
-
polygon.event.off(
|
|
356
|
-
polygon.event.off(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
event.on(
|
|
361
|
-
event.on(
|
|
362
|
-
event.on(
|
|
363
|
-
polygon.event.on(
|
|
364
|
-
polygon.event.on(
|
|
365
|
-
polygon.event.on(
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
342
|
+
viewer.scene.primitives.remove(collection);
|
|
343
|
+
event.off("pointer-move", onMouseMove);
|
|
344
|
+
event.off("left-click", onClick);
|
|
345
|
+
event.off("double-click", onDbClick);
|
|
346
|
+
polygon.event.off("update", onUpdate);
|
|
347
|
+
polygon.event.off("start-edit", onStartEdit);
|
|
348
|
+
polygon.event.off("stop-edit", onStopEdit);
|
|
349
|
+
polygon.event.off("destroy", onDestroy);
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
event.on("pointer-move", onMouseMove);
|
|
353
|
+
event.on("left-click", onClick);
|
|
354
|
+
event.on("double-click", onDbClick);
|
|
355
|
+
polygon.event.on("update", onUpdate);
|
|
356
|
+
polygon.event.on("start-edit", onStartEdit);
|
|
357
|
+
polygon.event.on("stop-edit", onStopEdit);
|
|
358
|
+
polygon.event.on("destroy", onDestroy);
|
|
359
|
+
}
|