gisviewer-vue3-arcgis 1.0.166 → 1.0.167

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 (26) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +11 -2
  2. package/es/src/gis-map/gis-map.vue.mjs +26 -23
  3. package/es/src/gis-map/index.d.ts +11 -2
  4. package/es/src/gis-map/utils/common-utils.mjs +9 -9
  5. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +9 -1
  6. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +1 -1
  7. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.mjs +6 -5
  8. package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +1 -0
  9. package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +103 -73
  10. package/es/src/gis-map/utils/map-initializer.d.ts +1 -0
  11. package/es/src/gis-map/utils/map-initializer.mjs +121 -122
  12. package/es/src/types/index.d.ts +1 -0
  13. package/es/style.css +1 -1
  14. package/lib/src/gis-map/gis-map.vue.d.ts +11 -2
  15. package/lib/src/gis-map/gis-map.vue.js +1 -1
  16. package/lib/src/gis-map/index.d.ts +11 -2
  17. package/lib/src/gis-map/utils/common-utils.js +1 -1
  18. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +9 -1
  19. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -1
  20. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.js +1 -1
  21. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +1 -0
  22. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
  23. package/lib/src/gis-map/utils/map-initializer.d.ts +1 -0
  24. package/lib/src/gis-map/utils/map-initializer.js +1 -1
  25. package/lib/src/types/index.d.ts +1 -0
  26. package/package.json +1 -1
@@ -29,6 +29,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
29
29
  queueLength: QueueLength;
30
30
  openDriveRenderer: OpenDriveRenderer;
31
31
  signalControlAreaController: SignalControlAreaController;
32
+ showLogDiv: import("vue").Ref<boolean>;
32
33
  appDataStore: import("pinia").Store<"appData", {
33
34
  mapConfig: {};
34
35
  saveTrackLog: boolean;
@@ -36,6 +37,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
36
37
  countdownPanels: import("../types").ISignalCountdownProps[];
37
38
  }, {}, {}>;
38
39
  countdownPanelInfos: import("vue").Ref<{
40
+ displayMode: string;
39
41
  crossId: string;
40
42
  roadId: string;
41
43
  mapPoint: number[];
@@ -56,7 +58,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
56
58
  rColor?: string | undefined;
57
59
  };
58
60
  }[]>;
59
- showLogDiv: import("vue").Ref<boolean>;
60
61
  mapViewer: import("vue").ComputedRef<MapView | SceneView>;
61
62
  startSaveTrackLog: () => void;
62
63
  downloadTrackLog: () => void;
@@ -123,6 +124,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
123
124
  props: any;
