gisviewer-vue3-arcgis 1.0.221 → 1.0.223
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/src/gis-map/gis-map.vue.d.ts +4 -0
- package/es/src/gis-map/gis-map.vue.mjs +106 -100
- package/es/src/gis-map/index.d.ts +4 -0
- package/es/src/gis-map/style/index.css +1 -1
- package/es/src/gis-map/utils/holo-flow/index.d.ts +3 -1
- package/es/src/gis-map/utils/holo-flow/index.mjs +34 -17
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +2 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +44 -26
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +36 -4
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +182 -105
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +1 -1
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +1 -1
- package/es/src/gis-map/utils/map-initializer.mjs +102 -93
- package/lib/src/gis-map/gis-map.vue.d.ts +4 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +4 -0
- package/lib/src/gis-map/style/index.css +1 -1
- package/lib/src/gis-map/utils/holo-flow/index.d.ts +3 -1
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +2 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +36 -4
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,47 @@
|
|
|
1
|
-
import { ISignalCountdownProps } from '../../../types';
|
|
1
|
+
import { IResult, ISignalCountdownProps } from '../../../types';
|
|
2
2
|
import SignalHoloFlow from './signal-holo-flow';
|
|
3
3
|
export default class LSRSignalHoloFlow extends SignalHoloFlow {
|
|
4
4
|
private stopLineLayer;
|
|
5
5
|
private watchHandle;
|
|
6
6
|
private countdownPanelProps;
|
|
7
|
-
|
|
7
|
+
private currentPanelScale;
|
|
8
|
+
/** 轨迹延迟时间 */
|
|
9
|
+
private trajectoryDelayTime;
|
|
10
|
+
/** 按照路口id->进口道路段id->停止线坐标保存的停止线 */
|
|
8
11
|
private stopLineMap;
|
|
12
|
+
/** 信号机id->进口道id->灯组id */
|
|
13
|
+
private lampGroupMap;
|
|
14
|
+
constructor(view: __esri.MapView | __esri.SceneView, countdownPanelInfos: ISignalCountdownProps[]);
|
|
15
|
+
/**
|
|
16
|
+
* 读取停止线图层,将灯组面板沿着停止线放置
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
9
19
|
initializeLayer(): Promise<void>;
|
|
10
|
-
|
|
20
|
+
/**
|
|
21
|
+
* 初始化灯组与进口道的关联关系
|
|
22
|
+
*/
|
|
23
|
+
initializeLampGroup(data: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* 处理统一信控平台信号灯数据
|
|
26
|
+
* @param data
|
|
27
|
+
*/
|
|
28
|
+
handleUniSignalData(data: any): IResult;
|
|
29
|
+
/**
|
|
30
|
+
* 根据地图比例尺计算灯组面板缩放比例
|
|
31
|
+
*/
|
|
11
32
|
private getPanelScale;
|
|
12
|
-
|
|
33
|
+
/**
|
|
34
|
+
* 地图移动时更新灯组面板位置
|
|
35
|
+
*/
|
|
36
|
+
private updatePanelPosition;
|
|
37
|
+
private doHoloSignalData;
|
|
38
|
+
private updateLampGroupPanelStatus;
|
|
39
|
+
/**
|
|
40
|
+
* 处理全息流信号灯数据
|
|
41
|
+
* @param data
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
handleHoloSignalData(data: any): Promise<void>;
|
|
13
45
|
clearSignal(): void;
|
|
14
46
|
/**
|
|
15
47
|
* 从停止线坐标计算面板旋转角度
|
|
@@ -1,166 +1,243 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Point as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
class
|
|
7
|
-
constructor(
|
|
8
|
-
|
|
1
|
+
import * as d from "@arcgis/core/core/reactiveUtils";
|
|
2
|
+
import { Point as f } from "@arcgis/core/geometry";
|
|
3
|
+
import * as u from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
4
|
+
import w from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
+
import g from "./signal-holo-flow.mjs";
|
|
6
|
+
class M extends g {
|
|
7
|
+
constructor(t, o) {
|
|
8
|
+
var r, i;
|
|
9
|
+
super(t), this.stopLineLayer = new w(), this.watchHandle = null, this.trajectoryDelayTime = 2, this.stopLineMap = /* @__PURE__ */ new Map(), this.lampGroupMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = o, this.view.map.add(this.stopLineLayer), this.trajectoryDelayTime = ((i = (r = this.mapConfig.holoFlow) == null ? void 0 : r.signal) == null ? void 0 : i.delay) || 2;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* 读取停止线图层,将灯组面板沿着停止线放置
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
10
15
|
async initializeLayer() {
|
|
11
|
-
var
|
|
16
|
+
var i, e;
|
|
17
|
+
if (this.stopLineMap.size > 0)
|
|
18
|
+
return;
|
|
12
19
|
console.time("初始化停止线图层");
|
|
13
|
-
let
|
|
14
|
-
if (!
|
|
20
|
+
let t = (e = (i = this.mapConfig.holoFlow) == null ? void 0 : i.signal) == null ? void 0 : e.stopLineLayer;
|
|
21
|
+
if (!t)
|
|
15
22
|
return;
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
for (const
|
|
19
|
-
const { roadId:
|
|
20
|
-
let { destinationPoint: n } =
|
|
21
|
-
const { coordinates:
|
|
23
|
+
t = this.mapConfig.assetsRoot + "/" + t;
|
|
24
|
+
const r = await (await fetch(t)).json();
|
|
25
|
+
for (const s of r.features) {
|
|
26
|
+
const { roadId: a } = s.properties;
|
|
27
|
+
let { destinationPoint: n } = s.properties;
|
|
28
|
+
const { coordinates: l } = s.geometry;
|
|
22
29
|
if (n) {
|
|
23
30
|
if (typeof n == "string")
|
|
24
31
|
try {
|
|
25
32
|
n = JSON.parse(n);
|
|
26
|
-
} catch (
|
|
27
|
-
console.error("解析面板基准点失败",
|
|
33
|
+
} catch (c) {
|
|
34
|
+
console.error("解析面板基准点失败", c);
|
|
28
35
|
continue;
|
|
29
36
|
}
|
|
30
37
|
} else {
|
|
31
|
-
const
|
|
32
|
-
n = [
|
|
38
|
+
const c = l[0], h = l[l.length - 1], p = (c[0] + h[0]) / 2, m = (c[1] + h[1]) / 2;
|
|
39
|
+
n = [p, m];
|
|
33
40
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
coord: i,
|
|
41
|
+
this.stopLineMap.set(a, {
|
|
42
|
+
coord: l,
|
|
37
43
|
panelPoint: n
|
|
38
|
-
})
|
|
39
|
-
e,
|
|
40
|
-
/* @__PURE__ */ new Map([
|
|
41
|
-
[o, { coord: i, panelPoint: n }]
|
|
42
|
-
])
|
|
43
|
-
);
|
|
44
|
+
});
|
|
44
45
|
}
|
|
45
46
|
console.timeEnd("初始化停止线图层");
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
/**
|
|
49
|
+
* 初始化灯组与进口道的关联关系
|
|
50
|
+
*/
|
|
51
|
+
initializeLampGroup(t) {
|
|
52
|
+
const { sigId: o, lampGroupList: r } = t, i = [];
|
|
53
|
+
r.forEach((e) => {
|
|
54
|
+
const { lampGroupNo: s, lampGroupType: a, crossFlowList: n, pedList: l } = e;
|
|
55
|
+
n.length > 0 && n.forEach((c) => {
|
|
56
|
+
const h = c.upSectionId;
|
|
57
|
+
let p = "s";
|
|
58
|
+
switch (c.turn) {
|
|
59
|
+
case 1:
|
|
60
|
+
p = "s";
|
|
61
|
+
break;
|
|
62
|
+
case 2:
|
|
63
|
+
p = "l";
|
|
64
|
+
break;
|
|
65
|
+
case 4:
|
|
66
|
+
p = "r";
|
|
67
|
+
break;
|
|
68
|
+
case 8:
|
|
69
|
+
p = "u";
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
a === 81 && (p = "bl"), i.push({
|
|
73
|
+
lampGroupId: s,
|
|
74
|
+
roadId: h,
|
|
75
|
+
dir: p
|
|
76
|
+
});
|
|
77
|
+
}), l.length > 0;
|
|
78
|
+
}), this.lampGroupMap.set(o, i), console.log(i);
|
|
51
79
|
}
|
|
52
|
-
|
|
53
|
-
|
|
80
|
+
/**
|
|
81
|
+
* 处理统一信控平台信号灯数据
|
|
82
|
+
* @param data
|
|
83
|
+
*/
|
|
84
|
+
handleUniSignalData(t) {
|
|
85
|
+
this.watchHandle || (this.watchHandle = d.watch(
|
|
54
86
|
() => this.view.extent,
|
|
55
|
-
() =>
|
|
56
|
-
const t = this.getPanelScale();
|
|
57
|
-
for (const o of this.countdownPanelProps) {
|
|
58
|
-
t !== this.currentPanelScale && (o.scale = t);
|
|
59
|
-
const { mapPoint: e } = o;
|
|
60
|
-
let n = new h({
|
|
61
|
-
x: e[0],
|
|
62
|
-
y: e[1]
|
|
63
|
-
});
|
|
64
|
-
this.view.spatialReference.isWebMercator && (n = d.geographicToWebMercator(
|
|
65
|
-
n
|
|
66
|
-
));
|
|
67
|
-
const i = this.view.toScreen(n);
|
|
68
|
-
if (o.position.left = i.x, o.position.top = i.y, this.view.type === "3d") {
|
|
69
|
-
const r = this.getPanelRotation(o.stopLine);
|
|
70
|
-
o.rotation = r;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
this.currentPanelScale = t;
|
|
74
|
-
}
|
|
87
|
+
() => this.updatePanelPosition()
|
|
75
88
|
));
|
|
76
|
-
const
|
|
77
|
-
if (!
|
|
78
|
-
return;
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
const { sigId: o } = t.data.basicInfo, r = this.lampGroupMap.get(o);
|
|
90
|
+
if (!r)
|
|
91
|
+
return { status: -1, message: "灯组未初始化" };
|
|
92
|
+
const { curSigColorInfo: i } = t.data, e = /* @__PURE__ */ new Map();
|
|
93
|
+
return i.forEach((s) => {
|
|
94
|
+
const a = String(s.lamgroupId), { color: n, leftTime: l } = s, c = r.find(
|
|
95
|
+
(h) => h.lampGroupId === a
|
|
96
|
+
);
|
|
97
|
+
if (c) {
|
|
98
|
+
const { roadId: h, dir: p } = c;
|
|
99
|
+
e.set(h, {
|
|
100
|
+
...e.get(h) || {},
|
|
101
|
+
[`${p}Number`]: l,
|
|
102
|
+
[`${p}Color`]: n === 1 ? "red" : n === 2 ? "yellow" : "green"
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}), this.updateLampGroupPanelStatus(o, e), { status: 0, message: "ok" };
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 根据地图比例尺计算灯组面板缩放比例
|
|
109
|
+
*/
|
|
110
|
+
getPanelScale() {
|
|
111
|
+
const t = this.view.scale;
|
|
112
|
+
let o = 1;
|
|
113
|
+
return t < 1e3 ? o = 1 : t < 2e3 ? o = 0.8 : t < 4e3 ? o = 0.4 : o = 0, o;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* 地图移动时更新灯组面板位置
|
|
117
|
+
*/
|
|
118
|
+
updatePanelPosition() {
|
|
119
|
+
const t = this.getPanelScale();
|
|
120
|
+
for (const o of this.countdownPanelProps) {
|
|
121
|
+
t !== this.currentPanelScale && (o.scale = t);
|
|
122
|
+
const { mapPoint: r } = o;
|
|
123
|
+
let i = new f({
|
|
124
|
+
x: r[0],
|
|
125
|
+
y: r[1]
|
|
126
|
+
});
|
|
127
|
+
this.view.spatialReference.isWebMercator && (i = u.geographicToWebMercator(
|
|
128
|
+
i
|
|
129
|
+
));
|
|
130
|
+
const e = this.view.toScreen(i);
|
|
131
|
+
if (o.position.left = e.x, o.position.top = e.y, this.view.type === "3d") {
|
|
132
|
+
const s = this.getPanelRotation(o.stopLine);
|
|
133
|
+
o.rotation = s;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
this.currentPanelScale = t;
|
|
137
|
+
}
|
|
138
|
+
doHoloSignalData(t) {
|
|
139
|
+
const o = t.crossId, r = t.phaseCountDownList, i = /* @__PURE__ */ new Map();
|
|
140
|
+
for (const e of r) {
|
|
141
|
+
let s = "";
|
|
142
|
+
for (let c of e.roadIdList)
|
|
143
|
+
if (c.startsWith("-") && (c = c.slice(1)), this.stopLineMap.has(c)) {
|
|
144
|
+
s = c;
|
|
85
145
|
break;
|
|
86
146
|
}
|
|
87
|
-
if (!
|
|
88
|
-
|
|
89
|
-
let e = c.get(o);
|
|
90
|
-
if (e || (e = {}, c.set(o, e)), !t.direction) {
|
|
91
|
-
console.log(`没有找到对应的方向${a}--${JSON.stringify(t)}`);
|
|
147
|
+
if (!s) {
|
|
148
|
+
console.log(`没有找到对应的进口道${o}--${s}`);
|
|
92
149
|
continue;
|
|
93
150
|
}
|
|
94
|
-
|
|
95
|
-
|
|
151
|
+
let a = i.get(s);
|
|
152
|
+
if (a || (a = {}, i.set(s, a)), !e.direction)
|
|
153
|
+
continue;
|
|
154
|
+
const n = e.direction.toLowerCase(), l = e.color === 1 ? "red" : e.color === 2 ? "yellow" : "green";
|
|
155
|
+
n === "u" ? (a.uNumber = e.leftTime, a.uColor = l) : n === "l" ? (a.lNumber = e.leftTime, a.lColor = l) : n === "s" ? (a.sNumber = e.leftTime, a.sColor = l) : n === "r" && (a.rNumber = e.leftTime, a.rColor = l);
|
|
96
156
|
}
|
|
97
|
-
|
|
98
|
-
|
|
157
|
+
this.updateLampGroupPanelStatus(o, i);
|
|
158
|
+
}
|
|
159
|
+
updateLampGroupPanelStatus(t, o) {
|
|
160
|
+
o.forEach((r, i) => {
|
|
161
|
+
const e = this.stopLineMap.get(i);
|
|
99
162
|
if (!e)
|
|
100
163
|
return;
|
|
101
|
-
const
|
|
102
|
-
(
|
|
164
|
+
const s = this.countdownPanelProps.find(
|
|
165
|
+
(a) => a.roadId === i
|
|
103
166
|
);
|
|
104
|
-
if (
|
|
105
|
-
|
|
167
|
+
if (s)
|
|
168
|
+
s.lampStatus = r;
|
|
106
169
|
else {
|
|
107
|
-
let
|
|
170
|
+
let a = new f({
|
|
108
171
|
x: e.panelPoint[0],
|
|
109
172
|
y: e.panelPoint[1]
|
|
110
173
|
});
|
|
111
|
-
this.view.spatialReference.isWebMercator && (
|
|
112
|
-
|
|
174
|
+
this.view.spatialReference.isWebMercator && (a = u.geographicToWebMercator(
|
|
175
|
+
a
|
|
113
176
|
));
|
|
114
|
-
const
|
|
177
|
+
const n = this.view.toScreen(a), l = this.getPanelRotation(e.coord);
|
|
115
178
|
this.countdownPanelProps.push({
|
|
116
179
|
displayMode: "complex",
|
|
117
|
-
crossId:
|
|
118
|
-
roadId:
|
|
180
|
+
crossId: t,
|
|
181
|
+
roadId: i,
|
|
119
182
|
mapPoint: e.panelPoint,
|
|
120
183
|
// 定位点地理坐标
|
|
121
184
|
stopLine: e.coord,
|
|
122
185
|
// 关联的停止线坐标
|
|
123
|
-
position: { left:
|
|
186
|
+
position: { left: n.x, top: n.y },
|
|
124
187
|
// 定位点屏幕坐标
|
|
125
|
-
rotation:
|
|
188
|
+
rotation: l,
|
|
126
189
|
// 面板旋转角度
|
|
127
190
|
scale: this.getPanelScale(),
|
|
128
|
-
lampStatus:
|
|
191
|
+
lampStatus: r
|
|
129
192
|
// 灯组状态
|
|
130
193
|
});
|
|
131
194
|
}
|
|
132
195
|
});
|
|
133
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* 处理全息流信号灯数据
|
|
199
|
+
* @param data
|
|
200
|
+
* @returns
|
|
201
|
+
*/
|
|
202
|
+
async handleHoloSignalData(t) {
|
|
203
|
+
this.watchHandle || (this.watchHandle = d.watch(
|
|
204
|
+
() => this.view.extent,
|
|
205
|
+
() => this.updatePanelPosition()
|
|
206
|
+
)), this.trajectoryDelayTime === 0 ? this.doHoloSignalData(t) : setTimeout(
|
|
207
|
+
() => this.doHoloSignalData(t),
|
|
208
|
+
this.trajectoryDelayTime * 1e3
|
|
209
|
+
);
|
|
210
|
+
}
|
|
134
211
|
clearSignal() {
|
|
135
|
-
var
|
|
136
|
-
this.stopLineLayer.removeAll(), this.countdownPanelProps.length = 0, (
|
|
212
|
+
var t;
|
|
213
|
+
this.stopLineLayer.removeAll(), this.countdownPanelProps.length = 0, (t = this.watchHandle) == null || t.remove(), this.watchHandle = null;
|
|
137
214
|
}
|
|
138
215
|
/**
|
|
139
216
|
* 从停止线坐标计算面板旋转角度
|
|
140
217
|
* @param coordinates
|
|
141
218
|
* @returns
|
|
142
219
|
*/
|
|
143
|
-
getPanelRotation(
|
|
144
|
-
const
|
|
145
|
-
let
|
|
146
|
-
x:
|
|
147
|
-
y:
|
|
220
|
+
getPanelRotation(t) {
|
|
221
|
+
const o = t[0];
|
|
222
|
+
let r = new f({
|
|
223
|
+
x: o[0],
|
|
224
|
+
y: o[1]
|
|
148
225
|
});
|
|
149
|
-
this.view.spatialReference.isWebMercator && (
|
|
150
|
-
|
|
226
|
+
this.view.spatialReference.isWebMercator && (r = u.geographicToWebMercator(
|
|
227
|
+
r
|
|
151
228
|
));
|
|
152
|
-
const
|
|
153
|
-
let
|
|
154
|
-
x:
|
|
155
|
-
y:
|
|
229
|
+
const i = this.view.toScreen(r), e = t[t.length - 1];
|
|
230
|
+
let s = new f({
|
|
231
|
+
x: e[0],
|
|
232
|
+
y: e[1]
|
|
156
233
|
});
|
|
157
|
-
this.view.spatialReference.isWebMercator && (
|
|
158
|
-
|
|
234
|
+
this.view.spatialReference.isWebMercator && (s = u.geographicToWebMercator(
|
|
235
|
+
s
|
|
159
236
|
));
|
|
160
|
-
const
|
|
161
|
-
return Math.atan2(
|
|
237
|
+
const a = this.view.toScreen(s), n = a.x - i.x, l = a.y - i.y;
|
|
238
|
+
return Math.atan2(l, n) * (180 / Math.PI);
|
|
162
239
|
}
|
|
163
240
|
}
|
|
164
241
|
export {
|
|
165
|
-
|
|
242
|
+
M as default
|
|
166
243
|
};
|
|
@@ -121,7 +121,7 @@ class C {
|
|
|
121
121
|
};
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
async
|
|
124
|
+
async handleHoloSignalData(e) {
|
|
125
125
|
const { crossId: t, lat: a, lon: s, rtStage: n, channelsConfig: i } = e;
|
|
126
126
|
await this.updateCountdown(t, a, s, n), !(!this.phaseLineLayer || !i) && ((!this.currentPhaseMap.has(t) || this.currentPhaseMap.get(t) !== n.stagePhase) && await this.updatePhaseLine(
|
|
127
127
|
t,
|