gisviewer-vue3-arcgis 1.0.149 → 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 l = await (await fetch(c)).arrayBuffer(), r = O.inflate(l, { 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 h = o.data.result.junctions;
356
- this.showJunction(h), e.options && e.options.centerMap !== !1 && await this.view.goTo(this.allLaneGraphics), this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick();
357
- const d = J.useAppDataStore;
357
+ const d = r.data.result.junctions;
358
+ this.showJunction(d), e.options && e.options.centerMap !== !1 && await this.view.goTo(this.allLaneGraphics), this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick();
359
+ const h = J.useAppDataStore;
358
360
  return x(
359
- () => d.isSketching,
361
+ () => h.isSketching,
360
362
  () => {
361
- var m, u;
362
- d.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 a = await (await fetch(s)).arrayBuffer(), l = O.inflate(a, { to: "string" }), r = JSON.parse(l);
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,90 +395,89 @@ 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 a = [];
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: h } = r;
408
- let d = r.name;
409
- d.includes("(") && (d = d.slice(0, d.indexOf("("))), d = d.replace(/(.)/g, "$1 ");
408
+ const { id: l, refLine: d } = o;
409
+ let h = o.name;
410
+ h.includes("(") && (h = h.slice(0, h.indexOf("("))), h = h.replace(/(.)/g, "$1 ");
410
411
  const g = new y({
411
412
  geometry: {
412
413
  type: "polyline",
413
- paths: [h]
414
+ paths: [d]
414
415
  },
415
416
  attributes: {
416
417
  ObjectID: c++,
417
- roadId: n,
418
- roadName: d
418
+ roadId: l,
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), a.push(D);
460
+ this.allLaneGraphics.push(D), n.push(D);
460
461
  }
461
462
  }
462
463
  }
463
464
  }
464
- const l = setInterval(() => {
465
- if (a.length > 0 || this.allRefLineGraphics.length > 0) {
466
- if (a.length > 0) {
467
- const r = a.splice(0, 100);
465
+ const a = setInterval(() => {
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
479
- clearInterval(l), s();
480
+ clearInterval(a), s();
480
481
  }, 10);
481
482
  });
482
483
  }
@@ -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
- (a) => a.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 a = `${this.hitGraphic.getAttribute(
552
+ const n = `${this.hitGraphic.getAttribute(
552
553
  "roadId"
553
554
  )}+${this.hitGraphic.getAttribute("sectionId")}`;
554
- if (a === this.currentSectionCode || this.sectionLayer.graphics.findIndex(
555
- (u) => u.getAttribute("id") === a
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 = a;
559
- const r = this.allLaneGraphics.filter(
560
- (u) => `${u.attributes.roadId}+${u.attributes.sectionId}` === a
561
- ), n = L.union(
562
- r.map((u) => u.geometry)
563
- ), h = this.hitGraphic.getAttribute("fromNode"), d = this.hitGraphic.getAttribute("toNode"), g = this.junctionNames.get(h) || h, p = this.junctionNames.get(d) || d;
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: a,
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 a = this.hitGraphic.getAttribute("id");
613
- if (a === this.currentJunctionId)
613
+ const n = this.hitGraphic.getAttribute("id");
614
+ if (n === this.currentJunctionId)
614
615
  return;
615
- this.currentJunctionId = a, this.view.openPopup({
616
+ this.currentJunctionId = n, this.view.openPopup({
616
617
  features: [this.hitGraphic],
617
618
  location: this.hitGraphic.geometry
618
619
  });
@@ -628,58 +629,62 @@ class F {
628
629
  */
629
630
  monitorMouseClick() {
630
631
  const e = j.debounce(async (t) => {
631
- var l;
632
- const o = (l = (await this.view.hitTest(t, {
632
+ var a;
633
+ const r = (a = (await this.view.hitTest(t, {
633
634
  include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
634
- })).results) == null ? void 0 : l.filter(
635
- (r) => r.type === "graphic"
635
+ })).results) == null ? void 0 : a.filter(
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"), a = 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: a,
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: a,
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: a,
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: a,
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: a,
668
+ id: n,
674
669
  projectName: this.projectName
675
670
  }
676
671
  });
677
- n.status === 200 && n.data.status === 0 && this.openDriveClickCallback && (s.setAttribute("edgeId", n.data.result.obj_id), this.openDriveClickCallback({
672
+ if (l.status === 200 && l.data.status === 0 && this.openDriveClickCallback) {
673
+ const d = l.data.result.obj_id;
674
+ s.setAttribute("edgeId", d), this.openDriveClickCallback({
675
+ type: "OpenDriveSection",
676
+ id: d,
677
+ details: l.data.result
678
+ });
679
+ }
680
+ } else
681
+ this.sectionLayer.remove(s), this.selectedSectionIds = this.selectedSectionIds.filter(
682
+ (o) => o !== n
683
+ ), this.openDriveClickCallback && this.openDriveClickCallback({
678
684
  type: "OpenDriveSection",
679
- id: a,
680
- details: n.data.result
681
- }));
682
- }
685
+ id: s.getAttribute("edgeId"),
686
+ details: void 0
687
+ });
683
688
  });
684
689
  this.mouseClickHandler = this.view.on("immediate-click", async (t) => {
685
690
  e(t).catch(() => {
@@ -693,10 +698,10 @@ class F {
693
698
  */
694
699
  increasePictureMarkerSize(e, t) {
695
700
  const i = setInterval(() => {
696
- const o = e.symbol, s = o.width;
701
+ const r = e.symbol, s = r.width;
697
702
  s < t ? e.symbol = {
698
703
  type: "picture-marker",
699
- url: o.url,
704
+ url: r.url,
700
705
  width: s + 1,
701
706
  height: s + 1
702
707
  } : clearInterval(i);
@@ -709,10 +714,10 @@ class F {
709
714
  */
710
715
  decreasePictureMarkerSize(e, t) {
711
716
  const i = setInterval(() => {
712
- const o = e.symbol, s = o.width;
717
+ const r = e.symbol, s = r.width;
713
718
  s > t ? e.symbol = {
714
719
  type: "picture-marker",
715
- url: o.url,
720
+ url: r.url,
716
721
  width: s - 1,
717
722
  height: s - 1
718
723
  } : clearInterval(i);
@@ -733,21 +738,21 @@ class F {
733
738
  const t = e.id.split("#");
734
739
  let i = t[0];
735
740
  i.startsWith("-") && (i = i.slice(1));
736
- let o = 0;
737
- t.length === 2 && (o = Number(t[1]));
741
+ let r = 0;
742
+ t.length === 2 && (r = Number(t[1]));
738
743
  const s = this.allLaneGraphics.find(
739
- (c) => c.getAttribute("roadId") === i && c.getAttribute("sectionIndex") === o
744
+ (c) => c.getAttribute("roadId") === i && c.getAttribute("sectionIndex") === r
740
745
  );
741
746
  if (s) {
742
747
  const c = `${i}+${s.getAttribute(
743
748
  "sectionId"
744
- )}`, a = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, l = await b.get(a, {
749
+ )}`, n = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, a = await b.get(n, {
745
750
  params: {
746
751
  id: c,
747
752
  projectName: this.projectName
748
753
  }
749
754
  });
750
- return l.status === 200 ? l.data : { status: -1, message: `路段信息查询失败: ${c}` };
755
+ return a.status === 200 ? a.data : { status: -1, message: `路段信息查询失败: ${c}` };
751
756
  } else
752
757
  return { status: -1, message: "未知类型" };
753
758
  }
@@ -773,29 +778,29 @@ class F {
773
778
  * @returns
774
779
  */
775
780
  async findSumo(e) {
776
- 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;
777
782
  if (t === "junction")
778
- return await this.findJunction(i, o);
783
+ return await this.findJunction(i, r);
779
784
  if (t === "edge") {
780
785
  const s = i.split("_");
781
786
  if (s.length > 2)
782
787
  return { status: -1, message: "id格式错误" };
783
- const c = s.length === 2 ? Number(s[1]) : void 0, a = s[0].split("#");
784
- if (a.length > 2)
788
+ const c = s.length === 2 ? Number(s[1]) : void 0, n = s[0].split("#");
789
+ if (n.length > 2)
785
790
  return { status: -1, message: "id格式错误" };
786
- const l = a[0], r = a.length === 2 ? Number(a[1]) : void 0;
787
- return await this.findLane({ roadsectId: l, 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 });
788
793
  } else
789
794
  return { status: -1, message: "未知类型" };
790
795
  }
791
796
  async findJunction(e, t) {
792
797
  const i = this.junctionLayer.graphics.find(
793
- (o) => o.attributes.id === e
798
+ (r) => r.attributes.id === e
794
799
  );
795
800
  if (!i)
796
801
  return { status: -1, message: "未找到。请检查路口编号" };
797
802
  if (t) {
798
- const o = new y({
803
+ const r = new y({
799
804
  geometry: i.geometry,
800
805
  symbol: {
801
806
  type: "simple-marker",
@@ -808,7 +813,7 @@ class F {
808
813
  }
809
814
  }
810
815
  });
811
- this.flashGraphic(o);
816
+ this.flashGraphic(r);
812
817
  }
813
818
  return await this.view.goTo(i.geometry, { duration: 1e3 }), { status: 0, message: "ok" };
814
819
  }
@@ -818,41 +823,41 @@ class F {
818
823
  * @returns
819
824
  */
820
825
  async findLane(e) {
821
- let { roadsectId: t, segmentId: i, laneId: o } = e;
826
+ let { roadsectId: t, segmentId: i, laneId: r } = e;
822
827
  t.startsWith("-") && (t = t.slice(1));
823
828
  let s = this.allLaneGraphics.filter(
824
- (l) => l.attributes.roadId === t
829
+ (a) => a.attributes.roadId === t
825
830
  );
826
831
  if (s.length === 0)
827
832
  return { status: -1, message: "未找到。请检查路段编号" };
828
833
  if (i !== void 0) {
829
- const l = [];
830
- if (s.forEach((r) => {
831
- const n = Number(r.attributes.sectionId);
832
- l.indexOf(n) === -1 && l.push(n);
833
- }), l.sort((r, n) => r - n), i > l.length - 1)
834
+ const a = [];
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)
834
839
  return { status: -1, message: "未找到。请检查基本段编号" };
835
- i = l[i], s = s.filter(
836
- (r) => Number(r.attributes.sectionId) === i
840
+ i = a[i], s = s.filter(
841
+ (o) => Number(o.attributes.sectionId) === i
837
842
  );
838
843
  }
839
- if (o !== void 0) {
840
- const l = [];
841
- if (s.forEach((r) => {
842
- const n = Number(r.attributes.laneId);
843
- l.indexOf(n) === -1 && l.push(n);
844
- }), l.sort((r, n) => r - n), o > l.length - 1)
844
+ if (r !== void 0) {
845
+ const a = [];
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)
845
850
  return { status: -1, message: "未找到。请检查车道编号" };
846
- o = l[o], s = s.filter(
847
- (r) => Number(r.attributes.laneId) === o
851
+ r = a[r], s = s.filter(
852
+ (o) => Number(o.attributes.laneId) === r
848
853
  );
849
854
  }
850
855
  const c = s.map(
851
- (l) => l.geometry
852
- ), a = L.union(c);
856
+ (a) => a.geometry
857
+ ), n = L.union(c);
853
858
  if (e.flash) {
854
- const l = new y({
855
- geometry: a,
859
+ const a = new y({
860
+ geometry: n,
856
861
  symbol: {
857
862
  type: "simple-fill",
858
863
  color: [255, 0, 0, 0.5],
@@ -863,9 +868,9 @@ class F {
863
868
  }
864
869
  }
865
870
  });
866
- this.flashGraphic(l);
871
+ this.flashGraphic(a);
867
872
  }
868
- return await this.view.goTo(a, { duration: 1e3 }), { status: 0, message: "ok" };
873
+ return await this.view.goTo(n, { duration: 1e3 }), { status: 0, message: "ok" };
869
874
  }
870
875
  /**
871
876
  * graphic渐隐渐显闪烁
@@ -874,8 +879,8 @@ class F {
874
879
  flashGraphic(e) {
875
880
  this.flashLayer.removeAll(), this.flashLayer.add(e);
876
881
  let t = 0, i = !0;
877
- const o = setInterval(() => {
878
- 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));
879
884
  }, 10);
880
885
  }
881
886
  /**
@@ -890,15 +895,15 @@ class F {
890
895
  const i = t.getAttribute("crossId");
891
896
  t.symbol.url = i ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(t, 30);
892
897
  }
893
- }), !e || e.type === "edge")
894
- if (!e || !e.id || e.id === "")
895
- this.sectionLayer.removeAll();
896
- else {
897
- const t = this.sectionLayer.graphics.find(
898
- (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
899
904
  );
900
- t && this.sectionLayer.remove(t);
901
- }
905
+ }), this.sectionLayer.removeMany(t));
906
+ }
902
907
  return { status: 0, message: "ok" };
903
908
  }
904
909
  /**
@@ -917,34 +922,41 @@ class F {
917
922
  const t = e.id.split("#");
918
923
  let i = String(t[0]);
919
924
  i.startsWith("-") && (i = i.slice(1));
920
- let o = "0";
921
- t.length === 2 && (o = String(t[1]));
925
+ let r = 0;
926
+ t.length === 2 && (r = Number(t[1]));
922
927
  let s = [];
923
928
  if (t.length === 1 ? s = this.allLaneGraphics.filter(
924
929
  (c) => c.getAttribute("roadId") === i
925
930
  ) : t.length === 2 && (s = this.allLaneGraphics.filter(
926
- (c) => c.getAttribute("roadId") === i && c.getAttribute("sectionId") === o
931
+ (c) => c.getAttribute("roadId") === i && c.getAttribute("sectionIndex") === r
927
932
  )), s.length > 0) {
928
- const c = L.union(
929
- s.map((l) => l.geometry)
930
- ), a = new y({
931
- geometry: c,
932
- symbol: {
933
- type: "simple-fill",
934
- color: [0, 255, 255, 0.5],
935
- style: "solid",
936
- outline: {
937
- color: [0, 255, 255],
938
- 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
939
956
  }
940
- },
941
- attributes: {
942
- type: "OpenDriveSection",
943
- edgeId: e.id,
944
- selected: !0
945
- }
946
- });
947
- return this.sectionLayer.add(a), { status: 0, message: "ok" };
957
+ });
958
+ this.sectionLayer.add(l);
959
+ }), { status: 0, message: "ok" };
948
960
  } else
949
961
  return { status: -1, message: "未找到路段" };
950
962
  }
@@ -953,51 +965,51 @@ class F {
953
965
  }
954
966
  }
955
967
  async geometrySearch(e) {
956
- const t = new S({
968
+ const t = new N({
957
969
  rings: [e]
958
970
  }), i = await this.laneLayer.queryFeatures({
959
971
  geometry: t,
960
972
  outFields: ["*"]
961
- }), o = [], s = [];
962
- for (const l of i.features) {
963
- const r = l.getAttribute("roadId"), n = l.getAttribute("sectionId"), h = `${r}#${n}`;
964
- if (o.indexOf(h) === -1) {
965
- o.push(h), this.selectSumo({
973
+ }), r = [], s = [];
974
+ for (const a of i.features) {
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({
966
978
  type: "edge",
967
- id: h
979
+ id: d
968
980
  });
969
- const d = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, g = await b.get(d, {
981
+ const h = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, g = await b.get(h, {
970
982
  params: {
971
- id: `${r}+${n}`,
983
+ id: `${o}+${a.getAttribute("sectionId")}`,
972
984
  projectName: this.projectName
973
985
  }
974
986
  });
975
987
  g.status === 200 && g.data.status === 0 && s.push(g.data.result);
976
988
  }
977
989
  }
978
- const c = this.junctionLayer.graphics.filter((l) => {
979
- const r = l.geometry;
980
- return L.contains(t, r);
981
- }), a = [];
982
- for (const l of c) {
983
- const r = l.getAttribute("id");
990
+ const c = this.junctionLayer.graphics.filter((a) => {
991
+ const o = a.geometry;
992
+ return L.contains(t, o);
993
+ }), n = [];
994
+ for (const a of c) {
995
+ const o = a.getAttribute("id");
984
996
  this.selectSumo({
985
997
  type: "junction",
986
- id: r
998
+ id: o
987
999
  });
988
- const n = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, h = await b.get(n, {
1000
+ const l = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, d = await b.get(l, {
989
1001
  params: {
990
- id: r,
1002
+ id: o,
991
1003
  projectName: this.projectName
992
1004
  }
993
1005
  });
994
- h.status === 200 && h.data.status === 0 && a.push(h.data.result);
1006
+ d.status === 200 && d.data.status === 0 && n.push(d.data.result);
995
1007
  }
996
1008
  return {
997
1009
  status: 0,
998
1010
  message: "ok",
999
1011
  result: {
1000
- junctions: a,
1012
+ junctions: n,
1001
1013
  edges: s
1002
1014
  }
1003
1015
  };
@@ -1006,43 +1018,43 @@ class F {
1006
1018
  const i = e.id.split("_");
1007
1019
  if (i.length !== 2)
1008
1020
  return { status: -1, message: "车道编号格式错误" };
1009
- const o = Number(i[1]), s = i[0].split("#"), c = s.length === 2 ? Number(s[1]) : 0;
1010
- let a = s[0];
1011
- a.startsWith("-") && (a = a.slice(1));
1012
- const l = this.allLaneGraphics.filter((v) => v.getAttribute("roadId") === a && v.getAttribute("sectionIndex") === c);
1013
- if (l.length === 0)
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);
1025
+ if (a.length === 0)
1014
1026
  return { status: -1, message: "未找到路段" };
1015
- const r = l.length - o, n = l.find(
1016
- (v) => Math.abs(v.getAttribute("laneId")) === r
1027
+ const o = a.length - r, l = a.find(
1028
+ (I) => Math.abs(I.getAttribute("laneId")) === o
1017
1029
  );
1018
- if (!n)
1030
+ if (!l)
1019
1031
  return { status: -1, message: "未找到车道" };
1020
- const h = e.start || 0, d = e.end || 100, g = G.lineString(n.getAttribute("leftLine")), p = C(g, h, d, {
1032
+ const d = e.start || 0, h = e.end || 100, g = G.lineString(l.getAttribute("leftLine")), p = C(g, d, h, {
1021
1033
  units: "meters"
1022
- }), m = G.lineString(n.getAttribute("rightLine")), u = C(m, h, d, {
1034
+ }), m = G.lineString(l.getAttribute("rightLine")), f = C(m, d, h, {
1023
1035
  units: "meters"
1024
- }), f = p.geometry.coordinates.concat(
1025
- u.geometry.coordinates.reverse()
1036
+ }), u = p.geometry.coordinates.concat(
1037
+ f.geometry.coordinates.reverse()
1026
1038
  );
1027
- f.push(f[f.length - 1]);
1039
+ u.push(u[u.length - 1]);
1028
1040
  const w = new y({
1029
- geometry: new S({
1030
- rings: [f]
1041
+ geometry: new N({
1042
+ rings: [u]
1031
1043
  }),
1032
1044
  attributes: {
1033
- ObjectID: n.getAttribute("ObjectID"),
1034
- id: n.getAttribute("id"),
1035
- fromNode: n.getAttribute("fromNode"),
1036
- toNode: n.getAttribute("toNode"),
1037
- roadId: n.getAttribute("roadId"),
1038
- roadName: n.getAttribute("roadName"),
1039
- sectionId: n.getAttribute("sectionId"),
1040
- sectionIndex: n.getAttribute("sectionIndex"),
1041
- laneId: n.getAttribute("laneId"),
1042
- type: n.getAttribute("type"),
1043
- 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"),
1044
1056
  leftLine: p.geometry.coordinates,
1045
- rightLine: u.geometry.coordinates
1057
+ rightLine: f.geometry.coordinates
1046
1058
  },
1047
1059
  symbol: {
1048
1060
  type: "simple-fill",