gisviewer-vue3-arcgis 1.0.250 → 1.0.252
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/es/src/gis-map/gis-map.vue.d.ts +4 -1
- package/es/src/gis-map/gis-map.vue.mjs +155 -153
- package/es/src/gis-map/index.d.ts +2 -0
- package/es/src/gis-map/utils/dbscan-cluster/index.d.ts +51 -0
- package/es/src/gis-map/utils/dbscan-cluster/index.mjs +256 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.d.ts +1 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +143 -127
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +87 -86
- package/es/src/gis-map/utils/overlay.d.ts +3 -8
- package/es/src/gis-map/utils/overlay.mjs +48 -52
- package/es/src/gis-map/utils/signal-control-area/district-renderer.d.ts +2 -2
- package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +6 -2
- package/es/src/gis-map/utils/signal-control-area/show-area.mjs +15 -15
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +1 -1
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +6 -2
- package/es/src/types/index.d.ts +33 -3
- package/lib/src/gis-map/gis-map.vue.d.ts +4 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +2 -0
- package/lib/src/gis-map/utils/dbscan-cluster/index.d.ts +51 -0
- package/lib/src/gis-map/utils/dbscan-cluster/index.js +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.d.ts +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/overlay.d.ts +3 -8
- package/lib/src/gis-map/utils/overlay.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.d.ts +2 -2
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
- package/lib/src/types/index.d.ts +33 -3
- package/package.json +1 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import * as f from "@arcgis/core/core/reactiveUtils";
|
|
2
|
+
import { Point as a } from "@arcgis/core/geometry";
|
|
3
|
+
import m from "@arcgis/core/Graphic";
|
|
4
|
+
import b from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
+
class M {
|
|
6
|
+
constructor(e) {
|
|
7
|
+
this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.zoomWatchHandle = null, this.locations = [], this.clusterMarkUrl = "", this.currentZoom = 0, this.view = e, this.currentZoom = e.zoom, this.clusterLayer = new b(), this.view.map.add(this.clusterLayer);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 将地理位置转换为屏幕坐标
|
|
11
|
+
*/
|
|
12
|
+
locationToScreen() {
|
|
13
|
+
this.locations.forEach((e) => {
|
|
14
|
+
const s = this.view.toScreen(
|
|
15
|
+
new a({ x: e.x, y: e.y })
|
|
16
|
+
);
|
|
17
|
+
e.properties.screenX = s.x, e.properties.screenY = s.y;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 添加聚类点到视图
|
|
22
|
+
* @param params
|
|
23
|
+
*/
|
|
24
|
+
addClusterPoints(e) {
|
|
25
|
+
var o;
|
|
26
|
+
this.locations = e.points, this.clusterMarkUrl = ((o = e.clusterSymbol) == null ? void 0 : o.url) || "/GisViewerAssets/Images/cross/gis_xhj_blue.png", e.points.forEach((r) => {
|
|
27
|
+
r.symbol || (r.symbol = e.pointSymbol || {
|
|
28
|
+
type: "simple-marker",
|
|
29
|
+
style: "circle",
|
|
30
|
+
color: "#3388ff",
|
|
31
|
+
size: 8,
|
|
32
|
+
outline: {
|
|
33
|
+
color: "#ffffff",
|
|
34
|
+
width: 1
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}), this.zoomWatchHandle || (this.zoomWatchHandle = f.watch(
|
|
38
|
+
() => this.view.zoom,
|
|
39
|
+
() => {
|
|
40
|
+
Math.abs(this.currentZoom - this.view.zoom) >= 1 && (this.currentZoom = this.view.zoom, this.locationToScreen(), this.clusterLayer.removeAll(), this.addClusterPoints(e));
|
|
41
|
+
}
|
|
42
|
+
)), this.locationToScreen(), console.time("cluster");
|
|
43
|
+
const s = this.doPixelCluster(e.points, 120, 3);
|
|
44
|
+
console.timeEnd("cluster"), this.showClusters(s);
|
|
45
|
+
}
|
|
46
|
+
showClusters(e) {
|
|
47
|
+
let s = Number.MIN_VALUE, o = Number.MAX_VALUE;
|
|
48
|
+
e.forEach((r) => {
|
|
49
|
+
r.count > 1 && (o = Math.min(o, r.count), s = Math.max(s, r.count));
|
|
50
|
+
}), e.forEach((r) => {
|
|
51
|
+
if (r.id !== -1) {
|
|
52
|
+
let t = o === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (r.count - o) / (s - o) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
|
|
53
|
+
t *= 0.75;
|
|
54
|
+
const i = new m({
|
|
55
|
+
geometry: new a({ x: r.center.x, y: r.center.y }),
|
|
56
|
+
attributes: {
|
|
57
|
+
count: r.count
|
|
58
|
+
},
|
|
59
|
+
symbol: {
|
|
60
|
+
type: "cim",
|
|
61
|
+
data: {
|
|
62
|
+
type: "CIMSymbolReference",
|
|
63
|
+
primitiveOverrides: [
|
|
64
|
+
{
|
|
65
|
+
// 将textGraphic的TextString替换为graphic.attributes.name
|
|
66
|
+
type: "CIMPrimitiveOverride",
|
|
67
|
+
primitiveName: "textGraphic",
|
|
68
|
+
propertyName: "TextString",
|
|
69
|
+
valueExpressionInfo: {
|
|
70
|
+
type: "CIMExpressionInfo",
|
|
71
|
+
title: "Custom",
|
|
72
|
+
expression: "$feature.count",
|
|
73
|
+
returnType: "Default"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
symbol: {
|
|
78
|
+
type: "CIMPointSymbol",
|
|
79
|
+
symbolLayers: [
|
|
80
|
+
// 聚合数量
|
|
81
|
+
{
|
|
82
|
+
type: "CIMVectorMarker",
|
|
83
|
+
size: t,
|
|
84
|
+
colorLocked: !0,
|
|
85
|
+
anchorPointUnits: "Relative",
|
|
86
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
87
|
+
markerGraphics: [
|
|
88
|
+
// 数量文本框
|
|
89
|
+
{
|
|
90
|
+
type: "CIMMarkerGraphic",
|
|
91
|
+
geometry: {
|
|
92
|
+
rings: [
|
|
93
|
+
[
|
|
94
|
+
[-15, 40],
|
|
95
|
+
[15, 40],
|
|
96
|
+
[15, 20],
|
|
97
|
+
[-15, 20],
|
|
98
|
+
[-15, 40]
|
|
99
|
+
]
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
symbol: {
|
|
103
|
+
type: "CIMPolygonSymbol",
|
|
104
|
+
symbolLayers: [
|
|
105
|
+
{
|
|
106
|
+
type: "CIMSolidFill",
|
|
107
|
+
enable: !0,
|
|
108
|
+
color: [2, 72, 200, 255]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: "CIMSolidStroke",
|
|
112
|
+
enable: !0,
|
|
113
|
+
width: 5,
|
|
114
|
+
color: [2, 72, 200, 128]
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
// 数量文字
|
|
120
|
+
{
|
|
121
|
+
type: "CIMMarkerGraphic",
|
|
122
|
+
primitiveName: "textGraphic",
|
|
123
|
+
geometry: { x: 0, y: 0 },
|
|
124
|
+
symbol: {
|
|
125
|
+
type: "CIMTextSymbol",
|
|
126
|
+
height: 16,
|
|
127
|
+
horizontalAlignment: "Center",
|
|
128
|
+
offsetX: 0,
|
|
129
|
+
offsetY: 30,
|
|
130
|
+
symbol: {
|
|
131
|
+
type: "CIMPolygonSymbol",
|
|
132
|
+
symbolLayers: [
|
|
133
|
+
{
|
|
134
|
+
type: "CIMSolidFill",
|
|
135
|
+
enable: !0,
|
|
136
|
+
color: [255, 255, 255, 255]
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
verticalAlignment: "Center"
|
|
141
|
+
},
|
|
142
|
+
textString: ""
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
scaleSymbolsProportionally: !0,
|
|
146
|
+
respectFrame: !0
|
|
147
|
+
},
|
|
148
|
+
// 聚合图标
|
|
149
|
+
{
|
|
150
|
+
type: "CIMPictureMarker",
|
|
151
|
+
enable: !0,
|
|
152
|
+
anchorPoint: {
|
|
153
|
+
x: 0,
|
|
154
|
+
y: 0
|
|
155
|
+
},
|
|
156
|
+
anchorPointUnits: "Relative",
|
|
157
|
+
size: t,
|
|
158
|
+
rotateClockwise: !0,
|
|
159
|
+
textureFilter: "Picture",
|
|
160
|
+
url: this.clusterMarkUrl
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
this.clusterLayer.add(i);
|
|
168
|
+
} else
|
|
169
|
+
r.items.forEach((t) => {
|
|
170
|
+
const i = new m({
|
|
171
|
+
geometry: new a({ x: t.x, y: t.y }),
|
|
172
|
+
attributes: t.properties,
|
|
173
|
+
symbol: t.symbol
|
|
174
|
+
});
|
|
175
|
+
this.clusterLayer.add(i);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* 获取邻居点
|
|
181
|
+
* @param locations
|
|
182
|
+
* @param index
|
|
183
|
+
* @param eps
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
186
|
+
getNeighbors(e, s, o) {
|
|
187
|
+
const r = e[s];
|
|
188
|
+
return e.filter((t) => t.id === r.id || t.visited ? !1 : this.getDistance(r, t) <= o);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* 两点间的像素距离
|
|
192
|
+
* @param point1
|
|
193
|
+
* @param point2
|
|
194
|
+
* @returns
|
|
195
|
+
*/
|
|
196
|
+
getDistance(e, s) {
|
|
197
|
+
return Math.sqrt(
|
|
198
|
+
Math.pow(e.properties.screenX - s.properties.screenX, 2) + Math.pow(e.properties.screenY - s.properties.screenY, 2)
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* 从聚类结果中创建聚类对象
|
|
203
|
+
* @param locations
|
|
204
|
+
* @returns
|
|
205
|
+
*/
|
|
206
|
+
createClusters(e) {
|
|
207
|
+
const s = {}, o = [];
|
|
208
|
+
for (let t = 0; t < e.length; t++) {
|
|
209
|
+
const i = e[t];
|
|
210
|
+
i.clusterId === void 0 || i.clusterId === -1 ? o.push(i) : (s[i.clusterId] || (s[i.clusterId] = []), s[i.clusterId].push(i));
|
|
211
|
+
}
|
|
212
|
+
const r = Object.keys(s).map((t, i) => {
|
|
213
|
+
const l = s[Number(t)], n = l.length, h = l.reduce((c, u) => c + u.x, 0), y = l.reduce((c, u) => c + u.y, 0), p = h / n, d = y / n;
|
|
214
|
+
return {
|
|
215
|
+
id: Number(t),
|
|
216
|
+
items: l,
|
|
217
|
+
count: n,
|
|
218
|
+
center: {
|
|
219
|
+
x: p,
|
|
220
|
+
y: d
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
return o.length > 0 && r.push({
|
|
225
|
+
id: -1,
|
|
226
|
+
items: o,
|
|
227
|
+
count: o.length,
|
|
228
|
+
center: null
|
|
229
|
+
}), r;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 按照像素距离聚类
|
|
233
|
+
* @param locations
|
|
234
|
+
* @param eps
|
|
235
|
+
* @param minPoints
|
|
236
|
+
* @returns
|
|
237
|
+
*/
|
|
238
|
+
doPixelCluster(e, s, o) {
|
|
239
|
+
let r = 0;
|
|
240
|
+
e.forEach((t) => t.visited = !1);
|
|
241
|
+
for (let t = 0; t < e.length; t++) {
|
|
242
|
+
const i = e[t];
|
|
243
|
+
if (i.visited)
|
|
244
|
+
continue;
|
|
245
|
+
i.visited = !0;
|
|
246
|
+
const l = this.getNeighbors(e, t, s);
|
|
247
|
+
l.length < o ? i.clusterId = -1 : (l.forEach((n) => {
|
|
248
|
+
n.visited = !0, n.clusterId = r;
|
|
249
|
+
}), i.clusterId = r, r++);
|
|
250
|
+
}
|
|
251
|
+
return this.createClusters(e);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
export {
|
|
255
|
+
M as default
|
|
256
|
+
};
|
|
@@ -24,6 +24,7 @@ export default class GreenWaveBandController {
|
|
|
24
24
|
addGreenWaveBand(params: IEditSignalControlAreaParams): void;
|
|
25
25
|
stopAddGreenWaveBand(): void;
|
|
26
26
|
showGreenWaveBand(params: IShowGreenWaveBandParams): Promise<void>;
|
|
27
|
+
removeGreenWaveBand(bandId: string): void;
|
|
27
28
|
/**
|
|
28
29
|
* 显示所有路口,进入待选状态
|
|
29
30
|
* @param nodeAttributes
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as y from "@arcgis/core/core/reactiveUtils.js";
|
|
2
2
|
import { Polyline as m } from "@arcgis/core/geometry";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import n from "@arcgis/core/Graphic";
|
|
4
|
+
import c from "@arcgis/core/layers/GraphicsLayer";
|
|
5
5
|
import b from "axios";
|
|
6
6
|
class w {
|
|
7
7
|
constructor(e) {
|
|
8
|
-
this.selectedNodeIds = [], this.nodeScale = 5e3, this.hasGpu = !1, this.hasGpu = localStorage.getItem("gpu") !== "Unknown", this.view = e, this.roadsectLayer = new
|
|
8
|
+
this.selectedNodeIds = [], this.nodeScale = 5e3, this.hasGpu = !1, this.hasGpu = localStorage.getItem("gpu") !== "Unknown", this.view = e, this.roadsectLayer = new c({
|
|
9
9
|
id: "roadsectLayer"
|
|
10
|
-
}), this.view.map.add(this.roadsectLayer), this.allNodesLayer = new
|
|
10
|
+
}), this.view.map.add(this.roadsectLayer), this.allNodesLayer = new c({
|
|
11
11
|
id: "allNodesLayer"
|
|
12
|
-
}), this.view.map.add(this.allNodesLayer), this.bandLayer = new
|
|
12
|
+
}), this.view.map.add(this.allNodesLayer), this.bandLayer = new c({
|
|
13
13
|
id: "bandLayer"
|
|
14
14
|
}), this.view.map.add(this.bandLayer);
|
|
15
15
|
}
|
|
@@ -18,8 +18,8 @@ class w {
|
|
|
18
18
|
* @param params
|
|
19
19
|
*/
|
|
20
20
|
addGreenWaveBand(e) {
|
|
21
|
-
this.addNodeCallback = e.addCrossCallback, this.removeNodeCallback = e.removeCrossCallback, e.removeAllCrossCallback && (this.removeAllNodeCallback = e.removeAllCrossCallback), this.selectedNodeIds = [], this.openDriveServer = e.odrServer, this.showAllNodes(e.crossesInArea), this.viewClickWatcher || (this.viewClickWatcher = this.view.on("click", (
|
|
22
|
-
this.handleViewClick(
|
|
21
|
+
this.addNodeCallback = e.addCrossCallback, this.removeNodeCallback = e.removeCrossCallback, e.removeAllCrossCallback && (this.removeAllNodeCallback = e.removeAllCrossCallback), this.selectedNodeIds = [], this.openDriveServer = e.odrServer, this.showAllNodes(e.crossesInArea), this.viewClickWatcher || (this.viewClickWatcher = this.view.on("click", (i) => {
|
|
22
|
+
this.handleViewClick(i);
|
|
23
23
|
}));
|
|
24
24
|
}
|
|
25
25
|
stopAddGreenWaveBand() {
|
|
@@ -27,59 +27,71 @@ class w {
|
|
|
27
27
|
(e = this.viewClickWatcher) == null || e.remove(), this.viewClickWatcher = void 0, this.allNodesLayer.removeAll(), this.selectedNodeIds = [], this.roadsectLayer.removeAll(), this.bandLayer.removeAll();
|
|
28
28
|
}
|
|
29
29
|
async showGreenWaveBand(e) {
|
|
30
|
-
this.scaleWatcher || (this.scaleWatcher = y.watch(
|
|
30
|
+
this.removeGreenWaveBand(e.bandId), this.scaleWatcher || (this.scaleWatcher = y.watch(
|
|
31
31
|
() => this.view.scale,
|
|
32
|
-
(s,
|
|
33
|
-
s > this.nodeScale &&
|
|
34
|
-
|
|
35
|
-
}) : s <= this.nodeScale &&
|
|
36
|
-
|
|
32
|
+
(s, o) => {
|
|
33
|
+
s > this.nodeScale && o <= this.nodeScale ? this.bandLayer.graphics.forEach((a) => {
|
|
34
|
+
a.geometry.type === "point" && (a.symbol = this.getShowNodeSymbol("marker"));
|
|
35
|
+
}) : s <= this.nodeScale && o > this.nodeScale && this.bandLayer.graphics.forEach((a) => {
|
|
36
|
+
a.geometry.type === "point" && (a.symbol = this.getShowNodeSymbol("picture"));
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
));
|
|
40
|
-
const
|
|
40
|
+
const i = new m({
|
|
41
41
|
paths: [e.coordinates]
|
|
42
|
-
}),
|
|
43
|
-
geometry:
|
|
44
|
-
symbol: this.getLineSymbol(!0),
|
|
42
|
+
}), t = new n({
|
|
43
|
+
geometry: i,
|
|
44
|
+
symbol: this.getLineSymbol(!0, e),
|
|
45
45
|
attributes: {
|
|
46
46
|
bandId: e.bandId,
|
|
47
47
|
type: "greenWaveBand",
|
|
48
48
|
id: e.bandId
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
this.roadsectLayer.add(
|
|
52
|
-
const
|
|
51
|
+
this.roadsectLayer.add(t), await this.view.goTo(t), e.nodeList && e.nodeList.forEach((s) => {
|
|
52
|
+
const o = new n({
|
|
53
53
|
geometry: {
|
|
54
54
|
type: "point",
|
|
55
55
|
x: s.longitude,
|
|
56
56
|
y: s.latitude
|
|
57
57
|
},
|
|
58
58
|
symbol: this.getShowNodeSymbol("picture"),
|
|
59
|
-
attributes:
|
|
59
|
+
attributes: {
|
|
60
|
+
...s,
|
|
61
|
+
bandId: e.bandId,
|
|
62
|
+
type: "greenWaveBandNode"
|
|
63
|
+
}
|
|
60
64
|
});
|
|
61
|
-
this.bandLayer.add(
|
|
65
|
+
this.bandLayer.add(o);
|
|
62
66
|
});
|
|
63
67
|
}
|
|
68
|
+
removeGreenWaveBand(e) {
|
|
69
|
+
let i = this.bandLayer.graphics.filter(
|
|
70
|
+
(t) => t.getAttribute("bandId") === e
|
|
71
|
+
);
|
|
72
|
+
this.bandLayer.removeMany(i.toArray()), i = this.roadsectLayer.graphics.filter(
|
|
73
|
+
(t) => t.getAttribute("bandId") === e
|
|
74
|
+
), this.roadsectLayer.removeMany(i.toArray());
|
|
75
|
+
}
|
|
64
76
|
/**
|
|
65
77
|
* 显示所有路口,进入待选状态
|
|
66
78
|
* @param nodeAttributes
|
|
67
79
|
*/
|
|
68
80
|
showAllNodes(e) {
|
|
69
|
-
const
|
|
70
|
-
e.forEach((
|
|
71
|
-
|
|
72
|
-
new
|
|
81
|
+
const i = [];
|
|
82
|
+
e.forEach((t) => {
|
|
83
|
+
i.push(
|
|
84
|
+
new n({
|
|
73
85
|
geometry: {
|
|
74
86
|
type: "point",
|
|
75
|
-
x:
|
|
76
|
-
y:
|
|
87
|
+
x: t.longitude,
|
|
88
|
+
y: t.latitude
|
|
77
89
|
},
|
|
78
90
|
symbol: this.getEditableNodeSymbol(!1),
|
|
79
|
-
attributes: { ...
|
|
91
|
+
attributes: { ...t, selected: !1 }
|
|
80
92
|
})
|
|
81
93
|
);
|
|
82
|
-
}), this.allNodesLayer.addMany(
|
|
94
|
+
}), this.allNodesLayer.addMany(i);
|
|
83
95
|
}
|
|
84
96
|
/**
|
|
85
97
|
* 点击待选/已选路口
|
|
@@ -87,51 +99,51 @@ class w {
|
|
|
87
99
|
* @returns
|
|
88
100
|
*/
|
|
89
101
|
async handleViewClick(e) {
|
|
90
|
-
var
|
|
91
|
-
const
|
|
102
|
+
var a;
|
|
103
|
+
const t = (a = (await this.view.hitTest(e, {
|
|
92
104
|
include: [this.allNodesLayer]
|
|
93
|
-
})).results) == null ? void 0 :
|
|
105
|
+
})).results) == null ? void 0 : a.filter(
|
|
94
106
|
(d) => d.type === "graphic"
|
|
95
107
|
);
|
|
96
|
-
if (
|
|
108
|
+
if (t.length === 0)
|
|
97
109
|
return;
|
|
98
|
-
const s =
|
|
99
|
-
if (this.selectedNodeIds.includes(
|
|
100
|
-
const d = this.selectedNodeIds.indexOf(
|
|
110
|
+
const s = t[0].graphic, o = s.getAttribute("id");
|
|
111
|
+
if (this.selectedNodeIds.includes(o)) {
|
|
112
|
+
const d = this.selectedNodeIds.indexOf(o) + 1;
|
|
101
113
|
if (d === 1)
|
|
102
|
-
this.removeAllNodeCallback && this.removeAllNodeCallback(), this.selectedNodeIds = [], this.allNodesLayer.graphics.forEach((
|
|
103
|
-
|
|
114
|
+
this.removeAllNodeCallback && this.removeAllNodeCallback(), this.selectedNodeIds = [], this.allNodesLayer.graphics.forEach((r) => {
|
|
115
|
+
r.setAttribute("selected", !1), r.symbol = this.getEditableNodeSymbol(!1), r.visible = !0;
|
|
104
116
|
}), this.roadsectLayer.removeAll();
|
|
105
117
|
else {
|
|
106
|
-
for (let
|
|
118
|
+
for (let r = d; r < this.selectedNodeIds.length; r++) {
|
|
107
119
|
this.removeNodeCallback && this.removeNodeCallback({
|
|
108
|
-
id: this.selectedNodeIds[
|
|
120
|
+
id: this.selectedNodeIds[r]
|
|
109
121
|
});
|
|
110
|
-
for (let
|
|
111
|
-
const h = this.roadsectLayer.graphics.getItemAt(
|
|
112
|
-
(h.getAttribute("id") === this.selectedNodeIds[
|
|
122
|
+
for (let l = 0; l < this.roadsectLayer.graphics.length; l++) {
|
|
123
|
+
const h = this.roadsectLayer.graphics.getItemAt(l);
|
|
124
|
+
(h.getAttribute("id") === this.selectedNodeIds[r] || !h.getAttribute("selected")) && (this.roadsectLayer.remove(h), l--);
|
|
113
125
|
}
|
|
114
126
|
}
|
|
115
|
-
this.selectedNodeIds = this.selectedNodeIds.slice(0, d), this.allNodesLayer.graphics.forEach((
|
|
116
|
-
const
|
|
117
|
-
|
|
127
|
+
this.selectedNodeIds = this.selectedNodeIds.slice(0, d), this.allNodesLayer.graphics.forEach((r) => {
|
|
128
|
+
const l = this.selectedNodeIds.includes(
|
|
129
|
+
r.getAttribute("id")
|
|
118
130
|
);
|
|
119
|
-
|
|
120
|
-
}), await this.showDownstreamNodes(
|
|
131
|
+
r.setAttribute("selected", l), r.symbol = this.getEditableNodeSymbol(l), r.visible = l;
|
|
132
|
+
}), await this.showDownstreamNodes(o);
|
|
121
133
|
}
|
|
122
134
|
} else {
|
|
123
|
-
s.setAttribute("selected", !0), s.symbol = this.getEditableNodeSymbol(!0), this.selectedNodeIds.push(
|
|
124
|
-
|
|
135
|
+
s.setAttribute("selected", !0), s.symbol = this.getEditableNodeSymbol(!0), this.selectedNodeIds.push(o), this.allNodesLayer.graphics.forEach((r) => {
|
|
136
|
+
r.visible = r.getAttribute("selected");
|
|
125
137
|
});
|
|
126
138
|
let d = [];
|
|
127
|
-
for (let
|
|
128
|
-
const
|
|
129
|
-
|
|
139
|
+
for (let r = 0; r < this.roadsectLayer.graphics.length; r++) {
|
|
140
|
+
const l = this.roadsectLayer.graphics.getItemAt(r);
|
|
141
|
+
l.getAttribute("id") === o ? (l.symbol = this.getLineSymbol(!0), l.setAttribute("selected", !0), d = l.geometry.paths[0]) : l.getAttribute("selected") || (this.roadsectLayer.remove(l), r--);
|
|
130
142
|
}
|
|
131
143
|
this.addNodeCallback && this.addNodeCallback({
|
|
132
144
|
...s.attributes,
|
|
133
145
|
roadsect: d
|
|
134
|
-
}), await this.showDownstreamNodes(
|
|
146
|
+
}), await this.showDownstreamNodes(o);
|
|
135
147
|
}
|
|
136
148
|
}
|
|
137
149
|
/**
|
|
@@ -140,18 +152,18 @@ class w {
|
|
|
140
152
|
*/
|
|
141
153
|
async showDownstreamNodes(e) {
|
|
142
154
|
this.view.container.style.cursor = "progress";
|
|
143
|
-
const
|
|
155
|
+
const i = await b.get(
|
|
144
156
|
`http://${this.openDriveServer}/api/computable/getDownstreamNodes`,
|
|
145
157
|
{ params: { nodeId: e } }
|
|
146
158
|
);
|
|
147
|
-
if (
|
|
159
|
+
if (i.status !== 200 || i.data.status !== 0) {
|
|
148
160
|
this.view.container.style.cursor = "default";
|
|
149
161
|
return;
|
|
150
162
|
}
|
|
151
|
-
|
|
152
|
-
this.allNodesLayer.graphics.forEach((
|
|
153
|
-
if (
|
|
154
|
-
const
|
|
163
|
+
i.data.result.forEach((s) => {
|
|
164
|
+
this.allNodesLayer.graphics.forEach((o) => {
|
|
165
|
+
if (o.getAttribute("nodeId") === s.id && o.getAttribute("selected") === !1 && (o.visible = !0, s.coordinates)) {
|
|
166
|
+
const a = new n({
|
|
155
167
|
geometry: {
|
|
156
168
|
type: "polyline",
|
|
157
169
|
paths: [s.coordinates]
|
|
@@ -159,80 +171,84 @@ class w {
|
|
|
159
171
|
symbol: this.getLineSymbol(!1),
|
|
160
172
|
attributes: { ...s, selected: !1 }
|
|
161
173
|
});
|
|
162
|
-
this.roadsectLayer.add(
|
|
174
|
+
this.roadsectLayer.add(a);
|
|
163
175
|
}
|
|
164
176
|
});
|
|
165
177
|
}), this.view.container.style.cursor = "default";
|
|
166
178
|
}
|
|
167
|
-
getLineSymbol(e) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
type: "
|
|
172
|
-
|
|
173
|
-
type: "
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
[
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
[
|
|
204
|
-
|
|
179
|
+
getLineSymbol(e, i) {
|
|
180
|
+
if (e) {
|
|
181
|
+
const t = (i == null ? void 0 : i.lineWidth) || 4, s = (i == null ? void 0 : i.lineColor) || [55, 125, 34, 255], o = (i == null ? void 0 : i.arrowColor) || [255, 255, 255, 255];
|
|
182
|
+
return Array.isArray(s) && s.length === 3 && s.push(255), Array.isArray(o) && o.length === 3 && o.push(255), {
|
|
183
|
+
type: "cim",
|
|
184
|
+
data: {
|
|
185
|
+
type: "CIMSymbolReference",
|
|
186
|
+
symbol: {
|
|
187
|
+
type: "CIMLineSymbol",
|
|
188
|
+
symbolLayers: [
|
|
189
|
+
{
|
|
190
|
+
type: "CIMVectorMarker",
|
|
191
|
+
enable: !0,
|
|
192
|
+
size: 4,
|
|
193
|
+
markerPlacement: {
|
|
194
|
+
type: "CIMMarkerPlacementAlongLineSameSize",
|
|
195
|
+
endings: "WithMarkers",
|
|
196
|
+
placementTemplate: [40],
|
|
197
|
+
angleToLine: !0
|
|
198
|
+
},
|
|
199
|
+
frame: {
|
|
200
|
+
xmin: -5,
|
|
201
|
+
ymin: -5,
|
|
202
|
+
xmax: 5,
|
|
203
|
+
ymax: 5
|
|
204
|
+
},
|
|
205
|
+
markerGraphics: [
|
|
206
|
+
{
|
|
207
|
+
type: "CIMMarkerGraphic",
|
|
208
|
+
geometry: {
|
|
209
|
+
paths: [
|
|
210
|
+
[
|
|
211
|
+
[t, -t],
|
|
212
|
+
[3 * t, 0],
|
|
213
|
+
[t, t]
|
|
214
|
+
],
|
|
215
|
+
[
|
|
216
|
+
[-t, t],
|
|
217
|
+
[-3 * t, 0],
|
|
218
|
+
[-t, -t]
|
|
219
|
+
]
|
|
205
220
|
]
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
221
|
+
},
|
|
222
|
+
symbol: {
|
|
223
|
+
type: "CIMLineSymbol",
|
|
224
|
+
symbolLayers: [
|
|
225
|
+
{
|
|
226
|
+
type: "CIMSolidStroke",
|
|
227
|
+
enable: !0,
|
|
228
|
+
width: 1.5,
|
|
229
|
+
color: o
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
218
233
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
type: "CIMSolidStroke",
|
|
238
|
+
enable: !0,
|
|
239
|
+
width: t,
|
|
240
|
+
color: s
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
}
|
|
229
244
|
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
245
|
+
};
|
|
246
|
+
} else
|
|
247
|
+
return {
|
|
248
|
+
type: "simple-line",
|
|
249
|
+
color: "gray",
|
|
250
|
+
width: 2
|
|
251
|
+
};
|
|
236
252
|
}
|
|
237
253
|
getShowNodeSymbol(e) {
|
|
238
254
|
return e === "marker" ? {
|