gisviewer-vue3-arcgis 1.0.264 → 1.0.266

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.
@@ -150,7 +150,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
150
150
  status: number;
151
151
  message: string;
152
152
  }>;
153
- clearBlockOpenDriveLane: () => void | {
153
+ clearBlockOpenDriveLane: (params: IBlockOpenDriveLaneParams) => void | {
154
154
  status: number;
155
155
  message: string;
156
156
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as gt, ref as _, reactive as ft, onMounted as yt, getCurrentInstance as wt, onUnmounted as Ct, computed as St, openBlock as T, createElementBlock as x, createElementVNode as y, withDirectives as vt, vShow as ht, Fragment as bt, renderList as Ot, createBlock as At } from "vue";
2
- import G, { registerStore as Dt } from "./stores/index.mjs";
1
+ import { defineComponent as gt, ref as _, reactive as ft, onMounted as yt, getCurrentInstance as wt, onUnmounted as Ct, computed as vt, openBlock as T, createElementBlock as x, createElementVNode as y, withDirectives as St, vShow as ht, Fragment as bt, renderList as Ot, createBlock as At } from "vue";
2
+ import G, { registerStore as kt } from "./stores/index.mjs";
3
3
  import "./style/index.css";
4
- import kt from "./utils/dbscan-cluster/index.mjs";
4
+ import Dt from "./utils/dbscan-cluster/index.mjs";
5
5
  import Lt from "./utils/detect-gpu.mjs";
6
6
  import Tt from "./utils/edpass-device-controller.mjs";
7
7
  import H from "./utils/green-wave-band-controller/index.mjs";
@@ -27,14 +27,14 @@ const xt = { class: "gis-viewer" }, Gt = { style: { position: "absolute", bottom
27
27
  const h = _(null);
28
28
  let n, p, c, o, r, s, g, t, l, a, d, w, b, f;
29
29
  const O = _(!1);
30
- Dt();
30
+ kt();
31
31
  const B = G.useAppDataStore, M = ft([]), P = (e) => Math.log2(591657527591555e-6 / e);
32
32
  let C = null, V = null;
33
33
  const A = (e) => {
34
34
  if (!Number.isFinite(e))
35
35
  return;
36
36
  const u = Math.round(e);
37
- u !== V && (V = u, S("update:zoom", u));
37
+ u !== V && (V = u, v("update:zoom", u));
38
38
  };
39
39
  Lt(), yt(async () => {
40
40
  if (!h.value)
@@ -46,33 +46,33 @@ const xt = { class: "gis-viewer" }, Gt = { style: { position: "absolute", bottom
46
46
  i.assetsRoot = z.assetsRoot || u, B.mapConfig = i, p = new Mt(), B.mapInitializer = p, n = await p.initialize({
47
47
  container: h.value,
48
48
  mapConfig: i,
49
- markerClickCallback: (m, k, L, dt) => {
50
- S("markerClick", m, k, L, dt);
49
+ markerClickCallback: (m, D, L, dt) => {
50
+ v("markerClick", m, D, L, dt);
51
51
  },
52
- mapClickCallback: (m, k, L) => {
53
- S("mapClick", m, k, L);
52
+ mapClickCallback: (m, D, L) => {
53
+ v("mapClick", m, D, L);
54
54
  }
55
55
  });
56
- const v = n.zoom ?? (n.scale ? P(n.scale) : void 0);
57
- typeof v == "number" && A(v);
56
+ const S = n.zoom ?? (n.scale ? P(n.scale) : void 0);
57
+ typeof S == "number" && A(S);
58
58
  const pt = n.zoom !== void 0 ? n.watch("zoom", (m) => {
59
59
  A(m);
60
60
  }) : n.watch("scale", (m) => {
61
61
  typeof m == "number" && m > 0 && A(P(m));
62
62
  });
63
- C = () => pt.remove(), r = new It(n, M), await r.init(), S("mapLoaded");
63
+ C = () => pt.remove(), r = new It(n, M), await r.init(), v("mapLoaded");
64
64
  }), Ct(() => {
65
65
  a == null || a.clearSignalControlArea(), t == null || t.clearOpenDrive(), r.clearHoloTrace(), r.clearHoloSignal(), o == null || o.disconnectTrafficFlow(), C == null || C(), C = null;
66
66
  });
67
- const J = St(() => n), U = () => {
67
+ const J = vt(() => n), U = () => {
68
68
  const e = G.useAppDataStore;
69
69
  e.saveTrackLog = !0;
70
70
  }, $ = () => {
71
71
  r.downloadTrackLog();
72
72
  }, q = () => {
73
- D("vehicleId");
73
+ k("vehicleId");
74
74
  }, K = () => {
75
- D("plateNumber");
75
+ k("plateNumber");
76
76
  }, F = async (e) => await p.setMapCenter(e), X = async (e) => await p.setMapCamera(e), Y = (e) => p.setMapZoom(e), R = async (e) => await p.lookAt(e), ee = (e) => p.setLayerVisibility(e), te = (e, u) => p.requestCoordinateTransform(e, u), ne = (e) => {
77
77
  p.cancelCoordinateTransform(e);
78
78
  }, ae = (e) => {
@@ -100,17 +100,17 @@ const xt = { class: "gis-viewer" }, Gt = { style: { position: "absolute", bottom
100
100
  r.clearHoloSignal();
101
101
  }, Ce = (e) => {
102
102
  o == null || o.toggleTrafficInfo(e), r == null || r.toggleTrafficInfo(e);
103
- }, Se = (e) => {
104
- r == null || r.togglePause(e);
105
103
  }, ve = (e) => {
104
+ r == null || r.togglePause(e);
105
+ }, Se = (e) => {
106
106
  o == null || o.toggleTrafficObject(e), r == null || r.toggleTrafficObject(e);
107
- }, D = (e) => {
107
+ }, k = (e) => {
108
108
  r == null || r.updatePanelContent(e);
109
- }, he = async (e) => (s || (s = new N(n)), s.addOverlays(e)), be = async (e) => (f || (f = new kt(n)), f.addClusterPoints(e)), Oe = () => {
109
+ }, he = async (e) => (s || (s = new N(n)), s.addOverlays(e)), be = async (e) => (f || (f = new Dt(n)), f.addClusterPoints(e)), Oe = () => {
110
110
  f == null || f.removeAllClusterPoints();
111
- }, Ae = (e) => (s || (s = new N(n)), s.addMask(e)), De = () => {
111
+ }, Ae = (e) => (s || (s = new N(n)), s.addMask(e)), ke = () => {
112
112
  s == null || s.removeMask();
113
- }, ke = (e) => s == null ? void 0 : s.removeOverlaysByType(e), Le = (e) => s == null ? void 0 : s.removeOverlaysById(e), Te = () => s == null ? void 0 : s.removeAllOverlays(), Ie = () => {
113
+ }, De = (e) => s == null ? void 0 : s.removeOverlaysByType(e), Le = (e) => s == null ? void 0 : s.removeOverlaysById(e), Te = () => s == null ? void 0 : s.removeAllOverlays(), Ie = () => {
114
114
  s == null || s.showAllOverlays();
115
115
  }, Be = (e) => {
116
116
  g || (g = new Vt(n)), g.updateQueueLength(e);
@@ -146,7 +146,7 @@ const xt = { class: "gis-viewer" }, Gt = { style: { position: "absolute", bottom
146
146
  }, je = async (e) => t ? t == null ? void 0 : t.blockLane(e) : {
147
147
  status: -1,
148
148
  message: "未加载OpenDrive地图"
149
- }, Je = () => t ? t == null ? void 0 : t.clearSplitLane() : {
149
+ }, Je = (e) => t ? t == null ? void 0 : t.clearBlockLane(e) : {
150
150
  status: -1,
151
151
  message: "未加载OpenDrive地图"
152
152
  }, Ue = async (e) => (a || (a = new I(n)), await a.showSignalControlArea(e)), $e = async (e) => (a || (a = new I(n)), await a.showDistrict(e)), qe = async (e) => (a || (a = new I(n)), await a.showSubDistrict(e)), Ke = async () => await (a == null ? void 0 : a.clearSignalControlArea()), Fe = (e) => a == null ? void 0 : a.setLayerVisibility(e), Xe = async (e) => a ? await (a == null ? void 0 : a.locateSignalControlArea(e)) : { status: -1, message: "未加载信号控制区" }, Ye = async (e) => a ? await a.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Re = () => a ? a.resetHighlight() : { status: -1, message: "未加载信号控制区" }, et = (e) => (l || (l = new zt(n)), l.showSubSignalControlArea(e)), tt = (e) => l ? l.editSubSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, nt = () => l ? l.stopEditSubSignalControlArea() : { status: -1, message: "未加载信号控制区" }, at = (e) => l ? l.selectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, rt = (e) => l ? l.unselectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, st = (e) => {
@@ -160,7 +160,7 @@ const xt = { class: "gis-viewer" }, Gt = { style: { position: "absolute", bottom
160
160
  if (!w)
161
161
  return { status: -1, message: "未加载警务管辖区" };
162
162
  w.clearJurisdiction();
163
- }, mt = async (e) => (b || (b = new Tt(n)), await b.setEdpassLayerVisibility(e)), z = Z, S = j;
163
+ }, mt = async (e) => (b || (b = new Tt(n)), await b.setEdpassLayerVisibility(e)), z = Z, v = j;
164
164
  return Q({
165
165
  mapViewer: J,
166
166
  setLayerVisibility: ee,
@@ -175,9 +175,9 @@ const xt = { class: "gis-viewer" }, Gt = { style: { position: "absolute", bottom
175
175
  addClusterPoints: be,
176
176
  removeAllClusterPoints: Oe,
177
177
  addMask: Ae,
178
- removeMask: De,
178
+ removeMask: ke,
179
179
  showAllOverlays: Ie,
180
- removeOverlaysByType: ke,
180
+ removeOverlaysByType: De,
181
181
  removeOverlaysById: Le,
182
182
  removeAllOverlays: Te,
183
183
  showLaneNumber: re,
@@ -195,9 +195,9 @@ const xt = { class: "gis-viewer" }, Gt = { style: { position: "absolute", bottom
195
195
  clearHoloSignal: we,
196
196
  setInterpolate: de,
197
197
  toggleTrafficInfo: Ce,
198
- toggleTrafficObject: ve,
199
- toggleVehicleInfo: D,
200
- togglePause: Se,
198
+ toggleTrafficObject: Se,
199
+ toggleVehicleInfo: k,
200
+ togglePause: ve,
201
201
  updateQueueLength: Be,
202
202
  removeQueueLength: Me,
203
203
  showOpenDriveFromServer: Pe,
@@ -240,7 +240,7 @@ const xt = { class: "gis-viewer" }, Gt = { style: { position: "absolute", bottom
240
240
  ref_key: "mapContainer",
241
241
  ref: h
242
242
  }, [
243
- vt(y("div", Gt, [
243
+ St(y("div", Gt, [
244
244
  y("button", {
245
245
  style: { "margin-right": "10px" },
246
246
  onClick: U
@@ -258,8 +258,8 @@ const xt = { class: "gis-viewer" }, Gt = { style: { position: "absolute", bottom
258
258
  [ht, O.value]
259
259
  ])
260
260
  ], 512),
261
- (T(!0), x(bt, null, Ot(M, (i, v) => (T(), At(Bt, {
262
- key: v,
261
+ (T(!0), x(bt, null, Ot(M, (i, S) => (T(), At(Bt, {
262
+ key: S,
263
263
  "display-mode": i.displayMode,
264
264
  flash: i.flash,
265
265
  "road-id": i.crossId,
@@ -134,7 +134,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
134
134
  status: number;
135
135
  message: string;
136
136
  }>;
137
- clearBlockOpenDriveLane: () => void | {
137
+ clearBlockOpenDriveLane: (params: import("../types").IBlockOpenDriveLaneParams) => void | {
138
138
  status: number;
139
139
  message: string;
140
140
  };
@@ -118,12 +118,17 @@ export default class OpenDriveRenderer {
118
118
  * @returns
119
119
  */
120
120
  splitLane(params: ISplitOpenDriveLaneParams): Promise<IResult>;
121
+ clearSplitLane(): void;
121
122
  /**
122
123
  * 封闭车道,使用可计算路网的id
123
124
  * @param params
124
125
  */
125
126
  blockLane(params: IBlockOpenDriveLaneParams): void;
126
- clearSplitLane(): void;
127
+ /**
128
+ * 解除封闭车道,使用可计算路网id
129
+ * @param params
130
+ */
131
+ clearBlockLane(params: IBlockOpenDriveLaneParams): void;
127
132
  selectComputable(params: IFindSumoParams): void;
128
133
  /**
129
134
  * 更新所有路口的symbol
@@ -310,13 +310,13 @@ class O {
310
310
  return this.instance || (this.instance = new O(e)), this.instance;
311
311
  }
312
312
  async makeMd5FromFile(e) {
313
- var t;
313
+ var i;
314
314
  try {
315
315
  const s = await (await fetch(e)).text();
316
- let r = (t = new J({
316
+ let r = (i = new J({
317
317
  ignoreAttributes: !1,
318
318
  allowBooleanAttributes: !0
319
- }).parse(s).OpenDRIVE.userData) == null ? void 0 : t.border;
319
+ }).parse(s).OpenDRIVE.userData) == null ? void 0 : i.border;
320
320
  return r ? r = JSON.parse(r) : r = [], { status: 0, message: "ok", result: { md5: E(s), border: r } };
321
321
  } catch (o) {
322
322
  return { status: -1, message: o.message };
@@ -335,8 +335,8 @@ class O {
335
335
  u > this.junctionScale && p <= this.junctionScale ? this.updateAllJunctionSymbol("marker") : u <= this.junctionScale && p > this.junctionScale && this.updateAllJunctionSymbol("picture");
336
336
  }
337
337
  );
338
- let t = e.file.split("/").pop() || "";
339
- t = t.split(".").slice(0, -1).join("."), this.openDriveServer = e.server;
338
+ let i = e.file.split("/").pop() || "";
339
+ i = i.split(".").slice(0, -1).join("."), this.openDriveServer = e.server;
340
340
  const o = `http://${this.openDriveServer}/api/openDrive/uploadXodr`;
341
341
  let s;
342
342
  try {
@@ -346,7 +346,7 @@ class O {
346
346
  {
347
347
  params: {
348
348
  url: e.file,
349
- projectName: t
349
+ projectName: i
350
350
  }
351
351
  }
352
352
  );
@@ -356,11 +356,11 @@ class O {
356
356
  if (s.status !== 200)
357
357
  return { status: -1, message: s.statusText };
358
358
  console.time("渲染用时");
359
- const i = s.data.result.geoSetting;
359
+ const t = s.data.result.geoSetting;
360
360
  A.setGeoData(
361
- i.geoReference,
362
- i.offsetX,
363
- i.offsetY
361
+ t.geoReference,
362
+ t.offsetX,
363
+ t.offsetY
364
364
  );
365
365
  let l = s.data.result.json;
366
366
  l.startsWith(window.location.protocol) || (l = `${window.location.protocol}//${e.server}${l}`);
@@ -394,10 +394,10 @@ class O {
394
394
  * @param server
395
395
  * @param projectName
396
396
  */
397
- async showOpenDriveFromServer(e, t) {
397
+ async showOpenDriveFromServer(e, i) {
398
398
  const o = `http://${e}/api/openDrive/analyzeXodr`, s = await w.get(o, {
399
399
  headers: {
400
- projectName: t
400
+ projectName: i
401
401
  },
402
402
  params: {
403
403
  analyze: !1,
@@ -406,11 +406,11 @@ class O {
406
406
  });
407
407
  if (s.status !== 200)
408
408
  throw new Error(`OpenDriveRenderer: ${s.statusText}`);
409
- let i = s.data.result.json;
410
- i.startsWith(window.location.protocol) || (i = `${window.location.protocol}//${e}${i}`);
411
- const l = await fetch(i);
409
+ let t = s.data.result.json;
410
+ t.startsWith(window.location.protocol) || (t = `${window.location.protocol}//${e}${t}`);
411
+ const l = await fetch(t);
412
412
  let r;
413
- if (i.endsWith("bin")) {
413
+ if (t.endsWith("bin")) {
414
414
  const a = await l.arrayBuffer(), c = M.inflate(a, { to: "string" });
415
415
  r = JSON.parse(c);
416
416
  } else
@@ -424,17 +424,17 @@ class O {
424
424
  * @param showRoadName 是否显示道路名称
425
425
  * @returns
426
426
  */
427
- async showAllLanes(e, t, o) {
427
+ async showAllLanes(e, i, o) {
428
428
  const s = await this.laneLayer.queryFeatures();
429
429
  return s.features.length > 0 && this.laneLayer.applyEdits({
430
430
  deleteFeatures: s.features
431
- }), this.roadNameLayer.visible = o, new Promise((i) => {
431
+ }), this.roadNameLayer.visible = o, new Promise((t) => {
432
432
  var c;
433
433
  let l = 0;
434
434
  this.allLaneGraphics = [], this.allRefLineGraphics = [];
435
435
  const r = [];
436
436
  for (const n of e) {
437
- if (!t && n.junction !== "-1")
437
+ if (!i && n.junction !== "-1")
438
438
  continue;
439
439
  const { id: d, refLine: y } = n;
440
440
  let h = n.name;
@@ -510,7 +510,7 @@ class O {
510
510
  });
511
511
  }
512
512
  } else
513
- clearInterval(a), i();
513
+ clearInterval(a), t();
514
514
  }, 10);
515
515
  });
516
516
  }
@@ -520,21 +520,21 @@ class O {
520
520
  * @returns
521
521
  */
522
522
  showJunction(e) {
523
- const t = [];
523
+ const i = [];
524
524
  let o;
525
525
  this.xodrBorder.length > 0 && (o = new S({
526
526
  rings: [this.xodrBorder]
527
527
  }));
528
528
  for (const s of e)
529
529
  if (s && (this.junctionNames.set(s.id, s.name), s.nodeType = s.type, s.crossId)) {
530
- const i = new F({
530
+ const t = new F({
531
531
  x: s.coordinates[0],
532
532
  y: s.coordinates[1]
533
533
  });
534
534
  let l = !0;
535
- if (o && (l = L.contains(o, i)), l) {
535
+ if (o && (l = L.contains(o, t)), l) {
536
536
  const r = new I({
537
- geometry: i,
537
+ geometry: t,
538
538
  attributes: {
539
539
  ...s,
540
540
  selected: !1,
@@ -542,18 +542,18 @@ class O {
542
542
  },
543
543
  symbol: this.getCrossGraphicSymbol(s, "marker")
544
544
  });
545
- t.push(r);
545
+ i.push(r);
546
546
  }
547
547
  }
548
- this.junctionLayer.addMany(t);
548
+ this.junctionLayer.addMany(i);
549
549
  }
550
550
  /**
551
551
  * 监听鼠标移动事件,高亮显示鼠标所在路段和路口
552
552
  */
553
553
  monitorMouseMove() {
554
- const e = j.debounce(async (t) => {
554
+ const e = j.debounce(async (i) => {
555
555
  var l;
556
- const s = (l = (await this.view.hitTest(t, {
556
+ const s = (l = (await this.view.hitTest(i, {
557
557
  include: [this.laneLayer, this.junctionLayer]
558
558
  })).results) == null ? void 0 : l.filter(
559
559
  (r) => r.type === "graphic"
@@ -562,8 +562,8 @@ class O {
562
562
  this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = ""), this.view.closePopup();
563
563
  return;
564
564
  }
565
- const i = s[0];
566
- if (this.hitGraphic = i.graphic, i.layer.id === "OpenDriveLane") {
565
+ const t = s[0];
566
+ if (this.hitGraphic = t.graphic, t.layer.id === "OpenDriveLane") {
567
567
  const r = `${this.hitGraphic.getAttribute(
568
568
  "roadId"
569
569
  )}+${this.hitGraphic.getAttribute("sectionId")}`, a = this.hitGraphic.getAttribute("roadsectBaseIds");
@@ -594,7 +594,8 @@ class O {
594
594
  fromNodeName: u,
595
595
  toNodeName: p,
596
596
  laneCount: n.length,
597
- roadsectBaseIds: this.hitGraphic.getAttribute("roadsectBaseIds")
597
+ roadsectBaseIds: this.hitGraphic.getAttribute("roadsectBaseIds"),
598
+ roadId: this.hitGraphic.getAttribute("roadId")
598
599
  },
599
600
  popupTemplate: {
600
601
  title: this.hitGraphic.getAttribute("roadName"),
@@ -620,15 +621,15 @@ class O {
620
621
  }
621
622
  });
622
623
  this.highlightLayer.removeAll(), this.highlightLayer.add(g);
623
- } else if (i.layer.id === "OpenDriveJunction") {
624
+ } else if (t.layer.id === "OpenDriveJunction") {
624
625
  const r = this.hitGraphic.getAttribute("id");
625
626
  if (r === this.currentJunctionId)
626
627
  return;
627
628
  this.currentJunctionId = r;
628
629
  }
629
630
  });
630
- this.mouseMoveHandler = this.view.on("pointer-move", async (t) => {
631
- e(t).catch(() => {
631
+ this.mouseMoveHandler = this.view.on("pointer-move", async (i) => {
632
+ e(i).catch(() => {
632
633
  });
633
634
  });
634
635
  }
@@ -636,20 +637,18 @@ class O {
636
637
  * 监听鼠标点击事件,获取高亮要素的拓扑信息
637
638
  */
638
639
  monitorMouseClick() {
639
- const e = j.debounce(async (t) => {
640
+ const e = j.debounce(async (i) => {
640
641
  var a;
641
- const s = (a = (await this.view.hitTest(t, {
642
+ const s = (a = (await this.view.hitTest(i, {
642
643
  include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
643
644
  })).results) == null ? void 0 : a.filter(
644
645
  (c) => c.type === "graphic"
645
646
  );
646
647
  if (s.length === 0)
647
648
  return;
648
- const i = s[0].graphic;
649
- console.log(i.attributes);
650
- const l = i.getAttribute("type"), r = i.getAttribute("id");
649
+ const t = s[0].graphic, l = t.getAttribute("type"), r = t.getAttribute("id");
651
650
  if (l === "OpenDriveJunction")
652
- if (i.getAttribute("selected") === !1) {
651
+ if (t.getAttribute("selected") === !1) {
653
652
  const c = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, n = await w.get(c, {
654
653
  params: {
655
654
  id: r,
@@ -660,24 +659,24 @@ class O {
660
659
  type: "OpenDriveJunction",
661
660
  id: r,
662
661
  details: n.data.result
663
- }), i.setAttribute("selected", !0), i.symbol = {
662
+ }), t.setAttribute("selected", !0), t.symbol = {
664
663
  type: "picture-marker",
665
664
  url: "/GisViewerAssets/Images/point_red.png",
666
665
  width: "20px",
667
666
  height: "20px"
668
- }, this.increasePictureMarkerSize(i, 50));
667
+ }, this.increasePictureMarkerSize(t, 50));
669
668
  } else
670
669
  this.openDriveClickCallback && this.openDriveClickCallback({
671
670
  type: "OpenDriveJunction",
672
671
  id: r,
673
672
  details: void 0
674
- }), i.setAttribute("selected", !1), i.symbol = this.getCrossGraphicSymbol(
675
- i.attributes,
673
+ }), t.setAttribute("selected", !1), t.symbol = this.getCrossGraphicSymbol(
674
+ t.attributes,
676
675
  this.view.scale < this.junctionScale ? "picture" : "marker"
677
676
  );
678
677
  else
679
- l === "OpenDriveSection" && (i.layer.id === "OpenDriveHighlight" ? (this.highlightLayer.removeAll(), this.sectionLayer.removeAll(), this.selectedSectionIds = [], this.sectionLayer.add(i), i.setAttribute("selected", !0), this.selectedSectionIds.push(r), this.splitLaneLayer.graphics.filter(
680
- (n) => n.getAttribute("roadsectBaseIds") === i.getAttribute("roadsectBaseIds")
678
+ l === "OpenDriveSection" && (t.layer.id === "OpenDriveHighlight" ? (this.highlightLayer.removeAll(), this.sectionLayer.removeAll(), this.selectedSectionIds = [], this.sectionLayer.add(t), t.setAttribute("selected", !0), this.selectedSectionIds.push(r), this.splitLaneLayer.graphics.filter(
679
+ (n) => n.getAttribute("roadsectBaseIds") === t.getAttribute("roadsectBaseIds")
681
680
  ).forEach(
682
681
  (n) => n.symbol = {
683
682
  type: "simple-fill",
@@ -689,10 +688,13 @@ class O {
689
688
  }
690
689
  ), this.openDriveClickCallback && this.openDriveClickCallback({
691
690
  type: "OpenDriveSection",
692
- id: i.getAttribute("roadsectBaseIds"),
693
- details: void 0
691
+ id: t.getAttribute("id"),
692
+ details: {
693
+ roadsectId: t.getAttribute("roadId"),
694
+ roadsectBaseIds: t.getAttribute("roadsectBaseIds")
695
+ }
694
696
  })) : (this.splitLaneLayer.graphics.filter(
695
- (n) => n.getAttribute("roadsectBaseIds") === i.getAttribute("roadsectBaseIds")
697
+ (n) => n.getAttribute("roadsectBaseIds") === t.getAttribute("roadsectBaseIds")
696
698
  ).forEach(
697
699
  (n) => n.symbol = {
698
700
  type: "simple-fill",
@@ -702,14 +704,17 @@ class O {
702
704
  width: 1
703
705
  }
704
706
  }
705
- ), this.sectionLayer.remove(i), this.selectedSectionIds = [], this.openDriveClickCallback && this.openDriveClickCallback({
707
+ ), this.sectionLayer.remove(t), this.selectedSectionIds = [], this.openDriveClickCallback && this.openDriveClickCallback({
706
708
  type: "CloseOpenDriveSection",
707
- id: i.getAttribute("roadsectBaseIds"),
708
- details: void 0
709
+ id: t.getAttribute("roadsectBaseIds"),
710
+ details: {
711
+ roadsectId: t.getAttribute("roadId"),
712
+ roadsectBaseIds: t.getAttribute("roadsectBaseIds")
713
+ }
709
714
  })));
710
715
  });
711
- this.mouseClickHandler = this.view.on("immediate-click", async (t) => {
712
- e(t).catch(() => {
716
+ this.mouseClickHandler = this.view.on("immediate-click", async (i) => {
717
+ e(i).catch(() => {
713
718
  });
714
719
  });
715
720
  }
@@ -718,14 +723,14 @@ class O {
718
723
  * @param graphic
719
724
  * @param targetSize
720
725
  */
721
- increasePictureMarkerSize(e, t) {
726
+ increasePictureMarkerSize(e, i) {
722
727
  const o = setInterval(() => {
723
- const s = e.symbol, i = s.width;
724
- i < t ? e.symbol = {
728
+ const s = e.symbol, t = s.width;
729
+ t < i ? e.symbol = {
725
730
  type: "picture-marker",
726
731
  url: s.url,
727
- width: i + 1,
728
- height: i + 1
732
+ width: t + 1,
733
+ height: t + 1
729
734
  } : clearInterval(o);
730
735
  }, 20);
731
736
  }
@@ -734,21 +739,21 @@ class O {
734
739
  * @param graphic
735
740
  * @param targetSize
736
741
  */
737
- decreasePictureMarkerSize(e, t) {
742
+ decreasePictureMarkerSize(e, i) {
738
743
  const o = setInterval(() => {
739
- const s = e.symbol, i = s.width;
740
- i > t ? e.symbol = {
744
+ const s = e.symbol, t = s.width;
745
+ t > i ? e.symbol = {
741
746
  type: "picture-marker",
742
747
  url: s.url,
743
- width: i - 1,
744
- height: i - 1
748
+ width: t - 1,
749
+ height: t - 1
745
750
  } : clearInterval(o);
746
751
  }, 20);
747
752
  }
748
753
  async getSumoInfo(e) {
749
754
  switch (e.type) {
750
755
  case "junction": {
751
- const t = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, o = await w.get(t, {
756
+ const i = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, o = await w.get(i, {
752
757
  params: {
753
758
  id: e.id,
754
759
  projectName: this.projectName
@@ -757,16 +762,16 @@ class O {
757
762
  return o.status === 200 ? o.data : { status: -1, message: `路口信息查询失败: ${e.id}` };
758
763
  }
759
764
  case "edge": {
760
- const t = e.id.split("#");
761
- let o = t[0];
765
+ const i = e.id.split("#");
766
+ let o = i[0];
762
767
  o.startsWith("-") && (o = o.slice(1));
763
768
  let s = 0;
764
- t.length === 2 && (s = Number(t[1]));
765
- const i = this.allLaneGraphics.find(
769
+ i.length === 2 && (s = Number(i[1]));
770
+ const t = this.allLaneGraphics.find(
766
771
  (l) => l.getAttribute("roadId") === o && l.getAttribute("sectionIndex") === s
767
772
  );
768
- if (i) {
769
- const l = `${o}+${i.getAttribute(
773
+ if (t) {
774
+ const l = `${o}+${t.getAttribute(
770
775
  "sectionId"
771
776
  )}`, r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, a = await w.get(r, {
772
777
  params: {
@@ -789,13 +794,13 @@ class O {
789
794
  * 清除OpenDrive内容
790
795
  */
791
796
  async clearOpenDrive() {
792
- var t, o, s;
797
+ var i, o, s;
793
798
  let e = await this.laneLayer.queryFeatures();
794
799
  e.features.length > 0 && await this.laneLayer.applyEdits({
795
800
  deleteFeatures: e.features
796
801
  }), e = await this.roadNameLayer.queryFeatures(), e.features.length > 0 && await this.roadNameLayer.applyEdits({
797
802
  deleteFeatures: e.features
798
- }), 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, (o = this.mouseClickHandler) == null || o.remove(), this.mouseClickHandler = void 0, (s = this.scaleWatch) == null || s.remove(), this.scaleWatch = void 0;
803
+ }), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), this.borderLayer.removeAll(), (i = this.mouseMoveHandler) == null || i.remove(), this.mouseMoveHandler = void 0, (o = this.mouseClickHandler) == null || o.remove(), this.mouseClickHandler = void 0, (s = this.scaleWatch) == null || s.remove(), this.scaleWatch = void 0;
799
804
  }
800
805
  /**
801
806
  * 用sumo的id定位车道、基本段、路段
@@ -803,14 +808,14 @@ class O {
803
808
  * @returns
804
809
  */
805
810
  async findSumo(e) {
806
- const { type: t, id: o } = e, s = e.flash === void 0 ? !0 : e.flash;
807
- if (t === "junction")
811
+ const { type: i, id: o } = e, s = e.flash === void 0 ? !0 : e.flash;
812
+ if (i === "junction")
808
813
  return await this.findJunction(o, s);
809
- if (t === "edge") {
810
- const i = o.split("_");
811
- if (i.length > 2)
814
+ if (i === "edge") {
815
+ const t = o.split("_");
816
+ if (t.length > 2)
812
817
  return { status: -1, message: "id格式错误" };
813
- const l = i.length === 2 ? Number(i[1]) : void 0, r = i[0].split("#");
818
+ const l = t.length === 2 ? Number(t[1]) : void 0, r = t[0].split("#");
814
819
  if (r.length > 2)
815
820
  return { status: -1, message: "id格式错误" };
816
821
  const a = r[0], c = r.length === 2 ? Number(r[1]) : void 0;
@@ -818,13 +823,13 @@ class O {
818
823
  } else
819
824
  return { status: -1, message: "未知类型" };
820
825
  }
821
- async findJunction(e, t) {
826
+ async findJunction(e, i) {
822
827
  const o = this.junctionLayer.graphics.find(
823
828
  (s) => s.attributes.id === e
824
829
  );
825
830
  if (!o)
826
831
  return { status: -1, message: "未找到。请检查路口编号" };
827
- if (t) {
832
+ if (i) {
828
833
  const s = new I({
829
834
  geometry: o.geometry,
830
835
  symbol: {
@@ -848,36 +853,36 @@ class O {
848
853
  * @returns
849
854
  */
850
855
  async findLane(e) {
851
- let { roadsectId: t, segmentId: o, laneId: s } = e;
852
- t.startsWith("-") && (t = t.slice(1));
853
- let i = this.allLaneGraphics.filter(
854
- (a) => a.attributes.roadId === t
856
+ let { roadsectId: i, segmentId: o, laneId: s } = e;
857
+ i.startsWith("-") && (i = i.slice(1));
858
+ let t = this.allLaneGraphics.filter(
859
+ (a) => a.attributes.roadId === i
855
860
  );
856
- if (i.length === 0)
861
+ if (t.length === 0)
857
862
  return { status: -1, message: "未找到。请检查路段编号" };
858
863
  if (o !== void 0) {
859
864
  const a = [];
860
- if (i.forEach((c) => {
865
+ if (t.forEach((c) => {
861
866
  const n = Number(c.attributes.sectionId);
862
867
  a.indexOf(n) === -1 && a.push(n);
863
868
  }), a.sort((c, n) => c - n), o > a.length - 1)
864
869
  return { status: -1, message: "未找到。请检查基本段编号" };
865
- o = a[o], i = i.filter(
870
+ o = a[o], t = t.filter(
866
871
  (c) => Number(c.attributes.sectionId) === o
867
872
  );
868
873
  }
869
874
  if (s !== void 0) {
870
875
  const a = [];
871
- if (i.forEach((c) => {
876
+ if (t.forEach((c) => {
872
877
  const n = Number(c.attributes.laneId);
873
878
  a.indexOf(n) === -1 && a.push(n);
874
879
  }), a.sort((c, n) => c - n), s > a.length - 1)
875
880
  return { status: -1, message: "未找到。请检查车道编号" };
876
- s = a[s], i = i.filter(
881
+ s = a[s], t = t.filter(
877
882
  (c) => Number(c.attributes.laneId) === s
878
883
  );
879
884
  }
880
- const l = i.map(
885
+ const l = t.map(
881
886
  (a) => a.geometry
882
887
  ), r = L.union(l);
883
888
  if (e.flash) {
@@ -902,9 +907,9 @@ class O {
902
907
  */
903
908
  flashGraphic(e) {
904
909
  this.flashLayer.removeAll(), this.flashLayer.add(e);
905
- let t = 0, o = !0;
910
+ let i = 0, o = !0;
906
911
  const s = setInterval(() => {
907
- o ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (o = !1, t++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (o = !0)), t >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(s));
912
+ o ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (o = !1, i++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (o = !0)), i >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(s));
908
913
  }, 10);
909
914
  }
910
915
  /**
@@ -913,19 +918,19 @@ class O {
913
918
  * @returns
914
919
  */
915
920
  unselectSumo(e) {
916
- if (e ? e.type === "junction" && this.junctionLayer.graphics.forEach((t) => {
917
- (!e || !e.id || e.id === "" || e.id === t.getAttribute("id")) && t.getAttribute("selected") && (t.setAttribute("selected", !1), t.symbol = this.getCrossGraphicSymbol(
918
- t.attributes,
921
+ if (e ? e.type === "junction" && this.junctionLayer.graphics.forEach((i) => {
922
+ (!e || !e.id || e.id === "" || e.id === i.getAttribute("id")) && i.getAttribute("selected") && (i.setAttribute("selected", !1), i.symbol = this.getCrossGraphicSymbol(
923
+ i.attributes,
919
924
  this.view.scale < this.junctionScale ? "picture" : "marker"
920
925
  ));
921
926
  }) : (this.highlightLayer.removeAll(), this.sectionLayer.removeAll(), this.selectedSectionIds = [], this.splitLaneLayer.removeAll()), !e || e.type === "edge") {
922
- let t;
923
- !e || !e.id || e.id === "" ? t = this.sectionLayer.graphics.toArray() : t = this.sectionLayer.graphics.filter((o) => o.getAttribute("edgeId") === e.id).toArray(), t.length > 0 && (t.forEach((o) => {
927
+ let i;
928
+ !e || !e.id || e.id === "" ? i = this.sectionLayer.graphics.toArray() : i = this.sectionLayer.graphics.filter((o) => o.getAttribute("edgeId") === e.id).toArray(), i.length > 0 && (i.forEach((o) => {
924
929
  const s = o.getAttribute("id");
925
930
  this.selectedSectionIds = this.selectedSectionIds.filter(
926
- (i) => i !== s
931
+ (t) => t !== s
927
932
  );
928
- }), this.sectionLayer.removeMany(t));
933
+ }), this.sectionLayer.removeMany(i));
929
934
  }
930
935
  return { status: 0, message: "ok" };
931
936
  }
@@ -937,24 +942,24 @@ class O {
937
942
  async selectSumo(e) {
938
943
  switch (e.type) {
939
944
  case "junction":
940
- return this.junctionLayer.graphics.forEach((t) => {
941
- if (e.id === t.getAttribute("id"))
942
- return t.setAttribute("selected", !0), t.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(t, 50), { status: 0, message: "ok" };
945
+ return this.junctionLayer.graphics.forEach((i) => {
946
+ if (e.id === i.getAttribute("id"))
947
+ return i.setAttribute("selected", !0), i.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(i, 50), { status: 0, message: "ok" };
943
948
  }), { status: -1, message: "未找到路口" };
944
949
  case "edge": {
945
- const t = e.id.split("#");
946
- let o = String(t[0]);
950
+ const i = e.id.split("#");
951
+ let o = String(i[0]);
947
952
  o.startsWith("-") && (o = o.slice(1));
948
953
  let s = 0;
949
- t.length === 2 && (s = Number(t[1]));
950
- let i = [];
951
- if (t.length === 1 ? i = this.allLaneGraphics.filter(
954
+ i.length === 2 && (s = Number(i[1]));
955
+ let t = [];
956
+ if (i.length === 1 ? t = this.allLaneGraphics.filter(
952
957
  (l) => l.getAttribute("roadId") === o
953
- ) : t.length === 2 && (i = this.allLaneGraphics.filter(
958
+ ) : i.length === 2 && (t = this.allLaneGraphics.filter(
954
959
  (l) => l.getAttribute("roadId") === o && l.getAttribute("sectionIndex") === s
955
- )), i.length > 0) {
960
+ )), t.length > 0) {
956
961
  const l = /* @__PURE__ */ new Map();
957
- return i.forEach((r) => {
962
+ return t.forEach((r) => {
958
963
  const a = r.getAttribute("roadId") + "+" + r.getAttribute("sectionId");
959
964
  this.selectedSectionIds.includes(a) || this.selectedSectionIds.push(a);
960
965
  let c = l.get(a);
@@ -988,12 +993,12 @@ class O {
988
993
  }
989
994
  }
990
995
  async geometrySearch(e) {
991
- const t = new S({
996
+ const i = new S({
992
997
  rings: [e]
993
998
  }), o = await this.laneLayer.queryFeatures({
994
- geometry: t,
999
+ geometry: i,
995
1000
  outFields: ["*"]
996
- }), s = [], i = [];
1001
+ }), s = [], t = [];
997
1002
  for (const a of o.features) {
998
1003
  const c = a.getAttribute("roadId"), n = a.getAttribute("sectionIndex"), d = `${c}#${n}`;
999
1004
  if (s.indexOf(d) === -1) {
@@ -1007,12 +1012,12 @@ class O {
1007
1012
  projectName: this.projectName
1008
1013
  }
1009
1014
  });
1010
- h.status === 200 && h.data.status === 0 && i.push(h.data.result);
1015
+ h.status === 200 && h.data.status === 0 && t.push(h.data.result);
1011
1016
  }
1012
1017
  }
1013
1018
  const l = this.junctionLayer.graphics.filter((a) => {
1014
1019
  const c = a.geometry;
1015
- return L.contains(t, c);
1020
+ return L.contains(i, c);
1016
1021
  }), r = [];
1017
1022
  for (const a of l) {
1018
1023
  const c = a.getAttribute("id");
@@ -1033,7 +1038,7 @@ class O {
1033
1038
  message: "ok",
1034
1039
  result: {
1035
1040
  junctions: r,
1036
- edges: i
1041
+ edges: t
1037
1042
  }
1038
1043
  };
1039
1044
  }
@@ -1046,8 +1051,8 @@ class O {
1046
1051
  const o = e.id.split("_");
1047
1052
  if (o.length !== 2)
1048
1053
  return { status: -1, message: "车道编号格式错误" };
1049
- const s = Number(o[1]), i = o[0].split("#"), l = i.length === 2 ? Number(i[1]) : 0;
1050
- let r = i[0];
1054
+ const s = Number(o[1]), t = o[0].split("#"), l = t.length === 2 ? Number(t[1]) : 0;
1055
+ let r = t[0];
1051
1056
  r.startsWith("-") && (r = r.slice(1));
1052
1057
  const a = this.allLaneGraphics.filter((b) => b.getAttribute("roadId") === r && b.getAttribute("sectionIndex") === l);
1053
1058
  if (a.length === 0)
@@ -1094,51 +1099,54 @@ class O {
1094
1099
  });
1095
1100
  return this.splitLaneLayer.add(f), A.viewGoto(this.view, [f]), { status: 0, message: "ok", result: { coordinates: m } };
1096
1101
  }
1102
+ clearSplitLane() {
1103
+ this.splitLaneLayer.removeAll();
1104
+ }
1097
1105
  /**
1098
1106
  * 封闭车道,使用可计算路网的id
1099
1107
  * @param params
1100
1108
  */
1101
1109
  blockLane(e) {
1102
- const t = this.allLaneGraphics.filter((s) => {
1110
+ const i = this.allLaneGraphics.filter((s) => {
1103
1111
  var l;
1104
- let i = String(s.getAttribute("laneId"));
1105
- return i.startsWith("-") && (i = i.slice(1)), s.getAttribute("roadId") === e.roadsectId && ((l = s.getAttribute("roadsectBaseIds")) == null ? void 0 : l.includes(e.roadsectBaseId)) && i === String(e.laneId);
1106
- }), o = t.map((s) => {
1107
- const i = s.clone();
1108
- return console.log(
1109
- t[0].getAttribute("roadsectBaseIds"),
1110
- this.selectedSectionIds,
1111
- this.selectedSectionIds.includes(
1112
- t[0].getAttribute("roadsectBaseIds")
1113
- )
1114
- ), i.symbol = {
1112
+ let t = String(s.getAttribute("laneId"));
1113
+ return t.startsWith("-") && (t = t.slice(1)), s.getAttribute("roadId") === e.roadsectId && ((l = s.getAttribute("roadsectBaseIds")) == null ? void 0 : l.includes(e.roadsectBaseId)) && t === String(e.laneId);
1114
+ }), o = i.map((s) => {
1115
+ const t = s.clone();
1116
+ return t.symbol = {
1115
1117
  type: "simple-fill",
1116
1118
  color: this.selectedSectionIds.includes(
1117
- t[0].getAttribute("roadsectBaseIds")
1119
+ i[0].getAttribute("roadsectBaseIds")
1118
1120
  ) ? [255, 69, 0, 0.8] : [255, 0, 0, 0.8],
1119
1121
  outline: {
1120
1122
  color: "red"
1121
1123
  }
1122
- }, i;
1124
+ }, t;
1123
1125
  });
1124
1126
  this.splitLaneLayer.addMany(o), A.viewGoto(this.view, o);
1125
1127
  }
1126
- clearSplitLane() {
1127
- this.splitLaneLayer.removeAll();
1128
+ /**
1129
+ * 解除封闭车道,使用可计算路网id
1130
+ * @param params
1131
+ */
1132
+ clearBlockLane(e) {
1133
+ const i = this.splitLaneLayer.graphics.filter((o) => {
1134
+ const s = o.getAttribute("roadId"), t = o.getAttribute("roadsectBaseIds");
1135
+ let l = String(o.getAttribute("laneId"));
1136
+ return l.startsWith("-") && (l = l.slice(1)), s === e.roadsectId && (t == null ? void 0 : t.includes(e.roadsectBaseId)) && l === String(e.laneId);
1137
+ });
1138
+ this.splitLaneLayer.removeMany(i.toArray());
1128
1139
  }
1129
1140
  selectComputable(e) {
1130
1141
  if (e.type === "roadsectBase") {
1131
- this.allLaneGraphics.forEach((o) => {
1132
- o.getAttribute("roadsectBaseIds") || console.log(o.attributes);
1133
- });
1134
- const t = this.allLaneGraphics.filter((o) => {
1142
+ const i = this.allLaneGraphics.filter((o) => {
1135
1143
  var s;
1136
1144
  return (s = o.getAttribute("roadsectBaseIds")) == null ? void 0 : s.includes(e.id);
1137
1145
  });
1138
- if (t.length > 0) {
1146
+ if (i.length > 0) {
1139
1147
  const o = L.union(
1140
- t.map((r) => r.geometry)
1141
- ), s = t[0].getAttribute("roadsectBaseIds"), i = new I({
1148
+ i.map((r) => r.geometry)
1149
+ ), s = i[0].getAttribute("roadsectBaseIds"), t = new I({
1142
1150
  geometry: o,
1143
1151
  symbol: {
1144
1152
  type: "simple-fill",
@@ -1154,7 +1162,7 @@ class O {
1154
1162
  roadsectBaseIds: s
1155
1163
  }
1156
1164
  });
1157
- this.sectionLayer.removeAll(), this.sectionLayer.add(i), A.viewGoto(this.view, [i]), this.selectedSectionIds = [s];
1165
+ this.sectionLayer.removeAll(), this.sectionLayer.add(t), A.viewGoto(this.view, [t]), this.selectedSectionIds = [s];
1158
1166
  const l = this.splitLaneLayer.graphics.filter(
1159
1167
  (r) => {
1160
1168
  var a;
@@ -1179,13 +1187,13 @@ class O {
1179
1187
  * @param symbolStyle
1180
1188
  */
1181
1189
  updateAllJunctionSymbol(e) {
1182
- const t = this.junctionLayer.graphics.clone();
1183
- this.junctionLayer.removeAll(), t.forEach((o) => {
1190
+ const i = this.junctionLayer.graphics.clone();
1191
+ this.junctionLayer.removeAll(), i.forEach((o) => {
1184
1192
  o.getAttribute("selected") || (o.symbol = this.getCrossGraphicSymbol(
1185
1193
  o.attributes,
1186
1194
  e
1187
1195
  ));
1188
- }), this.junctionLayer.addMany(t.toArray());
1196
+ }), this.junctionLayer.addMany(i.toArray());
1189
1197
  }
1190
1198
  /**
1191
1199
  * 生成路口点符号。在不同比例尺下,使用不同的符号
@@ -1193,16 +1201,16 @@ class O {
1193
1201
  * @param symbolType
1194
1202
  * @returns
1195
1203
  */
1196
- getCrossGraphicSymbol(e, t) {
1204
+ getCrossGraphicSymbol(e, i) {
1197
1205
  const o = e.crossId !== "" && e.crossId !== void 0 && e.crossId !== null;
1198
- if (t === "marker")
1206
+ if (i === "marker")
1199
1207
  return {
1200
1208
  type: "picture-marker",
1201
1209
  url: `/GisViewerAssets/Images/cross/${o ? "gis_xhj_blue" : "gis_lkcz_xz"}.png`,
1202
1210
  width: "32px",
1203
1211
  height: "32px"
1204
1212
  };
1205
- if (t === "picture")
1213
+ if (i === "picture")
1206
1214
  return o ? {
1207
1215
  type: "cim",
1208
1216
  data: {
@@ -150,7 +150,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
150
150
  status: number;
151
151
  message: string;
152
152
  }>;
153
- clearBlockOpenDriveLane: () => void | {
153
+ clearBlockOpenDriveLane: (params: IBlockOpenDriveLaneParams) => void | {
154
154
  status: number;
155
155
  message: string;
156
156
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),T=require("./stores/index.js");require("./style/index.css");const dt=require("./utils/dbscan-cluster/index.js"),mt=require("./utils/detect-gpu.js"),pt=require("./utils/edpass-device-controller.js"),x=require("./utils/green-wave-band-controller/index.js"),gt=require("./utils/holo-flow/index.js"),ft=require("./utils/holo-flow/signal-countdown-panel.vue.js"),yt=require("./utils/map-initializer.js"),P=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),wt=require("./utils/police-jurisdiction.js"),vt=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),St=require("./utils/signal-control-area/edit-area.js"),q=require("./utils/signal-control-area/show-area.js"),ht=require("./utils/traffic-flow.js"),Ct={class:"gis-viewer"},bt={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Ot=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(N,{expose:H,emit:G}){const C=r.ref(null);let a,p,l,i,s,o,f,t,u,n,g,w,b,y;const O=r.ref(!1);T.registerStore();const V=T.default.useAppDataStore,_=r.reactive([]),B=e=>Math.log2(591657527591555e-6/e);let v=null,I=null;const A=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==I&&(I=d,S("update:zoom",d))};mt.default(),r.onMounted(async()=>{if(!C.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(O.value=!O.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(M.config)).json();c.assetsRoot=M.assetsRoot||d,V.mapConfig=c,p=new yt.default,V.mapInitializer=p,a=await p.initialize({container:C.value,mapConfig:c,markerClickCallback:(m,D,L,ut)=>{S("markerClick",m,D,L,ut)},mapClickCallback:(m,D,L)=>{S("mapClick",m,D,L)}});const h=a.zoom??(a.scale?B(a.scale):void 0);typeof h=="number"&&A(h);const lt=a.zoom!==void 0?a.watch("zoom",m=>{A(m)}):a.watch("scale",m=>{typeof m=="number"&&m>0&&A(B(m))});v=()=>lt.remove(),s=new gt.default(a,_),await s.init(),S("mapLoaded")}),r.onUnmounted(()=>{n==null||n.clearSignalControlArea(),t==null||t.clearOpenDrive(),s.clearHoloTrace(),s.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),v==null||v(),v=null});const Z=r.computed(()=>a),W=()=>{const e=T.default.useAppDataStore;e.saveTrackLog=!0},j=()=>{s.downloadTrackLog()},J=()=>{k("vehicleId")},Q=()=>{k("plateNumber")},U=async e=>await p.setMapCenter(e),K=async e=>await p.setMapCamera(e),F=e=>p.setMapZoom(e),X=async e=>await p.lookAt(e),Y=e=>p.setLayerVisibility(e),R=(e,d)=>p.requestCoordinateTransform(e,d),$=e=>{p.cancelCoordinateTransform(e)},ee=e=>{p.setMapZoomRange(e)},te=e=>(l||(l=new E.default(a)),l.showLaneNumber(e)),ae=()=>{l==null||l.clearLaneNumber()},ne=async e=>(l||(l=new E.default(a)),await l.initializeSearch(e)),se=async()=>l==null?void 0:l.calCrossIndicatorArea(),re=async()=>{},oe=async(e,d)=>{i||(i=new ht.default(a)),i.connectTrafficFlow(e,d)},ie=()=>{i==null||i.disconnectTrafficFlow()},ce=async e=>{s.handleVehicleTraceData(e)},le=()=>{s.clearHoloTrace()},ue=e=>{s.setInterpolate(e)},de=async e=>{await s.handleSignalData(e)},me=async e=>{await s.initializeLampGroup(e)},pe=e=>{s.handleUniSignalData(e)},ge=()=>{s.clearHoloSignal()},fe=e=>{i==null||i.toggleTrafficInfo(e),s==null||s.toggleTrafficInfo(e)},ye=e=>{s==null||s.togglePause(e)},we=e=>{i==null||i.toggleTrafficObject(e),s==null||s.toggleTrafficObject(e)},k=e=>{s==null||s.updatePanelContent(e)},ve=async e=>(o||(o=new z.default(a)),o.addOverlays(e)),Se=async e=>(y||(y=new dt.default(a)),y.addClusterPoints(e)),he=()=>{y==null||y.removeAllClusterPoints()},Ce=e=>(o||(o=new z.default(a)),o.addMask(e)),be=()=>{o==null||o.removeMask()},Oe=e=>o==null?void 0:o.removeOverlaysByType(e),Ae=e=>o==null?void 0:o.removeOverlaysById(e),ke=()=>o==null?void 0:o.removeAllOverlays(),De=()=>{o==null||o.showAllOverlays()},Le=e=>{f||(f=new vt.default(a)),f.updateQueueLength(e)},Te=()=>{f==null||f.removeQueueLength()},qe=async(e,d)=>(t||(t=new P.default(a)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new P.default(a)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),_e=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Be=async()=>await(t==null?void 0:t.clearOpenDrive()),Ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},Me=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?t.selectComputable(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ne=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},He=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ge=async e=>t?t==null?void 0:t.blockLane(e):{status:-1,message:"未加载OpenDrive地图"},Ze=()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},We=async e=>(n||(n=new q.default(a)),await n.showSignalControlArea(e)),je=async e=>(n||(n=new q.default(a)),await n.showDistrict(e)),Je=async e=>(n||(n=new q.default(a)),await n.showSubDistrict(e)),Qe=async()=>await(n==null?void 0:n.clearSignalControlArea()),Ue=e=>n==null?void 0:n.setLayerVisibility(e),Ke=async e=>n?await(n==null?void 0:n.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Fe=async e=>n?await n.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Xe=()=>n?n.resetHighlight():{status:-1,message:"未加载信号控制区"},Ye=e=>(u||(u=new St.default(a)),u.showSubSignalControlArea(e)),Re=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},$e=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},et=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},tt=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},at=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},nt=e=>(g||(g=new x.default(a)),g.addGreenWaveBand(e)),st=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},rt=async e=>(g||(g=new x.default(a)),await g.showGreenWaveBand(e)),ot=async e=>(w||(w=new wt.default(a)),await w.showJurisdiction(e)),it=()=>{if(!w)return{status:-1,message:"未加载警务管辖区"};w.clearJurisdiction()},ct=async e=>(b||(b=new pt.default(a)),await b.setEdpassLayerVisibility(e)),M=N,S=G;return H({mapViewer:Z,setLayerVisibility:Y,setMapCenter:U,lookAt:X,setMapCamera:K,setMapZoom:F,setMapZoomRange:ee,requestCoordinateTransform:R,cancelCoordinateTransform:$,addOverlays:ve,addClusterPoints:Se,removeAllClusterPoints:he,addMask:Ce,removeMask:be,showAllOverlays:De,removeOverlaysByType:Oe,removeOverlaysById:Ae,removeAllOverlays:ke,showLaneNumber:te,clearLaneNumber:ae,initializeAreaTool:ne,calCrossIndicatorArea:se,calRoadIndicatorArea:re,connectCarFlow:oe,disconnectCarFlow:ie,handleHoloVehicleTraceData:ce,clearHoloTrace:le,initializeLampGroup:me,handleUniSignalData:pe,handleHoloSignalData:de,clearHoloSignal:ge,setInterpolate:ue,toggleTrafficInfo:fe,toggleTrafficObject:we,toggleVehicleInfo:k,togglePause:ye,updateQueueLength:Le,removeQueueLength:Te,showOpenDriveFromServer:qe,showOpenDriveFromFile:Ve,clearOpenDrive:Be,setOpendriveVisibility:_e,geometrySearchInOpenDrive:ze,findSumoInOpenDrive:Ie,selectSumoInOpenDrive:Me,unselectSumoInOpenDrive:xe,selectComputableInOpenDrive:Pe,getSumoInfo:Ee,splitOpenDriveLane:Ne,clearSplitOpenDriveLane:He,blockOpenDriveLane:Ge,clearBlockOpenDriveLane:Ze,showSignalControlArea:We,showDistrictArea:je,showSubDistrictArea:Je,clearSignalControlArea:Qe,setSignalControlAreaVisibility:Ue,locateSignalControlArea:Ke,highlightSignalControlArea:Fe,resetHighlightSignalControlArea:Xe,showSubSignalControlArea:Ye,editSubSignalControlArea:Re,stopEditSubSignalControlArea:$e,selectSubSignalControlAreaCross:et,unselectSubSignalControlAreaCross:tt,changeSubSignalControlAreaBorderVisibility:at,addGreenWaveBand:nt,stopAddGreenWaveBand:st,showGreenWaveBand:rt,showPoliceArea:ot,clearPoliceArea:it,setEdpassLayerVisibility:ct}),(e,d)=>(r.openBlock(),r.createElementBlock("div",Ct,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:C},[r.withDirectives(r.createElementVNode("div",bt,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:W}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 显示车辆id "),r.createElementVNode("button",{onClick:Q},"显示车辆号牌")],512),[[r.vShow,O.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_,(c,h)=>(r.openBlock(),r.createBlock(ft.default,{key:h,"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=Ot;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),T=require("./stores/index.js");require("./style/index.css");const dt=require("./utils/dbscan-cluster/index.js"),mt=require("./utils/detect-gpu.js"),pt=require("./utils/edpass-device-controller.js"),x=require("./utils/green-wave-band-controller/index.js"),gt=require("./utils/holo-flow/index.js"),ft=require("./utils/holo-flow/signal-countdown-panel.vue.js"),yt=require("./utils/map-initializer.js"),P=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),wt=require("./utils/police-jurisdiction.js"),vt=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),St=require("./utils/signal-control-area/edit-area.js"),q=require("./utils/signal-control-area/show-area.js"),ht=require("./utils/traffic-flow.js"),Ct={class:"gis-viewer"},bt={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Ot=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(N,{expose:H,emit:G}){const C=r.ref(null);let a,p,l,i,s,o,f,t,u,n,g,w,b,y;const O=r.ref(!1);T.registerStore();const B=T.default.useAppDataStore,V=r.reactive([]),_=e=>Math.log2(591657527591555e-6/e);let v=null,I=null;const k=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==I&&(I=d,S("update:zoom",d))};mt.default(),r.onMounted(async()=>{if(!C.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(O.value=!O.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(M.config)).json();c.assetsRoot=M.assetsRoot||d,B.mapConfig=c,p=new yt.default,B.mapInitializer=p,a=await p.initialize({container:C.value,mapConfig:c,markerClickCallback:(m,D,L,ut)=>{S("markerClick",m,D,L,ut)},mapClickCallback:(m,D,L)=>{S("mapClick",m,D,L)}});const h=a.zoom??(a.scale?_(a.scale):void 0);typeof h=="number"&&k(h);const lt=a.zoom!==void 0?a.watch("zoom",m=>{k(m)}):a.watch("scale",m=>{typeof m=="number"&&m>0&&k(_(m))});v=()=>lt.remove(),s=new gt.default(a,V),await s.init(),S("mapLoaded")}),r.onUnmounted(()=>{n==null||n.clearSignalControlArea(),t==null||t.clearOpenDrive(),s.clearHoloTrace(),s.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),v==null||v(),v=null});const Z=r.computed(()=>a),W=()=>{const e=T.default.useAppDataStore;e.saveTrackLog=!0},j=()=>{s.downloadTrackLog()},J=()=>{A("vehicleId")},Q=()=>{A("plateNumber")},U=async e=>await p.setMapCenter(e),K=async e=>await p.setMapCamera(e),F=e=>p.setMapZoom(e),X=async e=>await p.lookAt(e),Y=e=>p.setLayerVisibility(e),R=(e,d)=>p.requestCoordinateTransform(e,d),$=e=>{p.cancelCoordinateTransform(e)},ee=e=>{p.setMapZoomRange(e)},te=e=>(l||(l=new E.default(a)),l.showLaneNumber(e)),ae=()=>{l==null||l.clearLaneNumber()},ne=async e=>(l||(l=new E.default(a)),await l.initializeSearch(e)),se=async()=>l==null?void 0:l.calCrossIndicatorArea(),re=async()=>{},oe=async(e,d)=>{i||(i=new ht.default(a)),i.connectTrafficFlow(e,d)},ie=()=>{i==null||i.disconnectTrafficFlow()},ce=async e=>{s.handleVehicleTraceData(e)},le=()=>{s.clearHoloTrace()},ue=e=>{s.setInterpolate(e)},de=async e=>{await s.handleSignalData(e)},me=async e=>{await s.initializeLampGroup(e)},pe=e=>{s.handleUniSignalData(e)},ge=()=>{s.clearHoloSignal()},fe=e=>{i==null||i.toggleTrafficInfo(e),s==null||s.toggleTrafficInfo(e)},ye=e=>{s==null||s.togglePause(e)},we=e=>{i==null||i.toggleTrafficObject(e),s==null||s.toggleTrafficObject(e)},A=e=>{s==null||s.updatePanelContent(e)},ve=async e=>(o||(o=new z.default(a)),o.addOverlays(e)),Se=async e=>(y||(y=new dt.default(a)),y.addClusterPoints(e)),he=()=>{y==null||y.removeAllClusterPoints()},Ce=e=>(o||(o=new z.default(a)),o.addMask(e)),be=()=>{o==null||o.removeMask()},Oe=e=>o==null?void 0:o.removeOverlaysByType(e),ke=e=>o==null?void 0:o.removeOverlaysById(e),Ae=()=>o==null?void 0:o.removeAllOverlays(),De=()=>{o==null||o.showAllOverlays()},Le=e=>{f||(f=new vt.default(a)),f.updateQueueLength(e)},Te=()=>{f==null||f.removeQueueLength()},qe=async(e,d)=>(t||(t=new P.default(a)),await t.showOpenDriveFromServer(e,d)),Be=async e=>(t||(t=new P.default(a)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),Ve=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},_e=async()=>await(t==null?void 0:t.clearOpenDrive()),Ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},Me=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?t.selectComputable(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ne=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},He=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ge=async e=>t?t==null?void 0:t.blockLane(e):{status:-1,message:"未加载OpenDrive地图"},Ze=e=>t?t==null?void 0:t.clearBlockLane(e):{status:-1,message:"未加载OpenDrive地图"},We=async e=>(n||(n=new q.default(a)),await n.showSignalControlArea(e)),je=async e=>(n||(n=new q.default(a)),await n.showDistrict(e)),Je=async e=>(n||(n=new q.default(a)),await n.showSubDistrict(e)),Qe=async()=>await(n==null?void 0:n.clearSignalControlArea()),Ue=e=>n==null?void 0:n.setLayerVisibility(e),Ke=async e=>n?await(n==null?void 0:n.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Fe=async e=>n?await n.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Xe=()=>n?n.resetHighlight():{status:-1,message:"未加载信号控制区"},Ye=e=>(u||(u=new St.default(a)),u.showSubSignalControlArea(e)),Re=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},$e=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},et=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},tt=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},at=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},nt=e=>(g||(g=new x.default(a)),g.addGreenWaveBand(e)),st=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},rt=async e=>(g||(g=new x.default(a)),await g.showGreenWaveBand(e)),ot=async e=>(w||(w=new wt.default(a)),await w.showJurisdiction(e)),it=()=>{if(!w)return{status:-1,message:"未加载警务管辖区"};w.clearJurisdiction()},ct=async e=>(b||(b=new pt.default(a)),await b.setEdpassLayerVisibility(e)),M=N,S=G;return H({mapViewer:Z,setLayerVisibility:Y,setMapCenter:U,lookAt:X,setMapCamera:K,setMapZoom:F,setMapZoomRange:ee,requestCoordinateTransform:R,cancelCoordinateTransform:$,addOverlays:ve,addClusterPoints:Se,removeAllClusterPoints:he,addMask:Ce,removeMask:be,showAllOverlays:De,removeOverlaysByType:Oe,removeOverlaysById:ke,removeAllOverlays:Ae,showLaneNumber:te,clearLaneNumber:ae,initializeAreaTool:ne,calCrossIndicatorArea:se,calRoadIndicatorArea:re,connectCarFlow:oe,disconnectCarFlow:ie,handleHoloVehicleTraceData:ce,clearHoloTrace:le,initializeLampGroup:me,handleUniSignalData:pe,handleHoloSignalData:de,clearHoloSignal:ge,setInterpolate:ue,toggleTrafficInfo:fe,toggleTrafficObject:we,toggleVehicleInfo:A,togglePause:ye,updateQueueLength:Le,removeQueueLength:Te,showOpenDriveFromServer:qe,showOpenDriveFromFile:Be,clearOpenDrive:_e,setOpendriveVisibility:Ve,geometrySearchInOpenDrive:ze,findSumoInOpenDrive:Ie,selectSumoInOpenDrive:Me,unselectSumoInOpenDrive:xe,selectComputableInOpenDrive:Pe,getSumoInfo:Ee,splitOpenDriveLane:Ne,clearSplitOpenDriveLane:He,blockOpenDriveLane:Ge,clearBlockOpenDriveLane:Ze,showSignalControlArea:We,showDistrictArea:je,showSubDistrictArea:Je,clearSignalControlArea:Qe,setSignalControlAreaVisibility:Ue,locateSignalControlArea:Ke,highlightSignalControlArea:Fe,resetHighlightSignalControlArea:Xe,showSubSignalControlArea:Ye,editSubSignalControlArea:Re,stopEditSubSignalControlArea:$e,selectSubSignalControlAreaCross:et,unselectSubSignalControlAreaCross:tt,changeSubSignalControlAreaBorderVisibility:at,addGreenWaveBand:nt,stopAddGreenWaveBand:st,showGreenWaveBand:rt,showPoliceArea:ot,clearPoliceArea:it,setEdpassLayerVisibility:ct}),(e,d)=>(r.openBlock(),r.createElementBlock("div",Ct,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:C},[r.withDirectives(r.createElementVNode("div",bt,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:W}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 显示车辆id "),r.createElementVNode("button",{onClick:Q},"显示车辆号牌")],512),[[r.vShow,O.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(V,(c,h)=>(r.openBlock(),r.createBlock(ft.default,{key:h,"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=Ot;
@@ -134,7 +134,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
134
134
  status: number;
135
135
  message: string;
136
136
  }>;
137
- clearBlockOpenDriveLane: () => void | {
137
+ clearBlockOpenDriveLane: (params: import("../types").IBlockOpenDriveLaneParams) => void | {
138
138
  status: number;
139
139
  message: string;
140
140
  };
@@ -118,12 +118,17 @@ export default class OpenDriveRenderer {
118
118
  * @returns
119
119
  */
120
120
  splitLane(params: ISplitOpenDriveLaneParams): Promise<IResult>;
121
+ clearSplitLane(): void;
121
122
  /**
122
123
  * 封闭车道,使用可计算路网的id
123
124
  * @param params
124
125
  */
125
126
  blockLane(params: IBlockOpenDriveLaneParams): void;
126
- clearSplitLane(): void;
127
+ /**
128
+ * 解除封闭车道,使用可计算路网id
129
+ * @param params
130
+ */
131
+ clearBlockLane(params: IBlockOpenDriveLaneParams): void;
127
132
  selectComputable(params: IFindSumoParams): void;
128
133
  /**
129
134
  * 更新所有路口的symbol
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("@arcgis/core/Graphic"),J=require("@arcgis/core/core/promiseUtils"),E=require("@arcgis/core/core/reactiveUtils.js"),A=require("@arcgis/core/geometry"),q=require("@arcgis/core/geometry/geometryEngine"),x=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),T=require("@turf/helpers"),O=require("@turf/line-slice-along"),w=require("axios"),_=require("fast-xml-parser"),R=require("md5"),M=require("pako"),z=require("vue"),H=require("../../stores/index.js"),k=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 s=Object.getOwnPropertyDescriptor(S,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>S[t]})}}return e.default=S,Object.freeze(e)}const P=N(J),U=N(E),L=N(q),B=N(T);class C{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"},{name:"roadsectBaseIds",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 v({id:"OpenDriveJunction"}),this.sectionLayer=new v({id:"OpenDriveSection"}),this.highlightLayer=new v({id:"OpenDriveHighlight"}),this.flashLayer=new v({id:"OpenDriveFlash"}),this.drawLayer=new v({id:"Draw"}),this.splitLaneLayer=new v({id:"SplitLane"}),this.borderLayer=new v({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 C(e)),this.instance}async makeMd5FromFile(e){var t;try{const o=await(await fetch(e)).text();let r=(t=new _.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:R(o),border:r}}}catch(s){return{status:-1,message:s.message}}}async showOpenDriveFromFile(e){var d,m,u;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")});let t=e.file.split("/").pop()||"";t=t.split(".").slice(0,-1).join("."),this.openDriveServer=e.server;const s=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await w.post(s,{},{params:{url:e.file,projectName:t}})}catch(h){return{status:-1,message:h.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const i=o.data.result.geoSetting;k.default.setGeoData(i.geoReference,i.offsetX,i.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const r=await fetch(l);let a;if(l.endsWith("bin")){const h=await r.arrayBuffer(),p=M.inflate(h,{to:"string"});a=JSON.parse(p)}else a=await r.json();if(await this.showAllLanes(a,((d=e.options)==null?void 0:d.showJunctionLane)||!1,((m=e.options)==null?void 0:m.showRoadName)||!0),((u=e.options)==null?void 0:u.showJunctionPoint)!==!1){const h=o.data.result.junctions;this.showJunction(h)}e.options&&e.options.centerMap!==!1&&await this.view.goTo(this.allLaneGraphics),this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick();const n=H.default.useAppDataStore;return z.watch(()=>n.isSketching,()=>{var h,p;n.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 s=`http://${e}/api/openDrive/analyzeXodr`,o=await w.get(s,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let i=o.data.result.json;i.startsWith(window.location.protocol)||(i=`${window.location.protocol}//${e}${i}`);const l=await fetch(i);let r;if(i.endsWith("bin")){const a=await l.arrayBuffer(),c=M.inflate(a,{to:"string"});r=JSON.parse(c)}else r=await l.json();return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,s){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=s,new Promise(i=>{var c;let l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const r=[];for(const n of e){if(!t&&n.junction!=="-1")continue;const{id:d,refLine:m}=n;let u=n.name;u.includes("(")&&(u=u.slice(0,u.indexOf("("))),u=u.replace(/(.)/g,"$1 ");const h=new I({geometry:{type:"polyline",paths:[m]},attributes:{ObjectID:l++,roadId:d,roadName:u}});this.allRefLineGraphics.push(h),n.laneSections.sort((p,g)=>Number(p.id)-Number(g.id));for(let p=0;p<n.laneSections.length;p++){const g=n.laneSections[p],y=Number(g.id);for(const f of g.lanePaths){const b=Number(f.id);if(b===0)continue;const $=f.type,F=[...f.outerPath],j=f.innerPath.concat(F.reverse());if(j.length<=3){console.warn(`lane ${b} has less than 3 points`);continue}j.push(f.innerPath[0]);const D=new A.Polygon({rings:[j]});if(D){const G=new I({geometry:D,attributes:{ObjectID:l++,id:`${d}+${y}+${b}`,fromNode:n.fromNode,toNode:n.toNode,roadId:String(d),roadName:n.name,sectionId:String(y),sectionIndex:p,laneId:b,type:$,sumoId:"",leftLine:f.innerPath,rightLine:f.outerPath,roadsectBaseIds:(c=g.roadsectBaseIds)==null?void 0:c.toString()}});this.allLaneGraphics.push(G),r.push(G)}}}}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),i()},10)})}showJunction(e){const t=[];let s;this.xodrBorder.length>0&&(s=new A.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 i=new A.Point({x:o.coordinates[0],y:o.coordinates[1]});let l=!0;if(s&&(l=L.contains(s,i)),l){const r=new I({geometry:i,attributes:{...o,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(o,"marker")});t.push(r)}}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=P.debounce(async t=>{var l;const o=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.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 i=o[0];if(this.hitGraphic=i.graphic,i.layer.id==="OpenDriveLane"){const r=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`,a=this.hitGraphic.getAttribute("roadsectBaseIds");if(this.currentSectionCode===r||this.selectedSectionIds.includes(a)||this.sectionLayer.graphics.findIndex(y=>y.getAttribute("id")===r)>=0)return;this.currentSectionCode=r;const n=this.allLaneGraphics.filter(y=>`${y.attributes.roadId}+${y.attributes.sectionId}`===r),d=L.union(n.map(y=>y.geometry)),m=this.hitGraphic.getAttribute("fromNode"),u=this.hitGraphic.getAttribute("toNode"),h=this.junctionNames.get(m)||m,p=this.junctionNames.get(u)||u,g=new I({geometry:d,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:h,toNodeName:p,laneCount:n.length,roadsectBaseIds:this.hitGraphic.getAttribute("roadsectBaseIds")},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(g)}else if(i.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=P.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(c=>c.type==="graphic");if(o.length===0)return;const i=o[0].graphic;console.log(i.attributes);const l=i.getAttribute("type"),r=i.getAttribute("id");if(l==="OpenDriveJunction")if(i.getAttribute("selected")===!1){const c=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,n=await w.get(c,{params:{id:r,projectName:this.projectName}});n.status===200&&n.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:n.data.result}),i.setAttribute("selected",!0),i.symbol={type:"picture-marker",url:"/GisViewerAssets/Images/point_red.png",width:"20px",height:"20px"},this.increasePictureMarkerSize(i,50))}else this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:void 0}),i.setAttribute("selected",!1),i.symbol=this.getCrossGraphicSymbol(i.attributes,this.view.scale<this.junctionScale?"picture":"marker");else l==="OpenDriveSection"&&(i.layer.id==="OpenDriveHighlight"?(this.highlightLayer.removeAll(),this.sectionLayer.removeAll(),this.selectedSectionIds=[],this.sectionLayer.add(i),i.setAttribute("selected",!0),this.selectedSectionIds.push(r),this.splitLaneLayer.graphics.filter(n=>n.getAttribute("roadsectBaseIds")===i.getAttribute("roadsectBaseIds")).forEach(n=>n.symbol={type:"simple-fill",color:[255,69,0],outline:{color:"red",width:2}}),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:i.getAttribute("roadsectBaseIds"),details:void 0})):(this.splitLaneLayer.graphics.filter(n=>n.getAttribute("roadsectBaseIds")===i.getAttribute("roadsectBaseIds")).forEach(n=>n.symbol={type:"simple-fill",color:[255,0,0,.8],outline:{color:"red",width:1}}),this.sectionLayer.remove(i),this.selectedSectionIds=[],this.openDriveClickCallback&&this.openDriveClickCallback({type:"CloseOpenDriveSection",id:i.getAttribute("roadsectBaseIds"),details:void 0})))});this.mouseClickHandler=this.view.on("immediate-click",async t=>{e(t).catch(()=>{})})}increasePictureMarkerSize(e,t){const s=setInterval(()=>{const o=e.symbol,i=o.width;i<t?e.symbol={type:"picture-marker",url:o.url,width:i+1,height:i+1}:clearInterval(s)},20)}decreasePictureMarkerSize(e,t){const s=setInterval(()=>{const o=e.symbol,i=o.width;i>t?e.symbol={type:"picture-marker",url:o.url,width:i-1,height:i-1}:clearInterval(s)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const t=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,s=await w.get(t,{params:{id:e.id,projectName:this.projectName}});return s.status===200?s.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const t=e.id.split("#");let s=t[0];s.startsWith("-")&&(s=s.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const i=this.allLaneGraphics.find(l=>l.getAttribute("roadId")===s&&l.getAttribute("sectionIndex")===o);if(i){const l=`${s}+${i.getAttribute("sectionId")}`,r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await w.get(r,{params:{id:l,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${l}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}setOpendriveVisibility(e){this.laneLayer.visible=e}async clearOpenDrive(){var t,s,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,(s=this.mouseClickHandler)==null||s.remove(),this.mouseClickHandler=void 0,(o=this.scaleWatch)==null||o.remove(),this.scaleWatch=void 0}async findSumo(e){const{type:t,id:s}=e,o=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(s,o);if(t==="edge"){const i=s.split("_");if(i.length>2)return{status:-1,message:"id格式错误"};const l=i.length===2?Number(i[1]):void 0,r=i[0].split("#");if(r.length>2)return{status:-1,message:"id格式错误"};const a=r[0],c=r.length===2?Number(r[1]):void 0;return await this.findLane({roadsectId:a,segmentId:c,laneId:l,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const s=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!s)return{status:-1,message:"未找到。请检查路口编号"};if(t){const o=new I({geometry:s.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(s.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:s,laneId:o}=e;t.startsWith("-")&&(t=t.slice(1));let i=this.allLaneGraphics.filter(a=>a.attributes.roadId===t);if(i.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(s!==void 0){const a=[];if(i.forEach(c=>{const n=Number(c.attributes.sectionId);a.indexOf(n)===-1&&a.push(n)}),a.sort((c,n)=>c-n),s>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};s=a[s],i=i.filter(c=>Number(c.attributes.sectionId)===s)}if(o!==void 0){const a=[];if(i.forEach(c=>{const n=Number(c.attributes.laneId);a.indexOf(n)===-1&&a.push(n)}),a.sort((c,n)=>c-n),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],i=i.filter(c=>Number(c.attributes.laneId)===o)}const l=i.map(a=>a.geometry),r=L.union(l);if(e.flash){const a=new I({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,s=!0;const o=setInterval(()=>{s?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(s=!1,t++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(s=!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"))}):(this.highlightLayer.removeAll(),this.sectionLayer.removeAll(),this.selectedSectionIds=[],this.splitLaneLayer.removeAll()),!e||e.type==="edge"){let t;!e||!e.id||e.id===""?t=this.sectionLayer.graphics.toArray():t=this.sectionLayer.graphics.filter(s=>s.getAttribute("edgeId")===e.id).toArray(),t.length>0&&(t.forEach(s=>{const o=s.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(i=>i!==o)}),this.sectionLayer.removeMany(t))}return{status:0,message:"ok"}}async 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 s=String(t[0]);s.startsWith("-")&&(s=s.slice(1));let o=0;t.length===2&&(o=Number(t[1]));let i=[];if(t.length===1?i=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===s):t.length===2&&(i=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===s&&l.getAttribute("sectionIndex")===o)),i.length>0){const l=new Map;return i.forEach(r=>{const a=r.getAttribute("roadId")+"+"+r.getAttribute("sectionId");this.selectedSectionIds.includes(a)||this.selectedSectionIds.push(a);let c=l.get(a);c?c.push(r.geometry):(c=[r.geometry],l.set(a,c))}),l.forEach(async(r,a)=>{const c=L.union(r),n=new I({geometry:c,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(n),await this.view.goTo(n)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const t=new A.Polygon({rings:[e]}),s=await this.laneLayer.queryFeatures({geometry:t,outFields:["*"]}),o=[],i=[];for(const a of s.features){const c=a.getAttribute("roadId"),n=a.getAttribute("sectionIndex"),d=`${c}#${n}`;if(o.indexOf(d)===-1){o.push(d),this.selectSumo({type:"edge",id:d});const m=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,u=await w.get(m,{params:{id:`${c}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});u.status===200&&u.data.status===0&&i.push(u.data.result)}}const l=this.junctionLayer.graphics.filter(a=>{const c=a.geometry;return L.contains(t,c)}),r=[];for(const a of l){const c=a.getAttribute("id");this.selectSumo({type:"junction",id:c});const n=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await w.get(n,{params:{id:c,projectName:this.projectName}});d.status===200&&d.data.status===0&&r.push(d.data.result)}return{status:0,message:"ok",result:{junctions:r,edges:i}}}async splitLane(e){const s=e.id.split("_");if(s.length!==2)return{status:-1,message:"车道编号格式错误"};const o=Number(s[1]),i=s[0].split("#"),l=i.length===2?Number(i[1]):0;let r=i[0];r.startsWith("-")&&(r=r.slice(1));const a=this.allLaneGraphics.filter(b=>b.getAttribute("roadId")===r&&b.getAttribute("sectionIndex")===l);if(a.length===0)return{status:-1,message:"未找到路段"};const c=a.length-o,n=a.find(b=>Math.abs(b.getAttribute("laneId"))===c);if(!n)return{status:-1,message:"未找到车道"};const d=e.start||0,m=e.end||100,u=B.lineString(n.getAttribute("leftLine")),h=O.lineSliceAlong(u,d,m,{units:"meters"}),p=B.lineString(n.getAttribute("rightLine")),g=O.lineSliceAlong(p,d,m,{units:"meters"}),y=h.geometry.coordinates.concat(g.geometry.coordinates.reverse());y.push(y[y.length-1]);const f=new I({geometry:new A.Polygon({rings:[y]}),attributes:{ObjectID:n.getAttribute("ObjectID"),id:n.getAttribute("id"),fromNode:n.getAttribute("fromNode"),toNode:n.getAttribute("toNode"),roadId:n.getAttribute("roadId"),roadName:n.getAttribute("roadName"),sectionId:n.getAttribute("sectionId"),sectionIndex:n.getAttribute("sectionIndex"),laneId:n.getAttribute("laneId"),type:n.getAttribute("type"),sumoId:n.getAttribute("sumoId"),leftLine:h.geometry.coordinates,rightLine:g.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(f),k.default.viewGoto(this.view,[f]),{status:0,message:"ok",result:{coordinates:y}}}blockLane(e){const t=this.allLaneGraphics.filter(o=>{var l;let i=String(o.getAttribute("laneId"));return i.startsWith("-")&&(i=i.slice(1)),o.getAttribute("roadId")===e.roadsectId&&((l=o.getAttribute("roadsectBaseIds"))==null?void 0:l.includes(e.roadsectBaseId))&&i===String(e.laneId)}),s=t.map(o=>{const i=o.clone();return console.log(t[0].getAttribute("roadsectBaseIds"),this.selectedSectionIds,this.selectedSectionIds.includes(t[0].getAttribute("roadsectBaseIds"))),i.symbol={type:"simple-fill",color:this.selectedSectionIds.includes(t[0].getAttribute("roadsectBaseIds"))?[255,69,0,.8]:[255,0,0,.8],outline:{color:"red"}},i});this.splitLaneLayer.addMany(s),k.default.viewGoto(this.view,s)}clearSplitLane(){this.splitLaneLayer.removeAll()}selectComputable(e){if(e.type==="roadsectBase"){this.allLaneGraphics.forEach(s=>{s.getAttribute("roadsectBaseIds")||console.log(s.attributes)});const t=this.allLaneGraphics.filter(s=>{var o;return(o=s.getAttribute("roadsectBaseIds"))==null?void 0:o.includes(e.id)});if(t.length>0){const s=L.union(t.map(r=>r.geometry)),o=t[0].getAttribute("roadsectBaseIds"),i=new I({geometry:s,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",roadsectBaseIds:o}});this.sectionLayer.removeAll(),this.sectionLayer.add(i),k.default.viewGoto(this.view,[i]),this.selectedSectionIds=[o];const l=this.splitLaneLayer.graphics.filter(r=>{var a;return(a=r.getAttribute("roadsectBaseIds"))==null?void 0:a.includes(e.id)});l.length>0&&l.forEach(r=>r.symbol={type:"simple-fill",color:[255,69,0],outline:{color:"red",width:2}})}}}updateAllJunctionSymbol(e){const t=this.junctionLayer.graphics.clone();this.junctionLayer.removeAll(),t.forEach(s=>{s.getAttribute("selected")||(s.symbol=this.getCrossGraphicSymbol(s.attributes,e))}),this.junctionLayer.addMany(t.toArray())}getCrossGraphicSymbol(e,t){const s=e.crossId!==""&&e.crossId!==void 0&&e.crossId!==null;if(t==="marker")return{type:"picture-marker",url:`/GisViewerAssets/Images/cross/${s?"gis_xhj_blue":"gis_lkcz_xz"}.png`,width:"32px",height:"32px"};if(t==="picture")return s?{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:s?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=C;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("@arcgis/core/Graphic"),J=require("@arcgis/core/core/promiseUtils"),E=require("@arcgis/core/core/reactiveUtils.js"),A=require("@arcgis/core/geometry"),q=require("@arcgis/core/geometry/geometryEngine"),x=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),T=require("@turf/helpers"),O=require("@turf/line-slice-along"),w=require("axios"),_=require("fast-xml-parser"),R=require("md5"),M=require("pako"),z=require("vue"),H=require("../../stores/index.js"),k=require("../common-utils.js");function N(S){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(S){for(const i in S)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(S,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>S[i]})}}return e.default=S,Object.freeze(e)}const P=N(J),U=N(E),L=N(q),B=N(T);class C{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"},{name:"roadsectBaseIds",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 v({id:"OpenDriveJunction"}),this.sectionLayer=new v({id:"OpenDriveSection"}),this.highlightLayer=new v({id:"OpenDriveHighlight"}),this.flashLayer=new v({id:"OpenDriveFlash"}),this.drawLayer=new v({id:"Draw"}),this.splitLaneLayer=new v({id:"SplitLane"}),this.borderLayer=new v({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 C(e)),this.instance}async makeMd5FromFile(e){var i;try{const o=await(await fetch(e)).text();let r=(i=new _.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(o).OpenDRIVE.userData)==null?void 0:i.border;return r?r=JSON.parse(r):r=[],{status:0,message:"ok",result:{md5:R(o),border:r}}}catch(s){return{status:-1,message:s.message}}}async showOpenDriveFromFile(e){var d,m,u;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")});let i=e.file.split("/").pop()||"";i=i.split(".").slice(0,-1).join("."),this.openDriveServer=e.server;const s=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await w.post(s,{},{params:{url:e.file,projectName:i}})}catch(h){return{status:-1,message:h.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const t=o.data.result.geoSetting;k.default.setGeoData(t.geoReference,t.offsetX,t.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const r=await fetch(l);let a;if(l.endsWith("bin")){const h=await r.arrayBuffer(),p=M.inflate(h,{to:"string"});a=JSON.parse(p)}else a=await r.json();if(await this.showAllLanes(a,((d=e.options)==null?void 0:d.showJunctionLane)||!1,((m=e.options)==null?void 0:m.showRoadName)||!0),((u=e.options)==null?void 0:u.showJunctionPoint)!==!1){const h=o.data.result.junctions;this.showJunction(h)}e.options&&e.options.centerMap!==!1&&await this.view.goTo(this.allLaneGraphics),this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick();const n=H.default.useAppDataStore;return z.watch(()=>n.isSketching,()=>{var h,p;n.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,i){const s=`http://${e}/api/openDrive/analyzeXodr`,o=await w.get(s,{headers:{projectName:i},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let t=o.data.result.json;t.startsWith(window.location.protocol)||(t=`${window.location.protocol}//${e}${t}`);const l=await fetch(t);let r;if(t.endsWith("bin")){const a=await l.arrayBuffer(),c=M.inflate(a,{to:"string"});r=JSON.parse(c)}else r=await l.json();return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,i,s){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=s,new Promise(t=>{var c;let l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const r=[];for(const n of e){if(!i&&n.junction!=="-1")continue;const{id:d,refLine:m}=n;let u=n.name;u.includes("(")&&(u=u.slice(0,u.indexOf("("))),u=u.replace(/(.)/g,"$1 ");const h=new I({geometry:{type:"polyline",paths:[m]},attributes:{ObjectID:l++,roadId:d,roadName:u}});this.allRefLineGraphics.push(h),n.laneSections.sort((p,g)=>Number(p.id)-Number(g.id));for(let p=0;p<n.laneSections.length;p++){const g=n.laneSections[p],y=Number(g.id);for(const f of g.lanePaths){const b=Number(f.id);if(b===0)continue;const $=f.type,F=[...f.outerPath],j=f.innerPath.concat(F.reverse());if(j.length<=3){console.warn(`lane ${b} has less than 3 points`);continue}j.push(f.innerPath[0]);const D=new A.Polygon({rings:[j]});if(D){const G=new I({geometry:D,attributes:{ObjectID:l++,id:`${d}+${y}+${b}`,fromNode:n.fromNode,toNode:n.toNode,roadId:String(d),roadName:n.name,sectionId:String(y),sectionIndex:p,laneId:b,type:$,sumoId:"",leftLine:f.innerPath,rightLine:f.outerPath,roadsectBaseIds:(c=g.roadsectBaseIds)==null?void 0:c.toString()}});this.allLaneGraphics.push(G),r.push(G)}}}}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),t()},10)})}showJunction(e){const i=[];let s;this.xodrBorder.length>0&&(s=new A.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 t=new A.Point({x:o.coordinates[0],y:o.coordinates[1]});let l=!0;if(s&&(l=L.contains(s,t)),l){const r=new I({geometry:t,attributes:{...o,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(o,"marker")});i.push(r)}}this.junctionLayer.addMany(i)}monitorMouseMove(){const e=P.debounce(async i=>{var l;const o=(l=(await this.view.hitTest(i,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.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 t=o[0];if(this.hitGraphic=t.graphic,t.layer.id==="OpenDriveLane"){const r=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`,a=this.hitGraphic.getAttribute("roadsectBaseIds");if(this.currentSectionCode===r||this.selectedSectionIds.includes(a)||this.sectionLayer.graphics.findIndex(y=>y.getAttribute("id")===r)>=0)return;this.currentSectionCode=r;const n=this.allLaneGraphics.filter(y=>`${y.attributes.roadId}+${y.attributes.sectionId}`===r),d=L.union(n.map(y=>y.geometry)),m=this.hitGraphic.getAttribute("fromNode"),u=this.hitGraphic.getAttribute("toNode"),h=this.junctionNames.get(m)||m,p=this.junctionNames.get(u)||u,g=new I({geometry:d,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:h,toNodeName:p,laneCount:n.length,roadsectBaseIds:this.hitGraphic.getAttribute("roadsectBaseIds"),roadId:this.hitGraphic.getAttribute("roadId")},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(g)}else if(t.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 i=>{e(i).catch(()=>{})})}monitorMouseClick(){const e=P.debounce(async i=>{var a;const o=(a=(await this.view.hitTest(i,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(c=>c.type==="graphic");if(o.length===0)return;const t=o[0].graphic,l=t.getAttribute("type"),r=t.getAttribute("id");if(l==="OpenDriveJunction")if(t.getAttribute("selected")===!1){const c=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,n=await w.get(c,{params:{id:r,projectName:this.projectName}});n.status===200&&n.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:n.data.result}),t.setAttribute("selected",!0),t.symbol={type:"picture-marker",url:"/GisViewerAssets/Images/point_red.png",width:"20px",height:"20px"},this.increasePictureMarkerSize(t,50))}else this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:void 0}),t.setAttribute("selected",!1),t.symbol=this.getCrossGraphicSymbol(t.attributes,this.view.scale<this.junctionScale?"picture":"marker");else l==="OpenDriveSection"&&(t.layer.id==="OpenDriveHighlight"?(this.highlightLayer.removeAll(),this.sectionLayer.removeAll(),this.selectedSectionIds=[],this.sectionLayer.add(t),t.setAttribute("selected",!0),this.selectedSectionIds.push(r),this.splitLaneLayer.graphics.filter(n=>n.getAttribute("roadsectBaseIds")===t.getAttribute("roadsectBaseIds")).forEach(n=>n.symbol={type:"simple-fill",color:[255,69,0],outline:{color:"red",width:2}}),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:t.getAttribute("id"),details:{roadsectId:t.getAttribute("roadId"),roadsectBaseIds:t.getAttribute("roadsectBaseIds")}})):(this.splitLaneLayer.graphics.filter(n=>n.getAttribute("roadsectBaseIds")===t.getAttribute("roadsectBaseIds")).forEach(n=>n.symbol={type:"simple-fill",color:[255,0,0,.8],outline:{color:"red",width:1}}),this.sectionLayer.remove(t),this.selectedSectionIds=[],this.openDriveClickCallback&&this.openDriveClickCallback({type:"CloseOpenDriveSection",id:t.getAttribute("roadsectBaseIds"),details:{roadsectId:t.getAttribute("roadId"),roadsectBaseIds:t.getAttribute("roadsectBaseIds")}})))});this.mouseClickHandler=this.view.on("immediate-click",async i=>{e(i).catch(()=>{})})}increasePictureMarkerSize(e,i){const s=setInterval(()=>{const o=e.symbol,t=o.width;t<i?e.symbol={type:"picture-marker",url:o.url,width:t+1,height:t+1}:clearInterval(s)},20)}decreasePictureMarkerSize(e,i){const s=setInterval(()=>{const o=e.symbol,t=o.width;t>i?e.symbol={type:"picture-marker",url:o.url,width:t-1,height:t-1}:clearInterval(s)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const i=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,s=await w.get(i,{params:{id:e.id,projectName:this.projectName}});return s.status===200?s.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const i=e.id.split("#");let s=i[0];s.startsWith("-")&&(s=s.slice(1));let o=0;i.length===2&&(o=Number(i[1]));const t=this.allLaneGraphics.find(l=>l.getAttribute("roadId")===s&&l.getAttribute("sectionIndex")===o);if(t){const l=`${s}+${t.getAttribute("sectionId")}`,r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await w.get(r,{params:{id:l,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${l}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}setOpendriveVisibility(e){this.laneLayer.visible=e}async clearOpenDrive(){var i,s,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(),(i=this.mouseMoveHandler)==null||i.remove(),this.mouseMoveHandler=void 0,(s=this.mouseClickHandler)==null||s.remove(),this.mouseClickHandler=void 0,(o=this.scaleWatch)==null||o.remove(),this.scaleWatch=void 0}async findSumo(e){const{type:i,id:s}=e,o=e.flash===void 0?!0:e.flash;if(i==="junction")return await this.findJunction(s,o);if(i==="edge"){const t=s.split("_");if(t.length>2)return{status:-1,message:"id格式错误"};const l=t.length===2?Number(t[1]):void 0,r=t[0].split("#");if(r.length>2)return{status:-1,message:"id格式错误"};const a=r[0],c=r.length===2?Number(r[1]):void 0;return await this.findLane({roadsectId:a,segmentId:c,laneId:l,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,i){const s=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!s)return{status:-1,message:"未找到。请检查路口编号"};if(i){const o=new I({geometry:s.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(s.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:i,segmentId:s,laneId:o}=e;i.startsWith("-")&&(i=i.slice(1));let t=this.allLaneGraphics.filter(a=>a.attributes.roadId===i);if(t.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(s!==void 0){const a=[];if(t.forEach(c=>{const n=Number(c.attributes.sectionId);a.indexOf(n)===-1&&a.push(n)}),a.sort((c,n)=>c-n),s>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};s=a[s],t=t.filter(c=>Number(c.attributes.sectionId)===s)}if(o!==void 0){const a=[];if(t.forEach(c=>{const n=Number(c.attributes.laneId);a.indexOf(n)===-1&&a.push(n)}),a.sort((c,n)=>c-n),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],t=t.filter(c=>Number(c.attributes.laneId)===o)}const l=t.map(a=>a.geometry),r=L.union(l);if(e.flash){const a=new I({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 i=0,s=!0;const o=setInterval(()=>{s?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(s=!1,i++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(s=!0)),i>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if(e?e.type==="junction"&&this.junctionLayer.graphics.forEach(i=>{(!e||!e.id||e.id===""||e.id===i.getAttribute("id"))&&i.getAttribute("selected")&&(i.setAttribute("selected",!1),i.symbol=this.getCrossGraphicSymbol(i.attributes,this.view.scale<this.junctionScale?"picture":"marker"))}):(this.highlightLayer.removeAll(),this.sectionLayer.removeAll(),this.selectedSectionIds=[],this.splitLaneLayer.removeAll()),!e||e.type==="edge"){let i;!e||!e.id||e.id===""?i=this.sectionLayer.graphics.toArray():i=this.sectionLayer.graphics.filter(s=>s.getAttribute("edgeId")===e.id).toArray(),i.length>0&&(i.forEach(s=>{const o=s.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(t=>t!==o)}),this.sectionLayer.removeMany(i))}return{status:0,message:"ok"}}async selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(i=>{if(e.id===i.getAttribute("id"))return i.setAttribute("selected",!0),i.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(i,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const i=e.id.split("#");let s=String(i[0]);s.startsWith("-")&&(s=s.slice(1));let o=0;i.length===2&&(o=Number(i[1]));let t=[];if(i.length===1?t=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===s):i.length===2&&(t=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===s&&l.getAttribute("sectionIndex")===o)),t.length>0){const l=new Map;return t.forEach(r=>{const a=r.getAttribute("roadId")+"+"+r.getAttribute("sectionId");this.selectedSectionIds.includes(a)||this.selectedSectionIds.push(a);let c=l.get(a);c?c.push(r.geometry):(c=[r.geometry],l.set(a,c))}),l.forEach(async(r,a)=>{const c=L.union(r),n=new I({geometry:c,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(n),await this.view.goTo(n)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const i=new A.Polygon({rings:[e]}),s=await this.laneLayer.queryFeatures({geometry:i,outFields:["*"]}),o=[],t=[];for(const a of s.features){const c=a.getAttribute("roadId"),n=a.getAttribute("sectionIndex"),d=`${c}#${n}`;if(o.indexOf(d)===-1){o.push(d),this.selectSumo({type:"edge",id:d});const m=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,u=await w.get(m,{params:{id:`${c}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});u.status===200&&u.data.status===0&&t.push(u.data.result)}}const l=this.junctionLayer.graphics.filter(a=>{const c=a.geometry;return L.contains(i,c)}),r=[];for(const a of l){const c=a.getAttribute("id");this.selectSumo({type:"junction",id:c});const n=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await w.get(n,{params:{id:c,projectName:this.projectName}});d.status===200&&d.data.status===0&&r.push(d.data.result)}return{status:0,message:"ok",result:{junctions:r,edges:t}}}async splitLane(e){const s=e.id.split("_");if(s.length!==2)return{status:-1,message:"车道编号格式错误"};const o=Number(s[1]),t=s[0].split("#"),l=t.length===2?Number(t[1]):0;let r=t[0];r.startsWith("-")&&(r=r.slice(1));const a=this.allLaneGraphics.filter(b=>b.getAttribute("roadId")===r&&b.getAttribute("sectionIndex")===l);if(a.length===0)return{status:-1,message:"未找到路段"};const c=a.length-o,n=a.find(b=>Math.abs(b.getAttribute("laneId"))===c);if(!n)return{status:-1,message:"未找到车道"};const d=e.start||0,m=e.end||100,u=B.lineString(n.getAttribute("leftLine")),h=O.lineSliceAlong(u,d,m,{units:"meters"}),p=B.lineString(n.getAttribute("rightLine")),g=O.lineSliceAlong(p,d,m,{units:"meters"}),y=h.geometry.coordinates.concat(g.geometry.coordinates.reverse());y.push(y[y.length-1]);const f=new I({geometry:new A.Polygon({rings:[y]}),attributes:{ObjectID:n.getAttribute("ObjectID"),id:n.getAttribute("id"),fromNode:n.getAttribute("fromNode"),toNode:n.getAttribute("toNode"),roadId:n.getAttribute("roadId"),roadName:n.getAttribute("roadName"),sectionId:n.getAttribute("sectionId"),sectionIndex:n.getAttribute("sectionIndex"),laneId:n.getAttribute("laneId"),type:n.getAttribute("type"),sumoId:n.getAttribute("sumoId"),leftLine:h.geometry.coordinates,rightLine:g.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(f),k.default.viewGoto(this.view,[f]),{status:0,message:"ok",result:{coordinates:y}}}clearSplitLane(){this.splitLaneLayer.removeAll()}blockLane(e){const i=this.allLaneGraphics.filter(o=>{var l;let t=String(o.getAttribute("laneId"));return t.startsWith("-")&&(t=t.slice(1)),o.getAttribute("roadId")===e.roadsectId&&((l=o.getAttribute("roadsectBaseIds"))==null?void 0:l.includes(e.roadsectBaseId))&&t===String(e.laneId)}),s=i.map(o=>{const t=o.clone();return t.symbol={type:"simple-fill",color:this.selectedSectionIds.includes(i[0].getAttribute("roadsectBaseIds"))?[255,69,0,.8]:[255,0,0,.8],outline:{color:"red"}},t});this.splitLaneLayer.addMany(s),k.default.viewGoto(this.view,s)}clearBlockLane(e){const i=this.splitLaneLayer.graphics.filter(s=>{const o=s.getAttribute("roadId"),t=s.getAttribute("roadsectBaseIds");let l=String(s.getAttribute("laneId"));return l.startsWith("-")&&(l=l.slice(1)),o===e.roadsectId&&(t==null?void 0:t.includes(e.roadsectBaseId))&&l===String(e.laneId)});this.splitLaneLayer.removeMany(i.toArray())}selectComputable(e){if(e.type==="roadsectBase"){const i=this.allLaneGraphics.filter(s=>{var o;return(o=s.getAttribute("roadsectBaseIds"))==null?void 0:o.includes(e.id)});if(i.length>0){const s=L.union(i.map(r=>r.geometry)),o=i[0].getAttribute("roadsectBaseIds"),t=new I({geometry:s,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",roadsectBaseIds:o}});this.sectionLayer.removeAll(),this.sectionLayer.add(t),k.default.viewGoto(this.view,[t]),this.selectedSectionIds=[o];const l=this.splitLaneLayer.graphics.filter(r=>{var a;return(a=r.getAttribute("roadsectBaseIds"))==null?void 0:a.includes(e.id)});l.length>0&&l.forEach(r=>r.symbol={type:"simple-fill",color:[255,69,0],outline:{color:"red",width:2}})}}}updateAllJunctionSymbol(e){const i=this.junctionLayer.graphics.clone();this.junctionLayer.removeAll(),i.forEach(s=>{s.getAttribute("selected")||(s.symbol=this.getCrossGraphicSymbol(s.attributes,e))}),this.junctionLayer.addMany(i.toArray())}getCrossGraphicSymbol(e,i){const s=e.crossId!==""&&e.crossId!==void 0&&e.crossId!==null;if(i==="marker")return{type:"picture-marker",url:`/GisViewerAssets/Images/cross/${s?"gis_xhj_blue":"gis_lkcz_xz"}.png`,width:"32px",height:"32px"};if(i==="picture")return s?{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:s?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=C;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.264",
3
+ "version": "1.0.266",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [