gisviewer-vue3-arcgis 1.0.240 → 1.0.241

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.
@@ -111,6 +111,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
111
111
  removeQueueLength: () => void;
112
112
  showOpenDriveFromServer: (server: string, projectName: string) => Promise<import("../types").IResult>;
113
113
  showOpenDriveFromFile: (params: IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
114
+ setOpendriveVisibility: (visible: boolean) => void | {
115
+ status: number;
116
+ message: string;
117
+ };
114
118
  clearOpenDrive: () => Promise<void>;
115
119
  findSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
116
120
  selectSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
@@ -1,60 +1,60 @@
1
- import { defineComponent as $e, ref as k, reactive as qe, onMounted as Ke, getCurrentInstance as Je, onUnmounted as Re, computed as Xe, openBlock as O, createElementBlock as L, createElementVNode as f, withDirectives as Ye, vShow as Fe, Fragment as et, renderList as tt, createBlock as at } from "vue";
2
- import D, { registerStore as nt } from "./stores/index.mjs";
1
+ import { defineComponent as qe, ref as k, reactive as Ke, onMounted as Je, getCurrentInstance as Re, onUnmounted as Xe, computed as Ye, openBlock as O, createElementBlock as D, createElementVNode as f, withDirectives as Fe, vShow as et, Fragment as tt, renderList as at, createBlock as nt } from "vue";
2
+ import L, { registerStore as rt } from "./stores/index.mjs";
3
3
  import "./style/index.css";
4
- import rt from "./utils/detect-gpu.mjs";
4
+ import st from "./utils/detect-gpu.mjs";
5
5
  import T from "./utils/green-wave-band-controller/index.mjs";
6
- import st from "./utils/holo-flow/index.mjs";
7
- import ot from "./utils/holo-flow/signal-countdown-panel.vue.mjs";
8
- import it from "./utils/map-initializer.mjs";
6
+ import ot from "./utils/holo-flow/index.mjs";
7
+ import it from "./utils/holo-flow/signal-countdown-panel.vue.mjs";
8
+ import ct from "./utils/map-initializer.mjs";
9
9
  import B from "./utils/open-drive-renderer/index.mjs";
10
10
  import I from "./utils/overlay.mjs";
11
- import ct from "./utils/queue-length.mjs";
11
+ import lt from "./utils/queue-length.mjs";
12
12
  import M from "./utils/road-config-tool/index.mjs";
13
- import lt from "./utils/signal-control-area/edit-area.mjs";
14
- import ut from "./utils/signal-control-area/show-area.mjs";
15
- import mt from "./utils/traffic-flow.mjs";
16
- const pt = { class: "gis-viewer" }, gt = { style: { position: "absolute", bottom: "80px", left: "10px", "z-index": "9999" } }, Bt = /* @__PURE__ */ $e({
13
+ import ut from "./utils/signal-control-area/edit-area.mjs";
14
+ import mt from "./utils/signal-control-area/show-area.mjs";
15
+ import pt from "./utils/traffic-flow.mjs";
16
+ const gt = { class: "gis-viewer" }, dt = { style: { position: "absolute", bottom: "80px", left: "10px", "z-index": "9999" } }, It = /* @__PURE__ */ qe({
17
17
  __name: "gis-map",
18
18
  props: {
19
19
  config: {},
20
20
  assetsRoot: {}
21
21
  },
22
22
  emits: ["mapLoaded", "markerClick", "mapClick"],
23
- setup(_, { expose: x, emit: V }) {
23
+ setup(V, { expose: _, emit: x }) {
24
24
  const S = k(null);
25
25
  let s, u, c, o, a, n, d, t, l, r, m;
26
26
  const y = k(!1);
27
- nt();
28
- const G = D.useAppDataStore, b = qe([]);
29
- rt(), Ke(async () => {
27
+ rt();
28
+ const G = L.useAppDataStore, b = Ke([]);
29
+ st(), Je(async () => {
30
30
  if (!S.value)
31
31
  return;
32
32
  document.addEventListener("keydown", (g) => {
33
33
  g.ctrlKey && g.key === "i" && (y.value = !y.value);
34
34
  });
35
- const e = Je(), { $gisviewerAssetsRoot: p } = e.appContext.config.globalProperties, i = await (await fetch(A.config)).json();
36
- i.assetsRoot = A.assetsRoot || p, G.mapConfig = i, u = new it(), s = await u.initialize({
35
+ const e = Re(), { $gisviewerAssetsRoot: p } = e.appContext.config.globalProperties, i = await (await fetch(A.config)).json();
36
+ i.assetsRoot = A.assetsRoot || p, G.mapConfig = i, u = new ct(), s = await u.initialize({
37
37
  container: S.value,
38
38
  mapConfig: i,
39
- markerClickCallback: (g, w, h, Ze) => {
40
- v("markerClick", g, w, h, Ze);
39
+ markerClickCallback: (g, w, h, $e) => {
40
+ C("markerClick", g, w, h, $e);
41
41
  },
42
42
  mapClickCallback: (g, w, h) => {
43
- v("mapClick", g, w, h);
43
+ C("mapClick", g, w, h);
44
44
  }
45
- }), a = new st(s, b), await a.init(), v("mapLoaded");
46
- }), Re(() => {
45
+ }), a = new ot(s, b), await a.init(), C("mapLoaded");
46
+ }), Xe(() => {
47
47
  r == null || r.clearSignalControlArea(), t == null || t.clearOpenDrive(), a.clearHoloTrace(), a.clearHoloSignal(), o == null || o.disconnectTrafficFlow();
48
48
  });
49
- const H = Xe(() => s), z = () => {
50
- const e = D.useAppDataStore;
49
+ const H = Ye(() => s), z = () => {
50
+ const e = L.useAppDataStore;
51
51
  e.saveTrackLog = !0;
52
52
  }, P = () => {
53
53
  a.downloadTrackLog();
54
54
  }, W = () => {
55
- C("vehicleId");
55
+ v("vehicleId");
56
56
  }, N = () => {
57
- C("plateNumber");
57
+ v("plateNumber");
58
58
  }, E = async (e) => await u.setMapCenter(e), Q = async (e) => await u.setMapCamera(e), j = async (e) => await u.lookAt(e), U = (e) => u.setLayerVisibility(e), Z = (e, p) => u.requestCoordinateTransform(e, p), $ = (e) => {
59
59
  u.cancelCoordinateTransform(e);
60
60
  }, q = (e) => {
@@ -63,7 +63,7 @@ const pt = { class: "gis-viewer" }, gt = { style: { position: "absolute", bottom
63
63
  c == null || c.clearLaneNumber();
64
64
  }, R = async (e) => (c || (c = new M(s)), await c.initializeSearch(e)), X = async () => c == null ? void 0 : c.calCrossIndicatorArea(), Y = async () => {
65
65
  }, F = async (e, p) => {
66
- o || (o = new mt(s)), o.connectTrafficFlow(e, p);
66
+ o || (o = new pt(s)), o.connectTrafficFlow(e, p);
67
67
  }, ee = () => {
68
68
  o == null || o.disconnectTrafficFlow();
69
69
  }, te = async (e) => {
@@ -86,46 +86,49 @@ const pt = { class: "gis-viewer" }, gt = { style: { position: "absolute", bottom
86
86
  a == null || a.togglePause(e);
87
87
  }, ue = (e) => {
88
88
  o == null || o.toggleTrafficObject(e), a == null || a.toggleTrafficObject(e);
89
- }, C = (e) => {
89
+ }, v = (e) => {
90
90
  a == null || a.updatePanelContent(e);
91
91
  }, me = async (e) => (n || (n = new I(s)), n.addOverlays(e)), pe = (e) => (n || (n = new I(s)), n.addMask(e)), ge = () => {
92
92
  n == null || n.removeMask();
93
93
  }, de = (e) => n == null ? void 0 : n.removeOverlaysByType(e), fe = (e) => n == null ? void 0 : n.removeOverlaysById(e), Se = () => n == null ? void 0 : n.removeAllOverlays(), ye = () => {
94
94
  n == null || n.showAllOverlays();
95
- }, Ce = (e) => {
96
- d || (d = new ct(s)), d.updateQueueLength(e);
97
- }, ve = () => {
95
+ }, ve = (e) => {
96
+ d || (d = new lt(s)), d.updateQueueLength(e);
97
+ }, Ce = () => {
98
98
  d == null || d.removeQueueLength();
99
- }, we = async (e, p) => (t || (t = new B(s)), await t.showOpenDriveFromServer(e, p)), he = async (e) => (t || (t = new B(s)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), Oe = async () => await (t == null ? void 0 : t.clearOpenDrive()), be = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
99
+ }, we = async (e, p) => (t || (t = new B(s)), await t.showOpenDriveFromServer(e, p)), he = async (e) => (t || (t = new B(s)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), Oe = (e) => t ? t.setOpendriveVisibility(e) : {
100
100
  status: -1,
101
101
  message: "未加载OpenDrive地图"
102
- }, Ae = async (e) => t ? t.selectSumo(e) : {
102
+ }, be = async () => await (t == null ? void 0 : t.clearOpenDrive()), Ae = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
103
103
  status: -1,
104
104
  message: "未加载OpenDrive地图"
105
- }, ke = async (e) => t ? t.unselectSumo(e) : {
105
+ }, ke = async (e) => t ? t.selectSumo(e) : {
106
+ status: -1,
107
+ message: "未加载OpenDrive地图"
108
+ }, De = async (e) => t ? t.unselectSumo(e) : {
106
109
  status: -1,
107
110
  message: "未加载OpenDrive地图"
108
111
  }, Le = async (e) => t ? await t.geometrySearch(e) : {
109
112
  status: -1,
110
113
  message: "未加载OpenDrive地图"
111
- }, De = async (e) => t ? await t.getSumoInfo(e) : {
114
+ }, Te = async (e) => t ? await t.getSumoInfo(e) : {
112
115
  status: -1,
113
116
  message: "未加载OpenDrive地图"
114
- }, Te = async (e) => t ? await (t == null ? void 0 : t.splitLane(e)) : {
117
+ }, Be = async (e) => t ? await (t == null ? void 0 : t.splitLane(e)) : {
115
118
  status: -1,
116
119
  message: "未加载OpenDrive地图"
117
- }, Be = async () => t ? t == null ? void 0 : t.clearSplitLane() : {
120
+ }, Ie = async () => t ? t == null ? void 0 : t.clearSplitLane() : {
118
121
  status: -1,
119
122
  message: "未加载OpenDrive地图"
120
- }, Ie = async (e) => (r || (r = new ut(s)), await r.showSignalControlArea(e)), Me = async () => await (r == null ? void 0 : r.clearSignalControlArea()), _e = (e) => r == null ? void 0 : r.setLayerVisibility(e), xe = async (e) => r ? await (r == null ? void 0 : r.locateSignalControlArea(e)) : { status: -1, message: "未加载信号控制区" }, Ve = async (e) => r ? await r.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Ge = () => r ? r.resetHighlight() : { status: -1, message: "未加载信号控制区" }, He = (e) => (l || (l = new lt(s)), l.showSubSignalControlArea(e)), ze = (e) => l ? l.editSubSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Pe = () => l ? l.stopEditSubSignalControlArea() : { status: -1, message: "未加载信号控制区" }, We = (e) => l ? l.selectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, Ne = (e) => l ? l.unselectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, Ee = (e) => {
123
+ }, Me = async (e) => (r || (r = new mt(s)), await r.showSignalControlArea(e)), Ve = async () => await (r == null ? void 0 : r.clearSignalControlArea()), _e = (e) => r == null ? void 0 : r.setLayerVisibility(e), xe = async (e) => r ? await (r == null ? void 0 : r.locateSignalControlArea(e)) : { status: -1, message: "未加载信号控制区" }, Ge = async (e) => r ? await r.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, He = () => r ? r.resetHighlight() : { status: -1, message: "未加载信号控制区" }, ze = (e) => (l || (l = new ut(s)), l.showSubSignalControlArea(e)), Pe = (e) => l ? l.editSubSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, We = () => l ? l.stopEditSubSignalControlArea() : { status: -1, message: "未加载信号控制区" }, Ne = (e) => l ? l.selectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, Ee = (e) => l ? l.unselectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, Qe = (e) => {
121
124
  if (!l)
122
125
  return { status: -1, message: "未加载信号控制区" };
123
- }, Qe = (e) => (m || (m = new T(s)), m.addGreenWaveBand(e)), je = () => {
126
+ }, je = (e) => (m || (m = new T(s)), m.addGreenWaveBand(e)), Ue = () => {
124
127
  if (!m)
125
128
  return { status: -1, message: "未加载绿波带" };
126
129
  m.stopAddGreenWaveBand();
127
- }, Ue = async (e) => (m || (m = new T(s)), await m.showGreenWaveBand(e)), A = _, v = V;
128
- return x({
130
+ }, Ze = async (e) => (m || (m = new T(s)), await m.showGreenWaveBand(e)), A = V, C = x;
131
+ return _({
129
132
  mapViewer: H,
130
133
  setLayerVisibility: U,
131
134
  setMapCenter: E,
@@ -157,42 +160,43 @@ const pt = { class: "gis-viewer" }, gt = { style: { position: "absolute", bottom
157
160
  setInterpolate: ne,
158
161
  toggleTrafficInfo: ce,
159
162
  toggleTrafficObject: ue,
160
- toggleVehicleInfo: C,
163
+ toggleVehicleInfo: v,
161
164
  togglePause: le,
162
- updateQueueLength: Ce,
163
- removeQueueLength: ve,
165
+ updateQueueLength: ve,
166
+ removeQueueLength: Ce,
164
167
  showOpenDriveFromServer: we,
165
168
  showOpenDriveFromFile: he,
166
- clearOpenDrive: Oe,
169
+ clearOpenDrive: be,
170
+ setOpendriveVisibility: Oe,
167
171
  geometrySearchInOpenDrive: Le,
168
- findSumoInOpenDrive: be,
169
- selectSumoInOpenDrive: Ae,
170
- unselectSumoInOpenDrive: ke,
171
- getSumoInfo: De,
172
- splitOpenDriveLane: Te,
173
- clearSplitOpenDriveLane: Be,
174
- showSignalControlArea: Ie,
175
- clearSignalControlArea: Me,
172
+ findSumoInOpenDrive: Ae,
173
+ selectSumoInOpenDrive: ke,
174
+ unselectSumoInOpenDrive: De,
175
+ getSumoInfo: Te,
176
+ splitOpenDriveLane: Be,
177
+ clearSplitOpenDriveLane: Ie,
178
+ showSignalControlArea: Me,
179
+ clearSignalControlArea: Ve,
176
180
  setSignalControlAreaVisibility: _e,
177
181
  locateSignalControlArea: xe,
178
- highlightSignalControlArea: Ve,
179
- resetHighlightSignalControlArea: Ge,
180
- showSubSignalControlArea: He,
181
- editSubSignalControlArea: ze,
182
- stopEditSubSignalControlArea: Pe,
183
- selectSubSignalControlAreaCross: We,
184
- unselectSubSignalControlAreaCross: Ne,
185
- changeSubSignalControlAreaBorderVisibility: Ee,
186
- addGreenWaveBand: Qe,
187
- stopAddGreenWaveBand: je,
188
- showGreenWaveBand: Ue
189
- }), (e, p) => (O(), L("div", pt, [
182
+ highlightSignalControlArea: Ge,
183
+ resetHighlightSignalControlArea: He,
184
+ showSubSignalControlArea: ze,
185
+ editSubSignalControlArea: Pe,
186
+ stopEditSubSignalControlArea: We,
187
+ selectSubSignalControlAreaCross: Ne,
188
+ unselectSubSignalControlAreaCross: Ee,
189
+ changeSubSignalControlAreaBorderVisibility: Qe,
190
+ addGreenWaveBand: je,
191
+ stopAddGreenWaveBand: Ue,
192
+ showGreenWaveBand: Ze
193
+ }), (e, p) => (O(), D("div", gt, [
190
194
  f("div", {
191
195
  class: "gis-viewer-main",
192
196
  ref_key: "mapContainer",
193
197
  ref: S
194
198
  }, [
195
- Ye(f("div", gt, [
199
+ Fe(f("div", dt, [
196
200
  f("button", {
197
201
  style: { "margin-right": "10px" },
198
202
  onClick: z
@@ -207,10 +211,10 @@ const pt = { class: "gis-viewer" }, gt = { style: { position: "absolute", bottom
207
211
  }, " 显示车辆id "),
208
212
  f("button", { onClick: N }, "显示车辆号牌")
209
213
  ], 512), [
210
- [Fe, y.value]
214
+ [et, y.value]
211
215
  ])
212
216
  ], 512),
213
- (O(!0), L(et, null, tt(b, (i, g) => (O(), at(ot, {
217
+ (O(!0), D(tt, null, at(b, (i, g) => (O(), nt(it, {
214
218
  key: g,
215
219
  "display-mode": i.displayMode,
216
220
  flash: i.flash,
@@ -227,5 +231,5 @@ const pt = { class: "gis-viewer" }, gt = { style: { position: "absolute", bottom
227
231
  }
228
232
  });
229
233
  export {
230
- Bt as default
234
+ It as default
231
235
  };
@@ -98,6 +98,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
98
98
  removeQueueLength: () => void;
99
99
  showOpenDriveFromServer: (server: string, projectName: string) => Promise<import("../types").IResult>;
100
100
  showOpenDriveFromFile: (params: import("../types").IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
101
+ setOpendriveVisibility: (visible: boolean) => void | {
102
+ status: number;
103
+ message: string;
104
+ };
101
105
  clearOpenDrive: () => Promise<void>;
102
106
  findSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
103
107
  selectSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
@@ -22,14 +22,14 @@ class C {
22
22
  if (this.phaseLineLayer)
23
23
  this.phaseLineLayer.visible || (this.phaseLineLayer.visible = !0);
24
24
  else {
25
- const e = `${this.mapConfig.assetsRoot}/${this.mapConfig.phaseLineLayer}`, s = (await (await fetch(e)).json()).features.map((n, i) => ({
25
+ const e = `${this.mapConfig.assetsRoot}/${this.mapConfig.phaseLineLayer}`, s = (await (await fetch(e)).json()).features.map((i, n) => ({
26
26
  geometry: {
27
27
  type: "polyline",
28
- paths: [n.geometry.coordinates]
28
+ paths: [i.geometry.coordinates]
29
29
  },
30
30
  attributes: {
31
- ObjectID: i + 1,
32
- id: n.properties.id,
31
+ ObjectID: n + 1,
32
+ id: i.properties.id,
33
33
  color: "hide"
34
34
  }
35
35
  }));
@@ -108,7 +108,7 @@ class C {
108
108
  }
109
109
  ]
110
110
  }
111
- }), this.view.map.add(this.phaseLineLayer);
111
+ }), this.view.map.add(this.phaseLineLayer), console.log("相位线图层初始化成功");
112
112
  }
113
113
  }
114
114
  async initializePlateBackground() {
@@ -122,12 +122,12 @@ class C {
122
122
  });
123
123
  }
124
124
  async handleHoloSignalData(e) {
125
- const { crossId: t, lat: a, lon: s, rtStage: n, channelsConfig: i } = e;
126
- await this.updateCountdown(t, a, s, n), !(!this.phaseLineLayer || !i) && ((!this.currentPhaseMap.has(t) || this.currentPhaseMap.get(t) !== n.stagePhase) && await this.updatePhaseLine(
125
+ const { crossId: t, lat: a, lon: s, rtStage: i, channelsConfig: n } = e;
126
+ await this.updateCountdown(t, a, s, i), !(!this.phaseLineLayer || !n) && ((!this.currentPhaseMap.has(t) || this.currentPhaseMap.get(t) !== i.stagePhase) && await this.updatePhaseLine(
127
127
  t,
128
- n.channelsConfig,
129
- i
130
- ), this.currentPhaseMap.set(t, n.stagePhase));
128
+ i.channelsConfig,
129
+ n
130
+ ), this.currentPhaseMap.set(t, i.stagePhase));
131
131
  }
132
132
  /**
133
133
  * 清除实时信号相关图层
@@ -143,33 +143,33 @@ class C {
143
143
  async updateCountdown(e, t, a, s) {
144
144
  if (this.isDeletingCanvas)
145
145
  return;
146
- const n = this.countdownCanvasMap.get(e);
147
- if (n)
148
- this.drawCountdownText(n.countdownCanvas, s);
146
+ const i = this.countdownCanvasMap.get(e);
147
+ if (i)
148
+ this.drawCountdownText(i.countdownCanvas, s);
149
149
  else
150
150
  try {
151
- const i = new d({
151
+ const n = new d({
152
152
  longitude: a,
153
153
  latitude: t,
154
154
  z: 10
155
- }), o = this.view.toScreen(i), l = this.createCountdownCanvas();
155
+ }), o = this.view.toScreen(n), l = this.createCountdownCanvas();
156
156
  if (!l)
157
157
  return;
158
158
  const h = l[0], r = l[1];
159
159
  h.style.left = o.x + "px", h.style.top = o.y + "px", r.style.left = o.x + "px", r.style.top = o.y + "px", this.countdownCanvasMap.set(e, {
160
160
  backgroundCanvas: h,
161
161
  countdownCanvas: r,
162
- mapPoint: i
162
+ mapPoint: n
163
163
  }), this.drawCountdownText(r, s);
164
- } catch (i) {
165
- console.log("倒计时canvas创建失败", e, i);
164
+ } catch (n) {
165
+ console.log("倒计时canvas创建失败", e, n);
166
166
  }
167
167
  this.countdownWatchHandel || (this.countdownWatchHandel = c.watch(
168
168
  () => this.view.extent,
169
169
  () => {
170
- this.countdownCanvasMap.forEach((i) => {
171
- const o = this.view.toScreen(i.mapPoint);
172
- i.backgroundCanvas.style.left = o.x + "px", i.backgroundCanvas.style.top = o.y + "px", i.countdownCanvas.style.left = o.x + "px", i.countdownCanvas.style.top = o.y + "px";
170
+ this.countdownCanvasMap.forEach((n) => {
171
+ const o = this.view.toScreen(n.mapPoint);
172
+ n.backgroundCanvas.style.left = o.x + "px", n.backgroundCanvas.style.top = o.y + "px", n.countdownCanvas.style.left = o.x + "px", n.countdownCanvas.style.top = o.y + "px";
173
173
  });
174
174
  }
175
175
  ));
@@ -193,11 +193,11 @@ class C {
193
193
  }
194
194
  async updatePhaseLine(e, t, a) {
195
195
  const s = this.phaseLineLayer.source.filter(
196
- (n) => n.getAttribute("id").includes(e)
196
+ (i) => i.getAttribute("id").includes(e)
197
197
  );
198
- s.forEach((n) => {
199
- const i = n.getAttribute("id");
200
- this.isLaneInChannels(i, t) ? n.setAttribute("color", "green") : this.isLaneInChannels(i, a) ? n.setAttribute("color", "red") : n.setAttribute("color", "green");
198
+ s.forEach((i) => {
199
+ const n = i.getAttribute("id");
200
+ this.isLaneInChannels(n, t) ? i.setAttribute("color", "green") : this.isLaneInChannels(n, a) ? i.setAttribute("color", "red") : i.setAttribute("color", "green");
201
201
  }), await this.phaseLineLayer.applyEdits({ updateFeatures: s });
202
202
  }
203
203
  /**
@@ -207,11 +207,11 @@ class C {
207
207
  * @returns
208
208
  */
209
209
  isLaneInChannels(e, t) {
210
- const a = e.split("+"), s = a[1], n = a[2];
211
- for (let i = 0; i < t.length; i++)
212
- for (let o = 0; o < t[i].laneSnList.length; o++) {
213
- const l = t[i].laneSnList[o].toFixed(0);
214
- if (s === l[0] && n === l[1])
210
+ const a = e.split("+"), s = a[1], i = a[2];
211
+ for (let n = 0; n < t.length; n++)
212
+ for (let o = 0; o < t[n].laneSnList.length; o++) {
213
+ const l = t[n].laneSnList[o].toFixed(0);
214
+ if (s === l[0] && i === l[1])
215
215
  return !0;
216
216
  }
217
217
  return !1;
@@ -16,8 +16,8 @@ import E from "@arcgis/core/views/SceneView";
16
16
  import A from "@turf/destination";
17
17
  import * as J from "@turf/helpers";
18
18
  import K from "./custom-layer/custom-wmts-layer.mjs";
19
- function L(l, e) {
20
- return l && (l.startsWith("http://") || l.startsWith("https://") ? l : e + l);
19
+ function L(p, e) {
20
+ return p && (p.startsWith("http://") || p.startsWith("https://") ? p : e + p);
21
21
  }
22
22
  class oe {
23
23
  constructor() {
@@ -162,7 +162,7 @@ class oe {
162
162
  if (n)
163
163
  if (t.group) {
164
164
  let h = r.findLayerById(t.group);
165
- console.log(h), h && h.type === "group" ? h.add(n) : (h = new R({
165
+ h && h.type === "group" ? h.add(n) : (h = new R({
166
166
  id: t.group,
167
167
  title: t.groupTitle,
168
168
  visibilityMode: "inherited",
@@ -190,23 +190,23 @@ class oe {
190
190
  }
191
191
  this.view.ui.remove("attribution"), await this.view.when();
192
192
  const d = this.mapConfig.camera;
193
- let p;
193
+ let l;
194
194
  if (this.view.type === "2d") {
195
195
  let t = this.view.center;
196
196
  this.view.spatialReference.isWebMercator && (t = g.webMercatorToGeographic(
197
197
  t
198
- )), p = { center: [t.x, t.y], zoom: this.view.zoom };
198
+ )), l = { center: [t.x, t.y], zoom: this.view.zoom };
199
199
  } else {
200
200
  let t = this.view.camera.position;
201
201
  this.view.spatialReference.isWebMercator && (t = g.webMercatorToGeographic(
202
202
  t
203
- )), p = {
203
+ )), l = {
204
204
  position: t,
205
205
  heading: this.view.camera.heading,
206
206
  tilt: this.view.camera.tilt
207
207
  };
208
208
  }
209
- return d ? d.home = p : this.mapConfig.camera = { home: p }, this.view;
209
+ return d ? d.home = l : this.mapConfig.camera = { home: l }, this.view;
210
210
  }
211
211
  setLayerVisibility(e) {
212
212
  const { id: i, visible: o } = e, a = this.view.map.findLayerById(i);
@@ -300,8 +300,8 @@ class oe {
300
300
  const r = 1e3 / 30, d = T.watch(
301
301
  () => this.view.center,
302
302
  () => {
303
- const p = this.transformPoints(e), f = Date.now();
304
- f - o > r && (i(p), o = f);
303
+ const l = this.transformPoints(e), f = Date.now();
304
+ f - o > r && (i(l), o = f);
305
305
  }
306
306
  );
307
307
  return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(e) };
@@ -76,6 +76,7 @@ export default class OpenDriveRenderer {
76
76
  */
77
77
  private decreasePictureMarkerSize;
78
78
  getSumoInfo(params: IFindSumoParams): Promise<IResult>;
79
+ setOpendriveVisibility(visible: boolean): void;
79
80
  /**
80
81
  * 清除OpenDrive内容
81
82
  */
@@ -769,6 +769,9 @@ class M {
769
769
  return { status: -1, message: "未知类型" };
770
770
  }
771
771
  }
772
+ setOpendriveVisibility(e) {
773
+ this.laneLayer.visible = e;
774
+ }
772
775
  /**
773
776
  * 清除OpenDrive内容
774
777
  */
@@ -111,6 +111,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
111
111
  removeQueueLength: () => void;
112
112
  showOpenDriveFromServer: (server: string, projectName: string) => Promise<import("../types").IResult>;
113
113
  showOpenDriveFromFile: (params: IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
114
+ setOpendriveVisibility: (visible: boolean) => void | {
115
+ status: number;
116
+ message: string;
117
+ };
114
118
  clearOpenDrive: () => Promise<void>;
115
119
  findSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
116
120
  selectSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),b=require("./stores/index.js");require("./style/index.css");const je=require("./utils/detect-gpu.js"),A=require("./utils/green-wave-band-controller/index.js"),Qe=require("./utils/holo-flow/index.js"),Ue=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Ze=require("./utils/map-initializer.js"),L=require("./utils/open-drive-renderer/index.js"),D=require("./utils/overlay.js"),Ke=require("./utils/queue-length.js"),T=require("./utils/road-config-tool/index.js"),Je=require("./utils/signal-control-area/edit-area.js"),Xe=require("./utils/signal-control-area/show-area.js"),Ye=require("./utils/traffic-flow.js"),Fe={class:"gis-viewer"},Re={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},$e=n.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(_,{expose:B,emit:q}){const S=n.ref(null);let o,d,l,i,a,r,f,t,u,s,m;const y=n.ref(!1);b.registerStore();const V=b.default.useAppDataStore,k=n.reactive([]);je.default(),n.onMounted(async()=>{if(!S.value)return;document.addEventListener("keydown",p=>{p.ctrlKey&&p.key==="i"&&(y.value=!y.value)});const e=n.getCurrentInstance(),{$gisviewerAssetsRoot:g}=e.appContext.config.globalProperties,c=await(await fetch(O.config)).json();c.assetsRoot=O.assetsRoot||g,V.mapConfig=c,d=new Ze.default,o=await d.initialize({container:S.value,mapConfig:c,markerClickCallback:(p,C,h,We)=>{w("markerClick",p,C,h,We)},mapClickCallback:(p,C,h)=>{w("mapClick",p,C,h)}}),a=new Qe.default(o,k),await a.init(),w("mapLoaded")}),n.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),a.clearHoloTrace(),a.clearHoloSignal(),i==null||i.disconnectTrafficFlow()});const x=n.computed(()=>o),I=()=>{const e=b.default.useAppDataStore;e.saveTrackLog=!0},M=()=>{a.downloadTrackLog()},N=()=>{v("vehicleId")},E=()=>{v("plateNumber")},H=async e=>await d.setMapCenter(e),P=async e=>await d.setMapCamera(e),G=async e=>await d.lookAt(e),z=e=>d.setLayerVisibility(e),W=(e,g)=>d.requestCoordinateTransform(e,g),j=e=>{d.cancelCoordinateTransform(e)},Q=e=>{d.setMapZoomRange(e)},U=e=>(l||(l=new T.default(o)),l.showLaneNumber(e)),Z=()=>{l==null||l.clearLaneNumber()},K=async e=>(l||(l=new T.default(o)),await l.initializeSearch(e)),J=async()=>l==null?void 0:l.calCrossIndicatorArea(),X=async()=>{},Y=async(e,g)=>{i||(i=new Ye.default(o)),i.connectTrafficFlow(e,g)},F=()=>{i==null||i.disconnectTrafficFlow()},R=async e=>{a.handleVehicleTraceData(e)},$=()=>{a.clearHoloTrace()},ee=e=>{a.setInterpolate(e)},te=async e=>{await a.handleSignalData(e)},ae=async e=>{await a.initializeLampGroup(e)},ne=e=>{a.handleUniSignalData(e)},re=()=>{a.clearHoloSignal()},se=e=>{i==null||i.toggleTrafficInfo(e),a==null||a.toggleTrafficInfo(e)},oe=e=>{a==null||a.togglePause(e)},ie=e=>{i==null||i.toggleTrafficObject(e),a==null||a.toggleTrafficObject(e)},v=e=>{a==null||a.updatePanelContent(e)},ce=async e=>(r||(r=new D.default(o)),r.addOverlays(e)),le=e=>(r||(r=new D.default(o)),r.addMask(e)),ue=()=>{r==null||r.removeMask()},de=e=>r==null?void 0:r.removeOverlaysByType(e),me=e=>r==null?void 0:r.removeOverlaysById(e),ge=()=>r==null?void 0:r.removeAllOverlays(),pe=()=>{r==null||r.showAllOverlays()},fe=e=>{f||(f=new Ke.default(o)),f.updateQueueLength(e)},Se=()=>{f==null||f.removeQueueLength()},ye=async(e,g)=>(t||(t=new L.default(o)),await t.showOpenDriveFromServer(e,g)),ve=async e=>(t||(t=new L.default(o)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),we=async()=>await(t==null?void 0:t.clearOpenDrive()),Ce=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},he=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},be=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ke=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Oe=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ae=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Le=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},De=async e=>(s||(s=new Xe.default(o)),await s.showSignalControlArea(e)),Te=async()=>await(s==null?void 0:s.clearSignalControlArea()),_e=e=>s==null?void 0:s.setLayerVisibility(e),Be=async e=>s?await(s==null?void 0:s.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},qe=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ve=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},xe=e=>(u||(u=new Je.default(o)),u.showSubSignalControlArea(e)),Ie=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Me=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},Ne=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Ee=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},He=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},Pe=e=>(m||(m=new A.default(o)),m.addGreenWaveBand(e)),Ge=()=>{if(!m)return{status:-1,message:"未加载绿波带"};m.stopAddGreenWaveBand()},ze=async e=>(m||(m=new A.default(o)),await m.showGreenWaveBand(e)),O=_,w=q;return B({mapViewer:x,setLayerVisibility:z,setMapCenter:H,lookAt:G,setMapCamera:P,setMapZoomRange:Q,requestCoordinateTransform:W,cancelCoordinateTransform:j,addOverlays:ce,addMask:le,removeMask:ue,showAllOverlays:pe,removeOverlaysByType:de,removeOverlaysById:me,removeAllOverlays:ge,showLaneNumber:U,clearLaneNumber:Z,initializeAreaTool:K,calCrossIndicatorArea:J,calRoadIndicatorArea:X,connectCarFlow:Y,disconnectCarFlow:F,handleHoloVehicleTraceData:R,clearHoloTrace:$,initializeLampGroup:ae,handleUniSignalData:ne,handleHoloSignalData:te,clearHoloSignal:re,setInterpolate:ee,toggleTrafficInfo:se,toggleTrafficObject:ie,toggleVehicleInfo:v,togglePause:oe,updateQueueLength:fe,removeQueueLength:Se,showOpenDriveFromServer:ye,showOpenDriveFromFile:ve,clearOpenDrive:we,geometrySearchInOpenDrive:ke,findSumoInOpenDrive:Ce,selectSumoInOpenDrive:he,unselectSumoInOpenDrive:be,getSumoInfo:Oe,splitOpenDriveLane:Ae,clearSplitOpenDriveLane:Le,showSignalControlArea:De,clearSignalControlArea:Te,setSignalControlAreaVisibility:_e,locateSignalControlArea:Be,highlightSignalControlArea:qe,resetHighlightSignalControlArea:Ve,showSubSignalControlArea:xe,editSubSignalControlArea:Ie,stopEditSubSignalControlArea:Me,selectSubSignalControlAreaCross:Ne,unselectSubSignalControlAreaCross:Ee,changeSubSignalControlAreaBorderVisibility:He,addGreenWaveBand:Pe,stopAddGreenWaveBand:Ge,showGreenWaveBand:ze}),(e,g)=>(n.openBlock(),n.createElementBlock("div",Fe,[n.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:S},[n.withDirectives(n.createElementVNode("div",Re,[n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:I}," 开始记录 "),n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:M}," 下载日志 "),n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:N}," 显示车辆id "),n.createElementVNode("button",{onClick:E},"显示车辆号牌")],512),[[n.vShow,y.value]])],512),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(k,(c,p)=>(n.openBlock(),n.createBlock(Ue.default,{key:p,"display-mode":c.displayMode,flash:c.flash,"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","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=$e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),b=require("./stores/index.js");require("./style/index.css");const Qe=require("./utils/detect-gpu.js"),A=require("./utils/green-wave-band-controller/index.js"),Ue=require("./utils/holo-flow/index.js"),Ze=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Ke=require("./utils/map-initializer.js"),L=require("./utils/open-drive-renderer/index.js"),D=require("./utils/overlay.js"),Je=require("./utils/queue-length.js"),T=require("./utils/road-config-tool/index.js"),Xe=require("./utils/signal-control-area/edit-area.js"),Ye=require("./utils/signal-control-area/show-area.js"),Fe=require("./utils/traffic-flow.js"),Re={class:"gis-viewer"},$e={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},et=n.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(_,{expose:B,emit:V}){const y=n.ref(null);let o,d,l,i,a,r,f,t,u,s,m;const S=n.ref(!1);b.registerStore();const q=b.default.useAppDataStore,O=n.reactive([]);Qe.default(),n.onMounted(async()=>{if(!y.value)return;document.addEventListener("keydown",p=>{p.ctrlKey&&p.key==="i"&&(S.value=!S.value)});const e=n.getCurrentInstance(),{$gisviewerAssetsRoot:g}=e.appContext.config.globalProperties,c=await(await fetch(k.config)).json();c.assetsRoot=k.assetsRoot||g,q.mapConfig=c,d=new Ke.default,o=await d.initialize({container:y.value,mapConfig:c,markerClickCallback:(p,C,h,je)=>{w("markerClick",p,C,h,je)},mapClickCallback:(p,C,h)=>{w("mapClick",p,C,h)}}),a=new Ue.default(o,O),await a.init(),w("mapLoaded")}),n.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),a.clearHoloTrace(),a.clearHoloSignal(),i==null||i.disconnectTrafficFlow()});const x=n.computed(()=>o),I=()=>{const e=b.default.useAppDataStore;e.saveTrackLog=!0},M=()=>{a.downloadTrackLog()},N=()=>{v("vehicleId")},E=()=>{v("plateNumber")},H=async e=>await d.setMapCenter(e),P=async e=>await d.setMapCamera(e),G=async e=>await d.lookAt(e),z=e=>d.setLayerVisibility(e),W=(e,g)=>d.requestCoordinateTransform(e,g),j=e=>{d.cancelCoordinateTransform(e)},Q=e=>{d.setMapZoomRange(e)},U=e=>(l||(l=new T.default(o)),l.showLaneNumber(e)),Z=()=>{l==null||l.clearLaneNumber()},K=async e=>(l||(l=new T.default(o)),await l.initializeSearch(e)),J=async()=>l==null?void 0:l.calCrossIndicatorArea(),X=async()=>{},Y=async(e,g)=>{i||(i=new Fe.default(o)),i.connectTrafficFlow(e,g)},F=()=>{i==null||i.disconnectTrafficFlow()},R=async e=>{a.handleVehicleTraceData(e)},$=()=>{a.clearHoloTrace()},ee=e=>{a.setInterpolate(e)},te=async e=>{await a.handleSignalData(e)},ae=async e=>{await a.initializeLampGroup(e)},ne=e=>{a.handleUniSignalData(e)},re=()=>{a.clearHoloSignal()},se=e=>{i==null||i.toggleTrafficInfo(e),a==null||a.toggleTrafficInfo(e)},oe=e=>{a==null||a.togglePause(e)},ie=e=>{i==null||i.toggleTrafficObject(e),a==null||a.toggleTrafficObject(e)},v=e=>{a==null||a.updatePanelContent(e)},ce=async e=>(r||(r=new D.default(o)),r.addOverlays(e)),le=e=>(r||(r=new D.default(o)),r.addMask(e)),ue=()=>{r==null||r.removeMask()},de=e=>r==null?void 0:r.removeOverlaysByType(e),me=e=>r==null?void 0:r.removeOverlaysById(e),ge=()=>r==null?void 0:r.removeAllOverlays(),pe=()=>{r==null||r.showAllOverlays()},fe=e=>{f||(f=new Je.default(o)),f.updateQueueLength(e)},ye=()=>{f==null||f.removeQueueLength()},Se=async(e,g)=>(t||(t=new L.default(o)),await t.showOpenDriveFromServer(e,g)),ve=async e=>(t||(t=new L.default(o)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),we=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Ce=async()=>await(t==null?void 0:t.clearOpenDrive()),he=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},be=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Oe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ke=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Ae=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Le=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},De=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Te=async e=>(s||(s=new Ye.default(o)),await s.showSignalControlArea(e)),_e=async()=>await(s==null?void 0:s.clearSignalControlArea()),Be=e=>s==null?void 0:s.setLayerVisibility(e),Ve=async e=>s?await(s==null?void 0:s.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},qe=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},xe=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},Ie=e=>(u||(u=new Xe.default(o)),u.showSubSignalControlArea(e)),Me=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ne=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},Ee=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},He=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Pe=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},Ge=e=>(m||(m=new A.default(o)),m.addGreenWaveBand(e)),ze=()=>{if(!m)return{status:-1,message:"未加载绿波带"};m.stopAddGreenWaveBand()},We=async e=>(m||(m=new A.default(o)),await m.showGreenWaveBand(e)),k=_,w=V;return B({mapViewer:x,setLayerVisibility:z,setMapCenter:H,lookAt:G,setMapCamera:P,setMapZoomRange:Q,requestCoordinateTransform:W,cancelCoordinateTransform:j,addOverlays:ce,addMask:le,removeMask:ue,showAllOverlays:pe,removeOverlaysByType:de,removeOverlaysById:me,removeAllOverlays:ge,showLaneNumber:U,clearLaneNumber:Z,initializeAreaTool:K,calCrossIndicatorArea:J,calRoadIndicatorArea:X,connectCarFlow:Y,disconnectCarFlow:F,handleHoloVehicleTraceData:R,clearHoloTrace:$,initializeLampGroup:ae,handleUniSignalData:ne,handleHoloSignalData:te,clearHoloSignal:re,setInterpolate:ee,toggleTrafficInfo:se,toggleTrafficObject:ie,toggleVehicleInfo:v,togglePause:oe,updateQueueLength:fe,removeQueueLength:ye,showOpenDriveFromServer:Se,showOpenDriveFromFile:ve,clearOpenDrive:Ce,setOpendriveVisibility:we,geometrySearchInOpenDrive:ke,findSumoInOpenDrive:he,selectSumoInOpenDrive:be,unselectSumoInOpenDrive:Oe,getSumoInfo:Ae,splitOpenDriveLane:Le,clearSplitOpenDriveLane:De,showSignalControlArea:Te,clearSignalControlArea:_e,setSignalControlAreaVisibility:Be,locateSignalControlArea:Ve,highlightSignalControlArea:qe,resetHighlightSignalControlArea:xe,showSubSignalControlArea:Ie,editSubSignalControlArea:Me,stopEditSubSignalControlArea:Ne,selectSubSignalControlAreaCross:Ee,unselectSubSignalControlAreaCross:He,changeSubSignalControlAreaBorderVisibility:Pe,addGreenWaveBand:Ge,stopAddGreenWaveBand:ze,showGreenWaveBand:We}),(e,g)=>(n.openBlock(),n.createElementBlock("div",Re,[n.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:y},[n.withDirectives(n.createElementVNode("div",$e,[n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:I}," 开始记录 "),n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:M}," 下载日志 "),n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:N}," 显示车辆id "),n.createElementVNode("button",{onClick:E},"显示车辆号牌")],512),[[n.vShow,S.value]])],512),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(O,(c,p)=>(n.openBlock(),n.createBlock(Ze.default,{key:p,"display-mode":c.displayMode,flash:c.flash,"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","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=et;
@@ -98,6 +98,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
98
98
  removeQueueLength: () => void;
99
99
  showOpenDriveFromServer: (server: string, projectName: string) => Promise<import("../types").IResult>;
100
100
  showOpenDriveFromFile: (params: import("../types").IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
101
+ setOpendriveVisibility: (visible: boolean) => void | {
102
+ status: number;
103
+ message: string;
104
+ };
101
105
  clearOpenDrive: () => Promise<void>;
102
106
  findSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
103
107
  selectSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils"),u=require("@arcgis/core/geometry"),p=require("@arcgis/core/layers/FeatureLayer"),g=require("vue"),y=require("../../stores/index.js");function w(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const f=w(d);class m{constructor(e){this.currentPhaseMap=new Map,this.countdownCanvasMap=new Map,this.lastDataTime=0,this.isDeletingCanvas=!1,this.canvasWidth=80,this.canvasHeight=40,this.view=(e.type==="2d",e);const t=y.default.useAppDataStore;this.mapConfig=g.toRaw(t.mapConfig)}async initializeLayer(){try{await this.initializePlateBackground()}catch(e){console.log("倒计时背景图片加载失败",e)}if(this.mapConfig.phaseLineLayer)if(this.phaseLineLayer)this.phaseLineLayer.visible||(this.phaseLineLayer.visible=!0);else{const e=`${this.mapConfig.assetsRoot}/${this.mapConfig.phaseLineLayer}`,s=(await(await fetch(e)).json()).features.map((i,n)=>({geometry:{type:"polyline",paths:[i.geometry.coordinates]},attributes:{ObjectID:n+1,id:i.properties.id,color:"hide"}}));this.phaseLineLayer=new p({source:s,geometryType:"polyline",objectIdField:"ObjectID",outFields:["*"],fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"color",alias:"color",type:"string"}],renderer:{type:"unique-value",field:"color",defaultSymbol:{type:"simple-line",color:"lightblue",width:"2px",style:"none"},uniqueValueInfos:[{value:"green",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[19,255,69,.8]},width:1,height:.5}]}},{value:"red",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[254,5,9,.8]},width:1,height:.5}]}},{value:"yellow",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[255,215,0,.8]},width:1,height:.5}]}}]}}),this.view.map.add(this.phaseLineLayer)}}async initializePlateBackground(){return new Promise((e,t)=>{const a=new Image;a.src=`${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`,a.onload=()=>{this.plateBackground=a,e()},a.onerror=s=>{t(s)}})}async handleHoloSignalData(e){const{crossId:t,lat:a,lon:s,rtStage:i,channelsConfig:n}=e;await this.updateCountdown(t,a,s,i),!(!this.phaseLineLayer||!n)&&((!this.currentPhaseMap.has(t)||this.currentPhaseMap.get(t)!==i.stagePhase)&&await this.updatePhaseLine(t,i.channelsConfig,n),this.currentPhaseMap.set(t,i.stagePhase))}clearSignal(){this.phaseLineLayer&&(this.phaseLineLayer.visible=!1),this.countdownWatchHandel&&(this.countdownWatchHandel.remove(),this.countdownWatchHandel=void 0),this.countdownCanvasMap.forEach(e=>{this.view.container.removeChild(e.backgroundCanvas),this.view.container.removeChild(e.countdownCanvas)}),this.countdownCanvasMap.clear()}async updateCountdown(e,t,a,s){if(this.isDeletingCanvas)return;const i=this.countdownCanvasMap.get(e);if(i)this.drawCountdownText(i.countdownCanvas,s);else try{const n=new u.Point({longitude:a,latitude:t,z:10}),o=this.view.toScreen(n),r=this.createCountdownCanvas();if(!r)return;const h=r[0],c=r[1];h.style.left=o.x+"px",h.style.top=o.y+"px",c.style.left=o.x+"px",c.style.top=o.y+"px",this.countdownCanvasMap.set(e,{backgroundCanvas:h,countdownCanvas:c,mapPoint:n}),this.drawCountdownText(c,s)}catch(n){console.log("倒计时canvas创建失败",e,n)}this.countdownWatchHandel||(this.countdownWatchHandel=f.watch(()=>this.view.extent,()=>{this.countdownCanvasMap.forEach(n=>{const o=this.view.toScreen(n.mapPoint);n.backgroundCanvas.style.left=o.x+"px",n.backgroundCanvas.style.top=o.y+"px",n.countdownCanvas.style.left=o.x+"px",n.countdownCanvas.style.top=o.y+"px"})}))}drawCountdownText(e,t){const a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),a.font="24px Digital",a.textBaseline="middle",a.textAlign="center",a.fillStyle=t.stageRemainingTime<=t.stageAllRedTime?"red":t.stageRemainingTime<=t.stageAllRedTime+t.stageYellowTime?"yellow":"lime",a.fillText(t.stageRemainingTime.toFixed(0),e.width/2,e.height/2)}async updatePhaseLine(e,t,a){const s=this.phaseLineLayer.source.filter(i=>i.getAttribute("id").includes(e));s.forEach(i=>{const n=i.getAttribute("id");this.isLaneInChannels(n,t)?i.setAttribute("color","green"):this.isLaneInChannels(n,a)?i.setAttribute("color","red"):i.setAttribute("color","green")}),await this.phaseLineLayer.applyEdits({updateFeatures:s})}isLaneInChannels(e,t){const a=e.split("+"),s=a[1],i=a[2];for(let n=0;n<t.length;n++)for(let o=0;o<t[n].laneSnList.length;o++){const r=t[n].laneSnList[o].toFixed(0);if(s===r[0]&&i===r[1])return!0}return!1}createCountdownCanvas(){const e=document.createElement("canvas");e.width=this.canvasWidth,e.height=this.canvasHeight,e.style.position="absolute",e.style.transform="translate(-50%, -50%)";const t=e.getContext("2d");this.plateBackground?t.drawImage(this.plateBackground,0,0,this.canvasWidth,this.canvasHeight):(t.strokeStyle="rgba(0, 255, 0, 1)",t.lineWidth=1,t.strokeRect(0,0,this.canvasWidth,this.canvasHeight),t.fillStyle="rgba(0, 0, 0, 1)",t.fillRect(0,0,this.canvasWidth,this.canvasHeight)),this.view.container.appendChild(e);const a=document.createElement("canvas");return a.width=this.canvasWidth-10,a.height=this.canvasHeight-10,a.style.position="absolute",a.style.transform="translate(-50%, -50%)",this.view.container.appendChild(a),[e,a]}}exports.default=m;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils"),u=require("@arcgis/core/geometry"),p=require("@arcgis/core/layers/FeatureLayer"),g=require("vue"),y=require("../../stores/index.js");function w(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const f=w(d);class m{constructor(e){this.currentPhaseMap=new Map,this.countdownCanvasMap=new Map,this.lastDataTime=0,this.isDeletingCanvas=!1,this.canvasWidth=80,this.canvasHeight=40,this.view=(e.type==="2d",e);const t=y.default.useAppDataStore;this.mapConfig=g.toRaw(t.mapConfig)}async initializeLayer(){try{await this.initializePlateBackground()}catch(e){console.log("倒计时背景图片加载失败",e)}if(this.mapConfig.phaseLineLayer)if(this.phaseLineLayer)this.phaseLineLayer.visible||(this.phaseLineLayer.visible=!0);else{const e=`${this.mapConfig.assetsRoot}/${this.mapConfig.phaseLineLayer}`,s=(await(await fetch(e)).json()).features.map((i,n)=>({geometry:{type:"polyline",paths:[i.geometry.coordinates]},attributes:{ObjectID:n+1,id:i.properties.id,color:"hide"}}));this.phaseLineLayer=new p({source:s,geometryType:"polyline",objectIdField:"ObjectID",outFields:["*"],fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"color",alias:"color",type:"string"}],renderer:{type:"unique-value",field:"color",defaultSymbol:{type:"simple-line",color:"lightblue",width:"2px",style:"none"},uniqueValueInfos:[{value:"green",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[19,255,69,.8]},width:1,height:.5}]}},{value:"red",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[254,5,9,.8]},width:1,height:.5}]}},{value:"yellow",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[255,215,0,.8]},width:1,height:.5}]}}]}}),this.view.map.add(this.phaseLineLayer),console.log("相位线图层初始化成功")}}async initializePlateBackground(){return new Promise((e,t)=>{const a=new Image;a.src=`${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`,a.onload=()=>{this.plateBackground=a,e()},a.onerror=s=>{t(s)}})}async handleHoloSignalData(e){const{crossId:t,lat:a,lon:s,rtStage:i,channelsConfig:n}=e;await this.updateCountdown(t,a,s,i),!(!this.phaseLineLayer||!n)&&((!this.currentPhaseMap.has(t)||this.currentPhaseMap.get(t)!==i.stagePhase)&&await this.updatePhaseLine(t,i.channelsConfig,n),this.currentPhaseMap.set(t,i.stagePhase))}clearSignal(){this.phaseLineLayer&&(this.phaseLineLayer.visible=!1),this.countdownWatchHandel&&(this.countdownWatchHandel.remove(),this.countdownWatchHandel=void 0),this.countdownCanvasMap.forEach(e=>{this.view.container.removeChild(e.backgroundCanvas),this.view.container.removeChild(e.countdownCanvas)}),this.countdownCanvasMap.clear()}async updateCountdown(e,t,a,s){if(this.isDeletingCanvas)return;const i=this.countdownCanvasMap.get(e);if(i)this.drawCountdownText(i.countdownCanvas,s);else try{const n=new u.Point({longitude:a,latitude:t,z:10}),o=this.view.toScreen(n),r=this.createCountdownCanvas();if(!r)return;const h=r[0],c=r[1];h.style.left=o.x+"px",h.style.top=o.y+"px",c.style.left=o.x+"px",c.style.top=o.y+"px",this.countdownCanvasMap.set(e,{backgroundCanvas:h,countdownCanvas:c,mapPoint:n}),this.drawCountdownText(c,s)}catch(n){console.log("倒计时canvas创建失败",e,n)}this.countdownWatchHandel||(this.countdownWatchHandel=f.watch(()=>this.view.extent,()=>{this.countdownCanvasMap.forEach(n=>{const o=this.view.toScreen(n.mapPoint);n.backgroundCanvas.style.left=o.x+"px",n.backgroundCanvas.style.top=o.y+"px",n.countdownCanvas.style.left=o.x+"px",n.countdownCanvas.style.top=o.y+"px"})}))}drawCountdownText(e,t){const a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),a.font="24px Digital",a.textBaseline="middle",a.textAlign="center",a.fillStyle=t.stageRemainingTime<=t.stageAllRedTime?"red":t.stageRemainingTime<=t.stageAllRedTime+t.stageYellowTime?"yellow":"lime",a.fillText(t.stageRemainingTime.toFixed(0),e.width/2,e.height/2)}async updatePhaseLine(e,t,a){const s=this.phaseLineLayer.source.filter(i=>i.getAttribute("id").includes(e));s.forEach(i=>{const n=i.getAttribute("id");this.isLaneInChannels(n,t)?i.setAttribute("color","green"):this.isLaneInChannels(n,a)?i.setAttribute("color","red"):i.setAttribute("color","green")}),await this.phaseLineLayer.applyEdits({updateFeatures:s})}isLaneInChannels(e,t){const a=e.split("+"),s=a[1],i=a[2];for(let n=0;n<t.length;n++)for(let o=0;o<t[n].laneSnList.length;o++){const r=t[n].laneSnList[o].toFixed(0);if(s===r[0]&&i===r[1])return!0}return!1}createCountdownCanvas(){const e=document.createElement("canvas");e.width=this.canvasWidth,e.height=this.canvasHeight,e.style.position="absolute",e.style.transform="translate(-50%, -50%)";const t=e.getContext("2d");this.plateBackground?t.drawImage(this.plateBackground,0,0,this.canvasWidth,this.canvasHeight):(t.strokeStyle="rgba(0, 255, 0, 1)",t.lineWidth=1,t.strokeRect(0,0,this.canvasWidth,this.canvasHeight),t.fillStyle="rgba(0, 0, 0, 1)",t.fillRect(0,0,this.canvasWidth,this.canvasHeight)),this.view.container.appendChild(e);const a=document.createElement("canvas");return a.width=this.canvasWidth-10,a.height=this.canvasHeight-10,a.style.position="absolute",a.style.transform="translate(-50%, -50%)",this.view.container.appendChild(a),[e,a]}}exports.default=m;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("@arcgis/core/Basemap"),b=require("@arcgis/core/config"),q=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),z=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/FeatureLayer"),O=require("@arcgis/core/layers/GeoJSONLayer"),I=require("@arcgis/core/layers/GroupLayer"),x=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),S=require("@arcgis/core/layers/MapImageLayer"),R=require("@arcgis/core/layers/TileLayer"),G=require("@arcgis/core/layers/WebTileLayer"),H=require("@arcgis/core/Map"),_=require("@arcgis/core/views/MapView"),B=require("@arcgis/core/views/SceneView"),j=require("@turf/destination"),N=require("@turf/helpers"),U=require("./custom-layer/custom-wmts-layer.js");function v(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}return e.default=r,Object.freeze(e)}const L=v(q),g=v(z),E=v(N);function C(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class A{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){var w,y,M,k;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:a}=e;b.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,b.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,b.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const n=new H;if(((w=this.mapConfig)==null?void 0:w.mapOptions.mode.toLowerCase())==="2d"?(this.view=new _({map:n,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new B({map:n,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(y=this.mapConfig)==null?void 0:y.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var h,P;if(a){let o=t.mapPoint;o.spatialReference.isWebMercator&&(o=g.webMercatorToGeographic(o)),a([o.x,o.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const o=this.view.camera;if(this.view.spatialReference.isWebMercator){const p=g.webMercatorToGeographic(o.position),f={heading:o.heading,tilt:o.tilt,position:p.toJSON()};console.log(f),(h=navigator.clipboard)==null||h.writeText(JSON.stringify(f))}else console.log(o.toJSON());console.log(this.view.zoom,this.view.scale)}else{let o=this.view.center;this.view.spatialReference.isWebMercator&&(o=g.webMercatorToGeographic(o)),console.log({center:o.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(P=(await this.view.hitTest(t)).results)==null?void 0:P.filter(o=>o.type==="graphic");c.length>0&&c.forEach(o=>{var f;const p=o.graphic;(f=p.attributes)!=null&&f.type&&s&&s(p.attributes.type,p.attributes.id,p.attributes,t)})}),(M=this.mapConfig)!=null&&M.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const l=C(t.url,this.mapConfig.assetsRoot);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new G({urlTemplate:l,...t.options});break}case"tile":{c=new R({url:l,...t.options});break}case"customWMTS".toLowerCase():{c=new U.default({urlTemplate:l,...t.options});break}case"mapImage".toLowerCase():{c=new S({url:l,...t.options});break}case"arcgis":{const h=new T(t.options);n.basemap=h;break}case"feature":{c=new W({url:l,...t.options});break}case"3dtiles":{c=new x({url:l,...t.options});break}default:console.warn(`不支持的图层类型: ${t.type}`);break}if(c)if(t.group){let h=n.findLayerById(t.group);console.log(h),h&&h.type==="group"?h.add(c):(h=new I({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c]}),n.add(h))}else n.add(c)}):n.basemap=new T({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(k=this.mapConfig)!=null&&k.hdLayers){const t=this.mapConfig.hdLayers.map(l=>new O({url:C(l.url,this.mapConfig.assetsRoot),...l.options,title:l.options.id}));n.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const d=this.mapConfig.camera;let u;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=g.webMercatorToGeographic(t)),u={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=g.webMercatorToGeographic(t)),u={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return d?d.home=u:this.mapConfig.camera={home:u},this.view}setLayerVisibility(e){const{id:i,visible:s}=e,a=this.view.map.findLayerById(i);return a?(a.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new m.Point(e.target);break;case"polyline":e.target=new m.Polyline(e.target);break;case"polygon":e.target=new m.Polygon(e.target);break;case"multipoint":e.target=new m.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const a=Math.tan(i*Math.PI/180)*e.height,n=j(E.point(e.center),a,s+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:a}=this.mapConfig;if(!a)return{status:-1,message:"未配置camera"};const n=a[i];return n?(await this.view.goTo(n,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const n=1e3/30,d=L.watch(()=>this.view.center,()=>{const u=this.transformPoints(e),w=Date.now();w-s>n&&(i(u),s=w)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,d),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new m.Point({x:i[0],y:i[1]}),a=this.view.toScreen(s);return[a.x,a.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=L.watch(()=>this.view.zoom,a=>{i&&a<=i&&(this.view.zoom=i),s&&a>=s&&(this.view.zoom=s)}))}}exports.default=A;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("@arcgis/core/Basemap"),b=require("@arcgis/core/config"),q=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),z=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/FeatureLayer"),O=require("@arcgis/core/layers/GeoJSONLayer"),I=require("@arcgis/core/layers/GroupLayer"),x=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),S=require("@arcgis/core/layers/MapImageLayer"),R=require("@arcgis/core/layers/TileLayer"),G=require("@arcgis/core/layers/WebTileLayer"),H=require("@arcgis/core/Map"),_=require("@arcgis/core/views/MapView"),B=require("@arcgis/core/views/SceneView"),j=require("@turf/destination"),N=require("@turf/helpers"),U=require("./custom-layer/custom-wmts-layer.js");function v(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}return e.default=r,Object.freeze(e)}const L=v(q),g=v(z),E=v(N);function C(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class A{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){var w,y,M,k;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:a}=e;b.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,b.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,b.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const n=new H;if(((w=this.mapConfig)==null?void 0:w.mapOptions.mode.toLowerCase())==="2d"?(this.view=new _({map:n,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new B({map:n,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(y=this.mapConfig)==null?void 0:y.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var h,P;if(a){let o=t.mapPoint;o.spatialReference.isWebMercator&&(o=g.webMercatorToGeographic(o)),a([o.x,o.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const o=this.view.camera;if(this.view.spatialReference.isWebMercator){const p=g.webMercatorToGeographic(o.position),f={heading:o.heading,tilt:o.tilt,position:p.toJSON()};console.log(f),(h=navigator.clipboard)==null||h.writeText(JSON.stringify(f))}else console.log(o.toJSON());console.log(this.view.zoom,this.view.scale)}else{let o=this.view.center;this.view.spatialReference.isWebMercator&&(o=g.webMercatorToGeographic(o)),console.log({center:o.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(P=(await this.view.hitTest(t)).results)==null?void 0:P.filter(o=>o.type==="graphic");c.length>0&&c.forEach(o=>{var f;const p=o.graphic;(f=p.attributes)!=null&&f.type&&s&&s(p.attributes.type,p.attributes.id,p.attributes,t)})}),(M=this.mapConfig)!=null&&M.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const l=C(t.url,this.mapConfig.assetsRoot);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new G({urlTemplate:l,...t.options});break}case"tile":{c=new R({url:l,...t.options});break}case"customWMTS".toLowerCase():{c=new U.default({urlTemplate:l,...t.options});break}case"mapImage".toLowerCase():{c=new S({url:l,...t.options});break}case"arcgis":{const h=new T(t.options);n.basemap=h;break}case"feature":{c=new W({url:l,...t.options});break}case"3dtiles":{c=new x({url:l,...t.options});break}default:console.warn(`不支持的图层类型: ${t.type}`);break}if(c)if(t.group){let h=n.findLayerById(t.group);h&&h.type==="group"?h.add(c):(h=new I({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c]}),n.add(h))}else n.add(c)}):n.basemap=new T({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(k=this.mapConfig)!=null&&k.hdLayers){const t=this.mapConfig.hdLayers.map(l=>new O({url:C(l.url,this.mapConfig.assetsRoot),...l.options,title:l.options.id}));n.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const d=this.mapConfig.camera;let u;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=g.webMercatorToGeographic(t)),u={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=g.webMercatorToGeographic(t)),u={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return d?d.home=u:this.mapConfig.camera={home:u},this.view}setLayerVisibility(e){const{id:i,visible:s}=e,a=this.view.map.findLayerById(i);return a?(a.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new m.Point(e.target);break;case"polyline":e.target=new m.Polyline(e.target);break;case"polygon":e.target=new m.Polygon(e.target);break;case"multipoint":e.target=new m.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const a=Math.tan(i*Math.PI/180)*e.height,n=j(E.point(e.center),a,s+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:a}=this.mapConfig;if(!a)return{status:-1,message:"未配置camera"};const n=a[i];return n?(await this.view.goTo(n,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const n=1e3/30,d=L.watch(()=>this.view.center,()=>{const u=this.transformPoints(e),w=Date.now();w-s>n&&(i(u),s=w)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,d),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new m.Point({x:i[0],y:i[1]}),a=this.view.toScreen(s);return[a.x,a.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=L.watch(()=>this.view.zoom,a=>{i&&a<=i&&(this.view.zoom=i),s&&a>=s&&(this.view.zoom=s)}))}}exports.default=A;
@@ -76,6 +76,7 @@ export default class OpenDriveRenderer {
76
76
  */
77
77
  private decreasePictureMarkerSize;
78
78
  getSumoInfo(params: IFindSumoParams): Promise<IResult>;
79
+ setOpendriveVisibility(visible: boolean): void;
79
80
  /**
80
81
  * 清除OpenDrive内容
81
82
  */
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/Graphic"),F=require("@arcgis/core/core/promiseUtils"),J=require("@arcgis/core/core/reactiveUtils.js"),L=require("@arcgis/core/geometry"),E=require("@arcgis/core/geometry/geometryEngine"),x=require("@arcgis/core/layers/FeatureLayer"),w=require("@arcgis/core/layers/GraphicsLayer"),q=require("@turf/helpers"),G=require("@turf/line-slice-along"),b=require("axios"),R=require("fast-xml-parser"),_=require("md5"),O=require("pako"),T=require("vue"),z=require("../../stores/index.js"),H=require("../common-utils.js");function N(S){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(S){for(const t in S)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(S,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>S[t]})}}return e.default=S,Object.freeze(e)}const M=N(F),U=N(J),A=N(E),P=N(q);class k{constructor(e){this.junctionNames=new Map,this.junctionScale=5e3,this.xodrBorder=[],this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.selectedSectionIds=[],this.currentJunctionId="",this.view=e,this.laneLayer=new x({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"sectionIndex",alias:"路段序号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"},{name:"fromNode",alias:"起点路口",type:"string"},{name:"toNode",alias:"终点路口",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new x({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new w({id:"OpenDriveJunction"}),this.sectionLayer=new w({id:"OpenDriveSection"}),this.highlightLayer=new w({id:"OpenDriveHighlight"}),this.flashLayer=new w({id:"OpenDriveFlash"}),this.drawLayer=new w({id:"Draw"}),this.splitLaneLayer=new w({id:"SplitLane"}),this.borderLayer=new w({id:"OpenDriveBorder"}),this.view.map.addMany([this.laneLayer,this.sectionLayer,this.roadNameLayer,this.junctionLayer,this.highlightLayer,this.flashLayer,this.drawLayer,this.splitLaneLayer,this.borderLayer])}static getInstance(e){return this.instance||(this.instance=new k(e)),this.instance}async makeMd5FromFile(e){var t;try{const o=await(await fetch(e)).text();let r=(t=new R.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(o).OpenDRIVE.userData)==null?void 0:t.border;return r?r=JSON.parse(r):r=[],{status:0,message:"ok",result:{md5:_(o),border:r}}}catch(i){return{status:-1,message:i.message}}}async showOpenDriveFromFile(e){var g,m;this.openDriveClickCallback=e.selectedCallback,this.scaleWatch=U.watch(()=>this.view.scale,(h,p)=>{h>this.junctionScale&&p<=this.junctionScale?this.updateAllJunctionSymbol("marker"):h<=this.junctionScale&&p>this.junctionScale&&this.updateAllJunctionSymbol("picture")}),console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;if(this.projectName=t.result.md5,console.timeEnd("md5用时"),this.xodrBorder=t.result.border,this.xodrBorder.length>0){const h=new f({geometry:new L.Polygon({rings:[this.xodrBorder]}),symbol:{type:"simple-fill",style:"none",outline:{style:"dash",color:"black",width:2}}});this.borderLayer.add(h)}this.openDriveServer=e.server;const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await b.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(h){return{status:-1,message:h.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;H.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let c=o.data.result.json;c.startsWith(window.location.protocol)||(c=`${window.location.protocol}//${e.server}${c}`);const a=await(await fetch(c)).arrayBuffer(),n=O.inflate(a,{to:"string"}),l=JSON.parse(n);await this.showAllLanes(l,((g=e.options)==null?void 0:g.showJunctionLane)||!1,((m=e.options)==null?void 0:m.showRoadName)||!0);const d=o.data.result.junctions;this.showJunction(d),e.options&&e.options.centerMap!==!1&&await this.view.goTo(this.allLaneGraphics),this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick();const u=z.default.useAppDataStore;return T.watch(()=>u.isSketching,()=>{var h,p;u.isSketching?((h=this.mouseMoveHandler)==null||h.remove(),this.mouseMoveHandler=void 0,(p=this.mouseClickHandler)==null||p.remove(),this.mouseClickHandler=void 0):(this.monitorMouseMove(),this.monitorMouseClick())}),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await b.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let s=o.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const r=await(await fetch(s)).arrayBuffer(),a=O.inflate(r,{to:"string"}),n=JSON.parse(a);return await this.showAllLanes(n,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=i,new Promise(s=>{let c=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const r=[];for(const n of e){if(!t&&n.junction!=="-1")continue;const{id:l,refLine:d}=n;let u=n.name;u.includes("(")&&(u=u.slice(0,u.indexOf("("))),u=u.replace(/(.)/g,"$1 ");const g=new f({geometry:{type:"polyline",paths:[d]},attributes:{ObjectID:c++,roadId:l,roadName:u}});this.allRefLineGraphics.push(g),n.laneSections.sort((m,h)=>Number(m.id)-Number(h.id));for(let m=0;m<n.laneSections.length;m++){const h=n.laneSections[m],p=Number(h.id);for(const y of h.lanePaths){const v=Number(y.id);if(v===0)continue;const I=y.type,$=[...y.outerPath],j=y.innerPath.concat($.reverse());if(j.length<=3){console.warn(`lane ${v} has less than 3 points`);continue}j.push(y.innerPath[0]);const C=new L.Polygon({rings:[j]});if(C){const D=new f({geometry:C,attributes:{ObjectID:c++,id:`${l}+${p}+${v}`,fromNode:n.fromNode,toNode:n.toNode,roadId:String(l),roadName:n.name,sectionId:String(p),sectionIndex:m,laneId:v,type:I,sumoId:"",leftLine:y.innerPath,rightLine:y.outerPath}});this.allLaneGraphics.push(D),r.push(D)}}}}const a=setInterval(()=>{if(r.length>0||this.allRefLineGraphics.length>0){if(r.length>0){const n=r.splice(0,100);this.laneLayer.applyEdits({addFeatures:n})}if(this.allRefLineGraphics.length>0){const n=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:n})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];let i;this.xodrBorder.length>0&&(i=new L.Polygon({rings:[this.xodrBorder]}));for(const o of e)if(o&&(this.junctionNames.set(o.id,o.name),o.nodeType=o.type,o.crossId)){const s=new L.Point({x:o.coordinates[0],y:o.coordinates[1]});let c=!0;if(i&&(c=A.contains(i,s)),c){const r=new f({geometry:s,attributes:{...o,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(o,"marker")});t.push(r)}}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=M.debounce(async t=>{var c;const o=(c=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:c.filter(r=>r.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId=""),this.view.closePopup();return}const s=o[0];if(this.hitGraphic=s.graphic,s.layer.id==="OpenDriveLane"){const r=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`;if(this.currentSectionCode===r||this.selectedSectionIds.includes(r)||this.sectionLayer.graphics.findIndex(p=>p.getAttribute("id")===r)>=0)return;this.currentSectionCode=r;const n=this.allLaneGraphics.filter(p=>`${p.attributes.roadId}+${p.attributes.sectionId}`===r),l=A.union(n.map(p=>p.geometry)),d=this.hitGraphic.getAttribute("fromNode"),u=this.hitGraphic.getAttribute("toNode"),g=this.junctionNames.get(d)||d,m=this.junctionNames.get(u)||u,h=new f({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:r,selected:!1,fromNodeName:g,toNodeName:m,laneCount:n.length},popupTemplate:{title:this.hitGraphic.getAttribute("roadName"),content:[{type:"fields",fieldInfos:[{fieldName:"fromNodeName",label:"起点路口"},{fieldName:"toNodeName",label:"终点路口"},{fieldName:"laneCount",label:"车道数量"}]}]}});this.highlightLayer.removeAll(),this.highlightLayer.add(h)}else if(s.layer.id==="OpenDriveJunction"){const r=this.hitGraphic.getAttribute("id");if(r===this.currentJunctionId)return;this.currentJunctionId=r}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=M.debounce(async t=>{var a;const o=(a=(await this.view.hitTest(t,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(n=>n.type==="graphic");if(o.length===0)return;const s=o[0].graphic,c=s.getAttribute("type"),r=s.getAttribute("id");if(c==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const n=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,l=await b.get(n,{params:{id:r,projectName:this.projectName}});l.status===200&&l.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:l.data.result}),s.setAttribute("selected",!0),s.symbol={type:"picture-marker",url:"/GisViewerAssets/Images/point_red.png",width:"20px",height:"20px"},this.increasePictureMarkerSize(s,50))}else this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:void 0}),s.setAttribute("selected",!1),s.symbol=this.getCrossGraphicSymbol(s.attributes,this.view.scale<this.junctionScale?"picture":"marker");else if(c==="OpenDriveSection")if(s.layer.id==="OpenDriveHighlight"){this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0),this.selectedSectionIds.push(r);const n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,l=await b.get(n,{params:{id:r,projectName:this.projectName}});if(l.status===200&&l.data.status===0&&this.openDriveClickCallback){const d=l.data.result.obj_id;s.setAttribute("edgeId",d),this.openDriveClickCallback({type:"OpenDriveSection",id:d,details:l.data.result})}}else this.sectionLayer.remove(s),this.selectedSectionIds=this.selectedSectionIds.filter(n=>n!==r),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:s.getAttribute("edgeId"),details:void 0})});this.mouseClickHandler=this.view.on("immediate-click",async t=>{e(t).catch(()=>{})})}increasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s<t?e.symbol={type:"picture-marker",url:o.url,width:s+1,height:s+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s>t?e.symbol={type:"picture-marker",url:o.url,width:s-1,height:s-1}:clearInterval(i)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const t=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,i=await b.get(t,{params:{id:e.id,projectName:this.projectName}});return i.status===200?i.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.find(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===o);if(s){const c=`${i}+${s.getAttribute("sectionId")}`,r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await b.get(r,{params:{id:c,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${c}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}async clearOpenDrive(){var t,i,o;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),this.borderLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0,(o=this.scaleWatch)==null||o.remove(),this.scaleWatch=void 0}async findSumo(e){const{type:t,id:i}=e,o=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(i,o);if(t==="edge"){const s=i.split("_");if(s.length>2)return{status:-1,message:"id格式错误"};const c=s.length===2?Number(s[1]):void 0,r=s[0].split("#");if(r.length>2)return{status:-1,message:"id格式错误"};const a=r[0],n=r.length===2?Number(r[1]):void 0;return await this.findLane({roadsectId:a,segmentId:n,laneId:c,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const i=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(t){const o=new f({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[0,255,255,.8],outline:{color:[0,255,255],width:1}}});this.flashGraphic(o)}return await this.view.goTo(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:i,laneId:o}=e;t.startsWith("-")&&(t=t.slice(1));let s=this.allLaneGraphics.filter(a=>a.attributes.roadId===t);if(s.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(i!==void 0){const a=[];if(s.forEach(n=>{const l=Number(n.attributes.sectionId);a.indexOf(l)===-1&&a.push(l)}),a.sort((n,l)=>n-l),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(n=>Number(n.attributes.sectionId)===i)}if(o!==void 0){const a=[];if(s.forEach(n=>{const l=Number(n.attributes.laneId);a.indexOf(l)===-1&&a.push(l)}),a.sort((n,l)=>n-l),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(n=>Number(n.attributes.laneId)===o)}const c=s.map(a=>a.geometry),r=A.union(c);if(e.flash){const a=new f({geometry:r,symbol:{type:"simple-fill",color:[0,255,255,.6],style:"solid",outline:{width:0}}});this.flashGraphic(a)}return await this.view.goTo(r,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let t=0,i=!0;const o=setInterval(()=>{i?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(i=!1,t++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(i=!0)),t>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if((!e||e.type==="junction")&&this.junctionLayer.graphics.forEach(t=>{(!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")&&(t.setAttribute("selected",!1),t.symbol=this.getCrossGraphicSymbol(t.attributes,this.view.scale<this.junctionScale?"picture":"marker"))}),!e||e.type==="edge"){let t;!e||!e.id||e.id===""?t=this.sectionLayer.graphics.toArray():t=this.sectionLayer.graphics.filter(i=>i.getAttribute("edgeId")===e.id).toArray(),t.length>0&&(t.forEach(i=>{const o=i.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(s=>s!==o)}),this.sectionLayer.removeMany(t))}return{status:0,message:"ok"}}selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(t=>{if(e.id===t.getAttribute("id"))return t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const t=e.id.split("#");let i=String(t[0]);i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));let s=[];if(t.length===1?s=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===i):t.length===2&&(s=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===o)),s.length>0){const c=new Map;return s.forEach(r=>{const a=r.getAttribute("roadId")+"+"+r.getAttribute("sectionId");this.selectedSectionIds.includes(a)||this.selectedSectionIds.push(a);let n=c.get(a);n?n.push(r.geometry):(n=[r.geometry],c.set(a,n))}),c.forEach((r,a)=>{const n=A.union(r),l=new f({geometry:n,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:a,edgeId:e.id,selected:!0}});this.sectionLayer.add(l)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const t=new L.Polygon({rings:[e]}),i=await this.laneLayer.queryFeatures({geometry:t,outFields:["*"]}),o=[],s=[];for(const a of i.features){const n=a.getAttribute("roadId"),l=a.getAttribute("sectionIndex"),d=`${n}#${l}`;if(o.indexOf(d)===-1){o.push(d),this.selectSumo({type:"edge",id:d});const u=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,g=await b.get(u,{params:{id:`${n}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});g.status===200&&g.data.status===0&&s.push(g.data.result)}}const c=this.junctionLayer.graphics.filter(a=>{const n=a.geometry;return A.contains(t,n)}),r=[];for(const a of c){const n=a.getAttribute("id");this.selectSumo({type:"junction",id:n});const l=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await b.get(l,{params:{id:n,projectName:this.projectName}});d.status===200&&d.data.status===0&&r.push(d.data.result)}return{status:0,message:"ok",result:{junctions:r,edges:s}}}async splitLane(e){const i=e.id.split("_");if(i.length!==2)return{status:-1,message:"车道编号格式错误"};const o=Number(i[1]),s=i[0].split("#"),c=s.length===2?Number(s[1]):0;let r=s[0];r.startsWith("-")&&(r=r.slice(1));const a=this.allLaneGraphics.filter(I=>I.getAttribute("roadId")===r&&I.getAttribute("sectionIndex")===c);if(a.length===0)return{status:-1,message:"未找到路段"};const n=a.length-o,l=a.find(I=>Math.abs(I.getAttribute("laneId"))===n);if(!l)return{status:-1,message:"未找到车道"};const d=e.start||0,u=e.end||100,g=P.lineString(l.getAttribute("leftLine")),m=G.lineSliceAlong(g,d,u,{units:"meters"}),h=P.lineString(l.getAttribute("rightLine")),p=G.lineSliceAlong(h,d,u,{units:"meters"}),y=m.geometry.coordinates.concat(p.geometry.coordinates.reverse());y.push(y[y.length-1]);const v=new f({geometry:new L.Polygon({rings:[y]}),attributes:{ObjectID:l.getAttribute("ObjectID"),id:l.getAttribute("id"),fromNode:l.getAttribute("fromNode"),toNode:l.getAttribute("toNode"),roadId:l.getAttribute("roadId"),roadName:l.getAttribute("roadName"),sectionId:l.getAttribute("sectionId"),sectionIndex:l.getAttribute("sectionIndex"),laneId:l.getAttribute("laneId"),type:l.getAttribute("type"),sumoId:l.getAttribute("sumoId"),leftLine:m.geometry.coordinates,rightLine:p.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(v),this.view.goTo(v),{status:0,message:"ok",result:{coordinates:y}}}clearSplitLane(){this.splitLaneLayer.removeAll()}updateAllJunctionSymbol(e){const t=this.junctionLayer.graphics.clone();this.junctionLayer.removeAll(),t.forEach(i=>{i.getAttribute("selected")||(i.symbol=this.getCrossGraphicSymbol(i.attributes,e))}),this.junctionLayer.addMany(t.toArray())}getCrossGraphicSymbol(e,t){const i=e.crossId!==""&&e.crossId!==void 0&&e.crossId!==null;if(t==="marker")return{type:"picture-marker",url:`/GisViewerAssets/Images/cross/${i?"gis_xhj_blue":"gis_lkcz_xz"}.png`,width:"32px",height:"32px"};if(t==="picture")return i?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.crossId',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?25:15,haloSize:2,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:32,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz_xz.png",width:"32px",height:"32px"}}}exports.default=k;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/Graphic"),F=require("@arcgis/core/core/promiseUtils"),J=require("@arcgis/core/core/reactiveUtils.js"),L=require("@arcgis/core/geometry"),E=require("@arcgis/core/geometry/geometryEngine"),x=require("@arcgis/core/layers/FeatureLayer"),w=require("@arcgis/core/layers/GraphicsLayer"),q=require("@turf/helpers"),G=require("@turf/line-slice-along"),b=require("axios"),R=require("fast-xml-parser"),_=require("md5"),O=require("pako"),T=require("vue"),z=require("../../stores/index.js"),H=require("../common-utils.js");function N(S){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(S){for(const t in S)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(S,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>S[t]})}}return e.default=S,Object.freeze(e)}const M=N(F),U=N(J),A=N(E),P=N(q);class k{constructor(e){this.junctionNames=new Map,this.junctionScale=5e3,this.xodrBorder=[],this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.selectedSectionIds=[],this.currentJunctionId="",this.view=e,this.laneLayer=new x({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"sectionIndex",alias:"路段序号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"},{name:"fromNode",alias:"起点路口",type:"string"},{name:"toNode",alias:"终点路口",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new x({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new w({id:"OpenDriveJunction"}),this.sectionLayer=new w({id:"OpenDriveSection"}),this.highlightLayer=new w({id:"OpenDriveHighlight"}),this.flashLayer=new w({id:"OpenDriveFlash"}),this.drawLayer=new w({id:"Draw"}),this.splitLaneLayer=new w({id:"SplitLane"}),this.borderLayer=new w({id:"OpenDriveBorder"}),this.view.map.addMany([this.laneLayer,this.sectionLayer,this.roadNameLayer,this.junctionLayer,this.highlightLayer,this.flashLayer,this.drawLayer,this.splitLaneLayer,this.borderLayer])}static getInstance(e){return this.instance||(this.instance=new k(e)),this.instance}async makeMd5FromFile(e){var t;try{const o=await(await fetch(e)).text();let r=(t=new R.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(o).OpenDRIVE.userData)==null?void 0:t.border;return r?r=JSON.parse(r):r=[],{status:0,message:"ok",result:{md5:_(o),border:r}}}catch(i){return{status:-1,message:i.message}}}async showOpenDriveFromFile(e){var g,m;this.openDriveClickCallback=e.selectedCallback,this.scaleWatch=U.watch(()=>this.view.scale,(h,p)=>{h>this.junctionScale&&p<=this.junctionScale?this.updateAllJunctionSymbol("marker"):h<=this.junctionScale&&p>this.junctionScale&&this.updateAllJunctionSymbol("picture")}),console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;if(this.projectName=t.result.md5,console.timeEnd("md5用时"),this.xodrBorder=t.result.border,this.xodrBorder.length>0){const h=new f({geometry:new L.Polygon({rings:[this.xodrBorder]}),symbol:{type:"simple-fill",style:"none",outline:{style:"dash",color:"black",width:2}}});this.borderLayer.add(h)}this.openDriveServer=e.server;const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await b.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(h){return{status:-1,message:h.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;H.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let c=o.data.result.json;c.startsWith(window.location.protocol)||(c=`${window.location.protocol}//${e.server}${c}`);const a=await(await fetch(c)).arrayBuffer(),n=O.inflate(a,{to:"string"}),l=JSON.parse(n);await this.showAllLanes(l,((g=e.options)==null?void 0:g.showJunctionLane)||!1,((m=e.options)==null?void 0:m.showRoadName)||!0);const d=o.data.result.junctions;this.showJunction(d),e.options&&e.options.centerMap!==!1&&await this.view.goTo(this.allLaneGraphics),this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick();const u=z.default.useAppDataStore;return T.watch(()=>u.isSketching,()=>{var h,p;u.isSketching?((h=this.mouseMoveHandler)==null||h.remove(),this.mouseMoveHandler=void 0,(p=this.mouseClickHandler)==null||p.remove(),this.mouseClickHandler=void 0):(this.monitorMouseMove(),this.monitorMouseClick())}),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await b.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let s=o.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const r=await(await fetch(s)).arrayBuffer(),a=O.inflate(r,{to:"string"}),n=JSON.parse(a);return await this.showAllLanes(n,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=i,new Promise(s=>{let c=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const r=[];for(const n of e){if(!t&&n.junction!=="-1")continue;const{id:l,refLine:d}=n;let u=n.name;u.includes("(")&&(u=u.slice(0,u.indexOf("("))),u=u.replace(/(.)/g,"$1 ");const g=new f({geometry:{type:"polyline",paths:[d]},attributes:{ObjectID:c++,roadId:l,roadName:u}});this.allRefLineGraphics.push(g),n.laneSections.sort((m,h)=>Number(m.id)-Number(h.id));for(let m=0;m<n.laneSections.length;m++){const h=n.laneSections[m],p=Number(h.id);for(const y of h.lanePaths){const v=Number(y.id);if(v===0)continue;const I=y.type,$=[...y.outerPath],j=y.innerPath.concat($.reverse());if(j.length<=3){console.warn(`lane ${v} has less than 3 points`);continue}j.push(y.innerPath[0]);const C=new L.Polygon({rings:[j]});if(C){const D=new f({geometry:C,attributes:{ObjectID:c++,id:`${l}+${p}+${v}`,fromNode:n.fromNode,toNode:n.toNode,roadId:String(l),roadName:n.name,sectionId:String(p),sectionIndex:m,laneId:v,type:I,sumoId:"",leftLine:y.innerPath,rightLine:y.outerPath}});this.allLaneGraphics.push(D),r.push(D)}}}}const a=setInterval(()=>{if(r.length>0||this.allRefLineGraphics.length>0){if(r.length>0){const n=r.splice(0,100);this.laneLayer.applyEdits({addFeatures:n})}if(this.allRefLineGraphics.length>0){const n=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:n})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];let i;this.xodrBorder.length>0&&(i=new L.Polygon({rings:[this.xodrBorder]}));for(const o of e)if(o&&(this.junctionNames.set(o.id,o.name),o.nodeType=o.type,o.crossId)){const s=new L.Point({x:o.coordinates[0],y:o.coordinates[1]});let c=!0;if(i&&(c=A.contains(i,s)),c){const r=new f({geometry:s,attributes:{...o,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(o,"marker")});t.push(r)}}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=M.debounce(async t=>{var c;const o=(c=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:c.filter(r=>r.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId=""),this.view.closePopup();return}const s=o[0];if(this.hitGraphic=s.graphic,s.layer.id==="OpenDriveLane"){const r=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`;if(this.currentSectionCode===r||this.selectedSectionIds.includes(r)||this.sectionLayer.graphics.findIndex(p=>p.getAttribute("id")===r)>=0)return;this.currentSectionCode=r;const n=this.allLaneGraphics.filter(p=>`${p.attributes.roadId}+${p.attributes.sectionId}`===r),l=A.union(n.map(p=>p.geometry)),d=this.hitGraphic.getAttribute("fromNode"),u=this.hitGraphic.getAttribute("toNode"),g=this.junctionNames.get(d)||d,m=this.junctionNames.get(u)||u,h=new f({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:r,selected:!1,fromNodeName:g,toNodeName:m,laneCount:n.length},popupTemplate:{title:this.hitGraphic.getAttribute("roadName"),content:[{type:"fields",fieldInfos:[{fieldName:"fromNodeName",label:"起点路口"},{fieldName:"toNodeName",label:"终点路口"},{fieldName:"laneCount",label:"车道数量"}]}]}});this.highlightLayer.removeAll(),this.highlightLayer.add(h)}else if(s.layer.id==="OpenDriveJunction"){const r=this.hitGraphic.getAttribute("id");if(r===this.currentJunctionId)return;this.currentJunctionId=r}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=M.debounce(async t=>{var a;const o=(a=(await this.view.hitTest(t,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(n=>n.type==="graphic");if(o.length===0)return;const s=o[0].graphic,c=s.getAttribute("type"),r=s.getAttribute("id");if(c==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const n=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,l=await b.get(n,{params:{id:r,projectName:this.projectName}});l.status===200&&l.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:l.data.result}),s.setAttribute("selected",!0),s.symbol={type:"picture-marker",url:"/GisViewerAssets/Images/point_red.png",width:"20px",height:"20px"},this.increasePictureMarkerSize(s,50))}else this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:void 0}),s.setAttribute("selected",!1),s.symbol=this.getCrossGraphicSymbol(s.attributes,this.view.scale<this.junctionScale?"picture":"marker");else if(c==="OpenDriveSection")if(s.layer.id==="OpenDriveHighlight"){this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0),this.selectedSectionIds.push(r);const n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,l=await b.get(n,{params:{id:r,projectName:this.projectName}});if(l.status===200&&l.data.status===0&&this.openDriveClickCallback){const d=l.data.result.obj_id;s.setAttribute("edgeId",d),this.openDriveClickCallback({type:"OpenDriveSection",id:d,details:l.data.result})}}else this.sectionLayer.remove(s),this.selectedSectionIds=this.selectedSectionIds.filter(n=>n!==r),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:s.getAttribute("edgeId"),details:void 0})});this.mouseClickHandler=this.view.on("immediate-click",async t=>{e(t).catch(()=>{})})}increasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s<t?e.symbol={type:"picture-marker",url:o.url,width:s+1,height:s+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s>t?e.symbol={type:"picture-marker",url:o.url,width:s-1,height:s-1}:clearInterval(i)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const t=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,i=await b.get(t,{params:{id:e.id,projectName:this.projectName}});return i.status===200?i.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.find(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===o);if(s){const c=`${i}+${s.getAttribute("sectionId")}`,r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await b.get(r,{params:{id:c,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${c}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}setOpendriveVisibility(e){this.laneLayer.visible=e}async clearOpenDrive(){var t,i,o;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),this.borderLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0,(o=this.scaleWatch)==null||o.remove(),this.scaleWatch=void 0}async findSumo(e){const{type:t,id:i}=e,o=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(i,o);if(t==="edge"){const s=i.split("_");if(s.length>2)return{status:-1,message:"id格式错误"};const c=s.length===2?Number(s[1]):void 0,r=s[0].split("#");if(r.length>2)return{status:-1,message:"id格式错误"};const a=r[0],n=r.length===2?Number(r[1]):void 0;return await this.findLane({roadsectId:a,segmentId:n,laneId:c,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const i=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(t){const o=new f({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[0,255,255,.8],outline:{color:[0,255,255],width:1}}});this.flashGraphic(o)}return await this.view.goTo(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:i,laneId:o}=e;t.startsWith("-")&&(t=t.slice(1));let s=this.allLaneGraphics.filter(a=>a.attributes.roadId===t);if(s.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(i!==void 0){const a=[];if(s.forEach(n=>{const l=Number(n.attributes.sectionId);a.indexOf(l)===-1&&a.push(l)}),a.sort((n,l)=>n-l),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(n=>Number(n.attributes.sectionId)===i)}if(o!==void 0){const a=[];if(s.forEach(n=>{const l=Number(n.attributes.laneId);a.indexOf(l)===-1&&a.push(l)}),a.sort((n,l)=>n-l),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(n=>Number(n.attributes.laneId)===o)}const c=s.map(a=>a.geometry),r=A.union(c);if(e.flash){const a=new f({geometry:r,symbol:{type:"simple-fill",color:[0,255,255,.6],style:"solid",outline:{width:0}}});this.flashGraphic(a)}return await this.view.goTo(r,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let t=0,i=!0;const o=setInterval(()=>{i?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(i=!1,t++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(i=!0)),t>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if((!e||e.type==="junction")&&this.junctionLayer.graphics.forEach(t=>{(!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")&&(t.setAttribute("selected",!1),t.symbol=this.getCrossGraphicSymbol(t.attributes,this.view.scale<this.junctionScale?"picture":"marker"))}),!e||e.type==="edge"){let t;!e||!e.id||e.id===""?t=this.sectionLayer.graphics.toArray():t=this.sectionLayer.graphics.filter(i=>i.getAttribute("edgeId")===e.id).toArray(),t.length>0&&(t.forEach(i=>{const o=i.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(s=>s!==o)}),this.sectionLayer.removeMany(t))}return{status:0,message:"ok"}}selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(t=>{if(e.id===t.getAttribute("id"))return t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const t=e.id.split("#");let i=String(t[0]);i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));let s=[];if(t.length===1?s=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===i):t.length===2&&(s=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===o)),s.length>0){const c=new Map;return s.forEach(r=>{const a=r.getAttribute("roadId")+"+"+r.getAttribute("sectionId");this.selectedSectionIds.includes(a)||this.selectedSectionIds.push(a);let n=c.get(a);n?n.push(r.geometry):(n=[r.geometry],c.set(a,n))}),c.forEach((r,a)=>{const n=A.union(r),l=new f({geometry:n,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:a,edgeId:e.id,selected:!0}});this.sectionLayer.add(l)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const t=new L.Polygon({rings:[e]}),i=await this.laneLayer.queryFeatures({geometry:t,outFields:["*"]}),o=[],s=[];for(const a of i.features){const n=a.getAttribute("roadId"),l=a.getAttribute("sectionIndex"),d=`${n}#${l}`;if(o.indexOf(d)===-1){o.push(d),this.selectSumo({type:"edge",id:d});const u=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,g=await b.get(u,{params:{id:`${n}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});g.status===200&&g.data.status===0&&s.push(g.data.result)}}const c=this.junctionLayer.graphics.filter(a=>{const n=a.geometry;return A.contains(t,n)}),r=[];for(const a of c){const n=a.getAttribute("id");this.selectSumo({type:"junction",id:n});const l=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await b.get(l,{params:{id:n,projectName:this.projectName}});d.status===200&&d.data.status===0&&r.push(d.data.result)}return{status:0,message:"ok",result:{junctions:r,edges:s}}}async splitLane(e){const i=e.id.split("_");if(i.length!==2)return{status:-1,message:"车道编号格式错误"};const o=Number(i[1]),s=i[0].split("#"),c=s.length===2?Number(s[1]):0;let r=s[0];r.startsWith("-")&&(r=r.slice(1));const a=this.allLaneGraphics.filter(I=>I.getAttribute("roadId")===r&&I.getAttribute("sectionIndex")===c);if(a.length===0)return{status:-1,message:"未找到路段"};const n=a.length-o,l=a.find(I=>Math.abs(I.getAttribute("laneId"))===n);if(!l)return{status:-1,message:"未找到车道"};const d=e.start||0,u=e.end||100,g=P.lineString(l.getAttribute("leftLine")),m=G.lineSliceAlong(g,d,u,{units:"meters"}),h=P.lineString(l.getAttribute("rightLine")),p=G.lineSliceAlong(h,d,u,{units:"meters"}),y=m.geometry.coordinates.concat(p.geometry.coordinates.reverse());y.push(y[y.length-1]);const v=new f({geometry:new L.Polygon({rings:[y]}),attributes:{ObjectID:l.getAttribute("ObjectID"),id:l.getAttribute("id"),fromNode:l.getAttribute("fromNode"),toNode:l.getAttribute("toNode"),roadId:l.getAttribute("roadId"),roadName:l.getAttribute("roadName"),sectionId:l.getAttribute("sectionId"),sectionIndex:l.getAttribute("sectionIndex"),laneId:l.getAttribute("laneId"),type:l.getAttribute("type"),sumoId:l.getAttribute("sumoId"),leftLine:m.geometry.coordinates,rightLine:p.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(v),this.view.goTo(v),{status:0,message:"ok",result:{coordinates:y}}}clearSplitLane(){this.splitLaneLayer.removeAll()}updateAllJunctionSymbol(e){const t=this.junctionLayer.graphics.clone();this.junctionLayer.removeAll(),t.forEach(i=>{i.getAttribute("selected")||(i.symbol=this.getCrossGraphicSymbol(i.attributes,e))}),this.junctionLayer.addMany(t.toArray())}getCrossGraphicSymbol(e,t){const i=e.crossId!==""&&e.crossId!==void 0&&e.crossId!==null;if(t==="marker")return{type:"picture-marker",url:`/GisViewerAssets/Images/cross/${i?"gis_xhj_blue":"gis_lkcz_xz"}.png`,width:"32px",height:"32px"};if(t==="picture")return i?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.crossId',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?25:15,haloSize:2,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:32,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz_xz.png",width:"32px",height:"32px"}}}exports.default=k;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.240",
3
+ "version": "1.0.241",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [