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.
Files changed (27) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +4 -0
  2. package/es/src/gis-map/gis-map.vue.mjs +106 -100
  3. package/es/src/gis-map/index.d.ts +4 -0
  4. package/es/src/gis-map/style/index.css +1 -1
  5. package/es/src/gis-map/utils/holo-flow/index.d.ts +3 -1
  6. package/es/src/gis-map/utils/holo-flow/index.mjs +34 -17
  7. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +2 -0
  8. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +44 -26
  9. package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +36 -4
  10. package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +182 -105
  11. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +1 -1
  12. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +1 -1
  13. package/es/src/gis-map/utils/map-initializer.mjs +102 -93
  14. package/lib/src/gis-map/gis-map.vue.d.ts +4 -0
  15. package/lib/src/gis-map/gis-map.vue.js +1 -1
  16. package/lib/src/gis-map/index.d.ts +4 -0
  17. package/lib/src/gis-map/style/index.css +1 -1
  18. package/lib/src/gis-map/utils/holo-flow/index.d.ts +3 -1
  19. package/lib/src/gis-map/utils/holo-flow/index.js +1 -1
  20. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +2 -0
  21. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -1
  22. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +36 -4
  23. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
  24. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +1 -1
  25. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
  26. package/lib/src/gis-map/utils/map-initializer.js +1 -1
  27. 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
