gisviewer-vue3-arcgis 1.0.178 → 1.0.180

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.
@@ -125,10 +125,12 @@ declare const _sfc_main: import("vue").DefineComponent<{
125
125
  }) => Promise<import("../types").IResult>;
126
126
  resetHighlightSignalControlArea: () => import("../types").IResult;
127
127
  showSubSignalControlArea: (params: any) => import("../types").IResult;
128
- editSubSignalControlArea: () => Promise<import("../types").IResult> | {
128
+ editSubSignalControlArea: (addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void) => Promise<import("../types").IResult> | {
129
129
  status: number;
130
130
  message: string;
131
131
  };
132
+ selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
133
+ unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
132
134
  props: any;
133
135
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
134
136
  SignalCountdownPanel: import("vue").DefineComponent<{
@@ -1,16 +1,16 @@
1
- import { defineComponent as Pe, ref as k, reactive as Ve, onMounted as Be, getCurrentInstance as Ne, onUnmounted as ze, computed as Qe, openBlock as v, createElementBlock as A, createElementVNode as g, withDirectives as je, vShow as Ee, Fragment as Ze, renderList as $e, createBlock as qe } from "vue";
2
- import b, { registerStore as Ke } from "./stores/index.mjs";
1
+ import { defineComponent as Be, ref as k, reactive as Ne, onMounted as ze, getCurrentInstance as Qe, onUnmounted as je, computed as Ee, openBlock as C, createElementBlock as A, createElementVNode as g, withDirectives as Ze, vShow as $e, Fragment as qe, renderList as Ke, createBlock as Ue } from "vue";
2
+ import b, { registerStore as Ge } from "./stores/index.mjs";
3
3
  import "./style/index.css";
4
- import Ue from "./utils/holo-flow/index.mjs";
5
- import Ge from "./utils/holo-flow/signal-countdown-panel.vue.mjs";
6
- import Je from "./utils/map-initializer.mjs";
4
+ import Je from "./utils/holo-flow/index.mjs";
5
+ import Re from "./utils/holo-flow/signal-countdown-panel.vue.mjs";
6
+ import We from "./utils/map-initializer.mjs";
7
7
  import D from "./utils/open-drive-renderer/index.mjs";
8
8
  import L from "./utils/overlay.mjs";
9
- import Re from "./utils/queue-length.mjs";
9
+ import Xe from "./utils/queue-length.mjs";
10
10
  import T from "./utils/road-config-tool/index.mjs";
11
11
  import I from "./utils/signal-control-area-controller/index.mjs";
12
- import We from "./utils/traffic-flow.mjs";
13
- const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom: "80px", left: "10px", "z-index": "9999" } }, mt = /* @__PURE__ */ Pe({
12
+ import Ye from "./utils/traffic-flow.mjs";
13
+ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom: "80px", left: "10px", "z-index": "9999" } }, gt = /* @__PURE__ */ Be({
14
14
  __name: "gis-map",
15
15
  props: {
16
16
  config: {},
@@ -19,83 +19,83 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
19
19
  emits: ["mapLoaded", "markerClick", "mapClick"],
20
20
  setup(M, { expose: _, emit: x }) {
21
21
  const d = k(null);
22
- let s, l, c, o, a, n, p, t, r;
22
+ let o, u, c, s, n, r, p, t, a;
23
23
  const f = k(!1);
24
- Ke();
25
- const H = b.useAppDataStore, C = Ve([]);
26
- Be(async () => {
24
+ Ge();
25
+ const H = b.useAppDataStore, v = Ne([]);
26
+ ze(async () => {
27
27
  if (!d.value)
28
28
  return;
29
29
  document.addEventListener("keydown", (m) => {
30
30
  m.ctrlKey && m.key === "i" && (f.value = !f.value);
31
31
  });
32
- const e = Ne(), { $gisviewerAssetsRoot: u } = e.appContext.config.globalProperties, i = await (await fetch(O.config)).json();
33
- i.assetsRoot = O.assetsRoot || u, H.mapConfig = i, l = new Je(), s = await l.initialize({
32
+ const e = Qe(), { $gisviewerAssetsRoot: l } = e.appContext.config.globalProperties, i = await (await fetch(O.config)).json();
33
+ i.assetsRoot = O.assetsRoot || l, H.mapConfig = i, u = new We(), o = await u.initialize({
34
34
  container: d.value,
35
35
  mapConfig: i,
36
- markerClickCallback: (m, w, h, He) => {
37
- y("markerClick", m, w, h, He);
36
+ markerClickCallback: (m, w, h, Ve) => {
37
+ y("markerClick", m, w, h, Ve);
38
38
  },
39
39
  mapClickCallback: (m, w, h) => {
40
40
  y("mapClick", m, w, h);
41
41
  }
42
- }), a = new Ue(s, C), await a.init(), y("mapLoaded");
43
- }), ze(() => {
44
- r == null || r.clearSignalControlArea(), t == null || t.clearOpenDrive(), a.clearHoloTrace(), a.clearHoloSignal(), o == null || o.disconnectTrafficFlow();
42
+ }), n = new Je(o, v), await n.init(), y("mapLoaded");
43
+ }), je(() => {
44
+ a == null || a.clearSignalControlArea(), t == null || t.clearOpenDrive(), n.clearHoloTrace(), n.clearHoloSignal(), s == null || s.disconnectTrafficFlow();
45
45
  });
46
- const P = Qe(() => s), V = () => {
46
+ const P = Ee(() => o), V = () => {
47
47
  const e = b.useAppDataStore;
48
48
  e.saveTrackLog = !0;
49
49
  }, B = () => {
50
- a.downloadTrackLog();
50
+ n.downloadTrackLog();
51
51
  }, N = () => {
52
52
  S("vehicleId");
53
53
  }, z = () => {
54
54
  S("plateNumber");
55
- }, Q = async (e) => await l.setMapCenter(e), j = async (e) => await l.setMapCamera(e), E = async (e) => await l.lookAt(e), Z = (e) => l.setLayerVisibility(e), $ = (e, u) => l.requestCoordinateTransform(e, u), q = (e) => {
56
- l.cancelCoordinateTransform(e);
55
+ }, Q = async (e) => await u.setMapCenter(e), j = async (e) => await u.setMapCamera(e), E = async (e) => await u.lookAt(e), Z = (e) => u.setLayerVisibility(e), $ = (e, l) => u.requestCoordinateTransform(e, l), q = (e) => {
56
+ u.cancelCoordinateTransform(e);
57
57
  }, K = (e) => {
58
- l.setMapZoomRange(e);
59
- }, U = (e) => (c || (c = new T(s)), c.showLaneNumber(e)), G = () => {
58
+ u.setMapZoomRange(e);
59
+ }, U = (e) => (c || (c = new T(o)), c.showLaneNumber(e)), G = () => {
60
60
  c == null || c.clearLaneNumber();
61
- }, J = async (e) => (c || (c = new T(s)), await c.initializeSearch(e)), R = async () => c == null ? void 0 : c.calCrossIndicatorArea(), W = async () => {
62
- }, X = async (e, u) => {
63
- o || (o = new We(s)), o.connectTrafficFlow(e, u);
61
+ }, J = async (e) => (c || (c = new T(o)), await c.initializeSearch(e)), R = async () => c == null ? void 0 : c.calCrossIndicatorArea(), W = async () => {
62
+ }, X = async (e, l) => {
63
+ s || (s = new Ye(o)), s.connectTrafficFlow(e, l);
64
64
  }, Y = () => {
65
- o == null || o.disconnectTrafficFlow();
65
+ s == null || s.disconnectTrafficFlow();
66
66
  }, F = async (e) => {
67
- a.handleVehicleTraceData(e);
67
+ n.handleVehicleTraceData(e);
68
68
  }, ee = () => {
69
- a.clearHoloTrace();
69
+ n.clearHoloTrace();
70
70
  }, te = (e) => {
71
- a.setInterpolate(e);
71
+ n.setInterpolate(e);
72
72
  }, ae = async (e) => {
73
- await a.handleSignalData(e);
73
+ await n.handleSignalData(e);
74
74
  }, ne = () => {
75
- a.clearHoloSignal();
75
+ n.clearHoloSignal();
76
76
  }, re = (e) => {
77
- o == null || o.toggleTrafficInfo(e), a == null || a.toggleTrafficInfo(e);
78
- }, oe = (e) => {
79
- a == null || a.togglePause(e);
77
+ s == null || s.toggleTrafficInfo(e), n == null || n.toggleTrafficInfo(e);
80
78
  }, se = (e) => {
81
- o == null || o.toggleTrafficObject(e), a == null || a.toggleTrafficObject(e);
79
+ n == null || n.togglePause(e);
80
+ }, oe = (e) => {
81
+ s == null || s.toggleTrafficObject(e), n == null || n.toggleTrafficObject(e);
82
82
  }, S = (e) => {
83
- a == null || a.updatePanelContent(e);
84
- }, ie = async (e) => (n || (n = new L(s)), n.addOverlays(e)), ce = (e) => (n || (n = new L(s)), n.addMask(e)), le = () => {
85
- n == null || n.removeMask();
86
- }, ue = (e) => n == null ? void 0 : n.removeOverlaysByType(e), me = (e) => n == null ? void 0 : n.removeOverlaysById(e), pe = () => n == null ? void 0 : n.removeAllOverlays(), ge = () => {
87
- n == null || n.showAllOverlays();
83
+ n == null || n.updatePanelContent(e);
84
+ }, ie = async (e) => (r || (r = new L(o)), r.addOverlays(e)), ce = (e) => (r || (r = new L(o)), r.addMask(e)), le = () => {
85
+ r == null || r.removeMask();
86
+ }, ue = (e) => r == null ? void 0 : r.removeOverlaysByType(e), me = (e) => r == null ? void 0 : r.removeOverlaysById(e), pe = () => r == null ? void 0 : r.removeAllOverlays(), ge = () => {
87
+ r == null || r.showAllOverlays();
88
88
  }, de = (e) => {
89
- p || (p = new Re(s)), p.updateQueueLength(e);
89
+ p || (p = new Xe(o)), p.updateQueueLength(e);
90
90
  }, fe = () => {
91
91
  p == null || p.removeQueueLength();
92
- }, Se = async (e, u) => (t || (t = new D(s)), await t.showOpenDriveFromServer(e, u)), ye = async (e) => (t || (t = new D(s)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), we = async () => await (t == null ? void 0 : t.clearOpenDrive()), he = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
92
+ }, Se = async (e, l) => (t || (t = new D(o)), await t.showOpenDriveFromServer(e, l)), ye = async (e) => (t || (t = new D(o)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), we = async () => await (t == null ? void 0 : t.clearOpenDrive()), he = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
93
93
  status: -1,
94
94
  message: "未加载OpenDrive地图"
95
- }, ve = async (e) => t ? t.selectSumo(e) : {
95
+ }, Ce = async (e) => t ? t.selectSumo(e) : {
96
96
  status: -1,
97
97
  message: "未加载OpenDrive地图"
98
- }, Ce = async (e) => t ? t.unselectSumo(e) : {
98
+ }, ve = async (e) => t ? t.unselectSumo(e) : {
99
99
  status: -1,
100
100
  message: "未加载OpenDrive地图"
101
101
  }, Oe = async (e) => t ? await t.geometrySearch(e) : {
@@ -110,9 +110,12 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
110
110
  }, be = async () => t ? t == null ? void 0 : t.clearSplitLane() : {
111
111
  status: -1,
112
112
  message: "未加载OpenDrive地图"
113
- }, De = (e) => (r || (r = new I(s)), r.showSignalControlArea(e)), Le = () => {
114
- r == null || r.clearSignalControlArea();
115
- }, Te = async (e) => r ? await r.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Ie = async (e) => r ? await r.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Me = () => r ? r.resetHighlight() : { status: -1, message: "未加载信号控制区" }, _e = (e) => (r || (r = new I(s)), r.showSubSignalControlArea(e)), xe = () => r ? r.editSubSignalArea() : { status: -1, message: "未加载信号控制区" }, O = M, y = x;
113
+ }, De = (e) => (a || (a = new I(o)), a.showSignalControlArea(e)), Le = () => {
114
+ a == null || a.clearSignalControlArea();
115
+ }, Te = async (e) => a ? await a.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Ie = async (e) => a ? await a.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Me = () => a ? a.resetHighlight() : { status: -1, message: "未加载信号控制区" }, _e = (e) => (a || (a = new I(o)), a.showSubSignalControlArea(e)), xe = (e, l) => a ? a.editSubSignalArea(
116
+ e,
117
+ l
118
+ ) : { status: -1, message: "未加载信号控制区" }, He = (e) => a ? a.selectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, Pe = (e) => a ? a.unselectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, O = M, y = x;
116
119
  return _({
117
120
  mapViewer: P,
118
121
  setLayerVisibility: Z,
@@ -142,9 +145,9 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
142
145
  clearHoloSignal: ne,
143
146
  setInterpolate: te,
144
147
  toggleTrafficInfo: re,
145
- toggleTrafficObject: se,
148
+ toggleTrafficObject: oe,
146
149
  toggleVehicleInfo: S,
147
- togglePause: oe,
150
+ togglePause: se,
148
151
  updateQueueLength: de,
149
152
  removeQueueLength: fe,
150
153
  showOpenDriveFromServer: Se,
@@ -152,8 +155,8 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
152
155
  clearOpenDrive: we,
153
156
  geometrySearchInOpenDrive: Oe,
154
157
  findSumoInOpenDrive: he,
155
- selectSumoInOpenDrive: ve,
156
- unselectSumoInOpenDrive: Ce,
158
+ selectSumoInOpenDrive: Ce,
159
+ unselectSumoInOpenDrive: ve,
157
160
  getSumoInfo: ke,
158
161
  splitOpenDriveLane: Ae,
159
162
  clearSplitOpenDriveLane: be,
@@ -163,14 +166,16 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
163
166
  highlightSignalControlArea: Ie,
164
167
  resetHighlightSignalControlArea: Me,
165
168
  showSubSignalControlArea: _e,
166
- editSubSignalControlArea: xe
167
- }), (e, u) => (v(), A("div", Xe, [
169
+ editSubSignalControlArea: xe,
170
+ selectSubSignalControlAreaCross: He,
171
+ unselectSubSignalControlAreaCross: Pe
172
+ }), (e, l) => (C(), A("div", Fe, [
168
173
  g("div", {
169
174
  class: "gis-viewer-main",
170
175
  ref_key: "mapContainer",
171
176
  ref: d
172
177
  }, [
173
- je(g("div", Ye, [
178
+ Ze(g("div", et, [
174
179
  g("button", {
175
180
  style: { "margin-right": "10px" },
176
181
  onClick: V
@@ -185,10 +190,10 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
185
190
  }, " 显示车辆id "),
186
191
  g("button", { onClick: z }, "显示车辆号牌")
187
192
  ], 512), [
188
- [Ee, f.value]
193
+ [$e, f.value]
189
194
  ])
190
195
  ], 512),
191
- (v(!0), A(Ze, null, $e(C, (i, m) => (v(), qe(Ge, {
196
+ (C(!0), A(qe, null, Ke(v, (i, m) => (C(), Ue(Re, {
192
197
  key: m,
193
198
  "display-mode": i.displayMode,
194
199
  "road-id": i.crossId,
@@ -204,5 +209,5 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
204
209
  }
205
210
  });
206
211
  export {
207
- mt as default
212
+ gt as default
208
213
  };
@@ -114,10 +114,12 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
114
114
  }) => Promise<import("../types").IResult>;
115
115
  resetHighlightSignalControlArea: () => import("../types").IResult;
116
116
  showSubSignalControlArea: (params: any) => import("../types").IResult;
117
- editSubSignalControlArea: () => Promise<import("../types").IResult> | {
117
+ editSubSignalControlArea: (addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void) => Promise<import("../types").IResult> | {
118
118
  status: number;
119
119
  message: string;
120
120
  };
121
+ selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
122
+ unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
121
123
  props: any;
122
124
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
123
125
  SignalCountdownPanel: import("vue").DefineComponent<{
@@ -1,11 +1,11 @@
1
- import * as y from "@arcgis/core/core/promiseUtils.js";
2
- import * as T from "@arcgis/core/core/reactiveUtils.js";
3
- import C from "@arcgis/core/geometry/SpatialReference";
1
+ import * as v from "@arcgis/core/core/promiseUtils.js";
2
+ import * as y from "@arcgis/core/core/reactiveUtils.js";
3
+ import T from "@arcgis/core/geometry/SpatialReference";
4
4
  import * as b from "@arcgis/core/views/3d/externalRenderers";
5
5
  import * as a from "three";
6
6
  import { GLTFLoader as f } from "three/examples/jsm/loaders/GLTFLoader";
7
- import { MTLLoader as w } from "three/examples/jsm/loaders/MTLLoader";
8
- import { OBJLoader as M } from "three/examples/jsm/loaders/OBJLoader";
7
+ import { MTLLoader as C } from "three/examples/jsm/loaders/MTLLoader";
8
+ import { OBJLoader as w } from "three/examples/jsm/loaders/OBJLoader";
9
9
  import { toRaw as G } from "vue";
10
10
  import { EVehiclePlateState as m } from "../../../types/index.mjs";
11
11
  import S from "../../stores/index.mjs";
@@ -47,17 +47,17 @@ class N {
47
47
  "status"
48
48
  ]
49
49
  ], this.view = e;
50
- const i = G(this.appDataStore.mapConfig);
51
- this.assetsRoot = i.assetsRoot, document.addEventListener(
50
+ const s = G(this.appDataStore.mapConfig);
51
+ this.assetsRoot = s.assetsRoot, document.addEventListener(
52
52
  "visibilitychange",
53
53
  () => {
54
54
  this.clearVehicles(), this.tabVisible = !document.hidden;
55
55
  },
56
56
  !1
57
- ), T.watch(
57
+ ), y.watch(
58
58
  () => this.view.camera.position.z,
59
- (t, s) => {
60
- (s <= this.cameraHeightThreshold && t > this.cameraHeightThreshold || s > this.cameraHeightThreshold && t <= this.cameraHeightThreshold) && (this.updateModel = !0);
59
+ (t, i) => {
60
+ (i <= this.cameraHeightThreshold && t > this.cameraHeightThreshold || i > this.cameraHeightThreshold && t <= this.cameraHeightThreshold) && (this.updateModel = !0);
61
61
  }
62
62
  );
63
63
  }
@@ -74,40 +74,40 @@ class N {
74
74
  return this.logTable;
75
75
  }
76
76
  async init() {
77
- await y.eachAlways([
77
+ await v.eachAlways([
78
78
  new Promise((e) => {
79
79
  new f().load(`${this.assetsRoot}/3DModels/car.glb`, (t) => {
80
- const s = t.scene, l = new a.Box3().setFromObject(s).getSize(new a.Vector3());
81
- this.carModel = new a.Object3D(), this.carModel.rotation.x = a.MathUtils.degToRad(90), this.carModel.add(s), s.position.set(0, 0, l.z / 2), e();
80
+ const i = t.scene, l = new a.Box3().setFromObject(i).getSize(new a.Vector3());
81
+ this.carModel = new a.Object3D(), this.carModel.rotation.x = a.MathUtils.degToRad(90), this.carModel.add(i), i.position.set(0, 0, l.z / 2), e();
82
82
  });
83
83
  }),
84
84
  new Promise((e) => {
85
85
  new f().load(`${this.assetsRoot}/3DModels/van.glb`, (t) => {
86
- const s = t.scene, l = new a.Box3().setFromObject(s).getSize(new a.Vector3());
87
- this.vanModel = new a.Object3D(), this.vanModel.rotation.x = a.MathUtils.degToRad(90), this.vanModel.add(s), s.position.set(0, 0, l.z / 2), e();
86
+ const i = t.scene, l = new a.Box3().setFromObject(i).getSize(new a.Vector3());
87
+ this.vanModel = new a.Object3D(), this.vanModel.rotation.x = a.MathUtils.degToRad(90), this.vanModel.add(i), i.position.set(0, 0, l.z / 2), e();
88
88
  });
89
89
  }),
90
90
  new Promise((e) => {
91
91
  new f().load(`${this.assetsRoot}/3DModels/truck.glb`, (t) => {
92
- const s = t.scene;
93
- s.scale.set(1.2, 1, 1.5);
94
- const l = new a.Box3().setFromObject(s).getSize(new a.Vector3());
95
- this.truckModel = new a.Object3D(), this.truckModel.rotation.x = a.MathUtils.degToRad(90), this.truckModel.add(s), s.position.set(0, 0, l.z / 2), e();
92
+ const i = t.scene;
93
+ i.scale.set(1.2, 1, 1.5);
94
+ const l = new a.Box3().setFromObject(i).getSize(new a.Vector3());
95
+ this.truckModel = new a.Object3D(), this.truckModel.rotation.x = a.MathUtils.degToRad(90), this.truckModel.add(i), i.position.set(0, 0, l.z / 2), e();
96
96
  });
97
97
  }),
98
98
  new Promise((e) => {
99
99
  new f().load(`${this.assetsRoot}/3DModels/bus.glb`, (t) => {
100
- const s = t.scene, l = new a.Box3().setFromObject(s).getSize(new a.Vector3());
101
- this.busModel = new a.Object3D(), this.busModel.rotation.x = a.MathUtils.degToRad(90), this.busModel.add(s), s.position.set(0, 0, l.z / 2), e();
100
+ const i = t.scene, l = new a.Box3().setFromObject(i).getSize(new a.Vector3());
101
+ this.busModel = new a.Object3D(), this.busModel.rotation.x = a.MathUtils.degToRad(90), this.busModel.add(i), i.position.set(0, 0, l.z / 2), e();
102
102
  });
103
103
  }),
104
104
  new Promise((e) => {
105
- new w().load(
105
+ new C().load(
106
106
  `${this.assetsRoot}/3DModels/bicycle.mtl`,
107
107
  (t) => {
108
108
  t.preload();
109
- const s = new M();
110
- s.setMaterials(t), s.load(
109
+ const i = new w();
110
+ i.setMaterials(t), i.load(
111
111
  `${this.assetsRoot}/3DModels/bicycle.obj`,
112
112
  (o) => {
113
113
  this.bicycleModel = o, this.bicycleModel.rotation.x = a.MathUtils.degToRad(90), e();
@@ -117,16 +117,9 @@ class N {
117
117
  );
118
118
  }),
119
119
  new Promise((e) => {
120
- new w().load(
121
- `${this.assetsRoot}/3DModels/passenger.mtl`,
122
- (t) => {
123
- t.preload();
124
- const s = new M();
125
- s.setMaterials(t), s.load(`${this.assetsRoot}/3DModels/male.obj`, (o) => {
126
- o.scale.set(0.01, 0.01, 0.01), this.passengerModel = o, this.passengerModel.rotation.x = a.MathUtils.degToRad(90), this.passengerModel.rotation.y = a.MathUtils.degToRad(180), e();
127
- });
128
- }
129
- );
120
+ new w().load(`${this.assetsRoot}/3DModels/male.obj`, (t) => {
121
+ t.scale.set(0.01, 0.01, 0.01), this.passengerModel = t, this.passengerModel.rotation.x = a.MathUtils.degToRad(90), this.passengerModel.rotation.y = a.MathUtils.degToRad(180), e();
122
+ });
130
123
  }),
131
124
  new Promise((e) => {
132
125
  this.bluePlateBG = new Image(), this.bluePlateBG.src = `${this.assetsRoot}/Images/PlateBG/blue.png`, this.bluePlateBG.onload = () => {
@@ -176,11 +169,11 @@ class N {
176
169
  antialias: !0,
177
170
  powerPreference: "high-performance"
178
171
  }), this.renderer.shadowMap.enabled = !0, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setViewport(0, 0, this.view.width, this.view.height), this.renderer.autoClearDepth = !1, this.renderer.autoClearStencil = !1, this.renderer.autoClearColor = !1;
179
- const i = this.renderer.setRenderTarget.bind(
172
+ const s = this.renderer.setRenderTarget.bind(
180
173
  this.renderer
181
174
  );
182
- this.renderer.setRenderTarget = (s) => {
183
- i(s), s == null && e.bindRenderTarget();
175
+ this.renderer.setRenderTarget = (i) => {
176
+ s(i), i == null && e.bindRenderTarget();
184
177
  }, this.scene = new a.Scene();
185
178
  const { camera: t } = e;
186
179
  this.camera = new a.PerspectiveCamera(
@@ -191,13 +184,13 @@ class N {
191
184
  ), this.ambient = new a.AmbientLight(16777215, 2), this.scene.add(this.ambient), this.sun = new a.DirectionalLight(16777215, 2), this.scene.add(this.sun), e.resetWebGLState();
192
185
  }
193
186
  async render(e) {
194
- var s;
195
- const i = e.camera;
196
- if (this.camera.position.set(i.eye[0], i.eye[1], i.eye[2]), this.camera.up.set(i.up[0], i.up[1], i.up[2]), this.camera.lookAt(
197
- new a.Vector3(i.center[0], i.center[1], i.center[2])
198
- ), this.camera.projectionMatrix.fromArray(i.projectionMatrix), !this.isPaused && this.tabVisible)
187
+ var i;
188
+ const s = e.camera;
189
+ if (this.camera.position.set(s.eye[0], s.eye[1], s.eye[2]), this.camera.up.set(s.up[0], s.up[1], s.up[2]), this.camera.lookAt(
190
+ new a.Vector3(s.center[0], s.center[1], s.center[2])
191
+ ), this.camera.projectionMatrix.fromArray(s.projectionMatrix), !this.isPaused && this.tabVisible)
199
192
  for (const o of this.vehicleObjectMap.keys()) {
200
- const l = (s = this.vehicleObjectMap.get(o)) == null ? void 0 : s.model;
193
+ const l = (i = this.vehicleObjectMap.get(o)) == null ? void 0 : i.model;
201
194
  if (!l)
202
195
  continue;
203
196
  const r = this.computeVehiclePosition(o);
@@ -223,7 +216,7 @@ class N {
223
216
  async addVehicles(e) {
224
217
  if (this.isPaused || !this.isInitialized || !this.tabVisible)
225
218
  return;
226
- const i = Date.now();
219
+ const s = Date.now();
227
220
  for (const t of e) {
228
221
  this.appDataStore.saveTrackLog && this.logTable.push([
229
222
  t.ptcId,
@@ -241,23 +234,23 @@ class N {
241
234
  t.fixAngle,
242
235
  t.roadLayer,
243
236
  t.step,
244
- i,
237
+ s,
245
238
  0,
246
239
  0
247
240
  ]);
248
- const { vehicleId: s, localTimestamp: o } = t, l = Number(t.x), r = Number(t.y), d = Number(t.heading);
249
- this.historyPositionMap.set(s, [
241
+ const { vehicleId: i, localTimestamp: o } = t, l = Number(t.x), r = Number(t.y), d = Number(t.heading);
242
+ this.historyPositionMap.set(i, [
250
243
  { pos: [l, r, 0], heading: d, time: o }
251
244
  ]);
252
245
  const h = this.getVehicleModel(t);
253
- h.name = s, h.visible = !1;
246
+ h.name = i, h.visible = !1;
254
247
  try {
255
248
  const n = await this.createPlateSprite(t);
256
249
  n && (h.add(n), n.position.set(0, 5, -4));
257
250
  } catch (n) {
258
251
  console.log("createPlateSprite error:", n);
259
252
  }
260
- this.scene.add(h), this.vehicleObjectMap.set(s, {
253
+ this.scene.add(h), this.vehicleObjectMap.set(i, {
261
254
  model: h,
262
255
  data: t,
263
256
  waitForDelete: !1,
@@ -271,47 +264,47 @@ class N {
271
264
  async updateVehicles(e) {
272
265
  if (this.isPaused || !this.isInitialized || !this.tabVisible)
273
266
  return;
274
- const i = [], t = Date.now();
275
- for (const s of e) {
276
- const { vehicleId: o, localTimestamp: l } = s, r = Number(s.x), d = Number(s.y);
277
- let h = Number(s.heading);
267
+ const s = [], t = Date.now();
268
+ for (const i of e) {
269
+ const { vehicleId: o, localTimestamp: l } = i, r = Number(i.x), d = Number(i.y);
270
+ let h = Number(i.heading);
278
271
  const n = this.vehicleObjectMap.get(o), p = this.historyPositionMap.get(
279
272
  o
280
273
  );
281
274
  if (!n || !p)
282
- i.push(s);
275
+ s.push(i);
283
276
  else {
284
277
  if (this.appDataStore.saveTrackLog && this.logTable.push([
285
- s.ptcId,
286
- s.plateNo,
287
- s.timestamp,
288
- s.localTimestamp,
289
- s.speed,
290
- s.x,
291
- s.y,
292
- s.ptcType,
293
- s.vehicleType,
294
- s.vehicleColor,
295
- s.plateColor,
296
- s.heading,
297
- s.fixAngle,
298
- s.roadLayer,
299
- s.step,
278
+ i.ptcId,
279
+ i.plateNo,
280
+ i.timestamp,
281
+ i.localTimestamp,
282
+ i.speed,
283
+ i.x,
284
+ i.y,
285
+ i.ptcType,
286
+ i.vehicleType,
287
+ i.vehicleColor,
288
+ i.plateColor,
289
+ i.heading,
290
+ i.fixAngle,
291
+ i.roadLayer,
292
+ i.step,
300
293
  t,
301
294
  p.length,
302
295
  1
303
- ]), this.updateModel || n.data.vehicleColor !== s.vehicleColor || n.data.vehicleType !== s.vehicleType) {
304
- this.scene.remove(n.model), this.disposeModel(n.model), n.model = this.getVehicleModel(s), n.model.visible = !0;
305
- const c = await this.createPlateSprite(s);
296
+ ]), this.updateModel || n.data.vehicleColor !== i.vehicleColor || n.data.vehicleType !== i.vehicleType) {
297
+ this.scene.remove(n.model), this.disposeModel(n.model), n.model = this.getVehicleModel(i), n.model.visible = !0;
298
+ const c = await this.createPlateSprite(i);
306
299
  c && (n.model.add(c), c.position.set(0, 5, -4)), this.scene.add(n.model);
307
300
  }
308
- if (n.data.showName !== s.showName || n.data.plateColor !== s.plateColor) {
301
+ if (n.data.showName !== i.showName || n.data.plateColor !== i.plateColor) {
309
302
  const c = n.model.getObjectByName("VehiclePlate");
310
303
  c && (n.model.remove(c), this.disposeModel(c));
311
- const g = await this.createPlateSprite(s);
304
+ const g = await this.createPlateSprite(i);
312
305
  g && (n.model.add(g), g.position.set(0, 5, -4));
313
306
  }
314
- if (n.data = s, this.tabVisible) {
307
+ if (n.data = i, this.tabVisible) {
315
308
  const c = p[p.length - 1];
316
309
  Math.abs(h - c.heading) >= 180 && (h > c.heading ? c.heading += 360 : h += 360), p.push({
317
310
  pos: [r, d, 0],
@@ -327,20 +320,20 @@ class N {
327
320
  }
328
321
  }
329
322
  }
330
- await this.addVehicles(i), this.updateModel = !1;
323
+ await this.addVehicles(s), this.updateModel = !1;
331
324
  }
332
325
  toRenderCoordinates(e) {
333
- const i = [0, 0, 0];
326
+ const s = [0, 0, 0];
334
327
  return b.toRenderCoordinates(
335
328
  // @ts-ignore
336
329
  this.view,
337
330
  e,
338
331
  0,
339
- C.WGS84,
340
- i,
332
+ T.WGS84,
333
+ s,
341
334
  0,
342
335
  1
343
- ), i;
336
+ ), s;
344
337
  }
345
338
  /**
346
339
  * 删除车辆
@@ -348,7 +341,7 @@ class N {
348
341
  deleteVehicles(e) {
349
342
  if (this.isPaused)
350
343
  return;
351
- const i = Date.now();
344
+ const s = Date.now();
352
345
  e.forEach((t) => {
353
346
  if (this.appDataStore.saveTrackLog) {
354
347
  const o = this.historyPositionMap.get(t);
@@ -368,19 +361,19 @@ class N {
368
361
  "",
369
362
  "",
370
363
  "",
371
- i,
364
+ s,
372
365
  o ? o.length : 0,
373
366
  2
374
367
  ]);
375
368
  }
376
- const s = this.vehicleObjectMap.get(t);
377
- s && (this.tabVisible ? s.isMoving ? s.waitForDelete = !0 : this.deleteVehicle(s) : this.deleteVehicle(s));
369
+ const i = this.vehicleObjectMap.get(t);
370
+ i && (this.tabVisible ? i.isMoving ? i.waitForDelete = !0 : this.deleteVehicle(i) : this.deleteVehicle(i));
378
371
  });
379
372
  }
380
373
  deleteVehicle(e) {
381
374
  this.disposeModel(e.model), this.scene.remove(e.model);
382
- const i = e.data.vehicleId;
383
- this.vehicleObjectMap.delete(i), this.historyPositionMap.delete(i);
375
+ const s = e.data.vehicleId;
376
+ this.vehicleObjectMap.delete(s), this.historyPositionMap.delete(s);
384
377
  }
385
378
  async toggleTrafficInfo(e) {
386
379
  e.name === "vehiclePlate" && (e.visible === !0 && this.currentSpriteContent === m.None ? await this.updatePanelContent(m.PlateNumber) : await this.updatePanelContent(
@@ -405,11 +398,11 @@ class N {
405
398
  */
406
399
  async updatePanelContent(e) {
407
400
  this.currentSpriteContent = e;
408
- for (const i of this.vehicleObjectMap.values()) {
409
- const t = i.model.getObjectByName("VehiclePlate");
410
- if (t && (i.model.remove(t), this.disposeModel(t)), e !== m.None) {
411
- const s = await this.createPlateSprite(i.data);
412
- s && (i.model.add(s), s.position.set(0, 5, -4));
401
+ for (const s of this.vehicleObjectMap.values()) {
402
+ const t = s.model.getObjectByName("VehiclePlate");
403
+ if (t && (s.model.remove(t), this.disposeModel(t)), e !== m.None) {
404
+ const i = await this.createPlateSprite(s.data);
405
+ i && (s.model.add(i), i.position.set(0, 5, -4));
413
406
  }
414
407
  }
415
408
  }
@@ -423,11 +416,11 @@ class N {
423
416
  * 释放模型资源
424
417
  * */
425
418
  disposeModel(e) {
426
- e.traverse((i) => {
427
- if (i instanceof a.Mesh) {
428
- i.geometry.dispose();
419
+ e.traverse((s) => {
420
+ if (s instanceof a.Mesh) {
421
+ s.geometry.dispose();
429
422
  try {
430
- i.material.dispose();
423
+ s.material.dispose();
431
424
  } catch {
432
425
  }
433
426
  }
@@ -437,26 +430,26 @@ class N {
437
430
  * 计算车辆位置
438
431
  * */
439
432
  computeVehiclePosition(e) {
440
- const i = this.historyPositionMap.get(e), t = this.vehicleObjectMap.get(e);
441
- if (!t || !i || !t.isMoving && i.length <= 2)
433
+ const s = this.historyPositionMap.get(e), t = this.vehicleObjectMap.get(e);
434
+ if (!t || !s || !t.isMoving && s.length <= 2)
442
435
  return;
443
- const s = Date.now();
444
- t.isMoving = !0, t.data.roadLayer === "1" ? t.model.visible = this.showGroundVehicle : t.model.visible = this.showElevatedVehicle, t.segmentStartTime || (t.segmentStartTime = s, t.segmentTotalTime = i[1].time - i[0].time);
445
- const o = s - t.segmentStartTime, l = Math.min(
436
+ const i = Date.now();
437
+ t.isMoving = !0, t.data.roadLayer === "1" ? t.model.visible = this.showGroundVehicle : t.model.visible = this.showElevatedVehicle, t.segmentStartTime || (t.segmentStartTime = i, t.segmentTotalTime = s[1].time - s[0].time);
438
+ const o = i - t.segmentStartTime, l = Math.min(
446
439
  o / t.segmentTotalTime,
447
440
  1
448
441
  );
449
442
  if (l === 1)
450
- if (i.shift(), i.length === 1) {
443
+ if (s.shift(), s.length === 1) {
451
444
  t.waitForDelete === !0 ? this.deleteVehicle(t) : (t.segmentStartTime = void 0, t.segmentTotalTime = void 0, t.model.visible = !1, t.isMoving = !1, console.log("hide vehicle", e));
452
445
  return;
453
446
  } else {
454
447
  t.segmentStartTime = Date.now();
455
448
  const r = o - t.segmentTotalTime;
456
- return t.segmentTotalTime = i[1].time - i[0].time - r, (i[1].heading >= 270 && i[0].heading <= 90 || i[1].heading <= 90 && i[0].heading >= 270) && (i[1].heading > i[0].heading ? i[0].heading += 360 : i[1].heading += 360), i[0].pos.concat(i[0].heading);
449
+ return t.segmentTotalTime = s[1].time - s[0].time - r, (s[1].heading >= 270 && s[0].heading <= 90 || s[1].heading <= 90 && s[0].heading >= 270) && (s[1].heading > s[0].heading ? s[0].heading += 360 : s[1].heading += 360), s[0].pos.concat(s[0].heading);
457
450
  }
458
- else if (i.length >= 2) {
459
- const r = i[0].pos[0] + (i[1].pos[0] - i[0].pos[0]) * l, d = i[0].pos[1] + (i[1].pos[1] - i[0].pos[1]) * l, h = i[0].heading + (i[1].heading - i[0].heading) * l;
451
+ else if (s.length >= 2) {
452
+ const r = s[0].pos[0] + (s[1].pos[0] - s[0].pos[0]) * l, d = s[0].pos[1] + (s[1].pos[1] - s[0].pos[1]) * l, h = s[0].heading + (s[1].heading - s[0].heading) * l;
460
453
  return [r, d, 0, h];
461
454
  } else
462
455
  return;
@@ -466,70 +459,70 @@ class N {
466
459
  * */
467
460
  getVehicleModel(e) {
468
461
  if (this.view.camera.position.z >= this.cameraHeightThreshold) {
469
- const i = new a.SphereGeometry(5, 32, 32), t = new a.MeshPhysicalMaterial({
462
+ const s = new a.SphereGeometry(5, 32, 32), t = new a.MeshPhysicalMaterial({
470
463
  color: 325253,
471
464
  emissive: 0,
472
465
  roughness: this.roughness,
473
466
  metalness: this.metalness
474
467
  });
475
- return new a.Mesh(i, t);
468
+ return new a.Mesh(s, t);
476
469
  } else {
477
- let i;
470
+ let s;
478
471
  if (e.ptcType === 2)
479
- i = this.bicycleModel.clone();
472
+ s = this.bicycleModel.clone();
480
473
  else if (e.ptcType === 3)
481
- i = this.passengerModel.clone();
474
+ s = this.passengerModel.clone();
482
475
  else {
483
476
  switch (e.vehicleType) {
484
477
  case 10:
485
- i = this.carModel.clone();
478
+ s = this.carModel.clone();
486
479
  break;
487
480
  case 20:
488
- i = this.vanModel.clone();
481
+ s = this.vanModel.clone();
489
482
  break;
490
483
  case 25:
491
- i = this.truckModel.clone();
484
+ s = this.truckModel.clone();
492
485
  break;
493
486
  case 50:
494
- i = this.busModel.clone();
487
+ s = this.busModel.clone();
495
488
  break;
496
489
  default:
497
- i = this.carModel.clone();
490
+ s = this.carModel.clone();
498
491
  break;
499
492
  }
500
493
  const t = this.materialMap.get(e.vehicleColor) || this.defaultMaterial;
501
- let s = !1;
502
- i.traverse((o) => {
503
- !s && o instanceof a.Mesh && (o.material = t, s = !0);
494
+ let i = !1;
495
+ s.traverse((o) => {
496
+ !i && o instanceof a.Mesh && (o.material = t, i = !0);
504
497
  });
505
498
  }
506
- return i;
499
+ return s;
507
500
  }
508
501
  }
509
502
  /**
510
503
  * 创建号牌canvas
511
504
  * */
512
- createCanvas(e, i, t) {
513
- const s = document.createElement("canvas"), o = e.width, l = e.height;
514
- s.width = o, s.height = l;
515
- const r = s.getContext("2d");
505
+ createCanvas(e, s, t) {
506
+ const i = document.createElement("canvas"), o = e.width, l = e.height;
507
+ i.width = o, i.height = l;
508
+ const r = i.getContext("2d");
516
509
  if (!r) {
517
510
  console.log("canvas创建失败");
518
511
  return;
519
512
  }
520
- return r.fillStyle = "rgba(0,0,0,0.0)", r.fillRect(0, 0, o, l), r.drawImage(e, 0, 0, o, l), r.beginPath(), r.translate(o / 2, l / 2), r.fillStyle = t, r.font = "bold 32px 宋体", r.textBaseline = "middle", r.textAlign = "center", r.fillText(i, 0, 0), s;
513
+ return r.fillStyle = "rgba(0,0,0,0.0)", r.fillRect(0, 0, o, l), r.drawImage(e, 0, 0, o, l), r.beginPath(), r.translate(o / 2, l / 2), r.fillStyle = t, r.font = "bold 32px 宋体", r.textBaseline = "middle", r.textAlign = "center", r.fillText(s, 0, 0), i;
521
514
  }
522
515
  createPlateSprite(e) {
523
- return new Promise((i, t) => {
516
+ return new Promise((s, t) => {
524
517
  var h, n;
525
- const s = !e.plateNo || e.plateNo === "0" || e.plateNo === "000000";
526
- if (this.currentSpriteContent === m.None || this.currentSpriteContent === m.PlateNumber && s) {
527
- i(void 0);
518
+ const i = !e.plateNo || e.plateNo === "0" || e.plateNo === "000000";
519
+ if (this.currentSpriteContent === m.None || this.currentSpriteContent === m.PlateNumber && i) {
520
+ s(void 0);
528
521
  return;
529
522
  }
530
523
  let o = new Image(), l = "", r = "";
531
524
  if (this.currentSpriteContent === m.PlateNumber || this.currentSpriteContent === m.Mix)
532
- if (s)
525
+ if (i)
533
526
  o = this.greyPlateBG, l = e.ptcId, r = "#ffffff";
534
527
  else
535
528
  switch (l = ((h = e.showName) == null ? void 0 : h.substring(0, 2)) + "•" + ((n = e.showName) == null ? void 0 : n.substring(2)), e.plateColor) {
@@ -562,8 +555,8 @@ class N {
562
555
  const p = new a.CanvasTexture(d), c = new a.SpriteMaterial({
563
556
  map: p,
564
557
  transparent: !1
565
- }), g = new a.Sprite(c), u = 0.05, P = d.width * u, v = d.height * u;
566
- g.scale.set(P, v, 1), g.name = "VehiclePlate", i(g);
558
+ }), g = new a.Sprite(c), u = 0.05, M = d.width * u, P = d.height * u;
559
+ g.scale.set(M, P, 1), g.name = "VehiclePlate", s(g);
567
560
  } else {
568
561
  t("canvas创建失败");
569
562
  return;
@@ -26,12 +26,29 @@ export default class SignalControlAreaController {
26
26
  * @returns
27
27
  */
28
28
  private handleViewClick;
29
+ /**
30
+ * 显示周边的路口
31
+ * @param crossIds
32
+ * @returns
33
+ */
29
34
  private showNearbyCrosses;
35
+ private addCrossCallback;
36
+ private removeCrossCallback;
30
37
  /**
31
38
  * 编辑子区的路口
32
39
  * @returns
33
40
  */
34
- editSubSignalArea(): Promise<IResult>;
41
+ editSubSignalArea(addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void): Promise<IResult>;
42
+ /**
43
+ * 从外部接口选中一个路口
44
+ * @param id
45
+ */
46
+ selectSubSignalControlAreaCross(id: string): IResult;
47
+ /**
48
+ * 从外部接口取消选中一个路口
49
+ * @param id
50
+ */
51
+ unselectSubSignalControlAreaCross(id: string): IResult;
35
52
  /**
36
53
  * 在区控\子区\路口图层中查找对应的graphic
37
54
  * @param id
@@ -1,10 +1,10 @@
1
1
  import * as g from "@arcgis/core/core/reactiveUtils.js";
2
2
  import c from "@arcgis/core/Graphic";
3
3
  import y from "@arcgis/core/layers/GraphicsLayer";
4
- import u from "@turf/buffer";
5
- import d from "@turf/convex";
4
+ import p from "@turf/buffer";
5
+ import b from "@turf/convex";
6
6
  import * as n from "@turf/helpers";
7
- import b from "axios";
7
+ import d from "axios";
8
8
  import f from "concaveman";
9
9
  import C from "../../stores/index.mjs";
10
10
  import v from "./district-controller.mjs";
@@ -141,10 +141,19 @@ class N {
141
141
  if (r.length === 0)
142
142
  return;
143
143
  const s = r[0].graphic;
144
- s.getAttribute("selected") || await this.showNearbyCrosses(s.getAttribute("id"));
144
+ s.getAttribute("selected") ? s.getAttribute("signalId") && (this.removeCrossCallback && this.removeCrossCallback(s.getAttribute("id")), s.setAttribute("selected", !1), s.symbol = this.getCrossSymbolInSubDistrict(
145
+ s.attributes
146
+ )) : (s.getAttribute("signalId") && (this.addCrossCallback && this.addCrossCallback(s.getAttribute("id")), s.setAttribute("selected", !0), s.symbol = this.getCrossSymbolInSubDistrict(
147
+ s.attributes
148
+ )), await this.showNearbyCrosses(s.getAttribute("id")));
145
149
  }
150
+ /**
151
+ * 显示周边的路口
152
+ * @param crossIds
153
+ * @returns
154
+ */
146
155
  async showNearbyCrosses(e) {
147
- const t = await b.get(
156
+ const t = await d.get(
148
157
  `http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,
149
158
  { params: { junctionIds: e } }
150
159
  );
@@ -184,16 +193,40 @@ class N {
184
193
  * 编辑子区的路口
185
194
  * @returns
186
195
  */
187
- async editSubSignalArea() {
196
+ async editSubSignalArea(e, t) {
188
197
  if (this.openDriveServer) {
189
- this.clickWatcher || (this.clickWatcher = this.view.on("click", async (t) => {
190
- await this.handleViewClick(t);
198
+ this.addCrossCallback = e, this.removeCrossCallback = t, this.clickWatcher || (this.clickWatcher = this.view.on("click", async (s) => {
199
+ await this.handleViewClick(s);
191
200
  }));
192
- const e = this.crossLayer.graphics.toArray().map((t) => t.getAttribute("id")).join(",");
193
- return await this.showNearbyCrosses(e);
201
+ const r = this.crossLayer.graphics.toArray().map((s) => s.getAttribute("id")).join(",");
202
+ return await this.showNearbyCrosses(r);
194
203
  } else
195
204
  return { status: 1, message: "未配置OpenDriveServer" };
196
205
  }
206
+ /**
207
+ * 从外部接口选中一个路口
208
+ * @param id
209
+ */
210
+ selectSubSignalControlAreaCross(e) {
211
+ return this.crossLayer.graphics.forEach((t) => {
212
+ if (t.getAttribute("id") === e && !t.getAttribute("selected"))
213
+ return t.setAttribute("selected", !0), t.symbol = this.getCrossSymbolInSubDistrict(
214
+ t.attributes
215
+ ), { status: 0, message: "ok" };
216
+ }), { status: 0, message: "未找到" };
217
+ }
218
+ /**
219
+ * 从外部接口取消选中一个路口
220
+ * @param id
221
+ */
222
+ unselectSubSignalControlAreaCross(e) {
223
+ return this.crossLayer.graphics.forEach((t) => {
224
+ if (t.getAttribute("id") === e && t.getAttribute("selected"))
225
+ return t.setAttribute("selected", !1), t.symbol = this.getCrossSymbolInSubDistrict(
226
+ t.attributes
227
+ ), { status: 0, message: "ok" };
228
+ }), { status: 0, message: "未找到" };
229
+ }
197
230
  /**
198
231
  * 在区控\子区\路口图层中查找对应的graphic
199
232
  * @param id
@@ -222,16 +255,16 @@ class N {
222
255
  else {
223
256
  if (t) {
224
257
  const h = n.featureCollection(
225
- r.map((p) => n.point(p))
258
+ r.map((u) => n.point(u))
226
259
  );
227
- i = d(h);
260
+ i = b(h);
228
261
  } else {
229
262
  const h = f(r, 0.5);
230
263
  h.length >= 4 && (i = n.polygon([h]));
231
264
  }
232
265
  i || (i = n.lineString(r));
233
266
  }
234
- const a = u(
267
+ const a = p(
235
268
  i.geometry,
236
269
  // 区控面积更大,需要更大的缓冲半径
237
270
  t ? 200 : 30,
@@ -125,10 +125,12 @@ declare const _sfc_main: import("vue").DefineComponent<{
125
125
  }) => Promise<import("../types").IResult>;
126
126
  resetHighlightSignalControlArea: () => import("../types").IResult;
127
127
  showSubSignalControlArea: (params: any) => import("../types").IResult;
128
- editSubSignalControlArea: () => Promise<import("../types").IResult> | {
128
+ editSubSignalControlArea: (addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void) => Promise<import("../types").IResult> | {
129
129
  status: number;
130
130
  message: string;
131
131
  };
132
+ selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
133
+ unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
132
134
  props: any;
133
135
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
134
136
  SignalCountdownPanel: import("vue").DefineComponent<{
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),h=require("./stores/index.js");require("./style/index.css");const xe=require("./utils/holo-flow/index.js"),qe=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Me=require("./utils/map-initializer.js"),O=require("./utils/open-drive-renderer/index.js"),b=require("./utils/overlay.js"),Ve=require("./utils/queue-length.js"),A=require("./utils/road-config-tool/index.js"),L=require("./utils/signal-control-area-controller/index.js"),Ne=require("./utils/traffic-flow.js"),Be={class:"gis-viewer"},He={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Pe=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(D,{expose:T,emit:_}){const p=a.ref(null);let i,u,l,o,n,r,g,t,s;const f=a.ref(!1);h.registerStore();const I=h.default.useAppDataStore,C=a.reactive([]);a.onMounted(async()=>{if(!p.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(f.value=!f.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(k.config)).json();c.assetsRoot=k.assetsRoot||d,I.mapConfig=c,u=new Me.default,i=await u.initialize({container:p.value,mapConfig:c,markerClickCallback:(m,v,w,Ie)=>{S("markerClick",m,v,w,Ie)},mapClickCallback:(m,v,w)=>{S("mapClick",m,v,w)}}),n=new xe.default(i,C),await n.init(),S("mapLoaded")}),a.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),n.clearHoloTrace(),n.clearHoloSignal(),o==null||o.disconnectTrafficFlow()});const x=a.computed(()=>i),q=()=>{const e=h.default.useAppDataStore;e.saveTrackLog=!0},M=()=>{n.downloadTrackLog()},V=()=>{y("vehicleId")},N=()=>{y("plateNumber")},B=async e=>await u.setMapCenter(e),H=async e=>await u.setMapCamera(e),P=async e=>await u.lookAt(e),E=e=>u.setLayerVisibility(e),z=(e,d)=>u.requestCoordinateTransform(e,d),j=e=>{u.cancelCoordinateTransform(e)},Q=e=>{u.setMapZoomRange(e)},Z=e=>(l||(l=new A.default(i)),l.showLaneNumber(e)),K=()=>{l==null||l.clearLaneNumber()},U=async e=>(l||(l=new A.default(i)),await l.initializeSearch(e)),G=async()=>l==null?void 0:l.calCrossIndicatorArea(),J=async()=>{},W=async(e,d)=>{o||(o=new Ne.default(i)),o.connectTrafficFlow(e,d)},X=()=>{o==null||o.disconnectTrafficFlow()},Y=async e=>{n.handleVehicleTraceData(e)},F=()=>{n.clearHoloTrace()},R=e=>{n.setInterpolate(e)},$=async e=>{await n.handleSignalData(e)},ee=()=>{n.clearHoloSignal()},te=e=>{o==null||o.toggleTrafficInfo(e),n==null||n.toggleTrafficInfo(e)},ae=e=>{n==null||n.togglePause(e)},ne=e=>{o==null||o.toggleTrafficObject(e),n==null||n.toggleTrafficObject(e)},y=e=>{n==null||n.updatePanelContent(e)},re=async e=>(r||(r=new b.default(i)),r.addOverlays(e)),se=e=>(r||(r=new b.default(i)),r.addMask(e)),oe=()=>{r==null||r.removeMask()},ie=e=>r==null?void 0:r.removeOverlaysByType(e),ce=e=>r==null?void 0:r.removeOverlaysById(e),le=()=>r==null?void 0:r.removeAllOverlays(),ue=()=>{r==null||r.showAllOverlays()},de=e=>{g||(g=new Ve.default(i)),g.updateQueueLength(e)},me=()=>{g==null||g.removeQueueLength()},ge=async(e,d)=>(t||(t=new O.default(i)),await t.showOpenDriveFromServer(e,d)),pe=async e=>(t||(t=new O.default(i)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),fe=async()=>await(t==null?void 0:t.clearOpenDrive()),ye=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},Se=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ve=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},we=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},he=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ce=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},ke=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Oe=e=>(s||(s=new L.default(i)),s.showSignalControlArea(e)),be=()=>{s==null||s.clearSignalControlArea()},Ae=async e=>s?await s.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Le=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},De=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},Te=e=>(s||(s=new L.default(i)),s.showSubSignalControlArea(e)),_e=()=>s?s.editSubSignalArea():{status:-1,message:"未加载信号控制区"},k=D,S=_;return T({mapViewer:x,setLayerVisibility:E,setMapCenter:B,lookAt:P,setMapCamera:H,setMapZoomRange:Q,requestCoordinateTransform:z,cancelCoordinateTransform:j,addOverlays:re,addMask:se,removeMask:oe,showAllOverlays:ue,removeOverlaysByType:ie,removeOverlaysById:ce,removeAllOverlays:le,showLaneNumber:Z,clearLaneNumber:K,initializeAreaTool:U,calCrossIndicatorArea:G,calRoadIndicatorArea:J,connectCarFlow:W,disconnectCarFlow:X,handleHoloVehicleTraceData:Y,clearHoloTrace:F,handleHoloSignalData:$,clearHoloSignal:ee,setInterpolate:R,toggleTrafficInfo:te,toggleTrafficObject:ne,toggleVehicleInfo:y,togglePause:ae,updateQueueLength:de,removeQueueLength:me,showOpenDriveFromServer:ge,showOpenDriveFromFile:pe,clearOpenDrive:fe,geometrySearchInOpenDrive:we,findSumoInOpenDrive:ye,selectSumoInOpenDrive:Se,unselectSumoInOpenDrive:ve,getSumoInfo:he,splitOpenDriveLane:Ce,clearSplitOpenDriveLane:ke,showSignalControlArea:Oe,clearSignalControlArea:be,locateSignalControlArea:Ae,highlightSignalControlArea:Le,resetHighlightSignalControlArea:De,showSubSignalControlArea:Te,editSubSignalControlArea:_e}),(e,d)=>(a.openBlock(),a.createElementBlock("div",Be,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:p},[a.withDirectives(a.createElementVNode("div",He,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:q}," 开始记录 "),a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:M}," 下载日志 "),a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:V}," 显示车辆id "),a.createElementVNode("button",{onClick:N},"显示车辆号牌")],512),[[a.vShow,f.value]])],512),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(C,(c,m)=>(a.openBlock(),a.createBlock(qe.default,{key:m,"display-mode":c.displayMode,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=Pe;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),h=require("./stores/index.js");require("./style/index.css");const Me=require("./utils/holo-flow/index.js"),Ve=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Ne=require("./utils/map-initializer.js"),O=require("./utils/open-drive-renderer/index.js"),b=require("./utils/overlay.js"),Be=require("./utils/queue-length.js"),A=require("./utils/road-config-tool/index.js"),L=require("./utils/signal-control-area-controller/index.js"),He=require("./utils/traffic-flow.js"),Pe={class:"gis-viewer"},Ee={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},ze=n.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(D,{expose:T,emit:_}){const p=n.ref(null);let i,m,l,o,r,s,g,t,a;const f=n.ref(!1);h.registerStore();const I=h.default.useAppDataStore,C=n.reactive([]);n.onMounted(async()=>{if(!p.value)return;document.addEventListener("keydown",d=>{d.ctrlKey&&d.key==="i"&&(f.value=!f.value)});const e=n.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,c=await(await fetch(k.config)).json();c.assetsRoot=k.assetsRoot||u,I.mapConfig=c,m=new Ne.default,i=await m.initialize({container:p.value,mapConfig:c,markerClickCallback:(d,v,w,qe)=>{y("markerClick",d,v,w,qe)},mapClickCallback:(d,v,w)=>{y("mapClick",d,v,w)}}),r=new Me.default(i,C),await r.init(),y("mapLoaded")}),n.onUnmounted(()=>{a==null||a.clearSignalControlArea(),t==null||t.clearOpenDrive(),r.clearHoloTrace(),r.clearHoloSignal(),o==null||o.disconnectTrafficFlow()});const x=n.computed(()=>i),q=()=>{const e=h.default.useAppDataStore;e.saveTrackLog=!0},M=()=>{r.downloadTrackLog()},V=()=>{S("vehicleId")},N=()=>{S("plateNumber")},B=async e=>await m.setMapCenter(e),H=async e=>await m.setMapCamera(e),P=async e=>await m.lookAt(e),E=e=>m.setLayerVisibility(e),z=(e,u)=>m.requestCoordinateTransform(e,u),j=e=>{m.cancelCoordinateTransform(e)},Q=e=>{m.setMapZoomRange(e)},Z=e=>(l||(l=new A.default(i)),l.showLaneNumber(e)),K=()=>{l==null||l.clearLaneNumber()},U=async e=>(l||(l=new A.default(i)),await l.initializeSearch(e)),G=async()=>l==null?void 0:l.calCrossIndicatorArea(),J=async()=>{},W=async(e,u)=>{o||(o=new He.default(i)),o.connectTrafficFlow(e,u)},X=()=>{o==null||o.disconnectTrafficFlow()},Y=async e=>{r.handleVehicleTraceData(e)},F=()=>{r.clearHoloTrace()},R=e=>{r.setInterpolate(e)},$=async e=>{await r.handleSignalData(e)},ee=()=>{r.clearHoloSignal()},te=e=>{o==null||o.toggleTrafficInfo(e),r==null||r.toggleTrafficInfo(e)},ae=e=>{r==null||r.togglePause(e)},ne=e=>{o==null||o.toggleTrafficObject(e),r==null||r.toggleTrafficObject(e)},S=e=>{r==null||r.updatePanelContent(e)},re=async e=>(s||(s=new b.default(i)),s.addOverlays(e)),se=e=>(s||(s=new b.default(i)),s.addMask(e)),oe=()=>{s==null||s.removeMask()},ie=e=>s==null?void 0:s.removeOverlaysByType(e),ce=e=>s==null?void 0:s.removeOverlaysById(e),le=()=>s==null?void 0:s.removeAllOverlays(),ue=()=>{s==null||s.showAllOverlays()},me=e=>{g||(g=new Be.default(i)),g.updateQueueLength(e)},de=()=>{g==null||g.removeQueueLength()},ge=async(e,u)=>(t||(t=new O.default(i)),await t.showOpenDriveFromServer(e,u)),pe=async e=>(t||(t=new O.default(i)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),fe=async()=>await(t==null?void 0:t.clearOpenDrive()),Se=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},ye=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ve=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},we=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},he=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ce=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},ke=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Oe=e=>(a||(a=new L.default(i)),a.showSignalControlArea(e)),be=()=>{a==null||a.clearSignalControlArea()},Ae=async e=>a?await a.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Le=async e=>a?await a.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},De=()=>a?a.resetHighlight():{status:-1,message:"未加载信号控制区"},Te=e=>(a||(a=new L.default(i)),a.showSubSignalControlArea(e)),_e=(e,u)=>a?a.editSubSignalArea(e,u):{status:-1,message:"未加载信号控制区"},Ie=e=>a?a.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},xe=e=>a?a.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},k=D,y=_;return T({mapViewer:x,setLayerVisibility:E,setMapCenter:B,lookAt:P,setMapCamera:H,setMapZoomRange:Q,requestCoordinateTransform:z,cancelCoordinateTransform:j,addOverlays:re,addMask:se,removeMask:oe,showAllOverlays:ue,removeOverlaysByType:ie,removeOverlaysById:ce,removeAllOverlays:le,showLaneNumber:Z,clearLaneNumber:K,initializeAreaTool:U,calCrossIndicatorArea:G,calRoadIndicatorArea:J,connectCarFlow:W,disconnectCarFlow:X,handleHoloVehicleTraceData:Y,clearHoloTrace:F,handleHoloSignalData:$,clearHoloSignal:ee,setInterpolate:R,toggleTrafficInfo:te,toggleTrafficObject:ne,toggleVehicleInfo:S,togglePause:ae,updateQueueLength:me,removeQueueLength:de,showOpenDriveFromServer:ge,showOpenDriveFromFile:pe,clearOpenDrive:fe,geometrySearchInOpenDrive:we,findSumoInOpenDrive:Se,selectSumoInOpenDrive:ye,unselectSumoInOpenDrive:ve,getSumoInfo:he,splitOpenDriveLane:Ce,clearSplitOpenDriveLane:ke,showSignalControlArea:Oe,clearSignalControlArea:be,locateSignalControlArea:Ae,highlightSignalControlArea:Le,resetHighlightSignalControlArea:De,showSubSignalControlArea:Te,editSubSignalControlArea:_e,selectSubSignalControlAreaCross:Ie,unselectSubSignalControlAreaCross:xe}),(e,u)=>(n.openBlock(),n.createElementBlock("div",Pe,[n.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:p},[n.withDirectives(n.createElementVNode("div",Ee,[n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:q}," 开始记录 "),n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:M}," 下载日志 "),n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:V}," 显示车辆id "),n.createElementVNode("button",{onClick:N},"显示车辆号牌")],512),[[n.vShow,f.value]])],512),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(C,(c,d)=>(n.openBlock(),n.createBlock(Ve.default,{key:d,"display-mode":c.displayMode,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=ze;
@@ -114,10 +114,12 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
114
114
  }) => Promise<import("../types").IResult>;
115
115
  resetHighlightSignalControlArea: () => import("../types").IResult;
116
116
  showSubSignalControlArea: (params: any) => import("../types").IResult;
117
- editSubSignalControlArea: () => Promise<import("../types").IResult> | {
117
+ editSubSignalControlArea: (addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void) => Promise<import("../types").IResult> | {
118
118
  status: number;
119
119
  message: string;
120
120
  };
121
+ selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
122
+ unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
121
123
  props: any;
122
124
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
123
125
  SignalCountdownPanel: import("vue").DefineComponent<{
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("@arcgis/core/core/promiseUtils.js"),G=require("@arcgis/core/core/reactiveUtils.js"),C=require("@arcgis/core/geometry/SpatialReference"),L=require("@arcgis/core/views/3d/externalRenderers"),V=require("three"),f=require("three/examples/jsm/loaders/GLTFLoader"),M=require("three/examples/jsm/loaders/MTLLoader"),P=require("three/examples/jsm/loaders/OBJLoader"),B=require("vue"),m=require("../../../types/index.js"),R=require("../../stores/index.js");function b(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const s in u)if(s!=="default"){const t=Object.getOwnPropertyDescriptor(u,s);Object.defineProperty(e,s,t.get?t:{enumerable:!0,get:()=>u[s]})}}return e.default=u,Object.freeze(e)}const x=b(S),I=b(G),v=b(L),o=b(V);class D{constructor(e){this.cameraHeightThreshold=1e3,this.roughness=.2,this.metalness=.8,this.defaultMaterial=new o.MeshPhongMaterial({color:16777215}),this.materialMap=new Map([[1,this.createCarMaterial(16777215)],[2,this.createCarMaterial(7833753)],[3,this.createCarMaterial(16766720)],[4,this.createCarMaterial(16758465)],[5,this.createCarMaterial(14423100)],[6,this.createCarMaterial(3329330)],[7,this.createCarMaterial(2003183)],[8,this.createCarMaterial(16032864)],[9,this.createCarMaterial(2105376)],[10,this.createCarMaterial(9662683)],[99,this.createCarMaterial(6908265)]]),this.isInitialized=!1,this.showGroundVehicle=!0,this.showElevatedVehicle=!0,this.isPaused=!1,this.currentSpriteContent=m.EVehiclePlateState.None,this.historyPositionMap=new Map,this.vehicleObjectMap=new Map,this.tabVisible=!0,this.updateModel=!1,this.appDataStore=R.default.useAppDataStore,this.logTable=[["ptcId","plateno","timestamp","localTimestamp","speed","longitude","latitude","ptcType","vehicleType","vehicleColor","plateColor","heading","fixAngle","roadLayer","step","receiveTimestamp","queueLength","status"]],this.view=e;const s=B.toRaw(this.appDataStore.mapConfig);this.assetsRoot=s.assetsRoot,document.addEventListener("visibilitychange",()=>{this.clearVehicles(),this.tabVisible=!document.hidden},!1),I.watch(()=>this.view.camera.position.z,(t,i)=>{(i<=this.cameraHeightThreshold&&t>this.cameraHeightThreshold||i>this.cameraHeightThreshold&&t<=this.cameraHeightThreshold)&&(this.updateModel=!0)})}createCarMaterial(e){return new o.MeshPhongMaterial({color:e})}getLog(){return this.logTable}async init(){await x.eachAlways([new Promise(e=>{new f.GLTFLoader().load(`${this.assetsRoot}/3DModels/car.glb`,t=>{const i=t.scene,l=new o.Box3().setFromObject(i).getSize(new o.Vector3);this.carModel=new o.Object3D,this.carModel.rotation.x=o.MathUtils.degToRad(90),this.carModel.add(i),i.position.set(0,0,l.z/2),e()})}),new Promise(e=>{new f.GLTFLoader().load(`${this.assetsRoot}/3DModels/van.glb`,t=>{const i=t.scene,l=new o.Box3().setFromObject(i).getSize(new o.Vector3);this.vanModel=new o.Object3D,this.vanModel.rotation.x=o.MathUtils.degToRad(90),this.vanModel.add(i),i.position.set(0,0,l.z/2),e()})}),new Promise(e=>{new f.GLTFLoader().load(`${this.assetsRoot}/3DModels/truck.glb`,t=>{const i=t.scene;i.scale.set(1.2,1,1.5);const l=new o.Box3().setFromObject(i).getSize(new o.Vector3);this.truckModel=new o.Object3D,this.truckModel.rotation.x=o.MathUtils.degToRad(90),this.truckModel.add(i),i.position.set(0,0,l.z/2),e()})}),new Promise(e=>{new f.GLTFLoader().load(`${this.assetsRoot}/3DModels/bus.glb`,t=>{const i=t.scene,l=new o.Box3().setFromObject(i).getSize(new o.Vector3);this.busModel=new o.Object3D,this.busModel.rotation.x=o.MathUtils.degToRad(90),this.busModel.add(i),i.position.set(0,0,l.z/2),e()})}),new Promise(e=>{new M.MTLLoader().load(`${this.assetsRoot}/3DModels/bicycle.mtl`,t=>{t.preload();const i=new P.OBJLoader;i.setMaterials(t),i.load(`${this.assetsRoot}/3DModels/bicycle.obj`,a=>{this.bicycleModel=a,this.bicycleModel.rotation.x=o.MathUtils.degToRad(90),e()})})}),new Promise(e=>{new M.MTLLoader().load(`${this.assetsRoot}/3DModels/passenger.mtl`,t=>{t.preload();const i=new P.OBJLoader;i.setMaterials(t),i.load(`${this.assetsRoot}/3DModels/male.obj`,a=>{a.scale.set(.01,.01,.01),this.passengerModel=a,this.passengerModel.rotation.x=o.MathUtils.degToRad(90),this.passengerModel.rotation.y=o.MathUtils.degToRad(180),e()})})}),new Promise(e=>{this.bluePlateBG=new Image,this.bluePlateBG.src=`${this.assetsRoot}/Images/PlateBG/blue.png`,this.bluePlateBG.onload=()=>{e()}}),new Promise(e=>{this.yellowPlateBG=new Image,this.yellowPlateBG.src=`${this.assetsRoot}/Images/PlateBG/yellow.png`,this.yellowPlateBG.onload=()=>{e()}}),new Promise(e=>{this.whitePlateBG=new Image,this.whitePlateBG.src=`${this.assetsRoot}/Images/PlateBG/white.png`,this.whitePlateBG.onload=()=>{e()}}),new Promise(e=>{this.blackPlateBG=new Image,this.blackPlateBG.src=`${this.assetsRoot}/Images/PlateBG/black.png`,this.blackPlateBG.onload=()=>{e()}}),new Promise(e=>{this.neoYellowPlateBG=new Image,this.neoYellowPlateBG.src=`${this.assetsRoot}/Images/PlateBG/neo_yellow.png`,this.neoYellowPlateBG.onload=()=>{e()}}),new Promise(e=>{this.neoGreenPlateBG=new Image,this.neoGreenPlateBG.src=`${this.assetsRoot}/Images/PlateBG/neo_green.png`,this.neoGreenPlateBG.onload=()=>{e()}}),new Promise(e=>{this.greyPlateBG=new Image,this.greyPlateBG.src=`${this.assetsRoot}/Images/PlateBG/grey.png`,this.greyPlateBG.onload=()=>{e()}})]),this.isInitialized=!0}setInterpolate(e){this.clearVehicles(),this.tabVisible=e}async setup(e){this.context=e,this.renderer=new o.WebGLRenderer({context:e.gl,premultipliedAlpha:!0,logarithmicDepthBuffer:!0,antialias:!0,powerPreference:"high-performance"}),this.renderer.shadowMap.enabled=!0,this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setViewport(0,0,this.view.width,this.view.height),this.renderer.autoClearDepth=!1,this.renderer.autoClearStencil=!1,this.renderer.autoClearColor=!1;const s=this.renderer.setRenderTarget.bind(this.renderer);this.renderer.setRenderTarget=i=>{s(i),i==null&&e.bindRenderTarget()},this.scene=new o.Scene;const{camera:t}=e;this.camera=new o.PerspectiveCamera(t.fovY,t.aspect,.1,1e5),this.ambient=new o.AmbientLight(16777215,2),this.scene.add(this.ambient),this.sun=new o.DirectionalLight(16777215,2),this.scene.add(this.sun),e.resetWebGLState()}async render(e){var i;const s=e.camera;if(this.camera.position.set(s.eye[0],s.eye[1],s.eye[2]),this.camera.up.set(s.up[0],s.up[1],s.up[2]),this.camera.lookAt(new o.Vector3(s.center[0],s.center[1],s.center[2])),this.camera.projectionMatrix.fromArray(s.projectionMatrix),!this.isPaused&&this.tabVisible)for(const a of this.vehicleObjectMap.keys()){const l=(i=this.vehicleObjectMap.get(a))==null?void 0:i.model;if(!l)continue;const r=this.computeVehiclePosition(a);if(r){const d=this.toRenderCoordinates(r);l.position.set(d[0],d[1],d[2]),l.rotation.y=o.MathUtils.degToRad(-r[3])}}const t=e.sunLight;this.sun.position.set(t.direction[0],t.direction[1],t.direction[2]),this.sun.intensity=t.diffuse.intensity,this.sun.color=new o.Color(t.diffuse.color[0],t.diffuse.color[1],t.diffuse.color[2]),this.ambient.intensity=t.ambient.intensity,this.ambient.color=new o.Color(t.ambient.color[0],t.ambient.color[1],t.ambient.color[2]),this.renderer.resetState(),e.bindRenderTarget(),this.renderer.render(this.scene,this.camera),v.requestRender(this.view),e.resetWebGLState()}async addVehicles(e){if(this.isPaused||!this.isInitialized||!this.tabVisible)return;const s=Date.now();for(const t of e){this.appDataStore.saveTrackLog&&this.logTable.push([t.ptcId,t.plateNo,t.timestamp,t.localTimestamp,t.speed,t.x,t.y,t.ptcType,t.vehicleType,t.vehicleColor,t.plateColor,t.heading,t.fixAngle,t.roadLayer,t.step,s,0,0]);const{vehicleId:i,localTimestamp:a}=t,l=Number(t.x),r=Number(t.y),d=Number(t.heading);this.historyPositionMap.set(i,[{pos:[l,r,0],heading:d,time:a}]);const h=this.getVehicleModel(t);h.name=i,h.visible=!1;try{const n=await this.createPlateSprite(t);n&&(h.add(n),n.position.set(0,5,-4))}catch(n){console.log("createPlateSprite error:",n)}this.scene.add(h),this.vehicleObjectMap.set(i,{model:h,data:t,waitForDelete:!1,isMoving:!1})}}async updateVehicles(e){if(this.isPaused||!this.isInitialized||!this.tabVisible)return;const s=[],t=Date.now();for(const i of e){const{vehicleId:a,localTimestamp:l}=i,r=Number(i.x),d=Number(i.y);let h=Number(i.heading);const n=this.vehicleObjectMap.get(a),p=this.historyPositionMap.get(a);if(!n||!p)s.push(i);else{if(this.appDataStore.saveTrackLog&&this.logTable.push([i.ptcId,i.plateNo,i.timestamp,i.localTimestamp,i.speed,i.x,i.y,i.ptcType,i.vehicleType,i.vehicleColor,i.plateColor,i.heading,i.fixAngle,i.roadLayer,i.step,t,p.length,1]),this.updateModel||n.data.vehicleColor!==i.vehicleColor||n.data.vehicleType!==i.vehicleType){this.scene.remove(n.model),this.disposeModel(n.model),n.model=this.getVehicleModel(i),n.model.visible=!0;const c=await this.createPlateSprite(i);c&&(n.model.add(c),c.position.set(0,5,-4)),this.scene.add(n.model)}if(n.data.showName!==i.showName||n.data.plateColor!==i.plateColor){const c=n.model.getObjectByName("VehiclePlate");c&&(n.model.remove(c),this.disposeModel(c));const g=await this.createPlateSprite(i);g&&(n.model.add(g),g.position.set(0,5,-4))}if(n.data=i,this.tabVisible){const c=p[p.length-1];Math.abs(h-c.heading)>=180&&(h>c.heading?c.heading+=360:h+=360),p.push({pos:[r,d,0],heading:h,time:l})}else{this.historyPositionMap.set(a,[{pos:[r,d,0],heading:h,time:l}]);const c=this.toRenderCoordinates([r,d,0]);n.model.position.set(c[0],c[1],c[2]),n.model.rotation.y=o.MathUtils.degToRad(-h)}}}await this.addVehicles(s),this.updateModel=!1}toRenderCoordinates(e){const s=[0,0,0];return v.toRenderCoordinates(this.view,e,0,C.WGS84,s,0,1),s}deleteVehicles(e){if(this.isPaused)return;const s=Date.now();e.forEach(t=>{if(this.appDataStore.saveTrackLog){const a=this.historyPositionMap.get(t);this.logTable.push([t,"","","","","","","","","","","","","","",s,a?a.length:0,2])}const i=this.vehicleObjectMap.get(t);i&&(this.tabVisible?i.isMoving?i.waitForDelete=!0:this.deleteVehicle(i):this.deleteVehicle(i))})}deleteVehicle(e){this.disposeModel(e.model),this.scene.remove(e.model);const s=e.data.vehicleId;this.vehicleObjectMap.delete(s),this.historyPositionMap.delete(s)}async toggleTrafficInfo(e){e.name==="vehiclePlate"&&(e.visible===!0&&this.currentSpriteContent===m.EVehiclePlateState.None?await this.updatePanelContent(m.EVehiclePlateState.PlateNumber):await this.updatePanelContent(e.visible?this.currentSpriteContent:m.EVehiclePlateState.None))}togglePause(e){this.isPaused=e}clearVehicles(){for(const e of this.vehicleObjectMap.values())this.disposeModel(e.model),this.scene.remove(e.model);this.vehicleObjectMap.clear(),this.historyPositionMap.clear()}async updatePanelContent(e){this.currentSpriteContent=e;for(const s of this.vehicleObjectMap.values()){const t=s.model.getObjectByName("VehiclePlate");if(t&&(s.model.remove(t),this.disposeModel(t)),e!==m.EVehiclePlateState.None){const i=await this.createPlateSprite(s.data);i&&(s.model.add(i),i.position.set(0,5,-4))}}}toggleGroundVehicle(e){this.showGroundVehicle=e}toggleElevatedVehicle(e){this.showElevatedVehicle=e}disposeModel(e){e.traverse(s=>{if(s instanceof o.Mesh){s.geometry.dispose();try{s.material.dispose()}catch{}}})}computeVehiclePosition(e){const s=this.historyPositionMap.get(e),t=this.vehicleObjectMap.get(e);if(!t||!s||!t.isMoving&&s.length<=2)return;const i=Date.now();t.isMoving=!0,t.data.roadLayer==="1"?t.model.visible=this.showGroundVehicle:t.model.visible=this.showElevatedVehicle,t.segmentStartTime||(t.segmentStartTime=i,t.segmentTotalTime=s[1].time-s[0].time);const a=i-t.segmentStartTime,l=Math.min(a/t.segmentTotalTime,1);if(l===1)if(s.shift(),s.length===1){t.waitForDelete===!0?this.deleteVehicle(t):(t.segmentStartTime=void 0,t.segmentTotalTime=void 0,t.model.visible=!1,t.isMoving=!1,console.log("hide vehicle",e));return}else{t.segmentStartTime=Date.now();const r=a-t.segmentTotalTime;return t.segmentTotalTime=s[1].time-s[0].time-r,(s[1].heading>=270&&s[0].heading<=90||s[1].heading<=90&&s[0].heading>=270)&&(s[1].heading>s[0].heading?s[0].heading+=360:s[1].heading+=360),s[0].pos.concat(s[0].heading)}else if(s.length>=2){const r=s[0].pos[0]+(s[1].pos[0]-s[0].pos[0])*l,d=s[0].pos[1]+(s[1].pos[1]-s[0].pos[1])*l,h=s[0].heading+(s[1].heading-s[0].heading)*l;return[r,d,0,h]}else return}getVehicleModel(e){if(this.view.camera.position.z>=this.cameraHeightThreshold){const s=new o.SphereGeometry(5,32,32),t=new o.MeshPhysicalMaterial({color:325253,emissive:0,roughness:this.roughness,metalness:this.metalness});return new o.Mesh(s,t)}else{let s;if(e.ptcType===2)s=this.bicycleModel.clone();else if(e.ptcType===3)s=this.passengerModel.clone();else{switch(e.vehicleType){case 10:s=this.carModel.clone();break;case 20:s=this.vanModel.clone();break;case 25:s=this.truckModel.clone();break;case 50:s=this.busModel.clone();break;default:s=this.carModel.clone();break}const t=this.materialMap.get(e.vehicleColor)||this.defaultMaterial;let i=!1;s.traverse(a=>{!i&&a instanceof o.Mesh&&(a.material=t,i=!0)})}return s}}createCanvas(e,s,t){const i=document.createElement("canvas"),a=e.width,l=e.height;i.width=a,i.height=l;const r=i.getContext("2d");if(!r){console.log("canvas创建失败");return}return r.fillStyle="rgba(0,0,0,0.0)",r.fillRect(0,0,a,l),r.drawImage(e,0,0,a,l),r.beginPath(),r.translate(a/2,l/2),r.fillStyle=t,r.font="bold 32px 宋体",r.textBaseline="middle",r.textAlign="center",r.fillText(s,0,0),i}createPlateSprite(e){return new Promise((s,t)=>{var h,n;const i=!e.plateNo||e.plateNo==="0"||e.plateNo==="000000";if(this.currentSpriteContent===m.EVehiclePlateState.None||this.currentSpriteContent===m.EVehiclePlateState.PlateNumber&&i){s(void 0);return}let a=new Image,l="",r="";if(this.currentSpriteContent===m.EVehiclePlateState.PlateNumber||this.currentSpriteContent===m.EVehiclePlateState.Mix)if(i)a=this.greyPlateBG,l=e.ptcId,r="#ffffff";else switch(l=((h=e.showName)==null?void 0:h.substring(0,2))+"•"+((n=e.showName)==null?void 0:n.substring(2)),e.plateColor){case 1:a=this.bluePlateBG,r="#ffffff";break;case 2:a=this.yellowPlateBG,r="#000000";break;case 3:a=this.whitePlateBG,r="#000000";break;case 4:a=this.blackPlateBG,r="#ffffff";break;case 5:a=this.neoYellowPlateBG,r="#000000";break;case 6:a=this.neoGreenPlateBG,r="#000000";break;default:a=this.greyPlateBG,l=e.plateNo,r="#ffffff";break}else this.currentSpriteContent===m.EVehiclePlateState.Id&&(a=this.greyPlateBG,l=e.ptcId,r="#ffffff");const d=this.createCanvas(a,l,r);if(d){const p=new o.CanvasTexture(d),c=new o.SpriteMaterial({map:p,transparent:!1}),g=new o.Sprite(c),w=.05,y=d.width*w,T=d.height*w;g.scale.set(y,T,1),g.name="VehiclePlate",s(g)}else{t("canvas创建失败");return}a.onerror=p=>{console.log(`号牌背景加载失败: ${a.src}`,p),t(p)}})}}exports.default=D;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("@arcgis/core/core/promiseUtils.js"),S=require("@arcgis/core/core/reactiveUtils.js"),G=require("@arcgis/core/geometry/SpatialReference"),C=require("@arcgis/core/views/3d/externalRenderers"),V=require("three"),f=require("three/examples/jsm/loaders/GLTFLoader"),B=require("three/examples/jsm/loaders/MTLLoader"),M=require("three/examples/jsm/loaders/OBJLoader"),L=require("vue"),m=require("../../../types/index.js"),x=require("../../stores/index.js");function b(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const s in u)if(s!=="default"){const t=Object.getOwnPropertyDescriptor(u,s);Object.defineProperty(e,s,t.get?t:{enumerable:!0,get:()=>u[s]})}}return e.default=u,Object.freeze(e)}const R=b(T),I=b(S),P=b(C),o=b(V);class j{constructor(e){this.cameraHeightThreshold=1e3,this.roughness=.2,this.metalness=.8,this.defaultMaterial=new o.MeshPhongMaterial({color:16777215}),this.materialMap=new Map([[1,this.createCarMaterial(16777215)],[2,this.createCarMaterial(7833753)],[3,this.createCarMaterial(16766720)],[4,this.createCarMaterial(16758465)],[5,this.createCarMaterial(14423100)],[6,this.createCarMaterial(3329330)],[7,this.createCarMaterial(2003183)],[8,this.createCarMaterial(16032864)],[9,this.createCarMaterial(2105376)],[10,this.createCarMaterial(9662683)],[99,this.createCarMaterial(6908265)]]),this.isInitialized=!1,this.showGroundVehicle=!0,this.showElevatedVehicle=!0,this.isPaused=!1,this.currentSpriteContent=m.EVehiclePlateState.None,this.historyPositionMap=new Map,this.vehicleObjectMap=new Map,this.tabVisible=!0,this.updateModel=!1,this.appDataStore=x.default.useAppDataStore,this.logTable=[["ptcId","plateno","timestamp","localTimestamp","speed","longitude","latitude","ptcType","vehicleType","vehicleColor","plateColor","heading","fixAngle","roadLayer","step","receiveTimestamp","queueLength","status"]],this.view=e;const s=L.toRaw(this.appDataStore.mapConfig);this.assetsRoot=s.assetsRoot,document.addEventListener("visibilitychange",()=>{this.clearVehicles(),this.tabVisible=!document.hidden},!1),I.watch(()=>this.view.camera.position.z,(t,i)=>{(i<=this.cameraHeightThreshold&&t>this.cameraHeightThreshold||i>this.cameraHeightThreshold&&t<=this.cameraHeightThreshold)&&(this.updateModel=!0)})}createCarMaterial(e){return new o.MeshPhongMaterial({color:e})}getLog(){return this.logTable}async init(){await R.eachAlways([new Promise(e=>{new f.GLTFLoader().load(`${this.assetsRoot}/3DModels/car.glb`,t=>{const i=t.scene,l=new o.Box3().setFromObject(i).getSize(new o.Vector3);this.carModel=new o.Object3D,this.carModel.rotation.x=o.MathUtils.degToRad(90),this.carModel.add(i),i.position.set(0,0,l.z/2),e()})}),new Promise(e=>{new f.GLTFLoader().load(`${this.assetsRoot}/3DModels/van.glb`,t=>{const i=t.scene,l=new o.Box3().setFromObject(i).getSize(new o.Vector3);this.vanModel=new o.Object3D,this.vanModel.rotation.x=o.MathUtils.degToRad(90),this.vanModel.add(i),i.position.set(0,0,l.z/2),e()})}),new Promise(e=>{new f.GLTFLoader().load(`${this.assetsRoot}/3DModels/truck.glb`,t=>{const i=t.scene;i.scale.set(1.2,1,1.5);const l=new o.Box3().setFromObject(i).getSize(new o.Vector3);this.truckModel=new o.Object3D,this.truckModel.rotation.x=o.MathUtils.degToRad(90),this.truckModel.add(i),i.position.set(0,0,l.z/2),e()})}),new Promise(e=>{new f.GLTFLoader().load(`${this.assetsRoot}/3DModels/bus.glb`,t=>{const i=t.scene,l=new o.Box3().setFromObject(i).getSize(new o.Vector3);this.busModel=new o.Object3D,this.busModel.rotation.x=o.MathUtils.degToRad(90),this.busModel.add(i),i.position.set(0,0,l.z/2),e()})}),new Promise(e=>{new B.MTLLoader().load(`${this.assetsRoot}/3DModels/bicycle.mtl`,t=>{t.preload();const i=new M.OBJLoader;i.setMaterials(t),i.load(`${this.assetsRoot}/3DModels/bicycle.obj`,a=>{this.bicycleModel=a,this.bicycleModel.rotation.x=o.MathUtils.degToRad(90),e()})})}),new Promise(e=>{new M.OBJLoader().load(`${this.assetsRoot}/3DModels/male.obj`,t=>{t.scale.set(.01,.01,.01),this.passengerModel=t,this.passengerModel.rotation.x=o.MathUtils.degToRad(90),this.passengerModel.rotation.y=o.MathUtils.degToRad(180),e()})}),new Promise(e=>{this.bluePlateBG=new Image,this.bluePlateBG.src=`${this.assetsRoot}/Images/PlateBG/blue.png`,this.bluePlateBG.onload=()=>{e()}}),new Promise(e=>{this.yellowPlateBG=new Image,this.yellowPlateBG.src=`${this.assetsRoot}/Images/PlateBG/yellow.png`,this.yellowPlateBG.onload=()=>{e()}}),new Promise(e=>{this.whitePlateBG=new Image,this.whitePlateBG.src=`${this.assetsRoot}/Images/PlateBG/white.png`,this.whitePlateBG.onload=()=>{e()}}),new Promise(e=>{this.blackPlateBG=new Image,this.blackPlateBG.src=`${this.assetsRoot}/Images/PlateBG/black.png`,this.blackPlateBG.onload=()=>{e()}}),new Promise(e=>{this.neoYellowPlateBG=new Image,this.neoYellowPlateBG.src=`${this.assetsRoot}/Images/PlateBG/neo_yellow.png`,this.neoYellowPlateBG.onload=()=>{e()}}),new Promise(e=>{this.neoGreenPlateBG=new Image,this.neoGreenPlateBG.src=`${this.assetsRoot}/Images/PlateBG/neo_green.png`,this.neoGreenPlateBG.onload=()=>{e()}}),new Promise(e=>{this.greyPlateBG=new Image,this.greyPlateBG.src=`${this.assetsRoot}/Images/PlateBG/grey.png`,this.greyPlateBG.onload=()=>{e()}})]),this.isInitialized=!0}setInterpolate(e){this.clearVehicles(),this.tabVisible=e}async setup(e){this.context=e,this.renderer=new o.WebGLRenderer({context:e.gl,premultipliedAlpha:!0,logarithmicDepthBuffer:!0,antialias:!0,powerPreference:"high-performance"}),this.renderer.shadowMap.enabled=!0,this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setViewport(0,0,this.view.width,this.view.height),this.renderer.autoClearDepth=!1,this.renderer.autoClearStencil=!1,this.renderer.autoClearColor=!1;const s=this.renderer.setRenderTarget.bind(this.renderer);this.renderer.setRenderTarget=i=>{s(i),i==null&&e.bindRenderTarget()},this.scene=new o.Scene;const{camera:t}=e;this.camera=new o.PerspectiveCamera(t.fovY,t.aspect,.1,1e5),this.ambient=new o.AmbientLight(16777215,2),this.scene.add(this.ambient),this.sun=new o.DirectionalLight(16777215,2),this.scene.add(this.sun),e.resetWebGLState()}async render(e){var i;const s=e.camera;if(this.camera.position.set(s.eye[0],s.eye[1],s.eye[2]),this.camera.up.set(s.up[0],s.up[1],s.up[2]),this.camera.lookAt(new o.Vector3(s.center[0],s.center[1],s.center[2])),this.camera.projectionMatrix.fromArray(s.projectionMatrix),!this.isPaused&&this.tabVisible)for(const a of this.vehicleObjectMap.keys()){const l=(i=this.vehicleObjectMap.get(a))==null?void 0:i.model;if(!l)continue;const r=this.computeVehiclePosition(a);if(r){const d=this.toRenderCoordinates(r);l.position.set(d[0],d[1],d[2]),l.rotation.y=o.MathUtils.degToRad(-r[3])}}const t=e.sunLight;this.sun.position.set(t.direction[0],t.direction[1],t.direction[2]),this.sun.intensity=t.diffuse.intensity,this.sun.color=new o.Color(t.diffuse.color[0],t.diffuse.color[1],t.diffuse.color[2]),this.ambient.intensity=t.ambient.intensity,this.ambient.color=new o.Color(t.ambient.color[0],t.ambient.color[1],t.ambient.color[2]),this.renderer.resetState(),e.bindRenderTarget(),this.renderer.render(this.scene,this.camera),P.requestRender(this.view),e.resetWebGLState()}async addVehicles(e){if(this.isPaused||!this.isInitialized||!this.tabVisible)return;const s=Date.now();for(const t of e){this.appDataStore.saveTrackLog&&this.logTable.push([t.ptcId,t.plateNo,t.timestamp,t.localTimestamp,t.speed,t.x,t.y,t.ptcType,t.vehicleType,t.vehicleColor,t.plateColor,t.heading,t.fixAngle,t.roadLayer,t.step,s,0,0]);const{vehicleId:i,localTimestamp:a}=t,l=Number(t.x),r=Number(t.y),d=Number(t.heading);this.historyPositionMap.set(i,[{pos:[l,r,0],heading:d,time:a}]);const h=this.getVehicleModel(t);h.name=i,h.visible=!1;try{const n=await this.createPlateSprite(t);n&&(h.add(n),n.position.set(0,5,-4))}catch(n){console.log("createPlateSprite error:",n)}this.scene.add(h),this.vehicleObjectMap.set(i,{model:h,data:t,waitForDelete:!1,isMoving:!1})}}async updateVehicles(e){if(this.isPaused||!this.isInitialized||!this.tabVisible)return;const s=[],t=Date.now();for(const i of e){const{vehicleId:a,localTimestamp:l}=i,r=Number(i.x),d=Number(i.y);let h=Number(i.heading);const n=this.vehicleObjectMap.get(a),p=this.historyPositionMap.get(a);if(!n||!p)s.push(i);else{if(this.appDataStore.saveTrackLog&&this.logTable.push([i.ptcId,i.plateNo,i.timestamp,i.localTimestamp,i.speed,i.x,i.y,i.ptcType,i.vehicleType,i.vehicleColor,i.plateColor,i.heading,i.fixAngle,i.roadLayer,i.step,t,p.length,1]),this.updateModel||n.data.vehicleColor!==i.vehicleColor||n.data.vehicleType!==i.vehicleType){this.scene.remove(n.model),this.disposeModel(n.model),n.model=this.getVehicleModel(i),n.model.visible=!0;const c=await this.createPlateSprite(i);c&&(n.model.add(c),c.position.set(0,5,-4)),this.scene.add(n.model)}if(n.data.showName!==i.showName||n.data.plateColor!==i.plateColor){const c=n.model.getObjectByName("VehiclePlate");c&&(n.model.remove(c),this.disposeModel(c));const g=await this.createPlateSprite(i);g&&(n.model.add(g),g.position.set(0,5,-4))}if(n.data=i,this.tabVisible){const c=p[p.length-1];Math.abs(h-c.heading)>=180&&(h>c.heading?c.heading+=360:h+=360),p.push({pos:[r,d,0],heading:h,time:l})}else{this.historyPositionMap.set(a,[{pos:[r,d,0],heading:h,time:l}]);const c=this.toRenderCoordinates([r,d,0]);n.model.position.set(c[0],c[1],c[2]),n.model.rotation.y=o.MathUtils.degToRad(-h)}}}await this.addVehicles(s),this.updateModel=!1}toRenderCoordinates(e){const s=[0,0,0];return P.toRenderCoordinates(this.view,e,0,G.WGS84,s,0,1),s}deleteVehicles(e){if(this.isPaused)return;const s=Date.now();e.forEach(t=>{if(this.appDataStore.saveTrackLog){const a=this.historyPositionMap.get(t);this.logTable.push([t,"","","","","","","","","","","","","","",s,a?a.length:0,2])}const i=this.vehicleObjectMap.get(t);i&&(this.tabVisible?i.isMoving?i.waitForDelete=!0:this.deleteVehicle(i):this.deleteVehicle(i))})}deleteVehicle(e){this.disposeModel(e.model),this.scene.remove(e.model);const s=e.data.vehicleId;this.vehicleObjectMap.delete(s),this.historyPositionMap.delete(s)}async toggleTrafficInfo(e){e.name==="vehiclePlate"&&(e.visible===!0&&this.currentSpriteContent===m.EVehiclePlateState.None?await this.updatePanelContent(m.EVehiclePlateState.PlateNumber):await this.updatePanelContent(e.visible?this.currentSpriteContent:m.EVehiclePlateState.None))}togglePause(e){this.isPaused=e}clearVehicles(){for(const e of this.vehicleObjectMap.values())this.disposeModel(e.model),this.scene.remove(e.model);this.vehicleObjectMap.clear(),this.historyPositionMap.clear()}async updatePanelContent(e){this.currentSpriteContent=e;for(const s of this.vehicleObjectMap.values()){const t=s.model.getObjectByName("VehiclePlate");if(t&&(s.model.remove(t),this.disposeModel(t)),e!==m.EVehiclePlateState.None){const i=await this.createPlateSprite(s.data);i&&(s.model.add(i),i.position.set(0,5,-4))}}}toggleGroundVehicle(e){this.showGroundVehicle=e}toggleElevatedVehicle(e){this.showElevatedVehicle=e}disposeModel(e){e.traverse(s=>{if(s instanceof o.Mesh){s.geometry.dispose();try{s.material.dispose()}catch{}}})}computeVehiclePosition(e){const s=this.historyPositionMap.get(e),t=this.vehicleObjectMap.get(e);if(!t||!s||!t.isMoving&&s.length<=2)return;const i=Date.now();t.isMoving=!0,t.data.roadLayer==="1"?t.model.visible=this.showGroundVehicle:t.model.visible=this.showElevatedVehicle,t.segmentStartTime||(t.segmentStartTime=i,t.segmentTotalTime=s[1].time-s[0].time);const a=i-t.segmentStartTime,l=Math.min(a/t.segmentTotalTime,1);if(l===1)if(s.shift(),s.length===1){t.waitForDelete===!0?this.deleteVehicle(t):(t.segmentStartTime=void 0,t.segmentTotalTime=void 0,t.model.visible=!1,t.isMoving=!1,console.log("hide vehicle",e));return}else{t.segmentStartTime=Date.now();const r=a-t.segmentTotalTime;return t.segmentTotalTime=s[1].time-s[0].time-r,(s[1].heading>=270&&s[0].heading<=90||s[1].heading<=90&&s[0].heading>=270)&&(s[1].heading>s[0].heading?s[0].heading+=360:s[1].heading+=360),s[0].pos.concat(s[0].heading)}else if(s.length>=2){const r=s[0].pos[0]+(s[1].pos[0]-s[0].pos[0])*l,d=s[0].pos[1]+(s[1].pos[1]-s[0].pos[1])*l,h=s[0].heading+(s[1].heading-s[0].heading)*l;return[r,d,0,h]}else return}getVehicleModel(e){if(this.view.camera.position.z>=this.cameraHeightThreshold){const s=new o.SphereGeometry(5,32,32),t=new o.MeshPhysicalMaterial({color:325253,emissive:0,roughness:this.roughness,metalness:this.metalness});return new o.Mesh(s,t)}else{let s;if(e.ptcType===2)s=this.bicycleModel.clone();else if(e.ptcType===3)s=this.passengerModel.clone();else{switch(e.vehicleType){case 10:s=this.carModel.clone();break;case 20:s=this.vanModel.clone();break;case 25:s=this.truckModel.clone();break;case 50:s=this.busModel.clone();break;default:s=this.carModel.clone();break}const t=this.materialMap.get(e.vehicleColor)||this.defaultMaterial;let i=!1;s.traverse(a=>{!i&&a instanceof o.Mesh&&(a.material=t,i=!0)})}return s}}createCanvas(e,s,t){const i=document.createElement("canvas"),a=e.width,l=e.height;i.width=a,i.height=l;const r=i.getContext("2d");if(!r){console.log("canvas创建失败");return}return r.fillStyle="rgba(0,0,0,0.0)",r.fillRect(0,0,a,l),r.drawImage(e,0,0,a,l),r.beginPath(),r.translate(a/2,l/2),r.fillStyle=t,r.font="bold 32px 宋体",r.textBaseline="middle",r.textAlign="center",r.fillText(s,0,0),i}createPlateSprite(e){return new Promise((s,t)=>{var h,n;const i=!e.plateNo||e.plateNo==="0"||e.plateNo==="000000";if(this.currentSpriteContent===m.EVehiclePlateState.None||this.currentSpriteContent===m.EVehiclePlateState.PlateNumber&&i){s(void 0);return}let a=new Image,l="",r="";if(this.currentSpriteContent===m.EVehiclePlateState.PlateNumber||this.currentSpriteContent===m.EVehiclePlateState.Mix)if(i)a=this.greyPlateBG,l=e.ptcId,r="#ffffff";else switch(l=((h=e.showName)==null?void 0:h.substring(0,2))+"•"+((n=e.showName)==null?void 0:n.substring(2)),e.plateColor){case 1:a=this.bluePlateBG,r="#ffffff";break;case 2:a=this.yellowPlateBG,r="#000000";break;case 3:a=this.whitePlateBG,r="#000000";break;case 4:a=this.blackPlateBG,r="#ffffff";break;case 5:a=this.neoYellowPlateBG,r="#000000";break;case 6:a=this.neoGreenPlateBG,r="#000000";break;default:a=this.greyPlateBG,l=e.plateNo,r="#ffffff";break}else this.currentSpriteContent===m.EVehiclePlateState.Id&&(a=this.greyPlateBG,l=e.ptcId,r="#ffffff");const d=this.createCanvas(a,l,r);if(d){const p=new o.CanvasTexture(d),c=new o.SpriteMaterial({map:p,transparent:!1}),g=new o.Sprite(c),w=.05,v=d.width*w,y=d.height*w;g.scale.set(v,y,1),g.name="VehiclePlate",s(g)}else{t("canvas创建失败");return}a.onerror=p=>{console.log(`号牌背景加载失败: ${a.src}`,p),t(p)}})}}exports.default=j;
@@ -26,12 +26,29 @@ export default class SignalControlAreaController {
26
26
  * @returns
27
27
  */
28
28
  private handleViewClick;
29
+ /**
30
+ * 显示周边的路口
31
+ * @param crossIds
32
+ * @returns
33
+ */
29
34
  private showNearbyCrosses;
35
+ private addCrossCallback;
36
+ private removeCrossCallback;
30
37
  /**
31
38
  * 编辑子区的路口
32
39
  * @returns
33
40
  */
34
- editSubSignalArea(): Promise<IResult>;
41
+ editSubSignalArea(addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void): Promise<IResult>;
42
+ /**
43
+ * 从外部接口选中一个路口
44
+ * @param id
45
+ */
46
+ selectSubSignalControlAreaCross(id: string): IResult;
47
+ /**
48
+ * 从外部接口取消选中一个路口
49
+ * @param id
50
+ */
51
+ unselectSubSignalControlAreaCross(id: string): IResult;
35
52
  /**
36
53
  * 在区控\子区\路口图层中查找对应的graphic
37
54
  * @param id
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),u=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/buffer"),f=require("@turf/convex"),C=require("@turf/helpers"),v=require("axios"),S=require("concaveman"),L=require("../../stores/index.js"),w=require("./district-controller.js");function p(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const I=p(d),c=p(C);class A{constructor(e){var s;this.crossScale=5e3,this.view=e;const i=L.default.useAppDataStore.mapConfig;this.openDriveServer=(s=i.openDriveServer)==null?void 0:s.url,this.districtControllerLayer=new u({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new u({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new u({id:"crossLayer",visible:!1}),this.highlightLayer=new u({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1,this.districtControllerLayer.visible=!0;for(const t of e){const i=new w.default(t);this.drawArea(i,!0)}return this.scaleWatcher=I.watch(()=>this.view.scale,(t,i)=>{t>this.crossScale&&i<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&i>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var e,t;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.scaleWatcher)==null||e.remove(),this.scaleWatcher=void 0,(t=this.clickWatcher)==null||t.remove(),this.clickWatcher=void 0,this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id).toArray().map(r=>{const a=r.clone();return a.symbol.style="none",a}),i=this.subDistrictControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("parentId")===e.id).toArray().map(r=>r.clone()),s=this.crossLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("districtId")===e.id||r.getAttribute("subDistrictId")===e.id).toArray().map(r=>r.clone());if(t.length>0&&this.highlightLayer.addMany(t),i.length>0&&this.highlightLayer.addMany(i),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t);else if(i.length>0){const r=i[0].geometry.centroid;await this.view.goTo({target:r,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const i=e.children.map(s=>{const r={...s,selected:!0};return new y({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossSymbolInSubDistrict(r),attributes:r})});return this.crossLayer.addMany(i),this.view.goTo(i),{status:0,message:"ok"}}async handleViewClick(e){var r;const i=(r=(await this.view.hitTest(e,{include:[this.crossLayer]})).results)==null?void 0:r.filter(a=>a.type==="graphic");if(i.length===0)return;const s=i[0].graphic;s.getAttribute("selected")||await this.showNearbyCrosses(s.getAttribute("id"))}async showNearbyCrosses(e){const t=await v.get(`http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,{params:{junctionIds:e}});if(t.status===200)if(t.data.status===0){const i=t.data.result,s=[];return i.forEach(r=>{const{junctionId:a}=r;if(!this.crossLayer.graphics.some(n=>n.getAttribute("id")===a)){const n=new y({geometry:{type:"point",x:r.lon,y:r.lat},symbol:this.getCrossSymbolInSubDistrict(r),attributes:{id:r.junctionId,name:r.name,signalId:r.signalId,selected:!1}});s.push(n)}}),this.crossLayer.addMany(s),{status:0,message:"ok"}}else return{status:-1,message:t.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalArea(){if(this.openDriveServer){this.clickWatcher||(this.clickWatcher=this.view.on("click",async t=>{await this.handleViewClick(t)}));const e=this.crossLayer.graphics.toArray().map(t=>t.getAttribute("id")).join(",");return await this.showNearbyCrosses(e)}else return{status:1,message:"未配置OpenDriveServer"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(i=>i.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(i=>i.attributes.id===e)),t||(t=this.crossLayer.graphics.find(i=>i.attributes.id===e)),t}drawArea(e,t){const i=e.getAllCrossCoordinates();if(i.length>=2){let r=null;if(i.length===2)r=c.lineString(i);else{if(t){const h=c.featureCollection(i.map(m=>c.point(m)));r=f(h)}else{const h=S(i,.5);h.length>=4&&(r=c.polygon([h]))}r||(r=c.lineString(i))}const a=b(r.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const n={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},g=new y({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.2],outline:{color:e.areaColor,width:3,style:t?"solid":"long-dash"}},attributes:n,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(g):this.subDistrictControllerLayer.add(g)}for(const r of e.subDistricts)this.drawArea(r,!1);const s=[];e.crosses.forEach(r=>{const a={type:"cross",id:r.id,name:r.name,color:e.areaColor,signalId:r.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:r.isKey},l=new y({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:r.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(l)}),this.crossLayer.addMany(s)}getCrossSymbolInSubDistrict(e){return e.signalId&&e.signalId!==""?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e.selected?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz.png",width:"20px",height:"20px"}}getCrossGraphicSymbol(e,t){const{isKey:i,color:s}=e;if(t==="marker")return i?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,size:8,outline:{color:"white",width:1}};if(t==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:i?30:15,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:i?40:20,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${i?"gis_gjxk_blue":"gis_xhj_blue"}.png`}]}}}}}exports.default=A;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),u=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),d=require("@turf/buffer"),f=require("@turf/convex"),C=require("@turf/helpers"),v=require("axios"),S=require("concaveman"),A=require("../../stores/index.js"),I=require("./district-controller.js");function m(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const L=m(b),c=m(C);class w{constructor(t){var s;this.crossScale=5e3,this.view=t;const r=A.default.useAppDataStore.mapConfig;this.openDriveServer=(s=r.openDriveServer)==null?void 0:s.url,this.districtControllerLayer=new y({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new y({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new y({id:"crossLayer",visible:!1}),this.highlightLayer=new y({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(t){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1,this.districtControllerLayer.visible=!0;for(const e of t){const r=new I.default(e);this.drawArea(r,!0)}return this.scaleWatcher=L.watch(()=>this.view.scale,(e,r)=>{e>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):e<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var t,e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(t=this.scaleWatcher)==null||t.remove(),this.scaleWatcher=void 0,(e=this.clickWatcher)==null||e.remove(),this.clickWatcher=void 0,this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(t){const e=this.findAreaGraphic(t.id);return e?(e.attributes.type==="cross"?await this.view.goTo({target:e.geometry,scale:1500}):await this.view.goTo(e.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(t){if(!t.id||t.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const e=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===t.id).toArray().map(i=>{const a=i.clone();return a.symbol.style="none",a}),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===t.id||i.getAttribute("parentId")===t.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===t.id||i.getAttribute("districtId")===t.id||i.getAttribute("subDistrictId")===t.id).toArray().map(i=>i.clone());if(e.length>0&&this.highlightLayer.addMany(e),r.length>0&&this.highlightLayer.addMany(r),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(e.length>0)await this.view.goTo(e);else if(r.length>0){const i=r[0].geometry.centroid;await this.view.goTo({target:i,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(t){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=t.children.map(s=>{const i={...s,selected:!0};return new u({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossSymbolInSubDistrict(i),attributes:i})});return this.crossLayer.addMany(r),this.view.goTo(r),{status:0,message:"ok"}}async handleViewClick(t){var i;const r=(i=(await this.view.hitTest(t,{include:[this.crossLayer]})).results)==null?void 0:i.filter(a=>a.type==="graphic");if(r.length===0)return;const s=r[0].graphic;s.getAttribute("selected")?s.getAttribute("signalId")&&(this.removeCrossCallback&&this.removeCrossCallback(s.getAttribute("id")),s.setAttribute("selected",!1),s.symbol=this.getCrossSymbolInSubDistrict(s.attributes)):(s.getAttribute("signalId")&&(this.addCrossCallback&&this.addCrossCallback(s.getAttribute("id")),s.setAttribute("selected",!0),s.symbol=this.getCrossSymbolInSubDistrict(s.attributes)),await this.showNearbyCrosses(s.getAttribute("id")))}async showNearbyCrosses(t){const e=await v.get(`http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,{params:{junctionIds:t}});if(e.status===200)if(e.data.status===0){const r=e.data.result,s=[];return r.forEach(i=>{const{junctionId:a}=i;if(!this.crossLayer.graphics.some(n=>n.getAttribute("id")===a)){const n=new u({geometry:{type:"point",x:i.lon,y:i.lat},symbol:this.getCrossSymbolInSubDistrict(i),attributes:{id:i.junctionId,name:i.name,signalId:i.signalId,selected:!1}});s.push(n)}}),this.crossLayer.addMany(s),{status:0,message:"ok"}}else return{status:-1,message:e.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalArea(t,e){if(this.openDriveServer){this.addCrossCallback=t,this.removeCrossCallback=e,this.clickWatcher||(this.clickWatcher=this.view.on("click",async s=>{await this.handleViewClick(s)}));const r=this.crossLayer.graphics.toArray().map(s=>s.getAttribute("id")).join(",");return await this.showNearbyCrosses(r)}else return{status:1,message:"未配置OpenDriveServer"}}selectSubSignalControlAreaCross(t){return this.crossLayer.graphics.forEach(e=>{if(e.getAttribute("id")===t&&!e.getAttribute("selected"))return e.setAttribute("selected",!0),e.symbol=this.getCrossSymbolInSubDistrict(e.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}unselectSubSignalControlAreaCross(t){return this.crossLayer.graphics.forEach(e=>{if(e.getAttribute("id")===t&&e.getAttribute("selected"))return e.setAttribute("selected",!1),e.symbol=this.getCrossSymbolInSubDistrict(e.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}findAreaGraphic(t){let e=this.districtControllerLayer.graphics.find(r=>r.attributes.id===t);return e||(e=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===t)),e||(e=this.crossLayer.graphics.find(r=>r.attributes.id===t)),e}drawArea(t,e){const r=t.getAllCrossCoordinates();if(r.length>=2){let i=null;if(r.length===2)i=c.lineString(r);else{if(e){const h=c.featureCollection(r.map(p=>c.point(p)));i=f(h)}else{const h=S(r,.5);h.length>=4&&(i=c.polygon([h]))}i||(i=c.lineString(r))}const a=d(i.geometry,e?200:30,{units:"meters"});let l;e?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const n={type:"signalControlArea",id:t.id,name:t.name,parentId:t.parentId,parentName:t.parentName,crossCount:t.crossCount,subDistrictCount:t.subDistrictCount},g=new u({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",color:[...t.areaColor,.2],outline:{color:t.areaColor,width:3,style:e?"solid":"long-dash"}},attributes:n,popupTemplate:{title:`${e?"区控":"子区"} ${t.name}`,content:[{type:"fields",fieldInfos:l}]}});e?this.districtControllerLayer.add(g):this.subDistrictControllerLayer.add(g)}for(const i of t.subDistricts)this.drawArea(i,!1);const s=[];t.crosses.forEach(i=>{const a={type:"cross",id:i.id,name:i.name,color:t.areaColor,signalId:i.signalId,districtId:e?t.id:t.parentId,districtName:e?t.name:t.parentName,subDistrictId:e?"":t.id,subDistrictName:e?"":t.name,isKey:i.isKey},l=new u({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(l)}),this.crossLayer.addMany(s)}getCrossSymbolInSubDistrict(t){return t.signalId&&t.signalId!==""?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${t.selected?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz.png",width:"20px",height:"20px"}}getCrossGraphicSymbol(t,e){const{isKey:r,color:s}=t;if(e==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,size:8,outline:{color:"white",width:1}};if(e==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:r?30:15,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r?40:20,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${r?"gis_gjxk_blue":"gis_xhj_blue"}.png`}]}}}}}exports.default=w;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.178",
3
+ "version": "1.0.180",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [