gisviewer-vue3-arcgis 1.0.196 → 1.0.198
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 +2 -1
- package/es/src/gis-map/gis-map.vue.mjs +143 -141
- package/es/src/gis-map/index.d.ts +1 -0
- package/es/src/gis-map/utils/detect-gpu.d.ts +2 -0
- package/es/src/gis-map/utils/detect-gpu.mjs +44 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.d.ts +20 -5
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +106 -52
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.d.ts +0 -4
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +18 -60
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +2 -2
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +1 -0
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +60 -40
- package/es/src/types/index.d.ts +6 -4
- package/lib/src/gis-map/gis-map.vue.d.ts +2 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +1 -0
- package/lib/src/gis-map/utils/detect-gpu.d.ts +2 -0
- package/lib/src/gis-map/utils/detect-gpu.js +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.d.ts +20 -5
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.d.ts +0 -4
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/lib/src/types/index.d.ts +6 -4
- package/package.json +1 -1
|
@@ -1,46 +1,81 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as y from "@arcgis/core/core/reactiveUtils.js";
|
|
2
|
+
import { Polyline as m } from "@arcgis/core/geometry";
|
|
3
|
+
import c from "@arcgis/core/Graphic";
|
|
2
4
|
import n from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
-
import
|
|
4
|
-
class
|
|
5
|
+
import b from "axios";
|
|
6
|
+
class w {
|
|
5
7
|
constructor(e) {
|
|
6
|
-
this.selectedNodeIds = [], this.view = e, this.roadsectLayer = new n({
|
|
8
|
+
this.selectedNodeIds = [], this.nodeScale = 5e3, this.hasGpu = !1, this.hasGpu = localStorage.getItem("gpu") !== "Unknown", this.view = e, this.roadsectLayer = new n({
|
|
7
9
|
id: "roadsectLayer"
|
|
8
10
|
}), this.view.map.add(this.roadsectLayer), this.allNodesLayer = new n({
|
|
9
11
|
id: "allNodesLayer"
|
|
10
|
-
}), this.view.map.add(this.allNodesLayer)
|
|
12
|
+
}), this.view.map.add(this.allNodesLayer), this.bandLayer = new n({
|
|
13
|
+
id: "bandLayer"
|
|
14
|
+
}), this.view.map.add(this.bandLayer);
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
13
17
|
* 新增绿波带
|
|
14
18
|
* @param params
|
|
15
19
|
*/
|
|
16
20
|
addGreenWaveBand(e) {
|
|
17
|
-
this.
|
|
18
|
-
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", (o) => {
|
|
22
|
+
this.handleViewClick(o);
|
|
19
23
|
}));
|
|
20
24
|
}
|
|
21
25
|
stopAddGreenWaveBand() {
|
|
22
26
|
var e;
|
|
23
|
-
(e = this.viewClickWatcher) == null || e.remove(), this.viewClickWatcher = void 0, this.allNodesLayer.removeAll(), this.selectedNodeIds = [], this.roadsectLayer.removeAll();
|
|
27
|
+
(e = this.viewClickWatcher) == null || e.remove(), this.viewClickWatcher = void 0, this.allNodesLayer.removeAll(), this.selectedNodeIds = [], this.roadsectLayer.removeAll(), this.bandLayer.removeAll();
|
|
28
|
+
}
|
|
29
|
+
async showGreenWaveBand(e) {
|
|
30
|
+
this.scaleWatcher || (this.scaleWatcher = y.watch(
|
|
31
|
+
() => this.view.scale,
|
|
32
|
+
(s, i) => {
|
|
33
|
+
s > this.nodeScale && i <= this.nodeScale ? this.bandLayer.graphics.forEach((l) => {
|
|
34
|
+
l.geometry.type === "point" && (l.symbol = this.getShowNodeSymbol("marker"));
|
|
35
|
+
}) : s <= this.nodeScale && i > this.nodeScale && this.bandLayer.graphics.forEach((l) => {
|
|
36
|
+
l.geometry.type === "point" && (l.symbol = this.getShowNodeSymbol("picture"));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
));
|
|
40
|
+
const o = new m({
|
|
41
|
+
paths: [e.coordinates]
|
|
42
|
+
}), a = new c({
|
|
43
|
+
geometry: o,
|
|
44
|
+
symbol: this.getLineSymbol(!0),
|
|
45
|
+
attributes: { bandId: e.bandId }
|
|
46
|
+
});
|
|
47
|
+
this.roadsectLayer.add(a), await this.view.goTo(a), e.nodeList.forEach((s) => {
|
|
48
|
+
const i = new c({
|
|
49
|
+
geometry: {
|
|
50
|
+
type: "point",
|
|
51
|
+
x: s.longitude,
|
|
52
|
+
y: s.latitude
|
|
53
|
+
},
|
|
54
|
+
symbol: this.getShowNodeSymbol("picture"),
|
|
55
|
+
attributes: s
|
|
56
|
+
});
|
|
57
|
+
this.bandLayer.add(i);
|
|
58
|
+
});
|
|
24
59
|
}
|
|
25
60
|
/**
|
|
26
61
|
* 显示所有路口,进入待选状态
|
|
27
62
|
* @param nodeAttributes
|
|
28
63
|
*/
|
|
29
64
|
showAllNodes(e) {
|
|
30
|
-
const
|
|
65
|
+
const o = [];
|
|
31
66
|
e.forEach((a) => {
|
|
32
|
-
|
|
33
|
-
new
|
|
67
|
+
o.push(
|
|
68
|
+
new c({
|
|
34
69
|
geometry: {
|
|
35
70
|
type: "point",
|
|
36
71
|
x: a.longitude,
|
|
37
72
|
y: a.latitude
|
|
38
73
|
},
|
|
39
|
-
symbol: this.
|
|
74
|
+
symbol: this.getEditableNodeSymbol(!1),
|
|
40
75
|
attributes: { ...a, selected: !1 }
|
|
41
76
|
})
|
|
42
77
|
);
|
|
43
|
-
}), this.allNodesLayer.addMany(
|
|
78
|
+
}), this.allNodesLayer.addMany(o);
|
|
44
79
|
}
|
|
45
80
|
/**
|
|
46
81
|
* 点击待选/已选路口
|
|
@@ -48,50 +83,51 @@ class C {
|
|
|
48
83
|
* @returns
|
|
49
84
|
*/
|
|
50
85
|
async handleViewClick(e) {
|
|
51
|
-
var
|
|
52
|
-
const a = (
|
|
86
|
+
var l;
|
|
87
|
+
const a = (l = (await this.view.hitTest(e, {
|
|
53
88
|
include: [this.allNodesLayer]
|
|
54
|
-
})).results) == null ? void 0 :
|
|
55
|
-
(
|
|
89
|
+
})).results) == null ? void 0 : l.filter(
|
|
90
|
+
(d) => d.type === "graphic"
|
|
56
91
|
);
|
|
57
92
|
if (a.length === 0)
|
|
58
93
|
return;
|
|
59
|
-
const
|
|
60
|
-
if (this.selectedNodeIds.includes(
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
this.
|
|
64
|
-
t.setAttribute("selected", !1), t.symbol = this.
|
|
94
|
+
const s = a[0].graphic, i = s.getAttribute("id");
|
|
95
|
+
if (this.selectedNodeIds.includes(i)) {
|
|
96
|
+
const d = this.selectedNodeIds.indexOf(i) + 1;
|
|
97
|
+
if (d === 1)
|
|
98
|
+
this.removeAllNodeCallback && this.removeAllNodeCallback(), this.selectedNodeIds = [], this.allNodesLayer.graphics.forEach((t) => {
|
|
99
|
+
t.setAttribute("selected", !1), t.symbol = this.getEditableNodeSymbol(!1), t.visible = !0;
|
|
65
100
|
}), this.roadsectLayer.removeAll();
|
|
66
101
|
else {
|
|
67
|
-
for (let t =
|
|
68
|
-
this.
|
|
102
|
+
for (let t = d; t < this.selectedNodeIds.length; t++) {
|
|
103
|
+
this.removeNodeCallback && this.removeNodeCallback({
|
|
69
104
|
id: this.selectedNodeIds[t]
|
|
70
105
|
});
|
|
71
|
-
for (let
|
|
72
|
-
const
|
|
73
|
-
(
|
|
106
|
+
for (let r = 0; r < this.roadsectLayer.graphics.length; r++) {
|
|
107
|
+
const h = this.roadsectLayer.graphics.getItemAt(r);
|
|
108
|
+
(h.getAttribute("id") === this.selectedNodeIds[t] || !h.getAttribute("selected")) && (this.roadsectLayer.remove(h), r--);
|
|
74
109
|
}
|
|
75
110
|
}
|
|
76
|
-
this.selectedNodeIds = this.selectedNodeIds.slice(0,
|
|
77
|
-
const
|
|
111
|
+
this.selectedNodeIds = this.selectedNodeIds.slice(0, d), this.allNodesLayer.graphics.forEach((t) => {
|
|
112
|
+
const r = this.selectedNodeIds.includes(
|
|
78
113
|
t.getAttribute("id")
|
|
79
114
|
);
|
|
80
|
-
t.setAttribute("selected",
|
|
81
|
-
}), await this.showDownstreamNodes(
|
|
115
|
+
t.setAttribute("selected", r), t.symbol = this.getEditableNodeSymbol(r), t.visible = r;
|
|
116
|
+
}), await this.showDownstreamNodes(i);
|
|
82
117
|
}
|
|
83
118
|
} else {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
name: o.getAttribute("name")
|
|
87
|
-
}), o.symbol = this.getNodeSymbol(!0), this.selectedNodeIds.push(r), this.allNodesLayer.graphics.forEach((s) => {
|
|
88
|
-
s.visible = s.getAttribute("selected");
|
|
119
|
+
s.setAttribute("selected", !0), s.symbol = this.getEditableNodeSymbol(!0), this.selectedNodeIds.push(i), this.allNodesLayer.graphics.forEach((t) => {
|
|
120
|
+
t.visible = t.getAttribute("selected");
|
|
89
121
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
122
|
+
let d = [];
|
|
123
|
+
for (let t = 0; t < this.roadsectLayer.graphics.length; t++) {
|
|
124
|
+
const r = this.roadsectLayer.graphics.getItemAt(t);
|
|
125
|
+
r.getAttribute("id") === i ? (r.symbol = this.getLineSymbol(!0), r.setAttribute("selected", !0), d = r.geometry.paths[0]) : r.getAttribute("selected") || (this.roadsectLayer.remove(r), t--);
|
|
93
126
|
}
|
|
94
|
-
|
|
127
|
+
this.addNodeCallback && this.addNodeCallback({
|
|
128
|
+
...s.attributes,
|
|
129
|
+
roadsect: d
|
|
130
|
+
}), await this.showDownstreamNodes(i);
|
|
95
131
|
}
|
|
96
132
|
}
|
|
97
133
|
/**
|
|
@@ -100,26 +136,26 @@ class C {
|
|
|
100
136
|
*/
|
|
101
137
|
async showDownstreamNodes(e) {
|
|
102
138
|
this.view.container.style.cursor = "progress";
|
|
103
|
-
const
|
|
139
|
+
const o = await b.get(
|
|
104
140
|
`http://${this.openDriveServer}/api/computable/getDownstreamNodes`,
|
|
105
141
|
{ params: { nodeId: e } }
|
|
106
142
|
);
|
|
107
|
-
if (
|
|
143
|
+
if (o.status !== 200 || o.data.status !== 0) {
|
|
108
144
|
this.view.container.style.cursor = "default";
|
|
109
145
|
return;
|
|
110
146
|
}
|
|
111
|
-
|
|
112
|
-
this.allNodesLayer.graphics.forEach((
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
147
|
+
o.data.result.forEach((s) => {
|
|
148
|
+
this.allNodesLayer.graphics.forEach((i) => {
|
|
149
|
+
if (i.getAttribute("nodeId") === s.id && i.getAttribute("selected") === !1 && (i.visible = !0, s.coordinates)) {
|
|
150
|
+
const l = new c({
|
|
115
151
|
geometry: {
|
|
116
152
|
type: "polyline",
|
|
117
|
-
paths: [
|
|
153
|
+
paths: [s.coordinates]
|
|
118
154
|
},
|
|
119
155
|
symbol: this.getLineSymbol(!1),
|
|
120
|
-
attributes: { ...
|
|
156
|
+
attributes: { ...s, selected: !1 }
|
|
121
157
|
});
|
|
122
|
-
this.roadsectLayer.add(
|
|
158
|
+
this.roadsectLayer.add(l);
|
|
123
159
|
}
|
|
124
160
|
});
|
|
125
161
|
}), this.view.container.style.cursor = "default";
|
|
@@ -194,7 +230,25 @@ class C {
|
|
|
194
230
|
width: 2
|
|
195
231
|
};
|
|
196
232
|
}
|
|
197
|
-
|
|
233
|
+
getShowNodeSymbol(e) {
|
|
234
|
+
return e === "marker" ? {
|
|
235
|
+
type: "simple-marker",
|
|
236
|
+
style: "circle",
|
|
237
|
+
color: [61, 139, 249],
|
|
238
|
+
size: 8,
|
|
239
|
+
outline: {
|
|
240
|
+
color: "white",
|
|
241
|
+
width: 1
|
|
242
|
+
}
|
|
243
|
+
} : this.getEditableNodeSymbol(!0);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* 编辑状态时的路口符号
|
|
247
|
+
* 全部用cim符号,是否选中用不同的图标
|
|
248
|
+
* @param selected 是否选中
|
|
249
|
+
* @returns
|
|
250
|
+
*/
|
|
251
|
+
getEditableNodeSymbol(e) {
|
|
198
252
|
return {
|
|
199
253
|
type: "cim",
|
|
200
254
|
data: {
|
|
@@ -284,5 +338,5 @@ class C {
|
|
|
284
338
|
}
|
|
285
339
|
}
|
|
286
340
|
export {
|
|
287
|
-
|
|
341
|
+
w as default
|
|
288
342
|
};
|
|
@@ -8,10 +8,6 @@ export default class TraceRendererLayer implements ITraceRendererInterface {
|
|
|
8
8
|
private appDataStore;
|
|
9
9
|
private logTable;
|
|
10
10
|
constructor(view: __esri.MapView);
|
|
11
|
-
private getRendererText;
|
|
12
|
-
private em;
|
|
13
|
-
private el;
|
|
14
|
-
private getGpuText;
|
|
15
11
|
getLog(): (string | number)[][];
|
|
16
12
|
init(): Promise<void>;
|
|
17
13
|
private needInterpolate;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import p from "@arcgis/core/Graphic";
|
|
2
|
-
import
|
|
3
|
-
import { toRaw as
|
|
4
|
-
import
|
|
2
|
+
import m from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
+
import { toRaw as g } from "vue";
|
|
4
|
+
import y from "../../stores/index.mjs";
|
|
5
5
|
class v {
|
|
6
6
|
constructor(i) {
|
|
7
|
-
this.hasGpu = !1, this.appDataStore =
|
|
7
|
+
this.hasGpu = !1, this.appDataStore = y.useAppDataStore, this.logTable = [
|
|
8
8
|
[
|
|
9
9
|
"uuid",
|
|
10
10
|
"ptcId",
|
|
@@ -30,53 +30,11 @@ class v {
|
|
|
30
30
|
"step",
|
|
31
31
|
"receiveTimestamp"
|
|
32
32
|
]
|
|
33
|
-
], this.needInterpolate = !0, this.isPaused = !1, this.showVehiclePlate = !1, this.showGroundVehicle = !0, this.showElevatedVehicle = !0, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map(), this.view = i, this.mapConfig =
|
|
33
|
+
], this.needInterpolate = !0, this.isPaused = !1, this.showVehiclePlate = !1, this.showGroundVehicle = !0, this.showElevatedVehicle = !0, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map(), this.view = i, this.mapConfig = g(this.appDataStore.mapConfig), this.vehicleLayer = new m({
|
|
34
34
|
id: "vehicleLayer"
|
|
35
35
|
}), this.view.map.add(this.vehicleLayer);
|
|
36
|
-
const t =
|
|
37
|
-
this.hasGpu =
|
|
38
|
-
}
|
|
39
|
-
getRendererText() {
|
|
40
|
-
try {
|
|
41
|
-
const i = document.createElement("canvas"), t = i.getContext("webgl") || i.getContext("experimental-webgl");
|
|
42
|
-
if (!t)
|
|
43
|
-
return "Unknown";
|
|
44
|
-
const e = t.getExtension("WEBGL_debug_renderer_info");
|
|
45
|
-
return e && t.getParameter(e.UNMASKED_RENDERER_WEBGL) || "Unknown";
|
|
46
|
-
} catch {
|
|
47
|
-
return "Unknown";
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
em(i) {
|
|
51
|
-
const t = [], e = i.split("");
|
|
52
|
-
for (let s = 0; s < e.length; s++)
|
|
53
|
-
if (e[s] === "(")
|
|
54
|
-
t.push(s);
|
|
55
|
-
else if (e[s] === ")") {
|
|
56
|
-
const r = t.pop();
|
|
57
|
-
r !== void 0 && (e.splice(r, s - r + 1), s = r - 1);
|
|
58
|
-
}
|
|
59
|
-
return e.join("");
|
|
60
|
-
}
|
|
61
|
-
el(i) {
|
|
62
|
-
return this.em(i).replace(/\/PCIe\/SSE2/g, "").replace(/\s+/g, " ").trim();
|
|
63
|
-
}
|
|
64
|
-
getGpuText(i) {
|
|
65
|
-
try {
|
|
66
|
-
if (/, or similar$/.test(i) || /SwiftShader/.test(i))
|
|
67
|
-
return "Unknown";
|
|
68
|
-
if (/^ANGLE/.test(i)) {
|
|
69
|
-
const t = i.match(/\((.+)\)$/);
|
|
70
|
-
if (t) {
|
|
71
|
-
const e = t[1], s = e.split(/,\s*/g);
|
|
72
|
-
let r = s[1];
|
|
73
|
-
return /^ANGLE Metal Renderer: /.test(r) && (r = i.split(": ")[1].split(",")[0]), s.length === 1 && (r = s[0].split(" ").slice(1).join(" ")), /Direct3D/.test(r) && (r = r.split("Direct3D")[0].trim()), r;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
} catch {
|
|
77
|
-
return "Unknown";
|
|
78
|
-
}
|
|
79
|
-
return this.el(i);
|
|
36
|
+
const t = localStorage.getItem("gpu");
|
|
37
|
+
this.hasGpu = t !== "Unknown";
|
|
80
38
|
}
|
|
81
39
|
getLog() {
|
|
82
40
|
return this.logTable;
|
|
@@ -90,11 +48,11 @@ class v {
|
|
|
90
48
|
return;
|
|
91
49
|
}
|
|
92
50
|
const e = i.map((s) => {
|
|
93
|
-
const { vehicleId: r, heading: o, localTimestamp: h } = s,
|
|
51
|
+
const { vehicleId: r, heading: o, localTimestamp: h } = s, l = Number(s.x), n = Number(s.y), a = new p({
|
|
94
52
|
geometry: {
|
|
95
53
|
type: "point",
|
|
96
|
-
x:
|
|
97
|
-
y:
|
|
54
|
+
x: l,
|
|
55
|
+
y: n
|
|
98
56
|
},
|
|
99
57
|
attributes: {
|
|
100
58
|
...s,
|
|
@@ -103,7 +61,7 @@ class v {
|
|
|
103
61
|
symbol: this.hasGpu ? this.createCIMSymbol(s) : this.createMarkerSymbol()
|
|
104
62
|
});
|
|
105
63
|
return this.hasGpu && (a.visible = !1, this.historyPositionMap.set(r, [
|
|
106
|
-
{ pos: [
|
|
64
|
+
{ pos: [l, n, 0], heading: o, time: h }
|
|
107
65
|
]), this.vehicleObjectMap.set(r, {
|
|
108
66
|
graphic: a,
|
|
109
67
|
data: s,
|
|
@@ -122,7 +80,7 @@ class v {
|
|
|
122
80
|
}
|
|
123
81
|
const e = [];
|
|
124
82
|
i.forEach((s) => {
|
|
125
|
-
const { vehicleId: r, heading: o, localTimestamp: h } = s,
|
|
83
|
+
const { vehicleId: r, heading: o, localTimestamp: h } = s, l = Number(s.x), n = Number(s.y);
|
|
126
84
|
if (this.hasGpu) {
|
|
127
85
|
const a = this.vehicleObjectMap.get(r);
|
|
128
86
|
a ? (a.data = s, a.graphic.attributes = {
|
|
@@ -131,7 +89,7 @@ class v {
|
|
|
131
89
|
}, this.historyPositionMap.get(
|
|
132
90
|
r
|
|
133
91
|
).push({
|
|
134
|
-
pos: [
|
|
92
|
+
pos: [l, n, 0],
|
|
135
93
|
heading: o,
|
|
136
94
|
time: h
|
|
137
95
|
})) : e.push(s);
|
|
@@ -141,8 +99,8 @@ class v {
|
|
|
141
99
|
);
|
|
142
100
|
a ? a.geometry = {
|
|
143
101
|
type: "point",
|
|
144
|
-
x:
|
|
145
|
-
y:
|
|
102
|
+
x: l,
|
|
103
|
+
y: n
|
|
146
104
|
} : e.push(s);
|
|
147
105
|
}
|
|
148
106
|
}), this.addVehicles(e), t();
|
|
@@ -213,12 +171,12 @@ class v {
|
|
|
213
171
|
y: t[0].pos[1]
|
|
214
172
|
};
|
|
215
173
|
else {
|
|
216
|
-
const h = t[0].pos[0] + (t[1].pos[0] - t[0].pos[0]) * o,
|
|
174
|
+
const h = t[0].pos[0] + (t[1].pos[0] - t[0].pos[0]) * o, l = t[0].pos[1] + (t[1].pos[1] - t[0].pos[1]) * o, n = t[0].heading + (t[1].heading - t[0].heading) * o;
|
|
217
175
|
e.graphic.geometry = {
|
|
218
176
|
type: "point",
|
|
219
177
|
x: h,
|
|
220
|
-
y:
|
|
221
|
-
}, e.data.heading =
|
|
178
|
+
y: l
|
|
179
|
+
}, e.data.heading = n, e.graphic.symbol = this.hasGpu ? this.createCIMSymbol(e.data) : this.createMarkerSymbol();
|
|
222
180
|
}
|
|
223
181
|
}
|
|
224
182
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import r from "../common-utils.mjs";
|
|
2
2
|
class e {
|
|
3
3
|
constructor(t, i) {
|
|
4
|
-
this.parentName = "", this.crosses = [], this.subDistricts = [], this.crossCount = 0, this.subDistrictCount = 0, this.id = t.
|
|
4
|
+
this.parentName = "", this.crosses = [], this.subDistricts = [], this.crossCount = 0, this.subDistrictCount = 0, this.id = t.name, this.name = t.areaDesc, this.parentId = t.parentId, this.areaColor = i === "alarm" ? [255, 0, 0] : [61, 139, 249];
|
|
5
5
|
for (const s of t.children)
|
|
6
6
|
if (s.children) {
|
|
7
7
|
const o = new e(s, i);
|
|
8
|
-
o.parentName = this.name, this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
|
|
8
|
+
o.id = s.id, o.name = `SS ${s.name}`, o.parentName = this.name, this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
|
|
9
9
|
} else if (r.isCoordinateValid(s)) {
|
|
10
10
|
const o = {
|
|
11
11
|
id: s.id,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as p from "@arcgis/core/core/reactiveUtils.js";
|
|
2
2
|
import n from "@arcgis/core/Graphic";
|
|
3
3
|
import y from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import d from "@turf/buffer";
|
|
5
|
+
import g from "@turf/convex";
|
|
6
6
|
import * as a from "@turf/helpers";
|
|
7
7
|
import b from "axios";
|
|
8
8
|
import f from "concaveman";
|
|
9
9
|
import C from "../../stores/index.mjs";
|
|
10
10
|
import v from "./district-controller.mjs";
|
|
11
|
-
class
|
|
11
|
+
class G {
|
|
12
12
|
constructor(e) {
|
|
13
13
|
var i;
|
|
14
|
-
this.crossScale = 5e3, this.crossIdsInDistrict = [], this.view = e;
|
|
14
|
+
this.crossScale = 5e3, this.hasGpu = !1, this.crossIdsInDistrict = [], this.view = e, this.hasGpu = localStorage.getItem("gpu") !== "Unknown";
|
|
15
15
|
const r = C.useAppDataStore.mapConfig;
|
|
16
16
|
this.openDriveServer = (i = r.openDriveServer) == null ? void 0 : i.url, this.districtControllerLayer = new y({
|
|
17
17
|
id: "districtControllerLayer"
|
|
@@ -48,7 +48,7 @@ class N {
|
|
|
48
48
|
);
|
|
49
49
|
this.drawArea(r, !0);
|
|
50
50
|
}
|
|
51
|
-
return this.scaleWatcher =
|
|
51
|
+
return this.scaleWatcher = p.watch(
|
|
52
52
|
() => this.view.scale,
|
|
53
53
|
(t, r) => {
|
|
54
54
|
t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((i) => {
|
|
@@ -81,10 +81,17 @@ class N {
|
|
|
81
81
|
}
|
|
82
82
|
async locateSignalControlArea(e) {
|
|
83
83
|
const t = this.findAreaGraphic(e.id);
|
|
84
|
-
return t ? (t.attributes.type === "cross" ? await this.view.goTo(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
return t ? (t.attributes.type === "cross" ? await this.view.goTo(
|
|
85
|
+
{
|
|
86
|
+
target: t.geometry,
|
|
87
|
+
scale: 1500
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
duration: this.hasGpu ? 1e3 : 0
|
|
91
|
+
}
|
|
92
|
+
) : await this.view.goTo(t.geometry, {
|
|
93
|
+
duration: this.hasGpu ? 1e3 : 0
|
|
94
|
+
}), { status: 0, message: "ok" }) : { status: 1, message: "未找到" };
|
|
88
95
|
}
|
|
89
96
|
async highlightSignalControlArea(e) {
|
|
90
97
|
if (!e.id || e.id === "")
|
|
@@ -98,21 +105,35 @@ class N {
|
|
|
98
105
|
).toArray().map((s) => s.clone()), i = this.crossLayer.graphics.filter(
|
|
99
106
|
(s) => s.getAttribute("id") === e.id || s.getAttribute("districtId") === e.id || s.getAttribute("subDistrictId") === e.id
|
|
100
107
|
).toArray().map((s) => s.clone());
|
|
101
|
-
if (
|
|
108
|
+
if (r.length > 0 && this.highlightLayer.addMany(r), i.length > 0 && this.highlightLayer.addMany(i), this.highlightLayer.graphics.length === 0)
|
|
102
109
|
return { status: 1, message: "未找到" };
|
|
103
110
|
if (t.length > 0)
|
|
104
|
-
await this.view.goTo(t
|
|
111
|
+
await this.view.goTo(t, {
|
|
112
|
+
duration: this.hasGpu ? 1e3 : 0
|
|
113
|
+
});
|
|
105
114
|
else if (r.length > 0) {
|
|
106
115
|
const s = r[0].geometry.centroid;
|
|
107
|
-
await this.view.goTo(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
await this.view.goTo(
|
|
117
|
+
{
|
|
118
|
+
target: s,
|
|
119
|
+
scale: this.crossScale - 500
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
duration: this.hasGpu ? 1e3 : 0
|
|
123
|
+
}
|
|
124
|
+
);
|
|
111
125
|
} else
|
|
112
|
-
i.length > 1 ? await this.view.goTo(i
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
126
|
+
i.length > 1 ? await this.view.goTo(i, {
|
|
127
|
+
duration: this.hasGpu ? 1e3 : 0
|
|
128
|
+
}) : await this.view.goTo(
|
|
129
|
+
{
|
|
130
|
+
target: i[0].geometry,
|
|
131
|
+
scale: 1500
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
duration: this.hasGpu ? 1e3 : 0
|
|
135
|
+
}
|
|
136
|
+
);
|
|
116
137
|
return { status: 0, message: "ok" };
|
|
117
138
|
}
|
|
118
139
|
resetHighlight() {
|
|
@@ -132,7 +153,9 @@ class N {
|
|
|
132
153
|
attributes: s
|
|
133
154
|
});
|
|
134
155
|
});
|
|
135
|
-
return this.crossLayer.addMany(r), this.view.goTo(r
|
|
156
|
+
return this.crossLayer.addMany(r), this.view.goTo(r, {
|
|
157
|
+
duration: this.hasGpu ? 1e3 : 0
|
|
158
|
+
}), { status: 0, message: "ok" };
|
|
136
159
|
}
|
|
137
160
|
/**
|
|
138
161
|
* 点击路口时
|
|
@@ -151,10 +174,7 @@ class N {
|
|
|
151
174
|
const i = r[0].graphic;
|
|
152
175
|
i.getAttribute("selected") ? i.getAttribute("signalId") && (this.removeCrossCallback && this.removeCrossCallback({ id: i.getAttribute("id") }), i.setAttribute("selected", !1), i.symbol = this.getCrossSymbolInSubDistrict(
|
|
153
176
|
i.attributes
|
|
154
|
-
)) : (i.getAttribute("signalId") && (this.addCrossCallback && this.addCrossCallback(
|
|
155
|
-
id: i.getAttribute("id"),
|
|
156
|
-
name: i.getAttribute("name")
|
|
157
|
-
}), i.setAttribute("selected", !0), i.symbol = this.getCrossSymbolInSubDistrict(
|
|
177
|
+
)) : (i.getAttribute("signalId") && (this.addCrossCallback && this.addCrossCallback(i.attributes), i.setAttribute("selected", !0), i.symbol = this.getCrossSymbolInSubDistrict(
|
|
158
178
|
i.attributes
|
|
159
179
|
)), await this.showNearbyCrosses(i.getAttribute("id")));
|
|
160
180
|
}
|
|
@@ -180,10 +200,10 @@ class N {
|
|
|
180
200
|
continue;
|
|
181
201
|
}
|
|
182
202
|
if (this.crossLayer.graphics.some(
|
|
183
|
-
(
|
|
203
|
+
(h) => h.getAttribute("id") === o
|
|
184
204
|
))
|
|
185
205
|
continue;
|
|
186
|
-
const
|
|
206
|
+
const u = new n({
|
|
187
207
|
geometry: {
|
|
188
208
|
type: "point",
|
|
189
209
|
x: s.lon,
|
|
@@ -197,7 +217,7 @@ class N {
|
|
|
197
217
|
selected: !1
|
|
198
218
|
}
|
|
199
219
|
});
|
|
200
|
-
i.push(
|
|
220
|
+
i.push(u);
|
|
201
221
|
}
|
|
202
222
|
return this.crossLayer.addMany(i), { status: 0, message: "ok" };
|
|
203
223
|
} else
|
|
@@ -216,7 +236,7 @@ class N {
|
|
|
216
236
|
e.crossesInArea.map(
|
|
217
237
|
(s) => a.point([s.longitude, s.latitude])
|
|
218
238
|
)
|
|
219
|
-
), r =
|
|
239
|
+
), r = g(t);
|
|
220
240
|
r && (this.districtControllerLayer.removeAll(), this.districtControllerLayer.add(
|
|
221
241
|
new n({
|
|
222
242
|
geometry: {
|
|
@@ -305,17 +325,17 @@ class N {
|
|
|
305
325
|
s = a.lineString(r);
|
|
306
326
|
else {
|
|
307
327
|
if (t) {
|
|
308
|
-
const
|
|
328
|
+
const c = a.featureCollection(
|
|
309
329
|
r.map((m) => a.point(m))
|
|
310
330
|
);
|
|
311
|
-
s =
|
|
331
|
+
s = g(c);
|
|
312
332
|
} else {
|
|
313
|
-
const
|
|
314
|
-
|
|
333
|
+
const c = f(r, 0.5);
|
|
334
|
+
c.length >= 4 && (s = a.polygon([c]));
|
|
315
335
|
}
|
|
316
336
|
s || (s = a.lineString(r));
|
|
317
337
|
}
|
|
318
|
-
const o =
|
|
338
|
+
const o = d(
|
|
319
339
|
s.geometry,
|
|
320
340
|
// 区控面积更大,需要更大的缓冲半径
|
|
321
341
|
t ? 200 : 30,
|
|
@@ -347,7 +367,7 @@ class N {
|
|
|
347
367
|
label: "路口数量"
|
|
348
368
|
}
|
|
349
369
|
];
|
|
350
|
-
const
|
|
370
|
+
const u = {
|
|
351
371
|
type: "signalControlArea",
|
|
352
372
|
id: e.id,
|
|
353
373
|
name: e.name,
|
|
@@ -355,7 +375,7 @@ class N {
|
|
|
355
375
|
parentName: e.parentName,
|
|
356
376
|
crossCount: e.crossCount,
|
|
357
377
|
subDistrictCount: e.subDistrictCount
|
|
358
|
-
},
|
|
378
|
+
}, h = new n({
|
|
359
379
|
geometry: {
|
|
360
380
|
type: "polygon",
|
|
361
381
|
rings: o.geometry.coordinates
|
|
@@ -370,9 +390,9 @@ class N {
|
|
|
370
390
|
style: t ? "long-dash" : "solid"
|
|
371
391
|
}
|
|
372
392
|
},
|
|
373
|
-
attributes:
|
|
393
|
+
attributes: u,
|
|
374
394
|
popupTemplate: {
|
|
375
|
-
title: `${
|
|
395
|
+
title: `${e.name}`,
|
|
376
396
|
content: [
|
|
377
397
|
{
|
|
378
398
|
type: "fields",
|
|
@@ -381,7 +401,7 @@ class N {
|
|
|
381
401
|
]
|
|
382
402
|
}
|
|
383
403
|
});
|
|
384
|
-
t ? this.districtControllerLayer.add(
|
|
404
|
+
t ? this.districtControllerLayer.add(h) : this.subDistrictControllerLayer.add(h);
|
|
385
405
|
}
|
|
386
406
|
for (const s of e.subDistricts)
|
|
387
407
|
this.drawArea(s, !1);
|
|
@@ -648,5 +668,5 @@ class N {
|
|
|
648
668
|
}
|
|
649
669
|
}
|
|
650
670
|
export {
|
|
651
|
-
|
|
671
|
+
G as default
|
|
652
672
|
};
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -284,13 +284,15 @@ export interface INode {
|
|
|
284
284
|
}
|
|
285
285
|
export interface IEditSignalControlAreaParams {
|
|
286
286
|
crossesInArea: INode[];
|
|
287
|
-
addCrossCallback: (params:
|
|
288
|
-
id: string;
|
|
289
|
-
name: string;
|
|
290
|
-
}) => void;
|
|
287
|
+
addCrossCallback: (params: INode) => void;
|
|
291
288
|
removeCrossCallback: (params: {
|
|
292
289
|
id: string;
|
|
293
290
|
}) => void;
|
|
294
291
|
removeAllCrossCallback?: () => void;
|
|
295
292
|
odrServer: string;
|
|
296
293
|
}
|
|
294
|
+
export interface IShowGreenWaveBandParams {
|
|
295
|
+
bandId: string;
|
|
296
|
+
coordinates: number[][];
|
|
297
|
+
nodeList: INode[];
|
|
298
|
+
}
|