- constructor(view: __esri.MapView | __esri.SceneView, countdownPanelInfos: ISignalCountdownProps[]);
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
- private currentPanelScale;
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
- handleSignalData(data: any): Promise<void>;
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 g from "@arcgis/core/core/reactiveUtils";
2
- import { Point as h } from "@arcgis/core/geometry";
3
- import * as d from "@arcgis/core/geometry/support/webMercatorUtils.js";
4
- import u from "@arcgis/core/layers/GraphicsLayer";
5
- import y from "./signal-holo-flow.mjs";
6
- class b extends y {
7
- constructor(s, a) {
8
- super(s), this.stopLineLayer = new u(), this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = a, this.view.map.add(this.stopLineLayer);
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 p, c;
16
+ var i, e;
17
+ if (this.stopLineMap.size > 0)
18
+ return;
12
19
  console.time("初始化停止线图层");
13
- let s = (c = (p = this.mapConfig.holoFlow) == null ? void 0 : p.signal) == null ? void 0 : c.stopLineLayer;
14
- if (!s)
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
- s = this.mapConfig.assetsRoot + "/" + s;
17
- const l = await (await fetch(s)).json();
18
- for (const t of l.features) {
19
- const { roadId: o, nodeId: e } = t.properties;
20
- let { destinationPoint: n } = t.properties;
21
- const { coordinates: i } = t.geometry;
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 (f) {
27
- console.error("解析面板基准点失败", f);
33
+ } catch (c) {
34
+ console.error("解析面板基准点失败", c);
28
35
  continue;
29
36
  }
30
37
  } else {
31
- const f = i[0], w = i[i.length - 1], P = (f[0] + w[0]) / 2, m = (f[1] + w[1]) / 2;
32
- n = [P, m];
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
- const r = this.stopLineMap.get(e);
35
- r ? r.set(o, {
36
- coord: i,
41
+ this.stopLineMap.set(a, {
42
+ coord: l,
37
43
  panelPoint: n
38
- }) : this.stopLineMap.set(
39
- e,
40
- /* @__PURE__ */ new Map([
41
- [o, { coord: i, panelPoint: n }]
42
- ])
43
- );
44
+ });
44
45
  }
45
46
  console.timeEnd("初始化停止线图层");
46
47
  }
47
- getPanelScale() {
48
- const s = this.view.scale;
49
- let a = 1;
50
- return s < 1e3 ? a = 1 : s < 2e3 ? a = 0.8 : s < 4e3 ? a = 0.4 : a = 0, a;
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
- async handleSignalData(s) {
53
- this.watchHandle || (this.watchHandle = g.watch(
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 a = s.crossId, l = this.stopLineMap.get(a);
77
- if (!l)
78
- return;
79
- const p = s.phaseCountDownList, c = /* @__PURE__ */ new Map();
80
- for (const t of p) {
81
- let o = "";
82
- for (let r of t.roadIdList)
83
- if (r.startsWith("-") && (r = r.slice(1)), l.has(r)) {
84
- o = r;
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 (!o)
88
- continue;
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
- const n = t.direction.toLowerCase(), i = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
95
- n === "u" ? (e.uNumber = t.leftTime, e.uColor = i) : n === "l" ? (e.lNumber = t.leftTime, e.lColor = i) : n === "s" ? (e.sNumber = t.leftTime, e.sColor = i) : n === "r" && (e.rNumber = t.leftTime, e.rColor = i);
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
- c.forEach((t, o) => {
98
- const e = l.get(o);
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 n = this.countdownPanelProps.find(
102
- (i) => i.crossId === a && i.roadId === o
164
+ const s = this.countdownPanelProps.find(
165
+ (a) => a.roadId === i
103
166
  );
104
- if (n)
105
- n.lampStatus = t;
167
+ if (s)
168
+ s.lampStatus = r;
106
169
  else {
107
- let i = new h({
170
+ let a = new f({
108
171
  x: e.panelPoint[0],
109
172
  y: e.panelPoint[1]
110
173
  });
111
- this.view.spatialReference.isWebMercator && (i = d.geographicToWebMercator(
112
- i
174
+ this.view.spatialReference.isWebMercator && (a = u.geographicToWebMercator(
175
+ a
113
176
  ));
114
- const r = this.view.toScreen(i), f = this.getPanelRotation(e.coord);
177
+ const n = this.view.toScreen(a), l = this.getPanelRotation(e.coord);
115
178
  this.countdownPanelProps.push({
116
179
  displayMode: "complex",
117
- crossId: a,
118
- roadId: o,
180
+ crossId: t,
181
+ roadId: i,
119
182
  mapPoint: e.panelPoint,
120
183
  // 定位点地理坐标
121
184
  stopLine: e.coord,
122
185
  // 关联的停止线坐标
123
- position: { left: r.x, top: r.y },
186
+ position: { left: n.x, top: n.y },
124
187
  // 定位点屏幕坐标
125
- rotation: f,
188
+ rotation: l,
126
189
  // 面板旋转角度
127
190
  scale: this.getPanelScale(),
128
- lampStatus: t
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 s;
136
- this.stopLineLayer.removeAll(), this.countdownPanelProps.length = 0, (s = this.watchHandle) == null || s.remove(), this.watchHandle = null;
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(s) {
144
- const a = s[0];
145
- let l = new h({
146
- x: a[0],
147
- y: a[1]
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 && (l = d.geographicToWebMercator(
150
- l
226
+ this.view.spatialReference.isWebMercator && (r = u.geographicToWebMercator(
227
+ r
151
228
  ));
152
- const p = this.view.toScreen(l), c = s[s.length - 1];
153
- let t = new h({
154
- x: c[0],
155
- y: c[1]
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 && (t = d.geographicToWebMercator(
158
- t
234
+ this.view.spatialReference.isWebMercator && (s = u.geographicToWebMercator(
235
+ s
159
236
  ));
160
- const o = this.view.toScreen(t), e = o.x - p.x, n = o.y - p.y;
161
- return Math.atan2(n, e) * (180 / Math.PI);
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
- b as default
242
+ M as default
166
243
  };
@@ -16,7 +16,7 @@ export default class SignalHoloFlow {
16
16
  * */
17
17
  initializeLayer(): Promise<void>;
18
18
  private initializePlateBackground;
19
- handleSignalData(data: any): Promise<void>;
19
+ handleHoloSignalData(data: any): Promise<void>;
20
20
  /**
21
21
  * 清除实时信号相关图层
22
22
  * */
@@ -121,7 +121,7 @@ class C {
121
121
  };
122
122
  });
123
123
  }
124
- async handleSignalData(e) {
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,