gisviewer-vue3-arcgis 1.0.170 → 1.0.172

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.
@@ -1,112 +1,115 @@
1
- import * as d from "@arcgis/core/core/reactiveUtils";
2
- import { Point as m } from "@arcgis/core/geometry";
1
+ import * as w from "@arcgis/core/core/reactiveUtils";
2
+ import { Point as f } from "@arcgis/core/geometry";
3
+ import * as d from "@arcgis/core/geometry/support/webMercatorUtils.js";
3
4
  import P from "@arcgis/core/layers/GraphicsLayer";
4
- import w from "@turf/bearing";
5
- import u from "@turf/destination";
6
- import * as h from "@turf/helpers";
7
- import g from "../../stores/index.mjs";
8
- import y from "../common-utils.mjs";
9
- import L from "./signal-holo-flow.mjs";
10
- class b extends L {
11
- constructor(e) {
12
- super(e), this.stopLineLayer = new P(), this.store = g.useAppDataStore, this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.view.map.add(this.stopLineLayer);
5
+ import g from "./signal-holo-flow.mjs";
6
+ class S extends g {
7
+ constructor(n, a) {
8
+ super(n), this.stopLineLayer = new P(), this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = a, this.view.map.add(this.stopLineLayer);
13
9
  }
14
10
  async initializeLayer() {
15
- var c, r;
11
+ var p, l;
16
12
  console.time("初始化停止线图层");
17
- let e = (r = (c = this.mapConfig.holoFlow) == null ? void 0 : c.signal) == null ? void 0 : r.stopLineLayer;
18
- if (!e)
13
+ let n = (l = (p = this.mapConfig.holoFlow) == null ? void 0 : p.signal) == null ? void 0 : l.stopLineLayer;
14
+ if (!n)
19
15
  return;
20
- e = this.mapConfig.assetsRoot + "/" + e, (await (await fetch(e)).json()).features.forEach((t) => {
21
- const { roadId: n, nodeId: o, angle: s, destinationPoint: a } = t.properties, { coordinates: l } = t.geometry, f = this.stopLineMap.get(o);
22
- f ? f.set(n, {
23
- coord: l,
24
- panelPoint: a,
16
+ n = this.mapConfig.assetsRoot + "/" + n, (await (await fetch(n)).json()).features.forEach((t) => {
17
+ const { roadId: o, nodeId: e, angle: s, destinationPoint: i } = t.properties, { coordinates: r } = t.geometry, h = this.stopLineMap.get(e);
18
+ h ? h.set(o, {
19
+ coord: r,
20
+ panelPoint: i,
25
21
  angle: s
26
22
  }) : this.stopLineMap.set(
27
- o,
23
+ e,
28
24
  /* @__PURE__ */ new Map([
29
25
  [
30
- n,
31
- { coord: l, panelPoint: a, angle: s }
26
+ o,
27
+ { coord: r, panelPoint: i, angle: s }
32
28
  ]
33
29
  ])
34
30
  );
35
31
  }), console.timeEnd("初始化停止线图层");
36
32
  }
37
33
  getPanelScale() {
38
- const e = this.view.scale;
39
- let i = 1;
40
- return e < 1e3 ? i = 1 : e < 2e3 ? i = 0.8 : i = 0.4, i;
34
+ const n = this.view.scale;
35
+ let a = 1;
36
+ return n < 1e3 ? a = 1 : n < 2e3 ? a = 0.8 : a = 0.4, a;
41
37
  }
42
- async handleSignalData(e) {
43
- this.watchHandle || (this.watchHandle = d.watch(
38
+ async handleSignalData(n) {
39
+ this.watchHandle || (this.watchHandle = w.watch(
44
40
  () => this.view.extent,
45
41
  () => {
42
+ console.log("extent changed");
46
43
  const t = this.getPanelScale();
47
- for (const n of this.store.countdownPanels) {
48
- t !== this.currentPanelScale && (n.scale = t);
49
- const { mapPoint: o } = n, s = this.view.toScreen({
50
- type: "point",
51
- x: o[0],
52
- y: o[1]
44
+ for (const o of this.countdownPanelProps) {
45
+ t !== this.currentPanelScale && (o.scale = t);
46
+ const { mapPoint: e } = o;
47
+ let s = new f({
48
+ x: e[0],
49
+ y: e[1]
53
50
  });
54
- n.position.left = s.x, n.position.top = s.y;
51
+ this.view.spatialReference.isWebMercator && (s = d.geographicToWebMercator(
52
+ s
53
+ ));
54
+ const i = this.view.toScreen(s);
55
+ if (o.position.left = i.x, o.position.top = i.y, this.view.type === "3d") {
56
+ const r = this.getPanelRotation(o.stopLine);
57
+ o.rotation = r;
58
+ }
55
59
  }
56
60
  this.currentPanelScale = t;
57
61
  }
58
62
  ));
59
- const i = e.crossId, p = this.stopLineMap.get(i);
60
- if (!p) {
61
- console.log(`没有找到路口${i}`);
63
+ const a = n.crossId, c = this.stopLineMap.get(a);
64
+ if (!c)
62
65
  return;
63
- }
64
- const c = e.phaseCountDownList, r = /* @__PURE__ */ new Map();
65
- for (const t of c) {
66
- let n = "";
67
- for (let l of t.roadIdList)
68
- if (l.startsWith("-") && (l = l.slice(1)), p.has(l)) {
69
- n = l;
66
+ const p = n.phaseCountDownList, l = /* @__PURE__ */ new Map();
67
+ for (const t of p) {
68
+ let o = "";
69
+ for (let r of t.roadIdList)
70
+ if (r.startsWith("-") && (r = r.slice(1)), c.has(r)) {
71
+ o = r;
70
72
  break;
71
73
  }
72
- if (!n) {
73
- console.log(`没有找到对应的进口道${i}--${n}`);
74
+ if (!o)
74
75
  continue;
75
- }
76
- let o = r.get(n);
77
- if (o || (o = {}, r.set(n, o)), !t.direction) {
78
- console.log(`没有找到对应的方向${i}--${JSON.stringify(t)}`);
76
+ let e = l.get(o);
77
+ if (e || (e = {}, l.set(o, e)), !t.direction) {
78
+ console.log(`没有找到对应的方向${a}--${JSON.stringify(t)}`);
79
79
  continue;
80
80
  }
81
- const s = t.direction.toLowerCase(), a = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
82
- s === "u" ? (o.uNumber = t.leftTime, o.uColor = a) : s === "l" ? (o.lNumber = t.leftTime, o.lColor = a) : s === "s" ? (o.sNumber = t.leftTime, o.sColor = a) : s === "r" && (o.rNumber = t.leftTime, o.rColor = a);
81
+ const s = t.direction.toLowerCase(), i = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
82
+ s === "u" ? (e.uNumber = t.leftTime, e.uColor = i) : s === "l" ? (e.lNumber = t.leftTime, e.lColor = i) : s === "s" ? (e.sNumber = t.leftTime, e.sColor = i) : s === "r" && (e.rNumber = t.leftTime, e.rColor = i);
83
83
  }
84
- r.forEach((t, n) => {
85
- const o = p.get(n);
86
- if (!o)
84
+ l.forEach((t, o) => {
85
+ const e = c.get(o);
86
+ if (!e)
87
87
  return;
88
- const s = this.store.countdownPanels.find(
89
- (a) => a.crossId === i && a.roadId === n
88
+ const s = this.countdownPanelProps.find(
89
+ (i) => i.crossId === a && i.roadId === o
90
90
  );
91
91
  if (s)
92
92
  s.lampStatus = t;
93
93
  else {
94
- const a = o.panelPoint, l = this.view.toScreen({
95
- type: "point",
96
- x: a[0],
97
- y: a[1]
98
- }), f = this.getPanelRotation(o.coord);
99
- this.store.countdownPanels.push({
94
+ let i = new f({
95
+ x: e.panelPoint[0],
96
+ y: e.panelPoint[1]
97
+ });
98
+ this.view.spatialReference.isWebMercator && (i = d.geographicToWebMercator(
99
+ i
100
+ ));
101
+ const r = this.view.toScreen(i), h = this.getPanelRotation(e.coord);
102
+ console.log(i.toJSON(), r), this.countdownPanelProps.push({
100
103
  displayMode: "complex",
101
- crossId: i,
102
- roadId: n,
103
- mapPoint: a,
104
+ crossId: a,
105
+ roadId: o,
106
+ mapPoint: e.panelPoint,
104
107
  // 定位点地理坐标
105
- stopLine: o.coord,
108
+ stopLine: e.coord,
106
109
  // 关联的停止线坐标
107
- position: { left: l.x, top: l.y },
110
+ position: { left: r.x, top: r.y },
108
111
  // 定位点屏幕坐标
109
- rotation: f,
112
+ rotation: h,
110
113
  // 面板旋转角度
111
114
  scale: this.getPanelScale(),
112
115
  lampStatus: t
@@ -116,39 +119,35 @@ class b extends L {
116
119
  });
117
120
  }
118
121
  clearSignal() {
119
- var e;
120
- this.stopLineLayer.removeAll(), this.store.countdownPanels = [], (e = this.watchHandle) == null || e.remove(), this.watchHandle = null;
121
- }
122
- /**
123
- * 从停止线坐标计算面板位置
124
- * @param coordinates
125
- * @returns
126
- */
127
- getPanelPoint(e) {
128
- const i = y.getCenterPointInLine(e), p = e[0], c = e[e.length - 1];
129
- let t = w(h.point(p), h.point(c)) - 90;
130
- return t < -180 && (t += 360), u(h.point(i), 1, t, {
131
- units: "meters"
132
- }).geometry.coordinates;
122
+ var n;
123
+ this.stopLineLayer.removeAll(), this.countdownPanelProps.length = 0, (n = this.watchHandle) == null || n.remove(), this.watchHandle = null;
133
124
  }
134
125
  /**
135
126
  * 从停止线坐标计算面板旋转角度
136
127
  * @param coordinates
137
128
  * @returns
138
129
  */
139
- getPanelRotation(e) {
140
- const i = e[0], p = new m({
141
- x: i[0],
142
- y: i[1],
143
- spatialReference: this.view.spatialReference
144
- }), c = this.view.toScreen(p), r = e[e.length - 1], t = new m({
145
- x: r[0],
146
- y: r[1],
147
- spatialReference: this.view.spatialReference
148
- }), n = this.view.toScreen(t), o = n.x - c.x, s = n.y - c.y;
149
- return Math.atan2(s, o) * (180 / Math.PI);
130
+ getPanelRotation(n) {
131
+ const a = n[0];
132
+ let c = new f({
133
+ x: a[0],
134
+ y: a[1]
135
+ });
136
+ this.view.spatialReference.isWebMercator && (c = d.geographicToWebMercator(
137
+ c
138
+ ));
139
+ const p = this.view.toScreen(c), l = n[n.length - 1];
140
+ let t = new f({
141
+ x: l[0],
142
+ y: l[1]
143
+ });
144
+ this.view.spatialReference.isWebMercator && (t = d.geographicToWebMercator(
145
+ t
146
+ ));
147
+ const o = this.view.toScreen(t), e = o.x - p.x, s = o.y - p.y;
148
+ return Math.atan2(s, e) * (180 / Math.PI);
150
149
  }
151
150
  }
152
151
  export {
153
- b as default
152
+ S as default
154
153
  };
@@ -22,6 +22,7 @@ export default class TraceRendererExternal implements ITraceRendererInterface {
22
22
  private truckModel;
23
23
  private busModel;
24
24
  private bicycleModel;
25
+ private passengerModel;
25
26
  private bluePlateBG;
26
27
  private yellowPlateBG;
27
28
  private whitePlateBG;