gisviewer-vue3-arcgis 1.0.238 → 1.0.240
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/holo-flow/signal-holo-flow-lsr.d.ts +4 -1
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +180 -133
- package/es/src/gis-map/utils/map-initializer.mjs +108 -98
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +4 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IResult, ISignalCountdownProps } from '../../../types';
|
|
2
2
|
import SignalHoloFlow from './signal-holo-flow';
|
|
3
3
|
export default class LSRSignalHoloFlow extends SignalHoloFlow {
|
|
4
|
-
private
|
|
4
|
+
private waitingAreaLayer;
|
|
5
5
|
private watchHandle;
|
|
6
6
|
private countdownPanelProps;
|
|
7
7
|
private currentPanelScale;
|
|
@@ -9,6 +9,7 @@ export default class LSRSignalHoloFlow extends SignalHoloFlow {
|
|
|
9
9
|
private trajectoryDelayTime;
|
|
10
10
|
/** 按照路口id->进口道路段id->停止线坐标保存的停止线 */
|
|
11
11
|
private stopLineMap;
|
|
12
|
+
private waitingAreaMap;
|
|
12
13
|
/** 信号机id->进口道id->灯组id */
|
|
13
14
|
private lampGroupMap;
|
|
14
15
|
constructor(view: __esri.MapView | __esri.SceneView, countdownPanelInfos: ISignalCountdownProps[]);
|
|
@@ -35,6 +36,8 @@ export default class LSRSignalHoloFlow extends SignalHoloFlow {
|
|
|
35
36
|
*/
|
|
36
37
|
private updatePanelPosition;
|
|
37
38
|
private doHoloSignalData;
|
|
39
|
+
private updateWaitingArea;
|
|
40
|
+
private getColor;
|
|
38
41
|
private updateLampGroupPanelStatus;
|
|
39
42
|
/**
|
|
40
43
|
* 处理全息流信号灯数据
|
|
@@ -1,62 +1,70 @@
|
|
|
1
1
|
import * as w from "@arcgis/core/core/reactiveUtils";
|
|
2
|
-
import { Point as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { Point as u } from "@arcgis/core/geometry";
|
|
3
|
+
import * as g from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
4
|
+
import L from "@arcgis/core/Graphic";
|
|
5
|
+
import b from "@arcgis/core/layers/GraphicsLayer";
|
|
6
|
+
import M from "./signal-holo-flow.mjs";
|
|
7
|
+
class v extends M {
|
|
8
|
+
constructor(e, t) {
|
|
9
|
+
var n, a;
|
|
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 = t, this.view.map.add(this.waitingAreaLayer), this.trajectoryDelayTime = (a = (n = this.mapConfig.holoFlow) == null ? void 0 : n.signal) == null ? void 0 : a.delay, this.trajectoryDelayTime === void 0 && (this.trajectoryDelayTime = 2);
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* 读取停止线图层,将灯组面板沿着停止线放置
|
|
13
14
|
* @returns
|
|
14
15
|
*/
|
|
15
16
|
async initializeLayer() {
|
|
16
|
-
var i,
|
|
17
|
+
var a, o, s, i, r;
|
|
17
18
|
if (this.stopLineMap.size > 0)
|
|
18
19
|
return;
|
|
19
20
|
console.time("初始化停止线图层");
|
|
20
|
-
let e = (
|
|
21
|
+
let e = (o = (a = this.mapConfig.holoFlow) == null ? void 0 : a.signal) == null ? void 0 : o.stopLineLayer;
|
|
21
22
|
if (!e)
|
|
22
23
|
return;
|
|
23
24
|
e = this.mapConfig.assetsRoot + "/" + e;
|
|
24
|
-
|
|
25
|
-
for (const
|
|
26
|
-
const { roadId:
|
|
27
|
-
let { destinationPoint:
|
|
28
|
-
const { coordinates:
|
|
29
|
-
if (
|
|
30
|
-
if (typeof
|
|
25
|
+
let t = await fetch(e), n = await t.json();
|
|
26
|
+
for (const l of n.features) {
|
|
27
|
+
const { roadId: c, nodeId: d } = l.properties;
|
|
28
|
+
let { destinationPoint: p } = l.properties;
|
|
29
|
+
const { coordinates: h } = l.geometry;
|
|
30
|
+
if (p) {
|
|
31
|
+
if (typeof p == "string")
|
|
31
32
|
try {
|
|
32
|
-
|
|
33
|
-
} catch (
|
|
34
|
-
console.error("解析面板基准点失败",
|
|
33
|
+
p = JSON.parse(p);
|
|
34
|
+
} catch (f) {
|
|
35
|
+
console.error("解析面板基准点失败", f);
|
|
35
36
|
continue;
|
|
36
37
|
}
|
|
37
38
|
} else {
|
|
38
|
-
const
|
|
39
|
-
|
|
39
|
+
const f = h[0], m = h[h.length - 1], y = (f[0] + m[0]) / 2, P = (f[1] + m[1]) / 2;
|
|
40
|
+
p = [y, P];
|
|
40
41
|
}
|
|
41
|
-
this.stopLineMap.set(
|
|
42
|
-
coord:
|
|
43
|
-
panelPoint:
|
|
42
|
+
this.stopLineMap.set(`${d}_${c}`, {
|
|
43
|
+
coord: h,
|
|
44
|
+
panelPoint: p
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
|
-
console.timeEnd("初始化停止线图层")
|
|
47
|
+
if (console.timeEnd("初始化停止线图层"), console.time("初始化待行区图层"), e = (i = (s = this.mapConfig.holoFlow) == null ? void 0 : s.signal) == null ? void 0 : i.waitingAreaLayer, !!e) {
|
|
48
|
+
e = this.mapConfig.assetsRoot + "/" + e, t = await fetch(e), n = await t.json();
|
|
49
|
+
for (const l of n.features) {
|
|
50
|
+
const { roadId: c, direction: d, nodeId: p } = l.properties, { coordinates: h } = l.geometry, f = `${p}_${c}`;
|
|
51
|
+
this.waitingAreaMap.has(f) || this.waitingAreaMap.set(f, []), (r = this.waitingAreaMap.get(f)) == null || r.push({ coord: h, direction: d });
|
|
52
|
+
}
|
|
53
|
+
console.timeEnd("初始化待行区图层");
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
56
|
/**
|
|
49
57
|
* 初始化灯组与进口道的关联关系
|
|
50
58
|
*/
|
|
51
59
|
initializeLampGroup(e) {
|
|
52
|
-
const { sigId:
|
|
53
|
-
|
|
54
|
-
const { lampGroupNo:
|
|
55
|
-
if (
|
|
56
|
-
for (const c of
|
|
57
|
-
if (
|
|
60
|
+
const { sigId: t, lampGroupList: n } = e, a = [];
|
|
61
|
+
n.forEach((o) => {
|
|
62
|
+
const { lampGroupNo: s, lampGroupType: i, crossFlowList: r, pedList: l } = o;
|
|
63
|
+
if (r.length > 0)
|
|
64
|
+
for (const c of r) {
|
|
65
|
+
if (i === 81)
|
|
58
66
|
continue;
|
|
59
|
-
const
|
|
67
|
+
const d = c.upSectionId;
|
|
60
68
|
let p = "s";
|
|
61
69
|
switch (c.turn) {
|
|
62
70
|
case 1:
|
|
@@ -72,14 +80,14 @@ class M extends P {
|
|
|
72
80
|
p = "u";
|
|
73
81
|
break;
|
|
74
82
|
}
|
|
75
|
-
|
|
76
|
-
lampGroupId:
|
|
77
|
-
roadId:
|
|
83
|
+
a.push({
|
|
84
|
+
lampGroupId: s,
|
|
85
|
+
roadId: d,
|
|
78
86
|
dir: p
|
|
79
87
|
});
|
|
80
88
|
}
|
|
81
|
-
|
|
82
|
-
}), this.lampGroupMap.set(
|
|
89
|
+
l.length > 0;
|
|
90
|
+
}), this.lampGroupMap.set(t, a);
|
|
83
91
|
}
|
|
84
92
|
/**
|
|
85
93
|
* 处理统一信控平台信号灯数据
|
|
@@ -90,151 +98,190 @@ class M extends P {
|
|
|
90
98
|
() => this.view.extent,
|
|
91
99
|
() => this.updatePanelPosition()
|
|
92
100
|
));
|
|
93
|
-
const { sigId:
|
|
94
|
-
if (!
|
|
101
|
+
const { sigId: t, runningStatus: n } = e.data.basicInfo, a = this.lampGroupMap.get(t);
|
|
102
|
+
if (!a)
|
|
95
103
|
return { status: -1, message: "灯组未初始化" };
|
|
96
|
-
const
|
|
97
|
-
let
|
|
98
|
-
switch (String(
|
|
104
|
+
const o = /* @__PURE__ */ new Map();
|
|
105
|
+
let s = !1;
|
|
106
|
+
switch (String(n)) {
|
|
99
107
|
case "4": {
|
|
100
|
-
|
|
101
|
-
const { roadId:
|
|
102
|
-
|
|
103
|
-
...
|
|
104
|
-
[`${
|
|
105
|
-
[`${
|
|
108
|
+
s = !0, a.forEach((i) => {
|
|
109
|
+
const { roadId: r, dir: l } = i;
|
|
110
|
+
o.set(r, {
|
|
111
|
+
...o.get(r) || {},
|
|
112
|
+
[`${l}Number`]: "",
|
|
113
|
+
[`${l}Color`]: "yellow"
|
|
106
114
|
});
|
|
107
115
|
});
|
|
108
116
|
break;
|
|
109
117
|
}
|
|
110
118
|
case "5": {
|
|
111
|
-
|
|
112
|
-
const { roadId:
|
|
113
|
-
|
|
114
|
-
...
|
|
115
|
-
[`${
|
|
116
|
-
[`${
|
|
119
|
+
a.forEach((i) => {
|
|
120
|
+
const { roadId: r, dir: l } = i;
|
|
121
|
+
o.set(r, {
|
|
122
|
+
...o.get(r) || {},
|
|
123
|
+
[`${l}Number`]: "",
|
|
124
|
+
[`${l}Color`]: "red"
|
|
117
125
|
});
|
|
118
126
|
});
|
|
119
127
|
break;
|
|
120
128
|
}
|
|
121
129
|
case "6":
|
|
122
130
|
case "9": {
|
|
123
|
-
|
|
124
|
-
const { roadId:
|
|
125
|
-
|
|
126
|
-
...
|
|
127
|
-
[`${
|
|
128
|
-
[`${
|
|
131
|
+
a.forEach((i) => {
|
|
132
|
+
const { roadId: r, dir: l } = i;
|
|
133
|
+
o.set(r, {
|
|
134
|
+
...o.get(r) || {},
|
|
135
|
+
[`${l}Number`]: "",
|
|
136
|
+
[`${l}Color`]: "off"
|
|
129
137
|
});
|
|
130
138
|
});
|
|
131
139
|
break;
|
|
132
140
|
}
|
|
133
141
|
default: {
|
|
134
|
-
const { curSigColorInfo:
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
(
|
|
142
|
+
const { curSigColorInfo: i } = e.data;
|
|
143
|
+
i.forEach((r) => {
|
|
144
|
+
const l = String(r.lamgroupId), { color: c, leftTime: d } = r, p = a.find(
|
|
145
|
+
(h) => h.lampGroupId === l
|
|
138
146
|
);
|
|
139
147
|
if (p) {
|
|
140
|
-
const { roadId:
|
|
141
|
-
|
|
142
|
-
...
|
|
143
|
-
[`${
|
|
144
|
-
[`${
|
|
148
|
+
const { roadId: h, dir: f } = p;
|
|
149
|
+
o.set(h, {
|
|
150
|
+
...o.get(h) || {},
|
|
151
|
+
[`${f}Number`]: d,
|
|
152
|
+
[`${f}Color`]: c === 1 ? "red" : c === 2 ? "yellow" : "green"
|
|
145
153
|
});
|
|
146
154
|
}
|
|
147
155
|
});
|
|
148
156
|
}
|
|
149
157
|
}
|
|
150
|
-
return this.updateLampGroupPanelStatus(
|
|
158
|
+
return this.updateLampGroupPanelStatus(t, o, s), { status: 0, message: "ok" };
|
|
151
159
|
}
|
|
152
160
|
/**
|
|
153
161
|
* 根据地图比例尺计算灯组面板缩放比例
|
|
154
162
|
*/
|
|
155
163
|
getPanelScale() {
|
|
156
164
|
const e = this.view.scale;
|
|
157
|
-
let
|
|
158
|
-
return e < 500 ?
|
|
165
|
+
let t = 1;
|
|
166
|
+
return e < 500 ? t = 1.2 : e < 1e3 ? t = 1 : e < 2e3 ? t = 0.8 : e < 4e3 ? t = 0.4 : t = 0, t;
|
|
159
167
|
}
|
|
160
168
|
/**
|
|
161
169
|
* 地图移动时更新灯组面板位置
|
|
162
170
|
*/
|
|
163
171
|
updatePanelPosition() {
|
|
164
172
|
const e = this.getPanelScale();
|
|
165
|
-
for (const
|
|
166
|
-
e !== this.currentPanelScale && (
|
|
167
|
-
const { mapPoint:
|
|
168
|
-
let
|
|
169
|
-
x:
|
|
170
|
-
y:
|
|
173
|
+
for (const t of this.countdownPanelProps) {
|
|
174
|
+
e !== this.currentPanelScale && (t.scale = e);
|
|
175
|
+
const { mapPoint: n } = t;
|
|
176
|
+
let a = new u({
|
|
177
|
+
x: n[0],
|
|
178
|
+
y: n[1]
|
|
171
179
|
});
|
|
172
|
-
this.view.spatialReference.isWebMercator && (
|
|
173
|
-
|
|
180
|
+
this.view.spatialReference.isWebMercator && (a = g.geographicToWebMercator(
|
|
181
|
+
a
|
|
174
182
|
));
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
const
|
|
178
|
-
|
|
183
|
+
const o = this.view.toScreen(a);
|
|
184
|
+
if (t.position.left = o.x, t.position.top = o.y, this.view.type === "3d") {
|
|
185
|
+
const s = this.getPanelRotation(t.stopLine);
|
|
186
|
+
t.rotation = s;
|
|
179
187
|
}
|
|
180
188
|
}
|
|
181
189
|
this.currentPanelScale = e;
|
|
182
190
|
}
|
|
183
191
|
doHoloSignalData(e) {
|
|
184
|
-
const
|
|
185
|
-
for (const
|
|
186
|
-
let
|
|
187
|
-
for (let c of
|
|
188
|
-
if (c.startsWith("-") && (c = c.slice(1)), this.stopLineMap.has(c)) {
|
|
189
|
-
|
|
192
|
+
const t = e.crossId, n = e.phaseCountDownList, a = /* @__PURE__ */ new Map();
|
|
193
|
+
for (const o of n) {
|
|
194
|
+
let s = "";
|
|
195
|
+
for (let c of o.roadIdList)
|
|
196
|
+
if (c.startsWith("-") && (c = c.slice(1)), this.stopLineMap.has(`${t}_${c}`)) {
|
|
197
|
+
s = `${t}_${c}`;
|
|
190
198
|
break;
|
|
191
199
|
}
|
|
192
|
-
if (!
|
|
193
|
-
console.log(`没有找到对应的进口道${
|
|
200
|
+
if (!s) {
|
|
201
|
+
console.log(`没有找到对应的进口道${t}--${s}`);
|
|
194
202
|
continue;
|
|
195
203
|
}
|
|
196
|
-
let
|
|
197
|
-
if (
|
|
204
|
+
let i = a.get(s);
|
|
205
|
+
if (i || (i = {}, a.set(s, i)), !o.direction)
|
|
198
206
|
continue;
|
|
199
|
-
const
|
|
200
|
-
|
|
207
|
+
const r = o.direction.toLowerCase(), l = o.color === 1 ? "red" : o.color === 2 ? "yellow" : "green";
|
|
208
|
+
r === "u" ? (i.uNumber = o.leftTime, i.uColor = l) : r === "l" ? (i.lNumber = o.leftTime, i.lColor = l) : r === "s" ? (i.sNumber = o.leftTime, i.sColor = l) : r === "r" && (i.rNumber = o.leftTime, i.rColor = l);
|
|
201
209
|
}
|
|
202
|
-
this.updateLampGroupPanelStatus(
|
|
210
|
+
this.updateLampGroupPanelStatus(t, a), this.updateWaitingArea(t, a);
|
|
211
|
+
}
|
|
212
|
+
updateWaitingArea(e, t) {
|
|
213
|
+
t.forEach((n, a) => {
|
|
214
|
+
var o;
|
|
215
|
+
if (n.lColor) {
|
|
216
|
+
let s = this.waitingAreaLayer.graphics.find(
|
|
217
|
+
(i) => i.attributes.roadId === a && i.attributes.direction === "l"
|
|
218
|
+
);
|
|
219
|
+
if (s)
|
|
220
|
+
s.attributes.color !== n.lColor && (s.attributes.color = n.lColor, s.symbol = {
|
|
221
|
+
type: "simple-fill",
|
|
222
|
+
color: this.getColor(n.lColor),
|
|
223
|
+
outline: {
|
|
224
|
+
color: this.getColor(n.lColor)
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
else {
|
|
228
|
+
const i = (o = this.waitingAreaMap.get(a)) == null ? void 0 : o.find((r) => r.direction === "l");
|
|
229
|
+
i && (s = new L({
|
|
230
|
+
geometry: { type: "polygon", rings: i.coord },
|
|
231
|
+
attributes: {
|
|
232
|
+
roadId: a,
|
|
233
|
+
direction: "l",
|
|
234
|
+
color: n.lColor
|
|
235
|
+
},
|
|
236
|
+
symbol: {
|
|
237
|
+
type: "simple-fill",
|
|
238
|
+
color: this.getColor(n.lColor),
|
|
239
|
+
outline: {
|
|
240
|
+
color: this.getColor(n.lColor)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}), this.waitingAreaLayer.add(s));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
getColor(e) {
|
|
249
|
+
return e === "green" ? [0, 255, 0, 0.8] : e === "yellow" ? [255, 192, 2, 0.8] : [255, 0, 0, 0.8];
|
|
203
250
|
}
|
|
204
|
-
updateLampGroupPanelStatus(e,
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
if (!
|
|
251
|
+
updateLampGroupPanelStatus(e, t, n = !1) {
|
|
252
|
+
t.forEach((a, o) => {
|
|
253
|
+
const s = this.stopLineMap.get(o);
|
|
254
|
+
if (!s)
|
|
208
255
|
return;
|
|
209
|
-
const
|
|
210
|
-
(
|
|
256
|
+
const i = this.countdownPanelProps.find(
|
|
257
|
+
(r) => r.roadId === o
|
|
211
258
|
);
|
|
212
|
-
if (
|
|
213
|
-
|
|
259
|
+
if (i)
|
|
260
|
+
i.lampStatus = a, i.flash = n;
|
|
214
261
|
else {
|
|
215
|
-
let
|
|
216
|
-
x:
|
|
217
|
-
y:
|
|
262
|
+
let r = new u({
|
|
263
|
+
x: s.panelPoint[0],
|
|
264
|
+
y: s.panelPoint[1]
|
|
218
265
|
});
|
|
219
|
-
this.view.spatialReference.isWebMercator && (
|
|
220
|
-
|
|
266
|
+
this.view.spatialReference.isWebMercator && (r = g.geographicToWebMercator(
|
|
267
|
+
r
|
|
221
268
|
));
|
|
222
|
-
const
|
|
269
|
+
const l = this.view.toScreen(r), c = this.getPanelRotation(s.coord);
|
|
223
270
|
this.countdownPanelProps.push({
|
|
224
271
|
displayMode: "complex",
|
|
225
|
-
flash:
|
|
272
|
+
flash: n,
|
|
226
273
|
crossId: e,
|
|
227
|
-
roadId:
|
|
228
|
-
mapPoint:
|
|
274
|
+
roadId: o,
|
|
275
|
+
mapPoint: s.panelPoint,
|
|
229
276
|
// 定位点地理坐标
|
|
230
|
-
stopLine:
|
|
277
|
+
stopLine: s.coord,
|
|
231
278
|
// 关联的停止线坐标
|
|
232
|
-
position: { left:
|
|
279
|
+
position: { left: l.x, top: l.y },
|
|
233
280
|
// 定位点屏幕坐标
|
|
234
281
|
rotation: c,
|
|
235
282
|
// 面板旋转角度
|
|
236
283
|
scale: this.getPanelScale(),
|
|
237
|
-
lampStatus:
|
|
284
|
+
lampStatus: a
|
|
238
285
|
// 灯组状态
|
|
239
286
|
});
|
|
240
287
|
}
|
|
@@ -256,7 +303,7 @@ class M extends P {
|
|
|
256
303
|
}
|
|
257
304
|
clearSignal() {
|
|
258
305
|
var e;
|
|
259
|
-
this.
|
|
306
|
+
this.waitingAreaLayer.removeAll(), this.countdownPanelProps.length = 0, (e = this.watchHandle) == null || e.remove(), this.watchHandle = null;
|
|
260
307
|
}
|
|
261
308
|
/**
|
|
262
309
|
* 从停止线坐标计算面板旋转角度
|
|
@@ -264,26 +311,26 @@ class M extends P {
|
|
|
264
311
|
* @returns
|
|
265
312
|
*/
|
|
266
313
|
getPanelRotation(e) {
|
|
267
|
-
const
|
|
268
|
-
let
|
|
269
|
-
x: s[0],
|
|
270
|
-
y: s[1]
|
|
271
|
-
});
|
|
272
|
-
this.view.spatialReference.isWebMercator && (l = u.geographicToWebMercator(
|
|
273
|
-
l
|
|
274
|
-
));
|
|
275
|
-
const i = this.view.toScreen(l), t = e[e.length - 1];
|
|
276
|
-
let n = new d({
|
|
314
|
+
const t = e[0];
|
|
315
|
+
let n = new u({
|
|
277
316
|
x: t[0],
|
|
278
317
|
y: t[1]
|
|
279
318
|
});
|
|
280
|
-
this.view.spatialReference.isWebMercator && (n =
|
|
319
|
+
this.view.spatialReference.isWebMercator && (n = g.geographicToWebMercator(
|
|
281
320
|
n
|
|
282
321
|
));
|
|
283
|
-
const a = this.view.toScreen(n), o =
|
|
284
|
-
|
|
322
|
+
const a = this.view.toScreen(n), o = e[e.length - 1];
|
|
323
|
+
let s = new u({
|
|
324
|
+
x: o[0],
|
|
325
|
+
y: o[1]
|
|
326
|
+
});
|
|
327
|
+
this.view.spatialReference.isWebMercator && (s = g.geographicToWebMercator(
|
|
328
|
+
s
|
|
329
|
+
));
|
|
330
|
+
const i = this.view.toScreen(s), r = i.x - a.x, l = i.y - a.y;
|
|
331
|
+
return Math.atan2(l, r) * (180 / Math.PI);
|
|
285
332
|
}
|
|
286
333
|
}
|
|
287
334
|
export {
|
|
288
|
-
|
|
335
|
+
v as default
|
|
289
336
|
};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import { Multipoint as
|
|
5
|
-
import * as
|
|
1
|
+
import k from "@arcgis/core/Basemap";
|
|
2
|
+
import u from "@arcgis/core/config";
|
|
3
|
+
import * as T from "@arcgis/core/core/reactiveUtils";
|
|
4
|
+
import { Multipoint as P, Polygon as W, Polyline as z, Point as C } from "@arcgis/core/geometry";
|
|
5
|
+
import * as g from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
6
6
|
import x from "@arcgis/core/layers/FeatureLayer";
|
|
7
7
|
import I from "@arcgis/core/layers/GeoJSONLayer";
|
|
8
|
-
import R from "@arcgis/core/layers/
|
|
8
|
+
import R from "@arcgis/core/layers/GroupLayer";
|
|
9
|
+
import G from "@arcgis/core/layers/IntegratedMesh3DTilesLayer";
|
|
9
10
|
import H from "@arcgis/core/layers/MapImageLayer";
|
|
10
|
-
import
|
|
11
|
+
import B from "@arcgis/core/layers/TileLayer";
|
|
11
12
|
import O from "@arcgis/core/layers/WebTileLayer";
|
|
12
13
|
import S from "@arcgis/core/Map";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import * as
|
|
17
|
-
import
|
|
18
|
-
function
|
|
19
|
-
return
|
|
14
|
+
import N from "@arcgis/core/views/MapView";
|
|
15
|
+
import E from "@arcgis/core/views/SceneView";
|
|
16
|
+
import A from "@turf/destination";
|
|
17
|
+
import * as J from "@turf/helpers";
|
|
18
|
+
import K from "./custom-layer/custom-wmts-layer.mjs";
|
|
19
|
+
function L(l, e) {
|
|
20
|
+
return l && (l.startsWith("http://") || l.startsWith("https://") ? l : e + l);
|
|
20
21
|
}
|
|
21
|
-
class
|
|
22
|
+
class oe {
|
|
22
23
|
constructor() {
|
|
23
24
|
this.mapConfig = {}, this.watchHandleMap = /* @__PURE__ */ new Map(), this.handleIndex = 0, this.zoomWatchHandle = null;
|
|
24
25
|
}
|
|
@@ -28,19 +29,19 @@ class te {
|
|
|
28
29
|
* @returns view
|
|
29
30
|
*/
|
|
30
31
|
async initialize(e) {
|
|
31
|
-
var
|
|
32
|
+
var f, b, v, y;
|
|
32
33
|
this.mapConfig = e.mapConfig;
|
|
33
|
-
const { container: i, markerClickCallback: o, mapClickCallback:
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
if (((
|
|
37
|
-
map:
|
|
34
|
+
const { container: i, markerClickCallback: o, mapClickCallback: a } = e;
|
|
35
|
+
u.assetsPath = `${this.mapConfig.assetsRoot}/ArcgisAssets`, u.fontsUrl = `${this.mapConfig.assetsRoot}/fonts`, u.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
|
|
36
|
+
const r = new S();
|
|
37
|
+
if (((f = this.mapConfig) == null ? void 0 : f.mapOptions.mode.toLowerCase()) === "2d" ? (this.view = new N({
|
|
38
|
+
map: r,
|
|
38
39
|
container: i,
|
|
39
40
|
...this.mapConfig.mapOptions
|
|
40
41
|
}), this.view.on("drag", (t) => {
|
|
41
42
|
t.button === 2 && t.stopPropagation();
|
|
42
|
-
})) : this.view = new
|
|
43
|
-
map:
|
|
43
|
+
})) : this.view = new E({
|
|
44
|
+
map: r,
|
|
44
45
|
container: i,
|
|
45
46
|
environment: {
|
|
46
47
|
atmosphereEnabled: !0,
|
|
@@ -48,7 +49,7 @@ class te {
|
|
|
48
49
|
type: "virtual"
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
|
-
...(
|
|
52
|
+
...(b = this.mapConfig) == null ? void 0 : b.mapOptions
|
|
52
53
|
}), this.view.popup.visibleElements = {
|
|
53
54
|
closeButton: !0,
|
|
54
55
|
collapseButton: !1,
|
|
@@ -58,109 +59,118 @@ class te {
|
|
|
58
59
|
buttonEnabled: !1,
|
|
59
60
|
breakpoint: !1
|
|
60
61
|
}, this.view.on("click", async (t) => {
|
|
61
|
-
var
|
|
62
|
-
if (
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
)),
|
|
67
|
-
[
|
|
62
|
+
var h, M;
|
|
63
|
+
if (a) {
|
|
64
|
+
let s = t.mapPoint;
|
|
65
|
+
s.spatialReference.isWebMercator && (s = g.webMercatorToGeographic(
|
|
66
|
+
s
|
|
67
|
+
)), a(
|
|
68
|
+
[s.x, s.y],
|
|
68
69
|
[t.screenPoint.x, t.screenPoint.y],
|
|
69
70
|
t
|
|
70
71
|
);
|
|
71
72
|
}
|
|
72
73
|
if (this.view.type === "3d") {
|
|
73
|
-
const
|
|
74
|
+
const s = this.view.camera;
|
|
74
75
|
if (this.view.spatialReference.isWebMercator) {
|
|
75
|
-
const m =
|
|
76
|
-
|
|
77
|
-
),
|
|
78
|
-
heading:
|
|
79
|
-
tilt:
|
|
76
|
+
const m = g.webMercatorToGeographic(
|
|
77
|
+
s.position
|
|
78
|
+
), w = {
|
|
79
|
+
heading: s.heading,
|
|
80
|
+
tilt: s.tilt,
|
|
80
81
|
position: m.toJSON()
|
|
81
82
|
};
|
|
82
|
-
console.log(
|
|
83
|
+
console.log(w), (h = navigator.clipboard) == null || h.writeText(JSON.stringify(w));
|
|
83
84
|
} else
|
|
84
|
-
console.log(
|
|
85
|
+
console.log(s.toJSON());
|
|
85
86
|
console.log(this.view.zoom, this.view.scale);
|
|
86
87
|
} else {
|
|
87
|
-
let
|
|
88
|
-
this.view.spatialReference.isWebMercator && (
|
|
89
|
-
|
|
88
|
+
let s = this.view.center;
|
|
89
|
+
this.view.spatialReference.isWebMercator && (s = g.webMercatorToGeographic(
|
|
90
|
+
s
|
|
90
91
|
)), console.log({
|
|
91
|
-
center:
|
|
92
|
+
center: s.toJSON(),
|
|
92
93
|
zoom: this.view.zoom,
|
|
93
94
|
scale: this.view.scale
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
97
|
const n = (M = (await this.view.hitTest(t)).results) == null ? void 0 : M.filter(
|
|
97
|
-
(
|
|
98
|
+
(s) => s.type === "graphic"
|
|
98
99
|
);
|
|
99
|
-
n.length > 0 && n.forEach((
|
|
100
|
-
var
|
|
101
|
-
const m =
|
|
102
|
-
(
|
|
100
|
+
n.length > 0 && n.forEach((s) => {
|
|
101
|
+
var w;
|
|
102
|
+
const m = s.graphic;
|
|
103
|
+
(w = m.attributes) != null && w.type && o && o(
|
|
103
104
|
m.attributes.type,
|
|
104
105
|
m.attributes.id,
|
|
105
106
|
m.attributes,
|
|
106
107
|
t
|
|
107
108
|
);
|
|
108
109
|
});
|
|
109
|
-
}), (
|
|
110
|
-
const c =
|
|
110
|
+
}), (v = this.mapConfig) != null && v.baseLayers ? this.mapConfig.baseLayers.forEach((t) => {
|
|
111
|
+
const c = L(t.url, this.mapConfig.assetsRoot);
|
|
112
|
+
let n = null;
|
|
111
113
|
switch (t.type.toLowerCase()) {
|
|
112
114
|
case "webTile".toLowerCase(): {
|
|
113
|
-
|
|
115
|
+
n = new O({
|
|
114
116
|
urlTemplate: c,
|
|
115
117
|
...t.options
|
|
116
118
|
});
|
|
117
|
-
s.add(n);
|
|
118
119
|
break;
|
|
119
120
|
}
|
|
120
121
|
case "tile": {
|
|
121
|
-
|
|
122
|
+
n = new B({
|
|
122
123
|
url: c,
|
|
123
124
|
...t.options
|
|
124
125
|
});
|
|
125
|
-
s.add(n);
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
128
128
|
case "customWMTS".toLowerCase(): {
|
|
129
|
-
|
|
129
|
+
n = new K({
|
|
130
130
|
urlTemplate: c,
|
|
131
131
|
...t.options
|
|
132
132
|
});
|
|
133
|
-
s.add(n);
|
|
134
133
|
break;
|
|
135
134
|
}
|
|
136
135
|
case "mapImage".toLowerCase(): {
|
|
137
|
-
|
|
136
|
+
n = new H({
|
|
138
137
|
url: c,
|
|
139
138
|
...t.options
|
|
140
139
|
});
|
|
141
|
-
s.add(n);
|
|
142
140
|
break;
|
|
143
141
|
}
|
|
144
142
|
case "arcgis": {
|
|
145
|
-
const
|
|
146
|
-
|
|
143
|
+
const h = new k(t.options);
|
|
144
|
+
r.basemap = h;
|
|
147
145
|
break;
|
|
148
146
|
}
|
|
149
147
|
case "feature": {
|
|
150
|
-
|
|
151
|
-
s.add(n);
|
|
148
|
+
n = new x({ url: c, ...t.options });
|
|
152
149
|
break;
|
|
153
150
|
}
|
|
154
151
|
case "3dtiles": {
|
|
155
|
-
|
|
152
|
+
n = new G({
|
|
156
153
|
url: c,
|
|
157
154
|
...t.options
|
|
158
155
|
});
|
|
159
|
-
s.add(n);
|
|
160
156
|
break;
|
|
161
157
|
}
|
|
158
|
+
default:
|
|
159
|
+
console.warn(`不支持的图层类型: ${t.type}`);
|
|
160
|
+
break;
|
|
162
161
|
}
|
|
163
|
-
|
|
162
|
+
if (n)
|
|
163
|
+
if (t.group) {
|
|
164
|
+
let h = r.findLayerById(t.group);
|
|
165
|
+
console.log(h), h && h.type === "group" ? h.add(n) : (h = new R({
|
|
166
|
+
id: t.group,
|
|
167
|
+
title: t.groupTitle,
|
|
168
|
+
visibilityMode: "inherited",
|
|
169
|
+
layers: [n]
|
|
170
|
+
}), r.add(h));
|
|
171
|
+
} else
|
|
172
|
+
r.add(n);
|
|
173
|
+
}) : r.basemap = new k({
|
|
164
174
|
style: {
|
|
165
175
|
id: "arcgis/light-gray",
|
|
166
176
|
language: "zh-CN"
|
|
@@ -170,37 +180,37 @@ class te {
|
|
|
170
180
|
(c) => (
|
|
171
181
|
// 图层文件为GeoJson格式, renderer和symbol使用autocast配置
|
|
172
182
|
new I({
|
|
173
|
-
url:
|
|
183
|
+
url: L(c.url, this.mapConfig.assetsRoot),
|
|
174
184
|
...c.options,
|
|
175
185
|
title: c.options.id
|
|
176
186
|
})
|
|
177
187
|
)
|
|
178
188
|
);
|
|
179
|
-
|
|
189
|
+
r.addMany(t);
|
|
180
190
|
}
|
|
181
191
|
this.view.ui.remove("attribution"), await this.view.when();
|
|
182
|
-
const
|
|
183
|
-
let
|
|
192
|
+
const d = this.mapConfig.camera;
|
|
193
|
+
let p;
|
|
184
194
|
if (this.view.type === "2d") {
|
|
185
195
|
let t = this.view.center;
|
|
186
|
-
this.view.spatialReference.isWebMercator && (t =
|
|
196
|
+
this.view.spatialReference.isWebMercator && (t = g.webMercatorToGeographic(
|
|
187
197
|
t
|
|
188
|
-
)),
|
|
198
|
+
)), p = { center: [t.x, t.y], zoom: this.view.zoom };
|
|
189
199
|
} else {
|
|
190
200
|
let t = this.view.camera.position;
|
|
191
|
-
this.view.spatialReference.isWebMercator && (t =
|
|
201
|
+
this.view.spatialReference.isWebMercator && (t = g.webMercatorToGeographic(
|
|
192
202
|
t
|
|
193
|
-
)),
|
|
203
|
+
)), p = {
|
|
194
204
|
position: t,
|
|
195
205
|
heading: this.view.camera.heading,
|
|
196
206
|
tilt: this.view.camera.tilt
|
|
197
207
|
};
|
|
198
208
|
}
|
|
199
|
-
return
|
|
209
|
+
return d ? d.home = p : this.mapConfig.camera = { home: p }, this.view;
|
|
200
210
|
}
|
|
201
211
|
setLayerVisibility(e) {
|
|
202
|
-
const { id: i, visible: o } = e,
|
|
203
|
-
return
|
|
212
|
+
const { id: i, visible: o } = e, a = this.view.map.findLayerById(i);
|
|
213
|
+
return a ? (a.visible = o, { status: 0, message: "ok" }) : { status: -1, message: "未找到图层" };
|
|
204
214
|
}
|
|
205
215
|
/**
|
|
206
216
|
* 设置地图中心点
|
|
@@ -214,7 +224,7 @@ class te {
|
|
|
214
224
|
if (e.center || e.target) {
|
|
215
225
|
switch ((i = e.target) == null ? void 0 : i.type.toLowerCase()) {
|
|
216
226
|
case "point":
|
|
217
|
-
e.target = new
|
|
227
|
+
e.target = new C(e.target);
|
|
218
228
|
break;
|
|
219
229
|
case "polyline":
|
|
220
230
|
e.target = new z(e.target);
|
|
@@ -223,7 +233,7 @@ class te {
|
|
|
223
233
|
e.target = new W(e.target);
|
|
224
234
|
break;
|
|
225
235
|
case "multipoint":
|
|
226
|
-
e.target = new
|
|
236
|
+
e.target = new P(e.target);
|
|
227
237
|
break;
|
|
228
238
|
}
|
|
229
239
|
await this.view.goTo(e, { duration: (e.duration || 0) * 1e3 });
|
|
@@ -251,9 +261,9 @@ class te {
|
|
|
251
261
|
{ duration: (e.duration || 2) * 1e3 }
|
|
252
262
|
);
|
|
253
263
|
else {
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
264
|
+
const a = Math.tan(i * Math.PI / 180) * e.height, r = A(
|
|
265
|
+
J.point(e.center),
|
|
266
|
+
a,
|
|
257
267
|
o + 180,
|
|
258
268
|
{
|
|
259
269
|
units: "meters"
|
|
@@ -262,8 +272,8 @@ class te {
|
|
|
262
272
|
await this.view.goTo(
|
|
263
273
|
{
|
|
264
274
|
position: {
|
|
265
|
-
x:
|
|
266
|
-
y:
|
|
275
|
+
x: r.geometry.coordinates[0],
|
|
276
|
+
y: r.geometry.coordinates[1],
|
|
267
277
|
z: e.height
|
|
268
278
|
},
|
|
269
279
|
heading: o,
|
|
@@ -276,33 +286,33 @@ class te {
|
|
|
276
286
|
async setMapCamera(e) {
|
|
277
287
|
if (!this.view)
|
|
278
288
|
return { status: -1, message: "未初始化" };
|
|
279
|
-
const { name: i, duration: o = 0 } = e, { camera:
|
|
280
|
-
if (!
|
|
289
|
+
const { name: i, duration: o = 0 } = e, { camera: a } = this.mapConfig;
|
|
290
|
+
if (!a)
|
|
281
291
|
return { status: -1, message: "未配置camera" };
|
|
282
|
-
const
|
|
283
|
-
return
|
|
292
|
+
const r = a[i];
|
|
293
|
+
return r ? (await this.view.goTo(r, { duration: o * 1e3 }), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" };
|
|
284
294
|
}
|
|
285
295
|
/**
|
|
286
296
|
* 经纬度转像素坐标,在地图移动时回调
|
|
287
297
|
* */
|
|
288
298
|
requestCoordinateTransform(e, i) {
|
|
289
299
|
let o = 0;
|
|
290
|
-
const
|
|
300
|
+
const r = 1e3 / 30, d = T.watch(
|
|
291
301
|
() => this.view.center,
|
|
292
302
|
() => {
|
|
293
|
-
const
|
|
294
|
-
|
|
303
|
+
const p = this.transformPoints(e), f = Date.now();
|
|
304
|
+
f - o > r && (i(p), o = f);
|
|
295
305
|
}
|
|
296
306
|
);
|
|
297
|
-
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex,
|
|
307
|
+
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(e) };
|
|
298
308
|
}
|
|
299
309
|
transformPoints(e) {
|
|
300
310
|
return e.map((i) => {
|
|
301
|
-
const o = new
|
|
311
|
+
const o = new C({
|
|
302
312
|
x: i[0],
|
|
303
313
|
y: i[1]
|
|
304
|
-
}),
|
|
305
|
-
return [
|
|
314
|
+
}), a = this.view.toScreen(o);
|
|
315
|
+
return [a.x, a.y];
|
|
306
316
|
});
|
|
307
317
|
}
|
|
308
318
|
/**
|
|
@@ -317,14 +327,14 @@ class te {
|
|
|
317
327
|
* */
|
|
318
328
|
setMapZoomRange(e) {
|
|
319
329
|
const { min: i, max: o } = e;
|
|
320
|
-
!i && !o || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle =
|
|
330
|
+
!i && !o || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = T.watch(
|
|
321
331
|
() => this.view.zoom,
|
|
322
|
-
(
|
|
323
|
-
i &&
|
|
332
|
+
(a) => {
|
|
333
|
+
i && a <= i && (this.view.zoom = i), o && a >= o && (this.view.zoom = o);
|
|
324
334
|
}
|
|
325
335
|
));
|
|
326
336
|
}
|
|
327
337
|
}
|
|
328
338
|
export {
|
|
329
|
-
|
|
339
|
+
oe as default
|
|
330
340
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IResult, ISignalCountdownProps } from '../../../types';
|
|
2
2
|
import SignalHoloFlow from './signal-holo-flow';
|
|
3
3
|
export default class LSRSignalHoloFlow extends SignalHoloFlow {
|
|
4
|
-
private
|
|
4
|
+
private waitingAreaLayer;
|
|
5
5
|
private watchHandle;
|
|
6
6
|
private countdownPanelProps;
|
|
7
7
|
private currentPanelScale;
|
|
@@ -9,6 +9,7 @@ export default class LSRSignalHoloFlow extends SignalHoloFlow {
|
|
|
9
9
|
private trajectoryDelayTime;
|
|
10
10
|
/** 按照路口id->进口道路段id->停止线坐标保存的停止线 */
|
|
11
11
|
private stopLineMap;
|
|
12
|
+
private waitingAreaMap;
|
|
12
13
|
/** 信号机id->进口道id->灯组id */
|
|
13
14
|
private lampGroupMap;
|
|
14
15
|
constructor(view: __esri.MapView | __esri.SceneView, countdownPanelInfos: ISignalCountdownProps[]);
|
|
@@ -35,6 +36,8 @@ export default class LSRSignalHoloFlow extends SignalHoloFlow {
|
|
|
35
36
|
*/
|
|
36
37
|
private updatePanelPosition;
|
|
37
38
|
private doHoloSignalData;
|
|
39
|
+
private updateWaitingArea;
|
|
40
|
+
private getColor;
|
|
38
41
|
private updateLampGroupPanelStatus;
|
|
39
42
|
/**
|
|
40
43
|
* 处理全息流信号灯数据
|
|
@@ -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 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,s;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=(s=(a=this.mapConfig.holoFlow)==null?void 0:a.signal)==null?void 0:s.delay,this.trajectoryDelayTime===void 0&&(this.trajectoryDelayTime=2)}async initializeLayer(){var s,o,n,i,r;if(this.stopLineMap.size>0)return;console.time("初始化停止线图层");let e=(o=(s=this.mapConfig.holoFlow)==null?void 0:s.signal)==null?void 0:o.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:u}=l.properties;let{destinationPoint:p}=l.properties;const{coordinates:h}=l.geometry;if(p){if(typeof p=="string")try{p=JSON.parse(p)}catch(f){console.error("解析面板基准点失败",f);continue}}else{const f=h[0],m=h[h.length-1],b=(f[0]+m[0])/2,L=(f[1]+m[1])/2;p=[b,L]}this.stopLineMap.set(`${u}_${c}`,{coord:h,panelPoint:p})}if(console.timeEnd("初始化停止线图层"),console.time("初始化待行区图层"),e=(i=(n=this.mapConfig.holoFlow)==null?void 0:n.signal)==null?void 0:i.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:u,nodeId:p}=l.properties,{coordinates:h}=l.geometry,f=`${p}_${c}`;this.waitingAreaMap.has(f)||this.waitingAreaMap.set(f,[]),(r=this.waitingAreaMap.get(f))==null||r.push({coord:h,direction:u})}console.timeEnd("初始化待行区图层")}}initializeLampGroup(e){const{sigId:t,lampGroupList:a}=e,s=[];a.forEach(o=>{const{lampGroupNo:n,lampGroupType:i,crossFlowList:r,pedList:l}=o;if(r.length>0)for(const c of r){if(i===81)continue;const u=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}s.push({lampGroupId:n,roadId:u,dir:p})}l.length>0}),this.lampGroupMap.set(t,s)}handleUniSignalData(e){this.watchHandle||(this.watchHandle=y.watch(()=>this.view.extent,()=>this.updatePanelPosition()));const{sigId:t,runningStatus:a}=e.data.basicInfo,s=this.lampGroupMap.get(t);if(!s)return{status:-1,message:"灯组未初始化"};const o=new Map;let n=!1;switch(String(a)){case"4":{n=!0,s.forEach(i=>{const{roadId:r,dir:l}=i;o.set(r,{...o.get(r)||{},[`${l}Number`]:"",[`${l}Color`]:"yellow"})});break}case"5":{s.forEach(i=>{const{roadId:r,dir:l}=i;o.set(r,{...o.get(r)||{},[`${l}Number`]:"",[`${l}Color`]:"red"})});break}case"6":case"9":{s.forEach(i=>{const{roadId:r,dir:l}=i;o.set(r,{...o.get(r)||{},[`${l}Number`]:"",[`${l}Color`]:"off"})});break}default:{const{curSigColorInfo:i}=e.data;i.forEach(r=>{const l=String(r.lamgroupId),{color:c,leftTime:u}=r,p=s.find(h=>h.lampGroupId===l);if(p){const{roadId:h,dir:f}=p;o.set(h,{...o.get(h)||{},[`${f}Number`]:u,[`${f}Color`]:c===1?"red":c===2?"yellow":"green"})}})}}return this.updateLampGroupPanelStatus(t,o,n),{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 s=new g.Point({x:a[0],y:a[1]});this.view.spatialReference.isWebMercator&&(s=w.geographicToWebMercator(s));const o=this.view.toScreen(s);if(t.position.left=o.x,t.position.top=o.y,this.view.type==="3d"){const n=this.getPanelRotation(t.stopLine);t.rotation=n}}this.currentPanelScale=e}doHoloSignalData(e){const t=e.crossId,a=e.phaseCountDownList,s=new Map;for(const o of a){let n="";for(let c of o.roadIdList)if(c.startsWith("-")&&(c=c.slice(1)),this.stopLineMap.has(`${t}_${c}`)){n=`${t}_${c}`;break}if(!n){console.log(`没有找到对应的进口道${t}--${n}`);continue}let i=s.get(n);if(i||(i={},s.set(n,i)),!o.direction)continue;const r=o.direction.toLowerCase(),l=o.color===1?"red":o.color===2?"yellow":"green";r==="u"?(i.uNumber=o.leftTime,i.uColor=l):r==="l"?(i.lNumber=o.leftTime,i.lColor=l):r==="s"?(i.sNumber=o.leftTime,i.sColor=l):r==="r"&&(i.rNumber=o.leftTime,i.rColor=l)}this.updateLampGroupPanelStatus(t,s),this.updateWaitingArea(t,s)}updateWaitingArea(e,t){t.forEach((a,s)=>{var o;if(a.lColor){let n=this.waitingAreaLayer.graphics.find(i=>i.attributes.roadId===s&&i.attributes.direction==="l");if(n)n.attributes.color!==a.lColor&&(n.attributes.color=a.lColor,n.symbol={type:"simple-fill",color:this.getColor(a.lColor),outline:{color:this.getColor(a.lColor)}});else{const i=(o=this.waitingAreaMap.get(s))==null?void 0:o.find(r=>r.direction==="l");i&&(n=new C({geometry:{type:"polygon",rings:i.coord},attributes:{roadId:s,direction:"l",color:a.lColor},symbol:{type:"simple-fill",color:this.getColor(a.lColor),outline:{color:this.getColor(a.lColor)}}}),this.waitingAreaLayer.add(n))}}})}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((s,o)=>{const n=this.stopLineMap.get(o);if(!n)return;const i=this.countdownPanelProps.find(r=>r.roadId===o);if(i)i.lampStatus=s,i.flash=a;else{let r=new g.Point({x:n.panelPoint[0],y:n.panelPoint[1]});this.view.spatialReference.isWebMercator&&(r=w.geographicToWebMercator(r));const l=this.view.toScreen(r),c=this.getPanelRotation(n.coord);this.countdownPanelProps.push({displayMode:"complex",flash:a,crossId:e,roadId:o,mapPoint:n.panelPoint,stopLine:n.coord,position:{left:l.x,top:l.y},rotation:c,scale:this.getPanelScale(),lampStatus:s})}})}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 s=this.view.toScreen(a),o=e[e.length-1];let n=new g.Point({x:o[0],y:o[1]});this.view.spatialReference.isWebMercator&&(n=w.geographicToWebMercator(n));const i=this.view.toScreen(n),r=i.x-s.x,l=i.y-s.y;return Math.atan2(l,r)*(180/Math.PI)}}exports.default=G;
|
|
@@ -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 T=require("@arcgis/core/Basemap"),b=require("@arcgis/core/config"),q=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),z=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/FeatureLayer"),O=require("@arcgis/core/layers/GeoJSONLayer"),I=require("@arcgis/core/layers/GroupLayer"),x=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),S=require("@arcgis/core/layers/MapImageLayer"),R=require("@arcgis/core/layers/TileLayer"),G=require("@arcgis/core/layers/WebTileLayer"),H=require("@arcgis/core/Map"),_=require("@arcgis/core/views/MapView"),B=require("@arcgis/core/views/SceneView"),j=require("@turf/destination"),N=require("@turf/helpers"),U=require("./custom-layer/custom-wmts-layer.js");function v(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}return e.default=r,Object.freeze(e)}const L=v(q),g=v(z),E=v(N);function C(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class A{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){var w,y,M,k;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:a}=e;b.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,b.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,b.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const n=new H;if(((w=this.mapConfig)==null?void 0:w.mapOptions.mode.toLowerCase())==="2d"?(this.view=new _({map:n,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new B({map:n,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(y=this.mapConfig)==null?void 0:y.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var h,P;if(a){let o=t.mapPoint;o.spatialReference.isWebMercator&&(o=g.webMercatorToGeographic(o)),a([o.x,o.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const o=this.view.camera;if(this.view.spatialReference.isWebMercator){const p=g.webMercatorToGeographic(o.position),f={heading:o.heading,tilt:o.tilt,position:p.toJSON()};console.log(f),(h=navigator.clipboard)==null||h.writeText(JSON.stringify(f))}else console.log(o.toJSON());console.log(this.view.zoom,this.view.scale)}else{let o=this.view.center;this.view.spatialReference.isWebMercator&&(o=g.webMercatorToGeographic(o)),console.log({center:o.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(P=(await this.view.hitTest(t)).results)==null?void 0:P.filter(o=>o.type==="graphic");c.length>0&&c.forEach(o=>{var f;const p=o.graphic;(f=p.attributes)!=null&&f.type&&s&&s(p.attributes.type,p.attributes.id,p.attributes,t)})}),(M=this.mapConfig)!=null&&M.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const l=C(t.url,this.mapConfig.assetsRoot);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new G({urlTemplate:l,...t.options});break}case"tile":{c=new R({url:l,...t.options});break}case"customWMTS".toLowerCase():{c=new U.default({urlTemplate:l,...t.options});break}case"mapImage".toLowerCase():{c=new S({url:l,...t.options});break}case"arcgis":{const h=new T(t.options);n.basemap=h;break}case"feature":{c=new W({url:l,...t.options});break}case"3dtiles":{c=new x({url:l,...t.options});break}default:console.warn(`不支持的图层类型: ${t.type}`);break}if(c)if(t.group){let h=n.findLayerById(t.group);console.log(h),h&&h.type==="group"?h.add(c):(h=new I({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c]}),n.add(h))}else n.add(c)}):n.basemap=new T({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(k=this.mapConfig)!=null&&k.hdLayers){const t=this.mapConfig.hdLayers.map(l=>new O({url:C(l.url,this.mapConfig.assetsRoot),...l.options,title:l.options.id}));n.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const d=this.mapConfig.camera;let u;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=g.webMercatorToGeographic(t)),u={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=g.webMercatorToGeographic(t)),u={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return d?d.home=u:this.mapConfig.camera={home:u},this.view}setLayerVisibility(e){const{id:i,visible:s}=e,a=this.view.map.findLayerById(i);return a?(a.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new m.Point(e.target);break;case"polyline":e.target=new m.Polyline(e.target);break;case"polygon":e.target=new m.Polygon(e.target);break;case"multipoint":e.target=new m.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const a=Math.tan(i*Math.PI/180)*e.height,n=j(E.point(e.center),a,s+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:a}=this.mapConfig;if(!a)return{status:-1,message:"未配置camera"};const n=a[i];return n?(await this.view.goTo(n,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const n=1e3/30,d=L.watch(()=>this.view.center,()=>{const u=this.transformPoints(e),w=Date.now();w-s>n&&(i(u),s=w)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,d),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new m.Point({x:i[0],y:i[1]}),a=this.view.toScreen(s);return[a.x,a.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=L.watch(()=>this.view.zoom,a=>{i&&a<=i&&(this.view.zoom=i),s&&a>=s&&(this.view.zoom=s)}))}}exports.default=A;
|