gisviewer-vue3-arcgis 1.0.150 → 1.0.151

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,20 @@
1
1
  import y from "@arcgis/core/Graphic";
2
2
  import * as j from "@arcgis/core/core/promiseUtils";
3
- import { Polygon as S } from "@arcgis/core/geometry";
3
+ import { Polygon as N } from "@arcgis/core/geometry";
4
4
  import * as L from "@arcgis/core/geometry/geometryEngine";
5
5
  import k from "@arcgis/core/layers/FeatureLayer";
6
- import I from "@arcgis/core/layers/GraphicsLayer";
6
+ import v from "@arcgis/core/layers/GraphicsLayer";
7
7
  import * as G from "@turf/helpers";
8
8
  import { lineSliceAlong as C } from "@turf/line-slice-along";
9
9
  import b from "axios";
10
- import M from "md5";
10
+ import $ from "md5";
11
11
  import O from "pako";
12
12
  import { watch as x } from "vue";
13
13
  import J from "../../stores/index.mjs";
14
14
  import P from "../common-utils.mjs";
15
15
  class F {
16
16
  constructor(e) {
17
- this.junctionNames = /* @__PURE__ */ new Map(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.currentJunctionId = "", this.view = e, this.view.popup.visibleElements = {
18
- collapseButton: !1,
19
- actionBar: !1
20
- }, this.laneLayer = new k({
17
+ this.junctionNames = /* @__PURE__ */ new Map(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.selectedSectionIds = [], this.currentJunctionId = "", this.view = e, this.laneLayer = new k({
21
18
  id: "OpenDriveLane",
22
19
  fields: [
23
20
  {
@@ -45,6 +42,11 @@ class F {
45
42
  alias: "路段号",
46
43
  type: "string"
47
44
  },
45
+ {
46
+ name: "sectionIndex",
47
+ alias: "路段序号",
48
+ type: "string"
49
+ },
48
50
  {
49
51
  name: "laneId",
50
52
  alias: "车道号",
@@ -285,7 +287,7 @@ class F {
285
287
  }
286
288
  }
287
289
  ]
288
- }), this.junctionLayer = new I({ id: "OpenDriveJunction" }), this.sectionLayer = new I({ id: "OpenDriveSection" }), this.highlightLayer = new I({ id: "OpenDriveHighlight" }), this.flashLayer = new I({ id: "OpenDriveFlash" }), this.drawLayer = new I({ id: "Draw" }), this.splitLaneLayer = new I({ id: "SplitLane" }), this.view.map.addMany([
290
+ }), 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.view.map.addMany([
289
291
  this.laneLayer,
290
292
  this.junctionLayer,
291
293
  this.sectionLayer,
@@ -302,7 +304,7 @@ class F {
302
304
  async makeMd5FromFile(e) {
303
305
  try {
304
306
  const i = await (await fetch(e)).text();
305
- return { status: 0, message: "ok", result: M(i) };
307
+ return { status: 0, message: "ok", result: $(i) };
306
308
  } catch (t) {
307
309
  return { status: -1, message: t.message };
308
310
  }
@@ -320,9 +322,9 @@ class F {
320
322
  return t;
321
323
  this.projectName = t.result, console.timeEnd("md5用时"), this.openDriveServer = e.server, await this.makeMd5FromFile(e.file);
322
324
  const i = `http://${this.openDriveServer}/api/openDrive/uploadXodr`;
323
- let o;
325
+ let r;
324
326
  try {
325
- o = await b.post(
327
+ r = await b.post(
326
328
  i,
327
329
  {},
328
330
  {
@@ -335,31 +337,31 @@ class F {
335
337
  } catch (m) {
336
338
  return { status: -1, message: m.message };
337
339
  }
338
- if (o.status !== 200)
339
- return { status: -1, message: o.statusText };
340
+ if (r.status !== 200)
341
+ return { status: -1, message: r.statusText };
340
342
  console.time("渲染用时");
341
- const s = o.data.result.geoSetting;
343
+ const s = r.data.result.geoSetting;
342
344
  P.setGeoData(
343
345
  s.geoReference,
344
346
  s.offsetX,
345
347
  s.offsetY
346
348
  );
347
- let c = o.data.result.json;
349
+ let c = r.data.result.json;
348
350
  c.startsWith(window.location.protocol) || (c = `${window.location.protocol}//${e.server}${c}`);
349
- const a = await (await fetch(c)).arrayBuffer(), r = O.inflate(a, { to: "string" }), n = JSON.parse(r);
351
+ const a = await (await fetch(c)).arrayBuffer(), o = O.inflate(a, { to: "string" }), l = JSON.parse(o);
350
352
  await this.showAllLanes(
351
- n,
353
+ l,
352
354
  ((g = e.options) == null ? void 0 : g.showJunctionLane) || !1,
353
355
  ((p = e.options) == null ? void 0 : p.showRoadName) || !0
354
356
  );
355
- const d = o.data.result.junctions;
357
+ const d = r.data.result.junctions;
356
358
  this.showJunction(d), e.options && e.options.centerMap !== !1 && await this.view.goTo(this.allLaneGraphics), this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick();
357
359
  const h = J.useAppDataStore;
358
360
  return x(
359
361
  () => h.isSketching,
360
362
  () => {
361
- var m, u;
362
- h.isSketching ? ((m = this.mouseMoveHandler) == null || m.remove(), this.mouseMoveHandler = void 0, (u = this.mouseClickHandler) == null || u.remove(), this.mouseClickHandler = void 0) : (this.monitorMouseMove(), this.monitorMouseClick());
363
+ var m, f;
364
+ h.isSketching ? ((m = this.mouseMoveHandler) == null || m.remove(), this.mouseMoveHandler = void 0, (f = this.mouseClickHandler) == null || f.remove(), this.mouseClickHandler = void 0) : (this.monitorMouseMove(), this.monitorMouseClick());
363
365
  }
364
366
  ), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
365
367
  }
@@ -369,7 +371,7 @@ class F {
369
371
  * @param projectName
370
372
  */
371
373
  async showOpenDriveFromServer(e, t) {
372
- const i = `http://${e}/api/openDrive/analyzeXodr`, o = await b.get(i, {
374
+ const i = `http://${e}/api/openDrive/analyzeXodr`, r = await b.get(i, {
373
375
  headers: {
374
376
  projectName: t
375
377
  },
@@ -378,12 +380,12 @@ class F {
378
380
  compressed: !0
379
381
  }
380
382
  });
381
- if (o.status !== 200)
382
- throw new Error(`OpenDriveRenderer: ${o.statusText}`);
383
- let s = o.data.result.json;
383
+ if (r.status !== 200)
384
+ throw new Error(`OpenDriveRenderer: ${r.statusText}`);
385
+ let s = r.data.result.json;
384
386
  s.startsWith(window.location.protocol) || (s = `${window.location.protocol}//${e}${s}`);
385
- const l = await (await fetch(s)).arrayBuffer(), a = O.inflate(l, { to: "string" }), r = JSON.parse(a);
386
- return await this.showAllLanes(r, !1, !1), { status: 0, message: "ok" };
387
+ const n = await (await fetch(s)).arrayBuffer(), a = O.inflate(n, { to: "string" }), o = JSON.parse(a);
388
+ return await this.showAllLanes(o, !1, !1), { status: 0, message: "ok" };
387
389
  }
388
390
  /**
389
391
  * 显示所有车道
@@ -393,19 +395,18 @@ class F {
393
395
  * @returns
394
396
  */
395
397
  async showAllLanes(e, t, i) {
396
- const o = await this.laneLayer.queryFeatures();
397
- return o.features.length > 0 && this.laneLayer.applyEdits({
398
- deleteFeatures: o.features
398
+ const r = await this.laneLayer.queryFeatures();
399
+ return r.features.length > 0 && this.laneLayer.applyEdits({
400
+ deleteFeatures: r.features
399
401
  }), this.roadNameLayer.visible = i, new Promise((s) => {
400
402
  let c = 0;
401
403
  this.allLaneGraphics = [], this.allRefLineGraphics = [];
402
- const l = [];
403
- console.log(e.length);
404
- for (const r of e) {
405
- if (!t && r.junction !== "-1")
404
+ const n = [];
405
+ for (const o of e) {
406
+ if (!t && o.junction !== "-1")
406
407
  continue;
407
- const { id: n, refLine: d } = r;
408
- let h = r.name;
408
+ const { id: l, refLine: d } = o;
409
+ let h = o.name;
409
410
  h.includes("(") && (h = h.slice(0, h.indexOf("("))), h = h.replace(/(.)/g, "$1 ");
410
411
  const g = new y({
411
412
  geometry: {
@@ -414,65 +415,65 @@ class F {
414
415
  },
415
416
  attributes: {
416
417
  ObjectID: c++,
417
- roadId: n,
418
+ roadId: l,
418
419
  roadName: h
419
420
  }
420
421
  });
421
- this.allRefLineGraphics.push(g), r.laneSections.sort((p, m) => Number(p.id) - Number(m.id));
422
- for (let p = 0; p < r.laneSections.length; p++) {
423
- const m = r.laneSections[p], u = Number(m.id);
424
- for (const f of m.lanePaths) {
425
- const w = Number(f.id);
422
+ this.allRefLineGraphics.push(g), o.laneSections.sort((p, m) => Number(p.id) - Number(m.id));
423
+ for (let p = 0; p < o.laneSections.length; p++) {
424
+ const m = o.laneSections[p], f = Number(m.id);
425
+ for (const u of m.lanePaths) {
426
+ const w = Number(u.id);
426
427
  if (w === 0)
427
428
  continue;
428
- const v = f.type, $ = [...f.outerPath], N = f.innerPath.concat(
429
- $.reverse()
429
+ const I = u.type, M = [...u.outerPath], S = u.innerPath.concat(
430
+ M.reverse()
430
431
  );
431
- if (N.length <= 3) {
432
+ if (S.length <= 3) {
432
433
  console.warn(`lane ${w} has less than 3 points`);
433
434
  continue;
434
435
  }
435
- N.push(f.innerPath[0]);
436
- const A = new S({
437
- rings: [N]
436
+ S.push(u.innerPath[0]);
437
+ const A = new N({
438
+ rings: [S]
438
439
  });
439
440
  if (A) {
440
441
  const D = new y({
441
442
  geometry: A,
442
443
  attributes: {
443
444
  ObjectID: c++,
444
- id: `${n}+${u}+${w}`,
445
- fromNode: r.fromNode,
446
- toNode: r.toNode,
447
- roadId: String(n),
448
- roadName: r.name,
449
- sectionId: String(u),
445
+ id: `${l}+${f}+${w}`,
446
+ fromNode: o.fromNode,
447
+ toNode: o.toNode,
448
+ roadId: String(l),
449
+ roadName: o.name,
450
+ sectionId: String(f),
450
451
  sectionIndex: p,
451
452
  laneId: w,
452
- type: v,
453
+ type: I,
453
454
  sumoId: "",
454
455
  // 记录左右边线的起始点,用于按长度高亮车道的一部分
455
- leftLine: f.innerPath,
456
- rightLine: f.outerPath
456
+ leftLine: u.innerPath,
457
+ rightLine: u.outerPath
457
458
  }
458
459
  });
459
- this.allLaneGraphics.push(D), l.push(D);
460
+ this.allLaneGraphics.push(D), n.push(D);
460
461
  }
461
462
  }
462
463
  }
463
464
  }
464
465
  const a = setInterval(() => {
465
- if (l.length > 0 || this.allRefLineGraphics.length > 0) {
466
- if (l.length > 0) {
467
- const r = l.splice(0, 100);
466
+ if (n.length > 0 || this.allRefLineGraphics.length > 0) {
467
+ if (n.length > 0) {
468
+ const o = n.splice(0, 100);
468
469
  this.laneLayer.applyEdits({
469
- addFeatures: r
470
+ addFeatures: o
470
471
  });
471
472
  }
472
473
  if (this.allRefLineGraphics.length > 0) {
473
- const r = this.allRefLineGraphics.splice(0, 10);
474
+ const o = this.allRefLineGraphics.splice(0, 10);
474
475
  this.roadNameLayer.applyEdits({
475
- addFeatures: r
476
+ addFeatures: o
476
477
  });
477
478
  }
478
479
  } else
@@ -491,7 +492,7 @@ class F {
491
492
  if (!i)
492
493
  continue;
493
494
  this.junctionNames.set(i.id, i.name), i.nodeType = i.type;
494
- const o = new y({
495
+ const r = new y({
495
496
  geometry: {
496
497
  type: "point",
497
498
  x: i.coordinates[0],
@@ -527,7 +528,7 @@ class F {
527
528
  ]
528
529
  }
529
530
  });
530
- t.push(o);
531
+ t.push(r);
531
532
  }
532
533
  this.junctionLayer.addMany(t);
533
534
  }
@@ -537,32 +538,31 @@ class F {
537
538
  monitorMouseMove() {
538
539
  const e = j.debounce(async (t) => {
539
540
  var c;
540
- const o = (c = (await this.view.hitTest(t, {
541
+ const r = (c = (await this.view.hitTest(t, {
541
542
  include: [this.laneLayer, this.junctionLayer]
542
543
  })).results) == null ? void 0 : c.filter(
543
- (l) => l.type === "graphic"
544
+ (n) => n.type === "graphic"
544
545
  );
545
- if (o.length === 0) {
546
- this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = "", this.view.closePopup());
546
+ if (r.length === 0) {
547
+ this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = ""), this.view.closePopup();
547
548
  return;
548
549
  }
549
- const s = o[0];
550
+ const s = r[0];
550
551
  if (this.hitGraphic = s.graphic, s.layer.id === "OpenDriveLane") {
551
- const l = `${this.hitGraphic.getAttribute(
552
+ const n = `${this.hitGraphic.getAttribute(
552
553
  "roadId"
553
554
  )}+${this.hitGraphic.getAttribute("sectionId")}`;
554
- if (l === this.currentSectionCode || this.sectionLayer.graphics.findIndex(
555
- (u) => u.getAttribute("id") === l
555
+ if (this.currentSectionCode === n || this.selectedSectionIds.includes(n) || this.sectionLayer.graphics.findIndex(
556
+ (u) => u.getAttribute("id") === n
556
557
  ) >= 0)
557
558
  return;
558
- this.currentSectionCode = l;
559
- const r = this.allLaneGraphics.filter(
560
- (u) => `${u.attributes.roadId}+${u.attributes.sectionId}` === l
561
- ), n = L.union(
562
- r.map((u) => u.geometry)
563
- ), d = this.hitGraphic.getAttribute("fromNode"), h = this.hitGraphic.getAttribute("toNode"), g = this.junctionNames.get(d) || d, p = this.junctionNames.get(h) || h;
564
- this.highlightGraphic = new y({
565
- geometry: n,
559
+ this.currentSectionCode = n;
560
+ const o = this.allLaneGraphics.filter(
561
+ (u) => `${u.attributes.roadId}+${u.attributes.sectionId}` === n
562
+ ), l = L.union(
563
+ o.map((u) => u.geometry)
564
+ ), d = this.hitGraphic.getAttribute("fromNode"), h = this.hitGraphic.getAttribute("toNode"), g = this.junctionNames.get(d) || d, p = this.junctionNames.get(h) || h, m = new y({
565
+ geometry: l,
566
566
  symbol: {
567
567
  type: "simple-fill",
568
568
  color: [0, 255, 255, 0.5],
@@ -574,11 +574,11 @@ class F {
574
574
  },
575
575
  attributes: {
576
576
  type: "OpenDriveSection",
577
- id: l,
577
+ id: n,
578
578
  selected: !1,
579
579
  fromNodeName: g,
580
580
  toNodeName: p,
581
- laneCount: r.length
581
+ laneCount: o.length
582
582
  },
583
583
  popupTemplate: {
584
584
  title: this.hitGraphic.getAttribute("roadName"),
@@ -602,17 +602,18 @@ class F {
602
602
  }
603
603
  ]
604
604
  }
605
- }), this.highlightLayer.removeAll(), this.highlightLayer.add(this.highlightGraphic);
606
- const m = this.view.toMap(t);
605
+ });
606
+ this.highlightLayer.removeAll(), this.highlightLayer.add(m);
607
+ const f = this.view.toMap(t);
607
608
  this.view.openPopup({
608
- features: [this.highlightGraphic],
609
- location: m
609
+ features: [m],
610
+ location: f
610
611
  });
611
612
  } else if (s.layer.id === "OpenDriveJunction") {
612
- const l = this.hitGraphic.getAttribute("id");
613
- if (l === this.currentJunctionId)
613
+ const n = this.hitGraphic.getAttribute("id");
614
+ if (n === this.currentJunctionId)
614
615
  return;
615
- this.currentJunctionId = l, this.view.openPopup({
616
+ this.currentJunctionId = n, this.view.openPopup({
616
617
  features: [this.hitGraphic],
617
618
  location: this.hitGraphic.geometry
618
619
  });
@@ -629,60 +630,61 @@ class F {
629
630
  monitorMouseClick() {
630
631
  const e = j.debounce(async (t) => {
631
632
  var a;
632
- const o = (a = (await this.view.hitTest(t, {
633
+ const r = (a = (await this.view.hitTest(t, {
633
634
  include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
634
635
  })).results) == null ? void 0 : a.filter(
635
- (r) => r.type === "graphic"
636
+ (o) => o.type === "graphic"
636
637
  );
637
- if (o.length === 0)
638
+ if (r.length === 0)
638
639
  return;
639
- const s = o[0].graphic, c = s.getAttribute("type"), l = s.getAttribute("id");
640
+ const s = r[0].graphic, c = s.getAttribute("type"), n = s.getAttribute("id");
640
641
  if (c === "OpenDriveJunction")
641
642
  if (s.getAttribute("selected") === !1) {
642
- const r = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, n = await b.get(r, {
643
+ const o = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, l = await b.get(o, {
643
644
  params: {
644
- id: l,
645
+ id: n,
645
646
  projectName: this.projectName
646
647
  }
647
648
  });
648
- n.status === 200 && n.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
649
+ l.status === 200 && l.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
649
650
  type: "OpenDriveJunction",
650
- id: l,
651
- details: n.data.result
651
+ id: n,
652
+ details: l.data.result
652
653
  }), s.setAttribute("selected", !0), s.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(s, 50));
653
654
  } else {
654
655
  this.openDriveClickCallback && this.openDriveClickCallback({
655
656
  type: "OpenDriveJunction",
656
- id: l,
657
+ id: n,
657
658
  details: void 0
658
659
  }), s.setAttribute("selected", !1);
659
- const r = s.getAttribute("crossId");
660
- s.symbol.url = r ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(s, 30);
660
+ const o = s.getAttribute("crossId");
661
+ s.symbol.url = o ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(s, 30);
661
662
  }
662
663
  else if (c === "OpenDriveSection")
663
- if (s.getAttribute("selected"))
664
- this.sectionLayer.remove(s), this.openDriveClickCallback && this.openDriveClickCallback({
665
- type: "OpenDriveSection",
666
- id: s.getAttribute("edgeId"),
667
- details: void 0
668
- });
669
- else {
670
- this.highlightLayer.remove(s), this.sectionLayer.add(s), s.setAttribute("selected", !0);
671
- const r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, n = await b.get(r, {
664
+ if (s.layer.id === "OpenDriveHighlight") {
665
+ this.highlightLayer.remove(s), this.sectionLayer.add(s), s.setAttribute("selected", !0), this.selectedSectionIds.push(n);
666
+ const o = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, l = await b.get(o, {
672
667
  params: {
673
- id: l,
668
+ id: n,
674
669
  projectName: this.projectName
675
670
  }
676
671
  });
677
- if (n.status === 200 && n.data.status === 0 && this.openDriveClickCallback) {
678
- const d = n.data.result.obj_id;
672
+ if (l.status === 200 && l.data.status === 0 && this.openDriveClickCallback) {
673
+ const d = l.data.result.obj_id;
679
674
  s.setAttribute("edgeId", d), this.openDriveClickCallback({
680
675
  type: "OpenDriveSection",
681
676
  id: d,
682
- details: n.data.result
677
+ details: l.data.result
683
678
  });
684
679
  }
685
- }
680
+ } else
681
+ this.sectionLayer.remove(s), this.selectedSectionIds = this.selectedSectionIds.filter(
682
+ (o) => o !== n
683
+ ), this.openDriveClickCallback && this.openDriveClickCallback({
684
+ type: "OpenDriveSection",
685
+ id: s.getAttribute("edgeId"),
686
+ details: void 0
687
+ });
686
688
  });
687
689
  this.mouseClickHandler = this.view.on("immediate-click", async (t) => {
688
690
  e(t).catch(() => {
@@ -696,10 +698,10 @@ class F {
696
698
  */
697
699
  increasePictureMarkerSize(e, t) {
698
700
  const i = setInterval(() => {
699
- const o = e.symbol, s = o.width;
701
+ const r = e.symbol, s = r.width;
700
702
  s < t ? e.symbol = {
701
703
  type: "picture-marker",
702
- url: o.url,
704
+ url: r.url,
703
705
  width: s + 1,
704
706
  height: s + 1
705
707
  } : clearInterval(i);
@@ -712,10 +714,10 @@ class F {
712
714
  */
713
715
  decreasePictureMarkerSize(e, t) {
714
716
  const i = setInterval(() => {
715
- const o = e.symbol, s = o.width;
717
+ const r = e.symbol, s = r.width;
716
718
  s > t ? e.symbol = {
717
719
  type: "picture-marker",
718
- url: o.url,
720
+ url: r.url,
719
721
  width: s - 1,
720
722
  height: s - 1
721
723
  } : clearInterval(i);
@@ -736,15 +738,15 @@ class F {
736
738
  const t = e.id.split("#");
737
739
  let i = t[0];
738
740
  i.startsWith("-") && (i = i.slice(1));
739
- let o = 0;
740
- t.length === 2 && (o = Number(t[1]));
741
+ let r = 0;
742
+ t.length === 2 && (r = Number(t[1]));
741
743
  const s = this.allLaneGraphics.find(
742
- (c) => c.getAttribute("roadId") === i && c.getAttribute("sectionIndex") === o
744
+ (c) => c.getAttribute("roadId") === i && c.getAttribute("sectionIndex") === r
743
745
  );
744
746
  if (s) {
745
747
  const c = `${i}+${s.getAttribute(
746
748
  "sectionId"
747
- )}`, l = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, a = await b.get(l, {
749
+ )}`, n = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, a = await b.get(n, {
748
750
  params: {
749
751
  id: c,
750
752
  projectName: this.projectName
@@ -776,29 +778,29 @@ class F {
776
778
  * @returns
777
779
  */
778
780
  async findSumo(e) {
779
- const { type: t, id: i } = e, o = e.flash === void 0 ? !0 : e.flash;
781
+ const { type: t, id: i } = e, r = e.flash === void 0 ? !0 : e.flash;
780
782
  if (t === "junction")
781
- return await this.findJunction(i, o);
783
+ return await this.findJunction(i, r);
782
784
  if (t === "edge") {
783
785
  const s = i.split("_");
784
786
  if (s.length > 2)
785
787
  return { status: -1, message: "id格式错误" };
786
- const c = s.length === 2 ? Number(s[1]) : void 0, l = s[0].split("#");
787
- if (l.length > 2)
788
+ const c = s.length === 2 ? Number(s[1]) : void 0, n = s[0].split("#");
789
+ if (n.length > 2)
788
790
  return { status: -1, message: "id格式错误" };
789
- const a = l[0], r = l.length === 2 ? Number(l[1]) : void 0;
790
- return await this.findLane({ roadsectId: a, segmentId: r, laneId: c, flash: o });
791
+ const a = n[0], o = n.length === 2 ? Number(n[1]) : void 0;
792
+ return await this.findLane({ roadsectId: a, segmentId: o, laneId: c, flash: r });
791
793
  } else
792
794
  return { status: -1, message: "未知类型" };
793
795
  }
794
796
  async findJunction(e, t) {
795
797
  const i = this.junctionLayer.graphics.find(
796
- (o) => o.attributes.id === e
798
+ (r) => r.attributes.id === e
797
799
  );
798
800
  if (!i)
799
801
  return { status: -1, message: "未找到。请检查路口编号" };
800
802
  if (t) {
801
- const o = new y({
803
+ const r = new y({
802
804
  geometry: i.geometry,
803
805
  symbol: {
804
806
  type: "simple-marker",
@@ -811,7 +813,7 @@ class F {
811
813
  }
812
814
  }
813
815
  });
814
- this.flashGraphic(o);
816
+ this.flashGraphic(r);
815
817
  }
816
818
  return await this.view.goTo(i.geometry, { duration: 1e3 }), { status: 0, message: "ok" };
817
819
  }
@@ -821,7 +823,7 @@ class F {
821
823
  * @returns
822
824
  */
823
825
  async findLane(e) {
824
- let { roadsectId: t, segmentId: i, laneId: o } = e;
826
+ let { roadsectId: t, segmentId: i, laneId: r } = e;
825
827
  t.startsWith("-") && (t = t.slice(1));
826
828
  let s = this.allLaneGraphics.filter(
827
829
  (a) => a.attributes.roadId === t
@@ -830,32 +832,32 @@ class F {
830
832
  return { status: -1, message: "未找到。请检查路段编号" };
831
833
  if (i !== void 0) {
832
834
  const a = [];
833
- if (s.forEach((r) => {
834
- const n = Number(r.attributes.sectionId);
835
- a.indexOf(n) === -1 && a.push(n);
836
- }), a.sort((r, n) => r - n), i > a.length - 1)
835
+ if (s.forEach((o) => {
836
+ const l = Number(o.attributes.sectionId);
837
+ a.indexOf(l) === -1 && a.push(l);
838
+ }), a.sort((o, l) => o - l), i > a.length - 1)
837
839
  return { status: -1, message: "未找到。请检查基本段编号" };
838
840
  i = a[i], s = s.filter(
839
- (r) => Number(r.attributes.sectionId) === i
841
+ (o) => Number(o.attributes.sectionId) === i
840
842
  );
841
843
  }
842
- if (o !== void 0) {
844
+ if (r !== void 0) {
843
845
  const a = [];
844
- if (s.forEach((r) => {
845
- const n = Number(r.attributes.laneId);
846
- a.indexOf(n) === -1 && a.push(n);
847
- }), a.sort((r, n) => r - n), o > a.length - 1)
846
+ if (s.forEach((o) => {
847
+ const l = Number(o.attributes.laneId);
848
+ a.indexOf(l) === -1 && a.push(l);
849
+ }), a.sort((o, l) => o - l), r > a.length - 1)
848
850
  return { status: -1, message: "未找到。请检查车道编号" };
849
- o = a[o], s = s.filter(
850
- (r) => Number(r.attributes.laneId) === o
851
+ r = a[r], s = s.filter(
852
+ (o) => Number(o.attributes.laneId) === r
851
853
  );
852
854
  }
853
855
  const c = s.map(
854
856
  (a) => a.geometry
855
- ), l = L.union(c);
857
+ ), n = L.union(c);
856
858
  if (e.flash) {
857
859
  const a = new y({
858
- geometry: l,
860
+ geometry: n,
859
861
  symbol: {
860
862
  type: "simple-fill",
861
863
  color: [255, 0, 0, 0.5],
@@ -868,7 +870,7 @@ class F {
868
870
  });
869
871
  this.flashGraphic(a);
870
872
  }
871
- return await this.view.goTo(l, { duration: 1e3 }), { status: 0, message: "ok" };
873
+ return await this.view.goTo(n, { duration: 1e3 }), { status: 0, message: "ok" };
872
874
  }
873
875
  /**
874
876
  * graphic渐隐渐显闪烁
@@ -877,8 +879,8 @@ class F {
877
879
  flashGraphic(e) {
878
880
  this.flashLayer.removeAll(), this.flashLayer.add(e);
879
881
  let t = 0, i = !0;
880
- const o = setInterval(() => {
881
- i ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (i = !1, t++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (i = !0)), t >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(o));
882
+ const r = setInterval(() => {
883
+ i ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (i = !1, t++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (i = !0)), t >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(r));
882
884
  }, 10);
883
885
  }
884
886
  /**
@@ -893,15 +895,15 @@ class F {
893
895
  const i = t.getAttribute("crossId");
894
896
  t.symbol.url = i ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(t, 30);
895
897
  }
896
- }), !e || e.type === "edge")
897
- if (!e || !e.id || e.id === "")
898
- this.sectionLayer.removeAll();
899
- else {
900
- const t = this.sectionLayer.graphics.find(
901
- (i) => i.getAttribute("edgeId") === e.id
898
+ }), !e || e.type === "edge") {
899
+ let t;
900
+ !e || !e.id || e.id === "" ? t = this.sectionLayer.graphics.toArray() : t = this.sectionLayer.graphics.filter((i) => i.getAttribute("edgeId") === e.id).toArray(), t.length > 0 && (t.forEach((i) => {
901
+ const r = i.getAttribute("id");
902
+ this.selectedSectionIds = this.selectedSectionIds.filter(
903
+ (s) => s !== r
902
904
  );
903
- t && this.sectionLayer.remove(t);
904
- }
905
+ }), this.sectionLayer.removeMany(t));
906
+ }
905
907
  return { status: 0, message: "ok" };
906
908
  }
907
909
  /**
@@ -920,34 +922,41 @@ class F {
920
922
  const t = e.id.split("#");
921
923
  let i = String(t[0]);
922
924
  i.startsWith("-") && (i = i.slice(1));
923
- let o = "0";
924
- t.length === 2 && (o = String(t[1]));
925
+ let r = 0;
926
+ t.length === 2 && (r = Number(t[1]));
925
927
  let s = [];
926
928
  if (t.length === 1 ? s = this.allLaneGraphics.filter(
927
929
  (c) => c.getAttribute("roadId") === i
928
930
  ) : t.length === 2 && (s = this.allLaneGraphics.filter(
929
- (c) => c.getAttribute("roadId") === i && c.getAttribute("sectionId") === o
931
+ (c) => c.getAttribute("roadId") === i && c.getAttribute("sectionIndex") === r
930
932
  )), s.length > 0) {
931
- const c = L.union(
932
- s.map((a) => a.geometry)
933
- ), l = new y({
934
- geometry: c,
935
- symbol: {
936
- type: "simple-fill",
937
- color: [0, 255, 255, 0.5],
938
- style: "solid",
939
- outline: {
940
- color: [0, 255, 255],
941
- width: 1
933
+ const c = /* @__PURE__ */ new Map();
934
+ return s.forEach((n) => {
935
+ const a = n.getAttribute("roadId") + "+" + n.getAttribute("sectionId");
936
+ this.selectedSectionIds.includes(a) || this.selectedSectionIds.push(a);
937
+ let o = c.get(a);
938
+ o ? o.push(n.geometry) : (o = [n.geometry], c.set(a, o));
939
+ }), c.forEach((n, a) => {
940
+ const o = L.union(n), l = new y({
941
+ geometry: o,
942
+ symbol: {
943
+ type: "simple-fill",
944
+ color: [0, 255, 255, 0.5],
945
+ style: "solid",
946
+ outline: {
947
+ color: [0, 255, 255],
948
+ width: 1
949
+ }
950
+ },
951
+ attributes: {
952
+ type: "OpenDriveSection",
953
+ id: a,
954
+ edgeId: e.id,
955
+ selected: !0
942
956
  }
943
- },
944
- attributes: {
945
- type: "OpenDriveSection",
946
- edgeId: e.id,
947
- selected: !0
948
- }
949
- });
950
- return this.sectionLayer.add(l), { status: 0, message: "ok" };
957
+ });
958
+ this.sectionLayer.add(l);
959
+ }), { status: 0, message: "ok" };
951
960
  } else
952
961
  return { status: -1, message: "未找到路段" };
953
962
  }
@@ -956,22 +965,22 @@ class F {
956
965
  }
957
966
  }
958
967
  async geometrySearch(e) {
959
- const t = new S({
968
+ const t = new N({
960
969
  rings: [e]
961
970
  }), i = await this.laneLayer.queryFeatures({
962
971
  geometry: t,
963
972
  outFields: ["*"]
964
- }), o = [], s = [];
973
+ }), r = [], s = [];
965
974
  for (const a of i.features) {
966
- const r = a.getAttribute("roadId"), n = a.getAttribute("sectionId"), d = `${r}#${n}`;
967
- if (o.indexOf(d) === -1) {
968
- o.push(d), this.selectSumo({
975
+ const o = a.getAttribute("roadId"), l = a.getAttribute("sectionIndex"), d = `${o}#${l}`;
976
+ if (r.indexOf(d) === -1) {
977
+ r.push(d), this.selectSumo({
969
978
  type: "edge",
970
979
  id: d
971
980
  });
972
981
  const h = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, g = await b.get(h, {
973
982
  params: {
974
- id: `${r}+${n}`,
983
+ id: `${o}+${a.getAttribute("sectionId")}`,
975
984
  projectName: this.projectName
976
985
  }
977
986
  });
@@ -979,28 +988,28 @@ class F {
979
988
  }
980
989
  }
981
990
  const c = this.junctionLayer.graphics.filter((a) => {
982
- const r = a.geometry;
983
- return L.contains(t, r);
984
- }), l = [];
991
+ const o = a.geometry;
992
+ return L.contains(t, o);
993
+ }), n = [];
985
994
  for (const a of c) {
986
- const r = a.getAttribute("id");
995
+ const o = a.getAttribute("id");
987
996
  this.selectSumo({
988
997
  type: "junction",
989
- id: r
998
+ id: o
990
999
  });
991
- const n = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, d = await b.get(n, {
1000
+ const l = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, d = await b.get(l, {
992
1001
  params: {
993
- id: r,
1002
+ id: o,
994
1003
  projectName: this.projectName
995
1004
  }
996
1005
  });
997
- d.status === 200 && d.data.status === 0 && l.push(d.data.result);
1006
+ d.status === 200 && d.data.status === 0 && n.push(d.data.result);
998
1007
  }
999
1008
  return {
1000
1009
  status: 0,
1001
1010
  message: "ok",
1002
1011
  result: {
1003
- junctions: l,
1012
+ junctions: n,
1004
1013
  edges: s
1005
1014
  }
1006
1015
  };
@@ -1009,43 +1018,43 @@ class F {
1009
1018
  const i = e.id.split("_");
1010
1019
  if (i.length !== 2)
1011
1020
  return { status: -1, message: "车道编号格式错误" };
1012
- const o = Number(i[1]), s = i[0].split("#"), c = s.length === 2 ? Number(s[1]) : 0;
1013
- let l = s[0];
1014
- l.startsWith("-") && (l = l.slice(1));
1015
- const a = this.allLaneGraphics.filter((v) => v.getAttribute("roadId") === l && v.getAttribute("sectionIndex") === c);
1021
+ const r = Number(i[1]), s = i[0].split("#"), c = s.length === 2 ? Number(s[1]) : 0;
1022
+ let n = s[0];
1023
+ n.startsWith("-") && (n = n.slice(1));
1024
+ const a = this.allLaneGraphics.filter((I) => I.getAttribute("roadId") === n && I.getAttribute("sectionIndex") === c);
1016
1025
  if (a.length === 0)
1017
1026
  return { status: -1, message: "未找到路段" };
1018
- const r = a.length - o, n = a.find(
1019
- (v) => Math.abs(v.getAttribute("laneId")) === r
1027
+ const o = a.length - r, l = a.find(
1028
+ (I) => Math.abs(I.getAttribute("laneId")) === o
1020
1029
  );
1021
- if (!n)
1030
+ if (!l)
1022
1031
  return { status: -1, message: "未找到车道" };
1023
- const d = e.start || 0, h = e.end || 100, g = G.lineString(n.getAttribute("leftLine")), p = C(g, d, h, {
1032
+ const d = e.start || 0, h = e.end || 100, g = G.lineString(l.getAttribute("leftLine")), p = C(g, d, h, {
1024
1033
  units: "meters"
1025
- }), m = G.lineString(n.getAttribute("rightLine")), u = C(m, d, h, {
1034
+ }), m = G.lineString(l.getAttribute("rightLine")), f = C(m, d, h, {
1026
1035
  units: "meters"
1027
- }), f = p.geometry.coordinates.concat(
1028
- u.geometry.coordinates.reverse()
1036
+ }), u = p.geometry.coordinates.concat(
1037
+ f.geometry.coordinates.reverse()
1029
1038
  );
1030
- f.push(f[f.length - 1]);
1039
+ u.push(u[u.length - 1]);
1031
1040
  const w = new y({
1032
- geometry: new S({
1033
- rings: [f]
1041
+ geometry: new N({
1042
+ rings: [u]
1034
1043
  }),
1035
1044
  attributes: {
1036
- ObjectID: n.getAttribute("ObjectID"),
1037
- id: n.getAttribute("id"),
1038
- fromNode: n.getAttribute("fromNode"),
1039
- toNode: n.getAttribute("toNode"),
1040
- roadId: n.getAttribute("roadId"),
1041
- roadName: n.getAttribute("roadName"),
1042
- sectionId: n.getAttribute("sectionId"),
1043
- sectionIndex: n.getAttribute("sectionIndex"),
1044
- laneId: n.getAttribute("laneId"),
1045
- type: n.getAttribute("type"),
1046
- sumoId: n.getAttribute("sumoId"),
1045
+ ObjectID: l.getAttribute("ObjectID"),
1046
+ id: l.getAttribute("id"),
1047
+ fromNode: l.getAttribute("fromNode"),
1048
+ toNode: l.getAttribute("toNode"),
1049
+ roadId: l.getAttribute("roadId"),
1050
+ roadName: l.getAttribute("roadName"),
1051
+ sectionId: l.getAttribute("sectionId"),
1052
+ sectionIndex: l.getAttribute("sectionIndex"),
1053
+ laneId: l.getAttribute("laneId"),
1054
+ type: l.getAttribute("type"),
1055
+ sumoId: l.getAttribute("sumoId"),
1047
1056
  leftLine: p.geometry.coordinates,
1048
- rightLine: u.geometry.coordinates
1057
+ rightLine: f.geometry.coordinates
1049
1058
  },
1050
1059
  symbol: {
1051
1060
  type: "simple-fill",