124
125
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
125
126
  SignalCountdownPanel: import("vue").DefineComponent<{
127
+ displayMode: {
128
+ type: StringConstructor;
129
+ required: true;
130
+ };
126
131
  crossId: {
127
132
  type: StringConstructor;
128
133
  required: true;
@@ -175,8 +180,12 @@ declare const _sfc_main: import("vue").DefineComponent<{
175
180
  rNumberStyle: import("vue").ComputedRef<{
176
181
  color: string;
177
182
  }>;
178
- getColorString: (color: string | undefined) => "red" | "yellow" | "lime" | "white";
183
+ getColorString: (color: string | undefined) => "red" | "rgb(255, 192, 2)" | "lime" | "white";
179
184
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
185
+ displayMode: {
186
+ type: StringConstructor;
187
+ required: true;
188
+ };
180
189
  crossId: {
181
190
  type: StringConstructor;
182
191
  required: true;
@@ -19,19 +19,21 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
19
19
  },
20
20
  emits: ["mapLoaded", "markerClick", "mapClick"],
21
21
  setup(I, { expose: b, emit: M }) {
22
- const f = C(null);
23
- let s, l, i, r, n, a, p, t, o;
22
+ const d = C(null);
23
+ let s, l, i, o, n, a, p, t, r;
24
+ const f = C(!1);
24
25
  Ee();
25
- const h = T.useAppDataStore, { countdownPanels: _ } = je(h), d = C(!1);
26
+ const h = T.useAppDataStore, { countdownPanels: _ } = je(h);
26
27
  Me(async () => {
27
- if (!f.value)
28
+ if (!d.value)
28
29
  return;
29
30
  document.addEventListener("keydown", (m) => {
30
- m.ctrlKey && m.key === "i" && (d.value = !d.value);
31
+ m.ctrlKey && m.key === "i" && (f.value = !f.value);
31
32
  });
32
33
  const e = _e(), { $gisviewerAssetsRoot: u } = e.appContext.config.globalProperties, c = await (await fetch(O.config)).json();
33
34
  c.assetsRoot = O.assetsRoot || u, h.mapConfig = c, l = new qe(), s = await l.initialize({
34
- container: f.value,
35
+ container: d.value,
36
+ mapConfig: c,
35
37
  markerClickCallback: (m, y, v, Ie) => {
36
38
  w("markerClick", m, y, v, Ie);
37
39
  },
@@ -40,7 +42,7 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
40
42
  }
41
43
  }), n = new Fe(s), await n.init(), w("mapLoaded");
42
44
  }), He(() => {
43
- o == null || o.clearSignalControlArea(), t == null || t.clearOpenDrive(), n == null || n.clearHoloTrace(), n == null || n.clearHoloSignal(), r == null || r.disconnectTrafficFlow();
45
+ r == null || r.clearSignalControlArea(), t == null || t.clearOpenDrive(), n == null || n.clearHoloTrace(), n == null || n.clearHoloSignal(), o == null || o.disconnectTrafficFlow();
44
46
  });
45
47
  const H = xe(() => s), x = () => {
46
48
  const e = T.useAppDataStore;
@@ -55,9 +57,9 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
55
57
  i == null || i.clearLaneNumber();
56
58
  }, q = async (e) => (i || (i = new A(s)), await i.initializeSearch(e)), K = async () => i == null ? void 0 : i.calCrossIndicatorArea(), R = async () => {
57
59
  }, U = async (e, u) => {
58
- r || (r = new Ue(s)), r.connectTrafficFlow(e, u);
60
+ o || (o = new Ue(s)), o.connectTrafficFlow(e, u);
59
61
  }, $ = () => {
60
- r == null || r.disconnectTrafficFlow();
62
+ o == null || o.disconnectTrafficFlow();
61
63
  }, G = (e) => {
62
64
  n.handleVehicleTraceData(e);
63
65
  }, J = () => {
@@ -69,14 +71,14 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
69
71
  }, Y = () => {
70
72
  n.clearHoloSignal();
71
73
  }, ee = (e) => {
72
- r == null || r.toggleTrafficInfo(e), n.toggleTrafficInfo(e);
74
+ o == null || o.toggleTrafficInfo(e), n.toggleTrafficInfo(e);
73
75
  }, te = (e) => {
74
76
  n.togglePause(e);
75
77
  }, ae = (e) => {
76
- r == null || r.toggleTrafficObject(e), n.toggleTrafficObject(e);
78
+ o == null || o.toggleTrafficObject(e), n.toggleTrafficObject(e);
77
79
  }, ne = (e) => {
78
80
  n.updatePanelContent(e);
79
- }, re = async (e) => (a || (a = new D(s)), a.addOverlays(e)), oe = (e) => (a || (a = new D(s)), a.addMask(e)), se = () => {
81
+ }, oe = async (e) => (a || (a = new D(s)), a.addOverlays(e)), re = (e) => (a || (a = new D(s)), a.addMask(e)), se = () => {
80
82
  a == null || a.removeMask();
81
83
  }, ie = (e) => a == null ? void 0 : a.removeOverlaysByType(e), ce = (e) => a == null ? void 0 : a.removeOverlaysById(e), le = () => a == null ? void 0 : a.removeAllOverlays(), ue = () => {
82
84
  a == null || a.showAllOverlays();
@@ -84,7 +86,7 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
84
86
  p || (p = new Ke(s)), p.updateQueueLength(e);
85
87
  }, pe = () => {
86
88
  p == null || p.removeQueueLength();
87
- }, ge = async (e, u) => (t || (t = new L(s)), await t.showOpenDriveFromServer(e, u)), fe = async (e) => (t || (t = new L(s)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), de = async () => await (t == null ? void 0 : t.clearOpenDrive()), we = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
89
+ }, ge = async (e, u) => (t || (t = new L(s)), await t.showOpenDriveFromServer(e, u)), de = async (e) => (t || (t = new L(s)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), fe = async () => await (t == null ? void 0 : t.clearOpenDrive()), we = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
88
90
  status: -1,
89
91
  message: "未加载OpenDrive地图"
90
92
  }, ye = async (e) => t ? t.selectSumo(e) : {
@@ -105,9 +107,9 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
105
107
  }, Ce = async () => t ? t == null ? void 0 : t.clearSplitLane() : {
106
108
  status: -1,
107
109
  message: "未加载OpenDrive地图"
108
- }, ke = async (e) => (o || (o = new Re(s)), await o.showSignalControlArea(e)), Te = () => {
109
- o == null || o.clearSignalControlArea();
110
- }, Le = async (e) => o ? await o.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, De = async (e) => o ? await o.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Ae = () => o ? o.resetHighlight() : { status: -1, message: "未加载信号控制区" }, O = I, w = M;
110
+ }, ke = async (e) => (r || (r = new Re(s)), await r.showSignalControlArea(e)), Te = () => {
111
+ r == null || r.clearSignalControlArea();
112
+ }, Le = async (e) => r ? await r.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, De = async (e) => r ? await r.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Ae = () => r ? r.resetHighlight() : { status: -1, message: "未加载信号控制区" }, O = I, w = M;
111
113
  return b({
112
114
  mapViewer: H,
113
115
  setLayerVisibility: N,
@@ -117,8 +119,8 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
117
119
  setMapZoomRange: E,
118
120
  requestCoordinateTransform: Q,
119
121
  cancelCoordinateTransform: j,
120
- addOverlays: re,
121
- addMask: oe,
122
+ addOverlays: oe,
123
+ addMask: re,
122
124
  removeMask: se,
123
125
  showAllOverlays: ue,
124
126
  removeOverlaysByType: ie,
@@ -143,8 +145,8 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
143
145
  updateQueueLength: me,
144
146
  removeQueueLength: pe,
145
147
  showOpenDriveFromServer: ge,
146
- showOpenDriveFromFile: fe,
147
- clearOpenDrive: de,
148
+ showOpenDriveFromFile: de,
149
+ clearOpenDrive: fe,
148
150
  geometrySearchInOpenDrive: Se,
149
151
  findSumoInOpenDrive: we,
150
152
  selectSumoInOpenDrive: ye,
@@ -161,7 +163,7 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
161
163
  g("div", {
162
164
  class: "gis-viewer-main",
163
165
  ref_key: "mapContainer",
164
- ref: f
166
+ ref: d
165
167
  }, [
166
168
  Pe(g("div", Ge, [
167
169
  g("button", {
@@ -170,11 +172,12 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
170
172
  }, " 开始记录 "),
171
173
  g("button", { onClick: P }, "下载日志")
172
174
  ], 512), [
173
- [Be, d.value]
175
+ [Be, f.value]
174
176
  ])
175
177
  ], 512),
176
178
  (S(!0), k(Ve, null, ze(Ne(_), (c, m) => (S(), Qe(Ze, {
177
179
  key: m,
180
+ "display-mode": c.displayMode,
178
181
  "road-id": c.crossId,
179
182
  "cross-id": c.roadId,
180
183
  "map-point": c.mapPoint,
@@ -182,7 +185,7 @@ const $e = { class: "gis-viewer" }, Ge = { style: { position: "absolute", bottom
182
185
  position: c.position,
183
186
  rotation: c.rotation,
184
187
  "lamp-status": c.lampStatus
185
- }, null, 8, ["road-id", "cross-id", "map-point", "stop-line", "position", "rotation", "lamp-status"]))), 128))
188
+ }, null, 8, ["display-mode", "road-id", "cross-id", "map-point", "stop-line", "position", "rotation", "lamp-status"]))), 128))
186
189
  ]));
187
190
  }
188
191
  });
@@ -18,6 +18,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
18
18
  queueLength: import("./utils/queue-length").default;
19
19
  openDriveRenderer: import("./utils/open-drive-renderer").default;
20
20
  signalControlAreaController: import("./utils/signal-control-area-controller").default;
21
+ showLogDiv: import("vue").Ref<boolean>;
21
22
  appDataStore: import("pinia").Store<"appData", {
22
23
  mapConfig: {};
23
24
  saveTrackLog: boolean;
@@ -25,6 +26,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
25
26
  countdownPanels: import("../types").ISignalCountdownProps[];
26
27
  }, {}, {}>;
27
28
  countdownPanelInfos: import("vue").Ref<{
29
+ displayMode: string;
28
30
  crossId: string;
29
31
  roadId: string;
30
32
  mapPoint: number[];
@@ -45,7 +47,6 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
45
47
  rColor?: string | undefined;
46
48
  };
47
49
  }[]>;
48
- showLogDiv: import("vue").Ref<boolean>;
49
50
  mapViewer: import("vue").ComputedRef<__esri.MapView | __esri.SceneView>;
50
51
  startSaveTrackLog: () => void;
51
52
  downloadTrackLog: () => void;
@@ -112,6 +113,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
112
113
  props: any;
