gisviewer-vue3-arcgis 1.0.241 → 1.0.243
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/utils/common-utils.d.ts +1 -1
- package/es/src/gis-map/utils/common-utils.mjs +52 -39
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +135 -135
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +8 -8
- package/lib/src/gis-map/utils/common-utils.d.ts +1 -1
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
- package/package.json +1 -1
|
@@ -90,5 +90,5 @@ export default class CommonUtils {
|
|
|
90
90
|
* @returns
|
|
91
91
|
*/
|
|
92
92
|
static getCenterPointInLine(line: number[][]): number[];
|
|
93
|
-
static viewGoto(view: __esri.MapView | __esri.SceneView, target: Graphic[]): Promise<void>;
|
|
93
|
+
static viewGoto(view: __esri.MapView | __esri.SceneView, target: Graphic[], zoom?: boolean): Promise<void>;
|
|
94
94
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Point as L, Polyline as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
1
|
+
import { Point as L, Polyline as l } from "@arcgis/core/geometry";
|
|
2
|
+
import * as u from "@arcgis/core/geometry/geometryEngineAsync";
|
|
3
|
+
import * as y from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
4
|
+
import h from "@turf/bearing";
|
|
5
|
+
import p from "@turf/destination";
|
|
6
|
+
import * as f from "@turf/helpers";
|
|
7
7
|
import d from "@turf/length";
|
|
8
8
|
import O from "@turf/line-slice-along";
|
|
9
9
|
import w from "pako";
|
|
10
|
-
import
|
|
10
|
+
import P from "proj4";
|
|
11
11
|
class s {
|
|
12
12
|
/**
|
|
13
13
|
* 得到某个点在一定方向、距离之外的另一个点
|
|
@@ -17,7 +17,7 @@ class s {
|
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
19
|
static destinationWithPoint(t, e, n) {
|
|
20
|
-
const r =
|
|
20
|
+
const r = f.point([t.x, t.y]), i = p(r, n, e, {
|
|
21
21
|
units: "meters"
|
|
22
22
|
});
|
|
23
23
|
return new L({
|
|
@@ -31,8 +31,8 @@ class s {
|
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
33
33
|
static angleOfLine(t) {
|
|
34
|
-
const e = t.paths[0], n =
|
|
35
|
-
return
|
|
34
|
+
const e = t.paths[0], n = f.point(e[0]), r = f.point(e[e.length - 1]);
|
|
35
|
+
return h(n, r);
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* 在头尾两个方向上延长折线
|
|
@@ -40,14 +40,14 @@ class s {
|
|
|
40
40
|
* @param distance
|
|
41
41
|
*/
|
|
42
42
|
static extendLineInTowDir(t, e) {
|
|
43
|
-
const n = t.paths[0], r =
|
|
43
|
+
const n = t.paths[0], r = f.point(n[0]), i = f.point(n[1]), a = h(i, r), c = p(r, e, a, {
|
|
44
44
|
units: "meters"
|
|
45
|
-
}),
|
|
45
|
+
}), g = a > 0 ? a - 180 : a + 180, o = p(i, e, g, {
|
|
46
46
|
units: "meters"
|
|
47
47
|
});
|
|
48
|
-
return new
|
|
48
|
+
return new l({
|
|
49
49
|
paths: [
|
|
50
|
-
[
|
|
50
|
+
[c.geometry.coordinates, o.geometry.coordinates]
|
|
51
51
|
]
|
|
52
52
|
});
|
|
53
53
|
}
|
|
@@ -58,7 +58,7 @@ class s {
|
|
|
58
58
|
* @returns
|
|
59
59
|
*/
|
|
60
60
|
static async getIntersectPointOfTwoLines(t, e) {
|
|
61
|
-
const n = await
|
|
61
|
+
const n = await u.intersectLinesToPoints(
|
|
62
62
|
t,
|
|
63
63
|
e
|
|
64
64
|
);
|
|
@@ -84,9 +84,9 @@ class s {
|
|
|
84
84
|
e,
|
|
85
85
|
i
|
|
86
86
|
), await s.pointDistance(r) > 2.5) {
|
|
87
|
-
const
|
|
87
|
+
const a = new l({ paths: [r] });
|
|
88
88
|
return (await s.getOffsetLine(
|
|
89
|
-
|
|
89
|
+
a,
|
|
90
90
|
-i
|
|
91
91
|
)).paths[0];
|
|
92
92
|
}
|
|
@@ -102,8 +102,8 @@ class s {
|
|
|
102
102
|
static async pointDistance(t) {
|
|
103
103
|
if (t.length < 2)
|
|
104
104
|
return 0;
|
|
105
|
-
const e = new
|
|
106
|
-
return await
|
|
105
|
+
const e = new l({ paths: [t] });
|
|
106
|
+
return await u.geodesicLength(e, "meters");
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* 线按一定距离平移之后,与面相交的两个端点
|
|
@@ -114,10 +114,10 @@ class s {
|
|
|
114
114
|
*/
|
|
115
115
|
static async getIntersectPointOfLineAndPolygon(t, e, n = 0) {
|
|
116
116
|
n !== 0 && (t = await s.getOffsetLine(t, n));
|
|
117
|
-
const r = await
|
|
118
|
-
if (r instanceof
|
|
119
|
-
const i = r.paths[0],
|
|
120
|
-
return [
|
|
117
|
+
const r = await u.intersect(t, e);
|
|
118
|
+
if (r instanceof l) {
|
|
119
|
+
const i = r.paths[0], a = i[0], c = i[i.length - 1];
|
|
120
|
+
return [a, c];
|
|
121
121
|
}
|
|
122
122
|
return [];
|
|
123
123
|
}
|
|
@@ -128,12 +128,12 @@ class s {
|
|
|
128
128
|
* @returns 平移后的polyline
|
|
129
129
|
*/
|
|
130
130
|
static async getOffsetLine(t, e) {
|
|
131
|
-
const n =
|
|
131
|
+
const n = y.geographicToWebMercator(t), r = await u.offset(
|
|
132
132
|
n,
|
|
133
133
|
e,
|
|
134
134
|
"meters"
|
|
135
135
|
);
|
|
136
|
-
return
|
|
136
|
+
return y.webMercatorToGeographic(
|
|
137
137
|
r,
|
|
138
138
|
!1
|
|
139
139
|
);
|
|
@@ -147,8 +147,8 @@ class s {
|
|
|
147
147
|
try {
|
|
148
148
|
const e = [], n = t.split("");
|
|
149
149
|
for (let i = 0; i < n.length; i++) {
|
|
150
|
-
const
|
|
151
|
-
e.push(
|
|
150
|
+
const a = n[i];
|
|
151
|
+
e.push(a.charCodeAt(0));
|
|
152
152
|
}
|
|
153
153
|
const r = new Uint8Array(e);
|
|
154
154
|
return w.inflate(r, { to: "string" });
|
|
@@ -185,7 +185,7 @@ class s {
|
|
|
185
185
|
static transformLineProjection(t) {
|
|
186
186
|
try {
|
|
187
187
|
return t.map(
|
|
188
|
-
(e) =>
|
|
188
|
+
(e) => P(s.geoReference).inverse([
|
|
189
189
|
e[0] - s.xOffset,
|
|
190
190
|
e[1] - s.yOffset
|
|
191
191
|
])
|
|
@@ -199,7 +199,7 @@ class s {
|
|
|
199
199
|
}
|
|
200
200
|
static transformPointProjection(t) {
|
|
201
201
|
try {
|
|
202
|
-
return
|
|
202
|
+
return P(s.geoReference).inverse([
|
|
203
203
|
t[0] - s.xOffset,
|
|
204
204
|
t[1] - s.yOffset
|
|
205
205
|
]);
|
|
@@ -214,8 +214,8 @@ class s {
|
|
|
214
214
|
return Math.abs(t[0] - e[0]) < Number.EPSILON && Math.abs(t[1] - e[1]) < Number.EPSILON;
|
|
215
215
|
}
|
|
216
216
|
static getExtensionLine(t, e, n) {
|
|
217
|
-
const r =
|
|
218
|
-
return
|
|
217
|
+
const r = f.point(t), i = f.point(e), a = h(r, i);
|
|
218
|
+
return p(i, n, a, { units: "meters" }).geometry.coordinates;
|
|
219
219
|
}
|
|
220
220
|
static isCoordinateValid(t) {
|
|
221
221
|
return typeof t.latitude == "string" && (t.latitude = Number(t.latitude)), typeof t.longitude == "string" && (t.longitude = Number(t.longitude)), t.latitude !== null && t.longitude !== null && !isNaN(t.latitude) && !isNaN(t.longitude) && t.latitude !== 0 && t.longitude !== 0;
|
|
@@ -226,22 +226,35 @@ class s {
|
|
|
226
226
|
* @returns
|
|
227
227
|
*/
|
|
228
228
|
static getCenterPointInLine(t) {
|
|
229
|
-
const e =
|
|
229
|
+
const e = f.lineString(t), n = d(e, { units: "meters" }) / 2, r = O(e, 0, n, {
|
|
230
230
|
units: "meters"
|
|
231
231
|
});
|
|
232
232
|
return r.geometry.coordinates[r.geometry.coordinates.length - 1];
|
|
233
233
|
}
|
|
234
|
-
static async viewGoto(t, e) {
|
|
235
|
-
var
|
|
236
|
-
|
|
234
|
+
static async viewGoto(t, e, n = !0) {
|
|
235
|
+
var a, c;
|
|
236
|
+
const i = localStorage.getItem("gpu") !== "Unknown";
|
|
237
|
+
if (!n) {
|
|
238
|
+
if (e.length > 0) {
|
|
239
|
+
const g = e.map((o) => o.geometry).filter((o) => o);
|
|
240
|
+
if (g.length > 0) {
|
|
241
|
+
const o = (a = await u.union(g)) == null ? void 0 : a.extent;
|
|
242
|
+
o && (i ? await t.goTo(o.center, {
|
|
243
|
+
duration: 1e3
|
|
244
|
+
}) : t.center = o.center);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (i)
|
|
237
250
|
await t.goTo(e, {
|
|
238
251
|
duration: 1e3
|
|
239
252
|
});
|
|
240
253
|
else if (e.length > 0) {
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
|
|
254
|
+
const g = e.map((o) => o.geometry).filter((o) => o);
|
|
255
|
+
if (g.length > 0) {
|
|
256
|
+
const o = (c = await u.union(g)) == null ? void 0 : c.extent;
|
|
257
|
+
o && (t.extent = o);
|
|
245
258
|
}
|
|
246
259
|
}
|
|
247
260
|
}
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as m from "@arcgis/core/core/reactiveUtils";
|
|
2
2
|
import { Point as u } from "@arcgis/core/geometry";
|
|
3
3
|
import * as g from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
4
4
|
import L from "@arcgis/core/Graphic";
|
|
5
5
|
import b from "@arcgis/core/layers/GraphicsLayer";
|
|
6
6
|
import M from "./signal-holo-flow.mjs";
|
|
7
7
|
class v extends M {
|
|
8
|
-
constructor(e,
|
|
9
|
-
var
|
|
10
|
-
super(e), this.waitingAreaLayer = new b(), this.watchHandle = null, this.trajectoryDelayTime = 2, this.stopLineMap = /* @__PURE__ */ new Map(), this.waitingAreaMap = /* @__PURE__ */ new Map(), this.lampGroupMap = /* @__PURE__ */ new Map(), this.countdownPanelProps =
|
|
8
|
+
constructor(e, o) {
|
|
9
|
+
var s, n;
|
|
10
|
+
super(e), this.waitingAreaLayer = new b(), this.watchHandle = null, this.trajectoryDelayTime = 2, this.stopLineMap = /* @__PURE__ */ new Map(), this.waitingAreaMap = /* @__PURE__ */ new Map(), this.lampGroupMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = o, this.view.map.add(this.waitingAreaLayer), this.trajectoryDelayTime = (n = (s = this.mapConfig.holoFlow) == null ? void 0 : s.signal) == null ? void 0 : n.delay, this.trajectoryDelayTime === void 0 && (this.trajectoryDelayTime = 2);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* 读取停止线图层,将灯组面板沿着停止线放置
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
16
|
async initializeLayer() {
|
|
17
|
-
var
|
|
17
|
+
var n, a, i, r, t;
|
|
18
18
|
if (this.stopLineMap.size > 0)
|
|
19
19
|
return;
|
|
20
20
|
console.time("初始化停止线图层");
|
|
21
|
-
let e = (
|
|
21
|
+
let e = (a = (n = this.mapConfig.holoFlow) == null ? void 0 : n.signal) == null ? void 0 : a.stopLineLayer;
|
|
22
22
|
if (!e)
|
|
23
23
|
return;
|
|
24
24
|
e = this.mapConfig.assetsRoot + "/" + e;
|
|
25
|
-
let
|
|
26
|
-
for (const l of
|
|
27
|
-
const { roadId: c, nodeId:
|
|
25
|
+
let o = await fetch(e), s = await o.json();
|
|
26
|
+
for (const l of s.features) {
|
|
27
|
+
const { roadId: c, nodeId: h } = l.properties;
|
|
28
28
|
let { destinationPoint: p } = l.properties;
|
|
29
|
-
const { coordinates:
|
|
29
|
+
const { coordinates: f } = l.geometry;
|
|
30
30
|
if (p) {
|
|
31
31
|
if (typeof p == "string")
|
|
32
32
|
try {
|
|
33
33
|
p = JSON.parse(p);
|
|
34
|
-
} catch (
|
|
35
|
-
console.error("解析面板基准点失败",
|
|
34
|
+
} catch (d) {
|
|
35
|
+
console.error("解析面板基准点失败", d);
|
|
36
36
|
continue;
|
|
37
37
|
}
|
|
38
38
|
} else {
|
|
39
|
-
const
|
|
39
|
+
const d = f[0], w = f[f.length - 1], y = (d[0] + w[0]) / 2, P = (d[1] + w[1]) / 2;
|
|
40
40
|
p = [y, P];
|
|
41
41
|
}
|
|
42
|
-
this.stopLineMap.set(`${
|
|
43
|
-
coord:
|
|
42
|
+
this.stopLineMap.set(`${h}_${c}`, {
|
|
43
|
+
coord: f,
|
|
44
44
|
panelPoint: p
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
if (console.timeEnd("初始化停止线图层"), console.time("初始化待行区图层"), e = (
|
|
48
|
-
e = this.mapConfig.assetsRoot + "/" + e,
|
|
49
|
-
for (const l of
|
|
50
|
-
const { roadId: c, direction:
|
|
51
|
-
this.waitingAreaMap.has(
|
|
47
|
+
if (console.timeEnd("初始化停止线图层"), console.time("初始化待行区图层"), e = (r = (i = this.mapConfig.holoFlow) == null ? void 0 : i.signal) == null ? void 0 : r.waitingAreaLayer, !!e) {
|
|
48
|
+
e = this.mapConfig.assetsRoot + "/" + e, o = await fetch(e), s = await o.json();
|
|
49
|
+
for (const l of s.features) {
|
|
50
|
+
const { roadId: c, direction: h, nodeId: p } = l.properties, { coordinates: f } = l.geometry, d = `${p}_${c}`;
|
|
51
|
+
this.waitingAreaMap.has(d) || this.waitingAreaMap.set(d, []), (t = this.waitingAreaMap.get(d)) == null || t.push({ coord: f, direction: h });
|
|
52
52
|
}
|
|
53
53
|
console.timeEnd("初始化待行区图层");
|
|
54
54
|
}
|
|
@@ -57,14 +57,14 @@ class v extends M {
|
|
|
57
57
|
* 初始化灯组与进口道的关联关系
|
|
58
58
|
*/
|
|
59
59
|
initializeLampGroup(e) {
|
|
60
|
-
const { sigId:
|
|
61
|
-
|
|
62
|
-
const { lampGroupNo:
|
|
63
|
-
if (
|
|
64
|
-
for (const c of
|
|
65
|
-
if (
|
|
60
|
+
const { sigId: o, lampGroupList: s } = e, n = [];
|
|
61
|
+
s.forEach((a) => {
|
|
62
|
+
const { lampGroupNo: i, lampGroupType: r, crossFlowList: t, pedList: l } = a;
|
|
63
|
+
if (t.length > 0)
|
|
64
|
+
for (const c of t) {
|
|
65
|
+
if (r === 81)
|
|
66
66
|
continue;
|
|
67
|
-
const
|
|
67
|
+
const h = c.upSectionId;
|
|
68
68
|
let p = "s";
|
|
69
69
|
switch (c.turn) {
|
|
70
70
|
case 1:
|
|
@@ -80,35 +80,35 @@ class v extends M {
|
|
|
80
80
|
p = "u";
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
lampGroupId:
|
|
85
|
-
roadId:
|
|
83
|
+
n.push({
|
|
84
|
+
lampGroupId: i,
|
|
85
|
+
roadId: h,
|
|
86
86
|
dir: p
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
l.length > 0;
|
|
90
|
-
}), this.lampGroupMap.set(
|
|
90
|
+
}), this.lampGroupMap.set(o, n);
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* 处理统一信控平台信号灯数据
|
|
94
94
|
* @param data
|
|
95
95
|
*/
|
|
96
96
|
handleUniSignalData(e) {
|
|
97
|
-
this.watchHandle || (this.watchHandle =
|
|
97
|
+
this.watchHandle || (this.watchHandle = m.watch(
|
|
98
98
|
() => this.view.extent,
|
|
99
99
|
() => this.updatePanelPosition()
|
|
100
100
|
));
|
|
101
|
-
const { sigId:
|
|
102
|
-
if (!
|
|
101
|
+
const { sigId: o, runningStatus: s } = e.data.basicInfo, n = this.lampGroupMap.get(o);
|
|
102
|
+
if (!n)
|
|
103
103
|
return { status: -1, message: "灯组未初始化" };
|
|
104
|
-
const
|
|
105
|
-
let
|
|
106
|
-
switch (String(
|
|
104
|
+
const a = /* @__PURE__ */ new Map();
|
|
105
|
+
let i = !1;
|
|
106
|
+
switch (String(s)) {
|
|
107
107
|
case "4": {
|
|
108
|
-
|
|
109
|
-
const { roadId:
|
|
110
|
-
|
|
111
|
-
...
|
|
108
|
+
i = !0, n.forEach((r) => {
|
|
109
|
+
const { roadId: t, dir: l } = r;
|
|
110
|
+
a.set(t, {
|
|
111
|
+
...a.get(t) || {},
|
|
112
112
|
[`${l}Number`]: "",
|
|
113
113
|
[`${l}Color`]: "yellow"
|
|
114
114
|
});
|
|
@@ -116,10 +116,10 @@ class v extends M {
|
|
|
116
116
|
break;
|
|
117
117
|
}
|
|
118
118
|
case "5": {
|
|
119
|
-
|
|
120
|
-
const { roadId:
|
|
121
|
-
|
|
122
|
-
...
|
|
119
|
+
n.forEach((r) => {
|
|
120
|
+
const { roadId: t, dir: l } = r;
|
|
121
|
+
a.set(t, {
|
|
122
|
+
...a.get(t) || {},
|
|
123
123
|
[`${l}Number`]: "",
|
|
124
124
|
[`${l}Color`]: "red"
|
|
125
125
|
});
|
|
@@ -128,10 +128,10 @@ class v extends M {
|
|
|
128
128
|
}
|
|
129
129
|
case "6":
|
|
130
130
|
case "9": {
|
|
131
|
-
|
|
132
|
-
const { roadId:
|
|
133
|
-
|
|
134
|
-
...
|
|
131
|
+
n.forEach((r) => {
|
|
132
|
+
const { roadId: t, dir: l } = r;
|
|
133
|
+
a.set(t, {
|
|
134
|
+
...a.get(t) || {},
|
|
135
135
|
[`${l}Number`]: "",
|
|
136
136
|
[`${l}Color`]: "off"
|
|
137
137
|
});
|
|
@@ -139,108 +139,108 @@ class v extends M {
|
|
|
139
139
|
break;
|
|
140
140
|
}
|
|
141
141
|
default: {
|
|
142
|
-
const { curSigColorInfo:
|
|
143
|
-
|
|
144
|
-
const l = String(
|
|
145
|
-
(
|
|
142
|
+
const { curSigColorInfo: r } = e.data;
|
|
143
|
+
r.forEach((t) => {
|
|
144
|
+
const l = String(t.lamgroupId), { color: c, leftTime: h } = t, p = n.find(
|
|
145
|
+
(f) => f.lampGroupId === l
|
|
146
146
|
);
|
|
147
147
|
if (p) {
|
|
148
|
-
const { roadId:
|
|
149
|
-
|
|
150
|
-
...
|
|
151
|
-
[`${
|
|
152
|
-
[`${
|
|
148
|
+
const { roadId: f, dir: d } = p;
|
|
149
|
+
a.set(f, {
|
|
150
|
+
...a.get(f) || {},
|
|
151
|
+
[`${d}Number`]: h,
|
|
152
|
+
[`${d}Color`]: c === 1 ? "red" : c === 2 ? "yellow" : "green"
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
return this.updateLampGroupPanelStatus(
|
|
158
|
+
return this.updateLampGroupPanelStatus(o, a, i), { status: 0, message: "ok" };
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* 根据地图比例尺计算灯组面板缩放比例
|
|
162
162
|
*/
|
|
163
163
|
getPanelScale() {
|
|
164
164
|
const e = this.view.scale;
|
|
165
|
-
let
|
|
166
|
-
return e < 500 ?
|
|
165
|
+
let o = 1;
|
|
166
|
+
return e < 500 ? o = 1.2 : e < 1e3 ? o = 1 : e < 2e3 ? o = 0.8 : e < 4e3 ? o = 0.4 : o = 0, o;
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
169
|
* 地图移动时更新灯组面板位置
|
|
170
170
|
*/
|
|
171
171
|
updatePanelPosition() {
|
|
172
172
|
const e = this.getPanelScale();
|
|
173
|
-
for (const
|
|
174
|
-
e !== this.currentPanelScale && (
|
|
175
|
-
const { mapPoint:
|
|
176
|
-
let
|
|
177
|
-
x:
|
|
178
|
-
y:
|
|
173
|
+
for (const o of this.countdownPanelProps) {
|
|
174
|
+
e !== this.currentPanelScale && (o.scale = e);
|
|
175
|
+
const { mapPoint: s } = o;
|
|
176
|
+
let n = new u({
|
|
177
|
+
x: s[0],
|
|
178
|
+
y: s[1]
|
|
179
179
|
});
|
|
180
|
-
this.view.spatialReference.isWebMercator && (
|
|
181
|
-
|
|
180
|
+
this.view.spatialReference.isWebMercator && (n = g.geographicToWebMercator(
|
|
181
|
+
n
|
|
182
182
|
));
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
const
|
|
186
|
-
|
|
183
|
+
const a = this.view.toScreen(n);
|
|
184
|
+
if (o.position.left = a.x, o.position.top = a.y, this.view.type === "3d") {
|
|
185
|
+
const i = this.getPanelRotation(o.stopLine);
|
|
186
|
+
o.rotation = i;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
this.currentPanelScale = e;
|
|
190
190
|
}
|
|
191
191
|
doHoloSignalData(e) {
|
|
192
|
-
const
|
|
193
|
-
for (const
|
|
194
|
-
let
|
|
195
|
-
for (let
|
|
196
|
-
if (
|
|
197
|
-
|
|
192
|
+
const o = e.crossId, s = e.showWaitingArea === !0, n = e.phaseCountDownList, a = /* @__PURE__ */ new Map();
|
|
193
|
+
for (const i of n) {
|
|
194
|
+
let r = "";
|
|
195
|
+
for (let h of i.roadIdList)
|
|
196
|
+
if (h.startsWith("-") && (h = h.slice(1)), this.stopLineMap.has(`${o}_${h}`)) {
|
|
197
|
+
r = `${o}_${h}`;
|
|
198
198
|
break;
|
|
199
199
|
}
|
|
200
|
-
if (!
|
|
201
|
-
console.log(`没有找到对应的进口道${
|
|
200
|
+
if (!r) {
|
|
201
|
+
console.log(`没有找到对应的进口道${o}--${r}`);
|
|
202
202
|
continue;
|
|
203
203
|
}
|
|
204
|
-
let
|
|
205
|
-
if (
|
|
204
|
+
let t = a.get(r);
|
|
205
|
+
if (t || (t = {}, a.set(r, t)), !i.direction)
|
|
206
206
|
continue;
|
|
207
|
-
const
|
|
208
|
-
|
|
207
|
+
const l = i.direction.toLowerCase(), c = i.color === 1 ? "red" : i.color === 2 ? "yellow" : "green";
|
|
208
|
+
l === "u" ? (t.uNumber = i.leftTime, t.uColor = c) : l === "l" ? (t.lNumber = i.leftTime, t.lColor = c) : l === "s" ? (t.sNumber = i.leftTime, t.sColor = c) : l === "r" && (t.rNumber = i.leftTime, t.rColor = c);
|
|
209
209
|
}
|
|
210
|
-
this.updateLampGroupPanelStatus(
|
|
210
|
+
this.updateLampGroupPanelStatus(o, a), s && this.updateWaitingArea(o, a);
|
|
211
211
|
}
|
|
212
|
-
updateWaitingArea(e,
|
|
213
|
-
|
|
214
|
-
var
|
|
215
|
-
if (
|
|
216
|
-
let
|
|
217
|
-
(
|
|
212
|
+
updateWaitingArea(e, o) {
|
|
213
|
+
o.forEach((s, n) => {
|
|
214
|
+
var a;
|
|
215
|
+
if (s.lColor) {
|
|
216
|
+
let i = this.waitingAreaLayer.graphics.find(
|
|
217
|
+
(r) => r.attributes.roadId === n && r.attributes.direction === "l"
|
|
218
218
|
);
|
|
219
|
-
if (
|
|
220
|
-
|
|
219
|
+
if (i)
|
|
220
|
+
i.attributes.color !== s.lColor && (i.attributes.color = s.lColor, i.symbol = {
|
|
221
221
|
type: "simple-fill",
|
|
222
|
-
color: this.getColor(
|
|
222
|
+
color: this.getColor(s.lColor),
|
|
223
223
|
outline: {
|
|
224
|
-
color: this.getColor(
|
|
224
|
+
color: this.getColor(s.lColor)
|
|
225
225
|
}
|
|
226
226
|
});
|
|
227
227
|
else {
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
geometry: { type: "polygon", rings:
|
|
228
|
+
const r = (a = this.waitingAreaMap.get(n)) == null ? void 0 : a.find((t) => t.direction === "l");
|
|
229
|
+
r && (i = new L({
|
|
230
|
+
geometry: { type: "polygon", rings: r.coord },
|
|
231
231
|
attributes: {
|
|
232
|
-
roadId:
|
|
232
|
+
roadId: n,
|
|
233
233
|
direction: "l",
|
|
234
|
-
color:
|
|
234
|
+
color: s.lColor
|
|
235
235
|
},
|
|
236
236
|
symbol: {
|
|
237
237
|
type: "simple-fill",
|
|
238
|
-
color: this.getColor(
|
|
238
|
+
color: this.getColor(s.lColor),
|
|
239
239
|
outline: {
|
|
240
|
-
color: this.getColor(
|
|
240
|
+
color: this.getColor(s.lColor)
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
}), this.waitingAreaLayer.add(
|
|
243
|
+
}), this.waitingAreaLayer.add(i));
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
});
|
|
@@ -248,40 +248,40 @@ class v extends M {
|
|
|
248
248
|
getColor(e) {
|
|
249
249
|
return e === "green" ? [0, 255, 0, 0.8] : e === "yellow" ? [255, 192, 2, 0.8] : [255, 0, 0, 0.8];
|
|
250
250
|
}
|
|
251
|
-
updateLampGroupPanelStatus(e,
|
|
252
|
-
|
|
253
|
-
const
|
|
254
|
-
if (!
|
|
251
|
+
updateLampGroupPanelStatus(e, o, s = !1) {
|
|
252
|
+
o.forEach((n, a) => {
|
|
253
|
+
const i = this.stopLineMap.get(a);
|
|
254
|
+
if (!i)
|
|
255
255
|
return;
|
|
256
|
-
const
|
|
257
|
-
(
|
|
256
|
+
const r = this.countdownPanelProps.find(
|
|
257
|
+
(t) => t.roadId === a
|
|
258
258
|
);
|
|
259
|
-
if (
|
|
260
|
-
|
|
259
|
+
if (r)
|
|
260
|
+
r.lampStatus = n, r.flash = s;
|
|
261
261
|
else {
|
|
262
|
-
let
|
|
263
|
-
x:
|
|
264
|
-
y:
|
|
262
|
+
let t = new u({
|
|
263
|
+
x: i.panelPoint[0],
|
|
264
|
+
y: i.panelPoint[1]
|
|
265
265
|
});
|
|
266
|
-
this.view.spatialReference.isWebMercator && (
|
|
267
|
-
|
|
266
|
+
this.view.spatialReference.isWebMercator && (t = g.geographicToWebMercator(
|
|
267
|
+
t
|
|
268
268
|
));
|
|
269
|
-
const l = this.view.toScreen(
|
|
269
|
+
const l = this.view.toScreen(t), c = this.getPanelRotation(i.coord);
|
|
270
270
|
this.countdownPanelProps.push({
|
|
271
271
|
displayMode: "complex",
|
|
272
|
-
flash:
|
|
272
|
+
flash: s,
|
|
273
273
|
crossId: e,
|
|
274
|
-
roadId:
|
|
275
|
-
mapPoint:
|
|
274
|
+
roadId: a,
|
|
275
|
+
mapPoint: i.panelPoint,
|
|
276
276
|
// 定位点地理坐标
|
|
277
|
-
stopLine:
|
|
277
|
+
stopLine: i.coord,
|
|
278
278
|
// 关联的停止线坐标
|
|
279
279
|
position: { left: l.x, top: l.y },
|
|
280
280
|
// 定位点屏幕坐标
|
|
281
281
|
rotation: c,
|
|
282
282
|
// 面板旋转角度
|
|
283
283
|
scale: this.getPanelScale(),
|
|
284
|
-
lampStatus:
|
|
284
|
+
lampStatus: n
|
|
285
285
|
// 灯组状态
|
|
286
286
|
});
|
|
287
287
|
}
|
|
@@ -293,7 +293,7 @@ class v extends M {
|
|
|
293
293
|
* @returns
|
|
294
294
|
*/
|
|
295
295
|
async handleHoloSignalData(e) {
|
|
296
|
-
this.watchHandle || (this.watchHandle =
|
|
296
|
+
this.watchHandle || (this.watchHandle = m.watch(
|
|
297
297
|
() => this.view.extent,
|
|
298
298
|
() => this.updatePanelPosition()
|
|
299
299
|
)), this.trajectoryDelayTime === 0 ? this.doHoloSignalData(e) : setTimeout(
|
|
@@ -311,15 +311,7 @@ class v extends M {
|
|
|
311
311
|
* @returns
|
|
312
312
|
*/
|
|
313
313
|
getPanelRotation(e) {
|
|
314
|
-
const
|
|
315
|
-
let n = new u({
|
|
316
|
-
x: t[0],
|
|
317
|
-
y: t[1]
|
|
318
|
-
});
|
|
319
|
-
this.view.spatialReference.isWebMercator && (n = g.geographicToWebMercator(
|
|
320
|
-
n
|
|
321
|
-
));
|
|
322
|
-
const a = this.view.toScreen(n), o = e[e.length - 1];
|
|
314
|
+
const o = e[0];
|
|
323
315
|
let s = new u({
|
|
324
316
|
x: o[0],
|
|
325
317
|
y: o[1]
|
|
@@ -327,8 +319,16 @@ class v extends M {
|
|
|
327
319
|
this.view.spatialReference.isWebMercator && (s = g.geographicToWebMercator(
|
|
328
320
|
s
|
|
329
321
|
));
|
|
330
|
-
const
|
|
331
|
-
|
|
322
|
+
const n = this.view.toScreen(s), a = e[e.length - 1];
|
|
323
|
+
let i = new u({
|
|
324
|
+
x: a[0],
|
|
325
|
+
y: a[1]
|
|
326
|
+
});
|
|
327
|
+
this.view.spatialReference.isWebMercator && (i = g.geographicToWebMercator(
|
|
328
|
+
i
|
|
329
|
+
));
|
|
330
|
+
const r = this.view.toScreen(i), t = r.x - n.x, l = r.y - n.y;
|
|
331
|
+
return Math.atan2(l, t) * (180 / Math.PI);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import L from "@arcgis/core/Graphic";
|
|
2
2
|
import m from "@arcgis/core/layers/FeatureLayer";
|
|
3
3
|
import v from "../common-utils.mjs";
|
|
4
4
|
import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as z } from "./layer-symbol.mjs";
|
|
@@ -32,7 +32,7 @@ class C {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}), i.signals.forEach((a) => {
|
|
35
|
-
const n = new
|
|
35
|
+
const n = new L({
|
|
36
36
|
geometry: {
|
|
37
37
|
type: "point",
|
|
38
38
|
longitude: a.longitude,
|
|
@@ -116,14 +116,14 @@ class C {
|
|
|
116
116
|
color: c,
|
|
117
117
|
id: d,
|
|
118
118
|
districtName: p,
|
|
119
|
-
subDistrictName:
|
|
119
|
+
subDistrictName: f,
|
|
120
120
|
signalCount: b
|
|
121
121
|
} = u.attributes;
|
|
122
122
|
n.has(o) || n.set(o, {
|
|
123
123
|
color: c,
|
|
124
124
|
signalIds: [],
|
|
125
125
|
districtName: p,
|
|
126
|
-
subDistrictName:
|
|
126
|
+
subDistrictName: f,
|
|
127
127
|
signalCount: b
|
|
128
128
|
}), (y = n.get(o)) == null || y.signalIds.push(d);
|
|
129
129
|
});
|
|
@@ -140,11 +140,11 @@ class C {
|
|
|
140
140
|
style: "solid"
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
|
-
const { districtName: d, subDistrictName: p, signalIds:
|
|
143
|
+
const { districtName: d, subDistrictName: p, signalIds: f, signalCount: b } = u[1];
|
|
144
144
|
this.roadConnections.filter(
|
|
145
145
|
(l) => l.subDistrictId === c
|
|
146
146
|
).forEach((l) => {
|
|
147
|
-
const w = new
|
|
147
|
+
const w = new L({
|
|
148
148
|
geometry: {
|
|
149
149
|
type: "polyline",
|
|
150
150
|
paths: l.coordinates
|
|
@@ -228,7 +228,7 @@ class C {
|
|
|
228
228
|
const s = this.subDistrictPointLayer.createQuery();
|
|
229
229
|
s.where = `subDistrictId = '${e}'`, s.returnGeometry = !0;
|
|
230
230
|
const t = await this.subDistrictPointLayer.queryFeatures(s);
|
|
231
|
-
return t.features.length > 0 ? (await v.viewGoto(this.view, t.features), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
231
|
+
return t.features.length > 0 ? (await v.viewGoto(this.view, t.features, !1), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
234
234
|
* 高亮子区, 其他子区隐藏
|
|
@@ -240,7 +240,7 @@ class C {
|
|
|
240
240
|
const t = this.subDistrictPointLayer.definitionExpression;
|
|
241
241
|
this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${e}'`;
|
|
242
242
|
const r = await this.subDistrictPointLayer.queryFeatures(), i = r.features.length;
|
|
243
|
-
return i > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${e}'`, s = r.features[0].attributes.districtId, await v.viewGoto(this.view, r.features)) : this.subDistrictPointLayer.definitionExpression = t, { count: i, parentId: s };
|
|
243
|
+
return i > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${e}'`, s = r.features[0].attributes.districtId, await v.viewGoto(this.view, r.features, !1)) : this.subDistrictPointLayer.definitionExpression = t, { count: i, parentId: s };
|
|
244
244
|
}
|
|
245
245
|
/**
|
|
246
246
|
* 按照区控、子区id显示子区
|
|
@@ -90,5 +90,5 @@ export default class CommonUtils {
|
|
|
90
90
|
* @returns
|
|
91
91
|
*/
|
|
92
92
|
static getCenterPointInLine(line: number[][]): number[];
|
|
93
|
-
static viewGoto(view: __esri.MapView | __esri.SceneView, target: Graphic[]): Promise<void>;
|
|
93
|
+
static viewGoto(view: __esri.MapView | __esri.SceneView, target: Graphic[], zoom?: boolean): Promise<void>;
|
|
94
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),h=require("@turf/bearing"),y=require("@turf/destination"),b=require("@turf/helpers"),S=require("@turf/length"),x=require("@turf/line-slice-along"),A=require("pako"),d=require("proj4");function P(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const g=P(L),O=P(w),f=P(b);class s{static destinationWithPoint(e,t,n){const r=f.point([e.x,e.y]),i=y(r,n,t,{units:"meters"});return new p.Point({x:i.geometry.coordinates[0],y:i.geometry.coordinates[1]})}static angleOfLine(e){const t=e.paths[0],n=f.point(t[0]),r=f.point(t[t.length-1]);return h(n,r)}static extendLineInTowDir(e,t){const n=e.paths[0],r=f.point(n[0]),i=f.point(n[1]),c=h(i,r),a=y(r,t,c,{units:"meters"}),u=c>0?c-180:c+180,o=y(i,t,u,{units:"meters"});return new p.Polyline({paths:[[a.geometry.coordinates,o.geometry.coordinates]]})}static async getIntersectPointOfTwoLines(e,t){const n=await g.intersectLinesToPoints(e,t);if(n.length)return n[0]}static async getIntersectPointsOfStopLineAndLane(e,t,n){let r=await s.getIntersectPointOfLineAndPolygon(e,t);if(await s.pointDistance(r)<3&&n){for(const i of n)if(r=await s.getIntersectPointOfLineAndPolygon(e,t,i),await s.pointDistance(r)>2.5){const c=new p.Polyline({paths:[r]});return(await s.getOffsetLine(c,-i)).paths[0]}}else return r;return[]}static async pointDistance(e){if(e.length<2)return 0;const t=new p.Polyline({paths:[e]});return await g.geodesicLength(t,"meters")}static async getIntersectPointOfLineAndPolygon(e,t,n=0){n!==0&&(e=await s.getOffsetLine(e,n));const r=await g.intersect(e,t);if(r instanceof p.Polyline){const i=r.paths[0],c=i[0],a=i[i.length-1];return[c,a]}return[]}static async getOffsetLine(e,t){const n=O.geographicToWebMercator(e),r=await g.offset(n,t,"meters");return O.webMercatorToGeographic(r,!1)}static unzip(e){try{const t=[],n=e.split("");for(let i=0;i<n.length;i++){const c=n[i];t.push(c.charCodeAt(0))}const r=new Uint8Array(t);return A.inflate(r,{to:"string"})}catch{console.log(`非压缩内容: ${e}`)}}static getStdVecEntries(e,t=!1){const n=new Array(e.size());for(let r=0;r<e.size();r++)n[r]=e.get(r);return t&&e.delete(),n}static getStdMapEntries(e){const t=[];for(const n of s.getStdMapKeys(e))t.push([n,e.get(n)]);return t}static getStdMapKeys(e,t=!1){const n=[],r=e.keys();for(let i=0;i<r.size();i++)n.push(r.get(i));return r.delete(),t&&e.delete(),n}static setGeoData(e,t,n){s.geoReference=e,s.xOffset=t,s.yOffset=n}static transformLineProjection(e){try{return e.map(t=>d(s.geoReference).inverse([t[0]-s.xOffset,t[1]-s.yOffset]))}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",s.geoReference),e}}static transformPointProjection(e){try{return d(s.geoReference).inverse([e[0]-s.xOffset,e[1]-s.yOffset])}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",s.geoReference),e}}static pointsEqual(e,t){return Math.abs(e[0]-t[0])<Number.EPSILON&&Math.abs(e[1]-t[1])<Number.EPSILON}static getExtensionLine(e,t,n){const r=f.point(e),i=f.point(t),c=h(r,i);return y(i,n,c,{units:"meters"}).geometry.coordinates}static isCoordinateValid(e){return typeof e.latitude=="string"&&(e.latitude=Number(e.latitude)),typeof e.longitude=="string"&&(e.longitude=Number(e.longitude)),e.latitude!==null&&e.longitude!==null&&!isNaN(e.latitude)&&!isNaN(e.longitude)&&e.latitude!==0&&e.longitude!==0}static getCenterPointInLine(e){const t=f.lineString(e),n=S(t,{units:"meters"})/2,r=x(t,0,n,{units:"meters"});return r.geometry.coordinates[r.geometry.coordinates.length-1]}static async viewGoto(e,t,n=!0){var c,a;const i=localStorage.getItem("gpu")!=="Unknown";if(!n){if(t.length>0){const u=t.map(o=>o.geometry).filter(o=>o);if(u.length>0){const o=(c=await g.union(u))==null?void 0:c.extent;o&&(i?await e.goTo(o.center,{duration:1e3}):e.center=o.center)}}return}if(i)await e.goTo(t,{duration:1e3});else if(t.length>0){const u=t.map(o=>o.geometry).filter(o=>o);if(u.length>0){const o=(a=await g.union(u))==null?void 0:a.extent;o&&(e.extent=o)}}}}exports.default=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),S=require("@arcgis/core/geometry/support/webMercatorUtils.js"),C=require("@arcgis/core/Graphic"),I=require("@arcgis/core/layers/GraphicsLayer"),v=require("./signal-holo-flow.js");function P(d){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const t in d)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(d,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>d[t]})}}return e.default=d,Object.freeze(e)}const y=P(M),w=P(S);class G extends v.default{constructor(e,t){var a,
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),S=require("@arcgis/core/geometry/support/webMercatorUtils.js"),C=require("@arcgis/core/Graphic"),I=require("@arcgis/core/layers/GraphicsLayer"),v=require("./signal-holo-flow.js");function P(d){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const t in d)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(d,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>d[t]})}}return e.default=d,Object.freeze(e)}const y=P(M),w=P(S);class G extends v.default{constructor(e,t){var a,r;super(e),this.waitingAreaLayer=new I,this.watchHandle=null,this.trajectoryDelayTime=2,this.stopLineMap=new Map,this.waitingAreaMap=new Map,this.lampGroupMap=new Map,this.countdownPanelProps=t,this.view.map.add(this.waitingAreaLayer),this.trajectoryDelayTime=(r=(a=this.mapConfig.holoFlow)==null?void 0:a.signal)==null?void 0:r.delay,this.trajectoryDelayTime===void 0&&(this.trajectoryDelayTime=2)}async initializeLayer(){var r,s,i,n,o;if(this.stopLineMap.size>0)return;console.time("初始化停止线图层");let e=(s=(r=this.mapConfig.holoFlow)==null?void 0:r.signal)==null?void 0:s.stopLineLayer;if(!e)return;e=this.mapConfig.assetsRoot+"/"+e;let t=await fetch(e),a=await t.json();for(const l of a.features){const{roadId:c,nodeId:h}=l.properties;let{destinationPoint:p}=l.properties;const{coordinates:f}=l.geometry;if(p){if(typeof p=="string")try{p=JSON.parse(p)}catch(u){console.error("解析面板基准点失败",u);continue}}else{const u=f[0],m=f[f.length-1],b=(u[0]+m[0])/2,L=(u[1]+m[1])/2;p=[b,L]}this.stopLineMap.set(`${h}_${c}`,{coord:f,panelPoint:p})}if(console.timeEnd("初始化停止线图层"),console.time("初始化待行区图层"),e=(n=(i=this.mapConfig.holoFlow)==null?void 0:i.signal)==null?void 0:n.waitingAreaLayer,!!e){e=this.mapConfig.assetsRoot+"/"+e,t=await fetch(e),a=await t.json();for(const l of a.features){const{roadId:c,direction:h,nodeId:p}=l.properties,{coordinates:f}=l.geometry,u=`${p}_${c}`;this.waitingAreaMap.has(u)||this.waitingAreaMap.set(u,[]),(o=this.waitingAreaMap.get(u))==null||o.push({coord:f,direction:h})}console.timeEnd("初始化待行区图层")}}initializeLampGroup(e){const{sigId:t,lampGroupList:a}=e,r=[];a.forEach(s=>{const{lampGroupNo:i,lampGroupType:n,crossFlowList:o,pedList:l}=s;if(o.length>0)for(const c of o){if(n===81)continue;const h=c.upSectionId;let p="s";switch(c.turn){case 1:p="s";break;case 2:p="l";break;case 4:p="r";break;case 8:p="u";break}r.push({lampGroupId:i,roadId:h,dir:p})}l.length>0}),this.lampGroupMap.set(t,r)}handleUniSignalData(e){this.watchHandle||(this.watchHandle=y.watch(()=>this.view.extent,()=>this.updatePanelPosition()));const{sigId:t,runningStatus:a}=e.data.basicInfo,r=this.lampGroupMap.get(t);if(!r)return{status:-1,message:"灯组未初始化"};const s=new Map;let i=!1;switch(String(a)){case"4":{i=!0,r.forEach(n=>{const{roadId:o,dir:l}=n;s.set(o,{...s.get(o)||{},[`${l}Number`]:"",[`${l}Color`]:"yellow"})});break}case"5":{r.forEach(n=>{const{roadId:o,dir:l}=n;s.set(o,{...s.get(o)||{},[`${l}Number`]:"",[`${l}Color`]:"red"})});break}case"6":case"9":{r.forEach(n=>{const{roadId:o,dir:l}=n;s.set(o,{...s.get(o)||{},[`${l}Number`]:"",[`${l}Color`]:"off"})});break}default:{const{curSigColorInfo:n}=e.data;n.forEach(o=>{const l=String(o.lamgroupId),{color:c,leftTime:h}=o,p=r.find(f=>f.lampGroupId===l);if(p){const{roadId:f,dir:u}=p;s.set(f,{...s.get(f)||{},[`${u}Number`]:h,[`${u}Color`]:c===1?"red":c===2?"yellow":"green"})}})}}return this.updateLampGroupPanelStatus(t,s,i),{status:0,message:"ok"}}getPanelScale(){const e=this.view.scale;let t=1;return e<500?t=1.2:e<1e3?t=1:e<2e3?t=.8:e<4e3?t=.4:t=0,t}updatePanelPosition(){const e=this.getPanelScale();for(const t of this.countdownPanelProps){e!==this.currentPanelScale&&(t.scale=e);const{mapPoint:a}=t;let r=new g.Point({x:a[0],y:a[1]});this.view.spatialReference.isWebMercator&&(r=w.geographicToWebMercator(r));const s=this.view.toScreen(r);if(t.position.left=s.x,t.position.top=s.y,this.view.type==="3d"){const i=this.getPanelRotation(t.stopLine);t.rotation=i}}this.currentPanelScale=e}doHoloSignalData(e){const t=e.crossId,a=e.showWaitingArea===!0,r=e.phaseCountDownList,s=new Map;for(const i of r){let n="";for(let h of i.roadIdList)if(h.startsWith("-")&&(h=h.slice(1)),this.stopLineMap.has(`${t}_${h}`)){n=`${t}_${h}`;break}if(!n){console.log(`没有找到对应的进口道${t}--${n}`);continue}let o=s.get(n);if(o||(o={},s.set(n,o)),!i.direction)continue;const l=i.direction.toLowerCase(),c=i.color===1?"red":i.color===2?"yellow":"green";l==="u"?(o.uNumber=i.leftTime,o.uColor=c):l==="l"?(o.lNumber=i.leftTime,o.lColor=c):l==="s"?(o.sNumber=i.leftTime,o.sColor=c):l==="r"&&(o.rNumber=i.leftTime,o.rColor=c)}this.updateLampGroupPanelStatus(t,s),a&&this.updateWaitingArea(t,s)}updateWaitingArea(e,t){t.forEach((a,r)=>{var s;if(a.lColor){let i=this.waitingAreaLayer.graphics.find(n=>n.attributes.roadId===r&&n.attributes.direction==="l");if(i)i.attributes.color!==a.lColor&&(i.attributes.color=a.lColor,i.symbol={type:"simple-fill",color:this.getColor(a.lColor),outline:{color:this.getColor(a.lColor)}});else{const n=(s=this.waitingAreaMap.get(r))==null?void 0:s.find(o=>o.direction==="l");n&&(i=new C({geometry:{type:"polygon",rings:n.coord},attributes:{roadId:r,direction:"l",color:a.lColor},symbol:{type:"simple-fill",color:this.getColor(a.lColor),outline:{color:this.getColor(a.lColor)}}}),this.waitingAreaLayer.add(i))}}})}getColor(e){return e==="green"?[0,255,0,.8]:e==="yellow"?[255,192,2,.8]:[255,0,0,.8]}updateLampGroupPanelStatus(e,t,a=!1){t.forEach((r,s)=>{const i=this.stopLineMap.get(s);if(!i)return;const n=this.countdownPanelProps.find(o=>o.roadId===s);if(n)n.lampStatus=r,n.flash=a;else{let o=new g.Point({x:i.panelPoint[0],y:i.panelPoint[1]});this.view.spatialReference.isWebMercator&&(o=w.geographicToWebMercator(o));const l=this.view.toScreen(o),c=this.getPanelRotation(i.coord);this.countdownPanelProps.push({displayMode:"complex",flash:a,crossId:e,roadId:s,mapPoint:i.panelPoint,stopLine:i.coord,position:{left:l.x,top:l.y},rotation:c,scale:this.getPanelScale(),lampStatus:r})}})}async handleHoloSignalData(e){this.watchHandle||(this.watchHandle=y.watch(()=>this.view.extent,()=>this.updatePanelPosition())),this.trajectoryDelayTime===0?this.doHoloSignalData(e):setTimeout(()=>this.doHoloSignalData(e),this.trajectoryDelayTime*1e3)}clearSignal(){var e;this.waitingAreaLayer.removeAll(),this.countdownPanelProps.length=0,(e=this.watchHandle)==null||e.remove(),this.watchHandle=null}getPanelRotation(e){const t=e[0];let a=new g.Point({x:t[0],y:t[1]});this.view.spatialReference.isWebMercator&&(a=w.geographicToWebMercator(a));const r=this.view.toScreen(a),s=e[e.length-1];let i=new g.Point({x:s[0],y:s[1]});this.view.spatialReference.isWebMercator&&(i=w.geographicToWebMercator(i));const n=this.view.toScreen(i),o=n.x-r.x,l=n.y-r.y;return Math.atan2(l,o)*(180/Math.PI)}}exports.default=G;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/Graphic"),v=require("@arcgis/core/layers/FeatureLayer"),m=require("../common-utils.js"),w=require("./layer-symbol.js");class g{constructor(i){this.roadConnections=[],this.view=i,this.subDistrictPointLayer=new v(w.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=i.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new v(w.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=i.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(i){await this.clearSubDistricts(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const t=[],r=[];i.forEach(e=>{e.roadConnections.length>0&&this.roadConnections.push(...e.roadConnections),r.push({value:e.id,label:e.name,symbol:{type:"simple-marker",style:"circle",color:[...e.areaColor,.8],size:"8px",outline:{color:[...e.areaColor],width:4}}}),e.signals.forEach(a=>{const u=new f({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:s++,id:a.nodeId,name:a.name,subDistrictId:e.id,subDistrictName:e.name,districtId:e.parentId,districtName:e.parentName,signalCount:e.signalCount,color:e.areaColor.join(","),type:"subDistrict"}});t.push(u)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:t})}async showRoads(i){const{type:s,id:t}=i,r=this.subDistrictPointLayer.createQuery(),e=s==="district"?"districtId":"subDistrictId";r.where=`${e} = '${t}'`;const a=await this.subDistrictPointLayer.queryFeatures(r),u=new Map;a.features.forEach(n=>{var y;const{subDistrictId:o,color:c,id:d,districtName:b,subDistrictName:L,signalCount:p}=n.attributes;u.has(o)||u.set(o,{color:c,signalIds:[],districtName:b,subDistrictName:L,signalCount:p}),(y=u.get(o))==null||y.signalIds.push(d)});const h=[],D=[];for(const n of u){let o=0;const c=n[0];h.push({value:c,symbol:{type:"simple-line",color:n[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:d,subDistrictName:b,signalIds:L,signalCount:p}=n[1];this.roadConnections.filter(l=>l.subDistrictId===c).forEach(l=>{const I=new f({geometry:{type:"polyline",paths:l.coordinates},attributes:{ObjectID:o++,id:l.id,districtId:l.districtId,subDistrictId:c,subDistrictName:b,districtName:d,signalCount:p,color:n[1].color}});D.push(I)})}this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",color:[180,180,180,.5],width:2,style:"solid"},defaultLabel:"其他子区",uniqueValueInfos:h,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentLineRenderer=this.subDistrictLineLayer.renderer.clone(),await this.subDistrictLineLayer.applyEdits({addFeatures:D})}async clearSubDistricts(){var t;const i=await this.subDistrictPointLayer.queryFeatures();i.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:i.features}),this.subDistrictPointLayer.definitionExpression="1=1";const s=await this.subDistrictLineLayer.queryFeatures();s.features.length>0&&await this.subDistrictLineLayer.applyEdits({deleteFeatures:s.features}),this.subDistrictLineLayer.definitionExpression="1=1",(t=this.clickHandler)==null||t.remove()}setVisible(i){this.subDistrictPointLayer.visible=i,this.subDistrictLineLayer.visible=i}async locateSubDistrict(i){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${i}'`,s.returnGeometry=!0;const t=await this.subDistrictPointLayer.queryFeatures(s);return t.features.length>0?(await m.default.viewGoto(this.view,t.features),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(i){let s="";const t=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${i}'`;const r=await this.subDistrictPointLayer.queryFeatures(),e=r.features.length;return e>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${i}'`,s=r.features[0].attributes.districtId,await m.default.viewGoto(this.view,r.features)):this.subDistrictPointLayer.definitionExpression=t,{count:e,parentId:s}}filter(i){const{type:s,id:t}=i,r=`${s==="district"?"districtId":"subDistrictId"} = '${t}'`;this.subDistrictPointLayer.definitionExpression=r,this.subDistrictLineLayer.definitionExpression=r}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(i){var r;const t=(r=(await this.view.hitTest(i,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(e=>e.type==="graphic");if(t.length===0)console.time("resetRenderer"),this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const e=t[0].graphic,a=e.attributes.color.split(",").map(Number);this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[180,180,180,.5],width:4}},defaultLabel:"其他子区",uniqueValueInfos:[{value:e.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[...a,.8],size:"8px",outline:{color:a,width:4}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:e.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:e.attributes.color.split(",").map(Number),width:"8px"}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}}}}exports.default=g;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/Graphic"),v=require("@arcgis/core/layers/FeatureLayer"),m=require("../common-utils.js"),w=require("./layer-symbol.js");class g{constructor(i){this.roadConnections=[],this.view=i,this.subDistrictPointLayer=new v(w.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=i.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new v(w.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=i.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(i){await this.clearSubDistricts(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const t=[],r=[];i.forEach(e=>{e.roadConnections.length>0&&this.roadConnections.push(...e.roadConnections),r.push({value:e.id,label:e.name,symbol:{type:"simple-marker",style:"circle",color:[...e.areaColor,.8],size:"8px",outline:{color:[...e.areaColor],width:4}}}),e.signals.forEach(a=>{const u=new f({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:s++,id:a.nodeId,name:a.name,subDistrictId:e.id,subDistrictName:e.name,districtId:e.parentId,districtName:e.parentName,signalCount:e.signalCount,color:e.areaColor.join(","),type:"subDistrict"}});t.push(u)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:t})}async showRoads(i){const{type:s,id:t}=i,r=this.subDistrictPointLayer.createQuery(),e=s==="district"?"districtId":"subDistrictId";r.where=`${e} = '${t}'`;const a=await this.subDistrictPointLayer.queryFeatures(r),u=new Map;a.features.forEach(n=>{var y;const{subDistrictId:o,color:c,id:d,districtName:b,subDistrictName:L,signalCount:p}=n.attributes;u.has(o)||u.set(o,{color:c,signalIds:[],districtName:b,subDistrictName:L,signalCount:p}),(y=u.get(o))==null||y.signalIds.push(d)});const h=[],D=[];for(const n of u){let o=0;const c=n[0];h.push({value:c,symbol:{type:"simple-line",color:n[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:d,subDistrictName:b,signalIds:L,signalCount:p}=n[1];this.roadConnections.filter(l=>l.subDistrictId===c).forEach(l=>{const I=new f({geometry:{type:"polyline",paths:l.coordinates},attributes:{ObjectID:o++,id:l.id,districtId:l.districtId,subDistrictId:c,subDistrictName:b,districtName:d,signalCount:p,color:n[1].color}});D.push(I)})}this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",color:[180,180,180,.5],width:2,style:"solid"},defaultLabel:"其他子区",uniqueValueInfos:h,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentLineRenderer=this.subDistrictLineLayer.renderer.clone(),await this.subDistrictLineLayer.applyEdits({addFeatures:D})}async clearSubDistricts(){var t;const i=await this.subDistrictPointLayer.queryFeatures();i.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:i.features}),this.subDistrictPointLayer.definitionExpression="1=1";const s=await this.subDistrictLineLayer.queryFeatures();s.features.length>0&&await this.subDistrictLineLayer.applyEdits({deleteFeatures:s.features}),this.subDistrictLineLayer.definitionExpression="1=1",(t=this.clickHandler)==null||t.remove()}setVisible(i){this.subDistrictPointLayer.visible=i,this.subDistrictLineLayer.visible=i}async locateSubDistrict(i){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${i}'`,s.returnGeometry=!0;const t=await this.subDistrictPointLayer.queryFeatures(s);return t.features.length>0?(await m.default.viewGoto(this.view,t.features,!1),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(i){let s="";const t=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${i}'`;const r=await this.subDistrictPointLayer.queryFeatures(),e=r.features.length;return e>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${i}'`,s=r.features[0].attributes.districtId,await m.default.viewGoto(this.view,r.features,!1)):this.subDistrictPointLayer.definitionExpression=t,{count:e,parentId:s}}filter(i){const{type:s,id:t}=i,r=`${s==="district"?"districtId":"subDistrictId"} = '${t}'`;this.subDistrictPointLayer.definitionExpression=r,this.subDistrictLineLayer.definitionExpression=r}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(i){var r;const t=(r=(await this.view.hitTest(i,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(e=>e.type==="graphic");if(t.length===0)console.time("resetRenderer"),this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const e=t[0].graphic,a=e.attributes.color.split(",").map(Number);this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[180,180,180,.5],width:4}},defaultLabel:"其他子区",uniqueValueInfos:[{value:e.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[...a,.8],size:"8px",outline:{color:a,width:4}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:e.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:e.attributes.color.split(",").map(Number),width:"8px"}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}}}}exports.default=g;
|