113
114
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
114
115
  SignalCountdownPanel: import("vue").DefineComponent<{
116
+ displayMode: {
117
+ type: StringConstructor;
118
+ required: true;
119
+ };
115
120
  crossId: {
116
121
  type: StringConstructor;
117
122
  required: true;
@@ -164,8 +169,12 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
164
169
  rNumberStyle: import("vue").ComputedRef<{
165
170
  color: string;
166
171
  }>;
167
- getColorString: (color: string | undefined) => "red" | "yellow" | "lime" | "white";
172
+ getColorString: (color: string | undefined) => "red" | "rgb(255, 192, 2)" | "lime" | "white";
168
173
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
174
+ displayMode: {
175
+ type: StringConstructor;
176
+ required: true;
177
+ };
169
178
  crossId: {
170
179
  type: StringConstructor;
171
180
  required: true;
@@ -1,11 +1,11 @@
1
- import { Point as P, Polyline as f } from "@arcgis/core/geometry";
1
+ import { Point as L, Polyline as f } from "@arcgis/core/geometry";
2
2
  import * as g from "@arcgis/core/geometry/geometryEngineAsync";
3
3
  import * as l from "@arcgis/core/geometry/support/webMercatorUtils";
4
4
  import p from "@turf/bearing";
5
5
  import u from "@turf/destination";
6
6
  import * as a from "@turf/helpers";
7
- import O from "@turf/length";
8
- import d from "@turf/line-slice-along";
7
+ import d from "@turf/length";
8
+ import O from "@turf/line-slice-along";
9
9
  import w from "pako";
10
10
  import y from "proj4";
11
11
  class s {
@@ -20,7 +20,7 @@ class s {
20
20
  const r = a.point([t.x, t.y]), i = u(r, n, e, {
21
21
  units: "meters"
22
22
  });
23
- return new P({
23
+ return new L({
24
24
  x: i.geometry.coordinates[0],
25
25
  y: i.geometry.coordinates[1]
26
26
  });
@@ -42,12 +42,12 @@ class s {
42
42
  static extendLineInTowDir(t, e) {
43
43
  const n = t.paths[0], r = a.point(n[0]), i = a.point(n[1]), o = p(i, r), c = u(r, e, o, {
44
44
  units: "meters"
45
- }), h = o > 0 ? o - 180 : o + 180, L = u(i, e, h, {
45
+ }), h = o > 0 ? o - 180 : o + 180, P = u(i, e, h, {
46
46
  units: "meters"
47
47
  });
48
48
  return new f({
49
49
  paths: [
50
- [c.geometry.coordinates, L.geometry.coordinates]
50
+ [c.geometry.coordinates, P.geometry.coordinates]
51
51
  ]
52
52
  });
53
53
  }
@@ -226,10 +226,10 @@ class s {
226
226
  * @returns
227
227
  */
228
228
  static getCenterPointInLine(t) {
229
- const e = a.lineString(t), n = O(e, { units: "meters" }) / 2;
230
- return d(e, 0, n, {
229
+ const e = a.lineString(t), n = d(e, { units: "meters" }) / 2, r = O(e, 0, n, {
231
230
  units: "meters"
232
- }).geometry.coordinates[1];
231
+ });
232
+ return r.geometry.coordinates[r.geometry.coordinates.length - 1];
233
233
  }
234
234
  }
235
235
  export {
@@ -1,4 +1,8 @@
1
1
  declare const _sfc_main: import("vue").DefineComponent<{
2
+ displayMode: {
3
+ type: StringConstructor;
4
+ required: true;
5
+ };
2
6
  crossId: {
3
7
  type: StringConstructor;
4
8
  required: true;
@@ -51,8 +55,12 @@ declare const _sfc_main: import("vue").DefineComponent<{
51
55
  rNumberStyle: import("vue").ComputedRef<{
52
56
  color: string;
53
57
  }>;
54
- getColorString: (color: string | undefined) => "red" | "yellow" | "lime" | "white";
58
+ getColorString: (color: string | undefined) => "red" | "rgb(255, 192, 2)" | "lime" | "white";
55
59
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
60
+ displayMode: {
61
+ type: StringConstructor;
62
+ required: true;
63
+ };
56
64
  crossId: {
57
65
  type: StringConstructor;
58
66
  required: true;
@@ -1,7 +1,7 @@
1
1
  import o from "./signal-countdown-panel.vue2.mjs";
2
2
  import "./signal-countdown-panel.vue3.mjs";
3
3
  import t from "../../../../_virtual/_plugin-vue_export-helper.mjs";
4
- const n = /* @__PURE__ */ t(o, [["__scopeId", "data-v-93496d9c"]]);
4
+ const n = /* @__PURE__ */ t(o, [["__scopeId", "data-v-d749c855"]]);
5
5
  export {
6
6
  n as default
7
7
  };
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as C, computed as o, openBlock as l, createElementBlock as n, normalizeStyle as a, createElementVNode as t, toDisplayString as i, createCommentVNode as u } from "vue";
2
- const _ = {
2
+ const b = {
3
3
  key: 0,
4
4
  class: "signal-countdown-container"
5
- }, b = ["src"], I = {
5
+ }, _ = ["src"], I = {
6
6
  key: 1,
7
7
  class: "signal-countdown-container"
8
8
  }, N = ["src"], f = {
@@ -14,6 +14,7 @@ const _ = {
14
14
  }, V = ["src"], A = /* @__PURE__ */ C({
15
15
  __name: "signal-countdown-panel",
16
16
  props: {
17
+ displayMode: {},
17
18
  crossId: {},
18
19
  roadId: {},
19
20
  mapPoint: {},
@@ -49,7 +50,7 @@ const _ = {
49
50
  case "red":
50
51
  return "red";
51
52
  case "yellow":
52
- return "yellow";
53
+ return "rgb(255, 192, 2)";
53
54
  case "green":
54
55
  return "lime";
55
56
  default:
@@ -60,7 +61,7 @@ const _ = {
60
61
  class: "signal-countdown-panel",
61
62
  style: a(m.value)
62
63
  }, [
63
- e.lampStatus.uColor ? (l(), n("div", _, [
64
+ e.lampStatus.uColor ? (l(), n("div", b, [
64
65
  t("div", {
65
66
  class: "signal-countdown-number",
66
67
  style: a(d.value)
@@ -70,7 +71,7 @@ const _ = {
70
71
  src: p.value,
71
72
  width: "20px",
72
73
  height: "20px"
73
- }, null, 8, b)
74
+ }, null, 8, _)
74
75
  ])
75
76
  ])) : u("", !0),
76
77
  e.lampStatus.lColor ? (l(), n("div", I, [
@@ -2,6 +2,7 @@ import SignalHoloFlow from './signal-holo-flow';
2
2
  export default class LSRSignalHoloFlow extends SignalHoloFlow {
3
3
  private stopLineLayer;
4
4
  private store;
5
+ private watchHandle;
5
6
  constructor(view: __esri.MapView | __esri.SceneView);
6
7
  private stopLineMap;
7
8
  initializeLayer(): Promise<void>;
@@ -1,87 +1,117 @@
1
- import * as m from "@arcgis/core/core/reactiveUtils";
2
- import { Point as h } from "@arcgis/core/geometry";
3
- import f from "@arcgis/core/layers/GraphicsLayer";
4
- import P from "@turf/bearing";
5
- import g from "@turf/destination";
6
- import * as c from "@turf/helpers";
7
- import d from "../../stores/index.mjs";
8
- import y from "../common-utils.mjs";
9
- import w from "./signal-holo-flow.mjs";
10
- class F extends w {
11
- constructor(o) {
12
- super(o), this.stopLineLayer = new f(), this.store = d.useAppDataStore, this.stopLineMap = /* @__PURE__ */ new Map(), this.view.map.add(this.stopLineLayer);
1
+ import * as u from "@arcgis/core/core/reactiveUtils";
2
+ import { Point as d } from "@arcgis/core/geometry";
3
+ import P from "@arcgis/core/layers/GraphicsLayer";
4
+ import y from "@turf/bearing";
5
+ import L from "@turf/destination";
6
+ import * as w from "@turf/helpers";
7
+ import S from "../../stores/index.mjs";
8
+ import R from "../common-utils.mjs";
9
+ import v from "./signal-holo-flow.mjs";
10
+ class b extends v {
11
+ constructor(t) {
12
+ super(t), this.stopLineLayer = new P(), this.store = S.useAppDataStore, this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.view.map.add(this.stopLineLayer);
13
13
  }
14
14
  async initializeLayer() {
15
- var i, r;
15
+ var p, h;
16
16
  console.time("初始化停止线图层");
17
- let o = (r = (i = this.mapConfig.holoFlow) == null ? void 0 : i.signal) == null ? void 0 : r.stopLineLayer;
18
- if (!o)
17
+ let t = (h = (p = this.mapConfig.holoFlow) == null ? void 0 : p.signal) == null ? void 0 : h.stopLineLayer;
18
+ if (!t)
19
19
  return;
20
- o = this.mapConfig.assetsRoot + "/" + o, (await (await fetch(o)).json()).features.forEach((t) => {
21
- const { roadId: n, nodeId: e } = t.properties, { coordinates: s } = t.geometry, l = this.stopLineMap.get(e);
22
- l ? l.set(n, s) : this.stopLineMap.set(e, /* @__PURE__ */ new Map([[n, s]]));
23
- }), console.timeEnd("初始化停止线图层"), m.watch(
20
+ t = this.mapConfig.assetsRoot + "/" + t, (await (await fetch(t)).json()).features.forEach((a) => {
21
+ const { roadId: o, nodeId: n } = a.properties, { coordinates: r } = a.geometry, e = this.stopLineMap.get(n);
22
+ e ? e.set(o, r) : this.stopLineMap.set(n, /* @__PURE__ */ new Map([[o, r]]));
23
+ }), console.timeEnd("初始化停止线图层");
24
+ }
25
+ async handleSignalData(t) {
26
+ this.watchHandle || (this.watchHandle = u.watch(
24
27
  () => this.view.extent,
25
28
  () => {
26
- for (const t of this.store.countdownPanels) {
27
- const { mapPoint: n, stopLine: e } = t, s = this.view.toScreen({
29
+ for (const o of this.store.countdownPanels) {
30
+ const { mapPoint: n } = o, r = this.view.toScreen({
28
31
  type: "point",
29
32
  x: n[0],
30
33
  y: n[1]
31
34
  });
32
- t.position.left = s.x, t.position.top = s.y;
33
- const l = this.getPanelRotation(e);
34
- t.rotation = l;
35
+ o.position.left = r.x, o.position.top = r.y;
35
36
  }
36
37
  }
37
- );
38
- }
39
- async handleSignalData(o) {
40
- const { crossId: a, roadId: p, lampStatus: i } = o, r = this.stopLineMap.get(a);
41
- if (!r)
42
- return;
43
- const t = r.get(p);
44
- if (!t)
45
- return;
46
- const n = this.store.countdownPanels.find(
47
- (e) => e.crossId === a && e.roadId === p
48
- );
49
- if (n)
50
- n.lampStatus = i;
51
- else {
52
- const e = this.getPanelPoint(t), s = this.view.toScreen({
53
- type: "point",
54
- x: e[0],
55
- y: e[1]
56
- }), l = this.getPanelRotation(t);
57
- this.store.countdownPanels.push({
58
- crossId: a,
59
- roadId: p,
60
- mapPoint: e,
61
- // 定位点地理坐标
62
- stopLine: t,
63
- // 关联的停止线坐标
64
- position: { left: s.x, top: s.y },
65
- // 定位点屏幕坐标
66
- rotation: l,
67
- // 面板旋转角度
68
- lampStatus: i
69
- // 灯组状态
38
+ ));
39
+ const s = t.crossId, i = t.rtStage, p = t.nonCurStageRemainingTime, h = t.allStageFlows;
40
+ console.log(s, i, p, h);
41
+ const a = /* @__PURE__ */ new Map();
42
+ h.forEach((o) => {
43
+ const { stageId: n, stageFlows: r } = o;
44
+ let e = "green", m = i.stageRemainingTime;
45
+ if (n === i.stageId)
46
+ m <= i.stageAllRedTime ? e = "red" : i.stageYellowTime !== 0 && m <= i.stageYellowTime + i.stageAllRedTime && (e = "yellow");
47
+ else {
48
+ e = "red";
49
+ const l = p.find(
50
+ (g) => g.stageId === n
51
+ );
52
+ m = l ? l.stageNextRunRemainingTime : 0;
53
+ }
54
+ r.forEach((l) => {
55
+ let { fromRoadId: g } = l;
56
+ g.startsWith("-") && (g = g.slice(1));
57
+ const f = l.direction.toLowerCase();
58
+ let c = a.get(g);
59
+ c || (c = {}, a.set(g, c)), f === "u" ? (c.uNumber = m, c.uColor = e) : f === "l" ? (c.lNumber = m, c.lColor = e) : f === "s" ? (c.sNumber = m, c.sColor = e) : f === "r" && (c.rNumber = m, c.rColor = e === "yellow" ? "red" : e);
70
60
  });
71
- }
61
+ }), a.forEach((o, n) => {
62
+ console.log(n, o);
63
+ const r = this.stopLineMap.get(s);
64
+ if (!r) {
65
+ console.error(`路口${s}没有找到对应的停止线`);
66
+ return;
67
+ }
68
+ const e = r.get(n);
69
+ if (!e) {
70
+ console.error(`路口${s}的进口道${n}没有找到对应的停止线`);
71
+ return;
72
+ }
73
+ const m = this.store.countdownPanels.find(
74
+ (l) => l.crossId === s && l.roadId === n
75
+ );
76
+ if (m)
77
+ m.lampStatus = o;
78
+ else {
79
+ const l = this.getPanelPoint(e), g = this.view.toScreen({
80
+ type: "point",
81
+ x: l[0],
82
+ y: l[1]
83
+ }), f = this.getPanelRotation(e);
84
+ this.store.countdownPanels.push({
85
+ displayMode: "complete",
86
+ crossId: s,
87
+ roadId: n,
88
+ mapPoint: l,
89
+ // 定位点地理坐标
90
+ stopLine: e,
91
+ // 关联的停止线坐标
92
+ position: { left: g.x, top: g.y },
93
+ // 定位点屏幕坐标
94
+ rotation: f,
95
+ // 面板旋转角度
96
+ lampStatus: o
97
+ // 灯组状态
98
+ });
99
+ }
100
+ });
72
101
  }
73
102
  clearSignal() {
74
- this.stopLineLayer.removeAll();
103
+ var t;
104
+ this.stopLineLayer.removeAll(), this.store.countdownPanels = [], (t = this.watchHandle) == null || t.remove(), this.watchHandle = null;
75
105
  }
76
106
  /**
77
107
  * 从停止线坐标计算面板位置
78
108
  * @param coordinates
79
109
  * @returns
80
110
  */
81
- getPanelPoint(o) {
82
- const a = y.getCenterPointInLine(o), p = o[0], i = o[o.length - 1];
83
- let t = P(c.point(p), c.point(i)) - 90;
84
- return t < -180 && (t += 360), g(c.point(a), 1, t, {
111
+ getPanelPoint(t) {
112
+ const s = R.getCenterPointInLine(t), i = t[0], p = t[t.length - 1];
113
+ let a = y(w.point(i), w.point(p)) - 90;
114
+ return a < -180 && (a += 360), L(w.point(s), 1, a, {
85
115
  units: "meters"
86
116
  }).geometry.coordinates;
87
117
  }
@@ -90,19 +120,19 @@ class F extends w {
90
120
  * @param coordinates
91
121
  * @returns
92
122
  */
93
- getPanelRotation(o) {
94
- const a = o[0], p = new h({
95
- x: a[0],
96
- y: a[1],
123
+ getPanelRotation(t) {
124
+ const s = t[0], i = new d({
125
+ x: s[0],
126
+ y: s[1],
97
127
  spatialReference: this.view.spatialReference
98
- }), i = this.view.toScreen(p), r = o[o.length - 1], t = new h({
99
- x: r[0],
100
- y: r[1],
128
+ }), p = this.view.toScreen(i), h = t[t.length - 1], a = new d({
129
+ x: h[0],
130
+ y: h[1],
101
131
  spatialReference: this.view.spatialReference
102
- }), n = this.view.toScreen(t), e = n.x - i.x, s = n.y - i.y;
103
- return Math.atan2(s, e) * (180 / Math.PI);
132
+ }), o = this.view.toScreen(a), n = o.x - p.x, r = o.y - p.y;
133
+ return Math.atan2(r, n) * (180 / Math.PI);
104
134
  }
105
135
  }
106
136
  export {
107
- F as default
137
+ b as default
108
138
  };
@@ -11,6 +11,7 @@ export default class MapInitializer {
11
11
  */
12
12
  initialize(params: {
13
13
  container: HTMLElement;
14
+ mapConfig: any;
14
15
  markerClickCallback?: (type: string, id: string, detail: any, event?: any) => void;
15
16
  mapClickCallback?: (mapPoint: number[], screenPoint: number[], event?: any) => void;
16
17
  }): Promise<MapView | SceneView>;