gisviewer-vue3-arcgis 1.0.143 → 1.0.144

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,19 +1,21 @@
1
- import p from "@arcgis/core/Graphic";
1
+ import m from "@arcgis/core/Graphic";
2
2
  import * as k from "@arcgis/core/core/promiseUtils";
3
3
  import { Polygon as O } from "@arcgis/core/geometry";
4
4
  import * as L from "@arcgis/core/geometry/geometryEngine";
5
- import j from "@arcgis/core/layers/FeatureLayer";
6
- import b from "@arcgis/core/layers/GraphicsLayer";
7
- import g from "axios";
5
+ import S from "@arcgis/core/layers/FeatureLayer";
6
+ import w from "@arcgis/core/layers/GraphicsLayer";
7
+ import y from "axios";
8
8
  import F from "md5";
9
- import G from "pako";
10
- import A from "../common-utils.mjs";
11
- class S {
9
+ import j from "pako";
10
+ import { watch as $ } from "vue";
11
+ import M from "../../stores/index.mjs";
12
+ import G from "../common-utils.mjs";
13
+ class A {
12
14
  constructor(e) {
13
15
  this.junctionNames = /* @__PURE__ */ new Map(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.currentJunctionId = "", this.view = e, this.view.popup.visibleElements = {
14
16
  collapseButton: !1,
15
17
  actionBar: !1
16
- }, this.laneLayer = new j({
18
+ }, this.laneLayer = new S({
17
19
  id: "OpenDriveLane",
18
20
  fields: [
19
21
  {
@@ -231,7 +233,7 @@ class S {
231
233
  }
232
234
  ]
233
235
  }
234
- }), this.roadNameLayer = new j({
236
+ }), this.roadNameLayer = new S({
235
237
  id: "OpenDriveRoadName",
236
238
  fields: [
237
239
  {
@@ -281,7 +283,7 @@ class S {
281
283
  }
282
284
  }
283
285
  ]
284
- }), this.junctionLayer = new b({ id: "OpenDriveJunction" }), this.sectionLayer = new b({ id: "OpenDriveSection" }), this.highlightLayer = new b({ id: "OpenDriveHighlight" }), this.flashLayer = new b({ id: "OpenDriveFlash" }), this.drawLayer = new b({ id: "Draw" }), this.view.map.addMany([
286
+ }), this.junctionLayer = new w({ id: "OpenDriveJunction" }), this.sectionLayer = new w({ id: "OpenDriveSection" }), this.highlightLayer = new w({ id: "OpenDriveHighlight" }), this.flashLayer = new w({ id: "OpenDriveFlash" }), this.drawLayer = new w({ id: "Draw" }), this.view.map.addMany([
285
287
  this.laneLayer,
286
288
  this.junctionLayer,
287
289
  this.sectionLayer,
@@ -292,14 +294,14 @@ class S {
292
294
  ]);
293
295
  }
294
296
  static getInstance(e) {
295
- return this.instance || (this.instance = new S(e)), this.instance;
297
+ return this.instance || (this.instance = new A(e)), this.instance;
296
298
  }
297
299
  async makeMd5FromFile(e) {
298
300
  try {
299
- const i = await (await fetch(e)).text();
300
- return { status: 0, message: "ok", result: F(i) };
301
- } catch (t) {
302
- return { status: -1, message: t.message };
301
+ const t = await (await fetch(e)).text();
302
+ return { status: 0, message: "ok", result: F(t) };
303
+ } catch (i) {
304
+ return { status: -1, message: i.message };
303
305
  }
304
306
  }
305
307
  /**
@@ -308,17 +310,17 @@ class S {
308
310
  * @returns
309
311
  */
310
312
  async showOpenDriveFromFile(e) {
311
- var h, f;
313
+ var h, p;
312
314
  this.openDriveClickCallback = e.selectedCallback, console.time("md5用时");
313
- const t = await this.makeMd5FromFile(e.file);
314
- if (t.status !== 0)
315
- return t;
316
- this.projectName = t.result, console.timeEnd("md5用时"), this.openDriveServer = e.server, await this.makeMd5FromFile(e.file);
317
- const i = `http://${this.openDriveServer}/api/openDrive/uploadXodr`;
315
+ const i = await this.makeMd5FromFile(e.file);
316
+ if (i.status !== 0)
317
+ return i;
318
+ this.projectName = i.result, console.timeEnd("md5用时"), this.openDriveServer = e.server, await this.makeMd5FromFile(e.file);
319
+ const t = `http://${this.openDriveServer}/api/openDrive/uploadXodr`;
318
320
  let o;
319
321
  try {
320
- o = await g.post(
321
- i,
322
+ o = await y.post(
323
+ t,
322
324
  {},
323
325
  {
324
326
  params: {
@@ -334,22 +336,22 @@ class S {
334
336
  return { status: -1, message: o.statusText };
335
337
  console.time("渲染用时");
336
338
  const s = o.data.result.geoSetting;
337
- A.setGeoData(
339
+ G.setGeoData(
338
340
  s.geoReference,
339
341
  s.offsetX,
340
342
  s.offsetY
341
343
  );
342
- let l = o.data.result.json;
343
- l.startsWith(window.location.protocol) || (l = `${window.location.protocol}//${e.server}${l}`);
344
- const n = await (await fetch(l)).arrayBuffer(), r = G.inflate(n, { to: "string" }), c = JSON.parse(r);
344
+ let n = o.data.result.json;
345
+ n.startsWith(window.location.protocol) || (n = `${window.location.protocol}//${e.server}${n}`);
346
+ const r = await (await fetch(n)).arrayBuffer(), a = j.inflate(r, { to: "string" }), c = JSON.parse(a);
345
347
  await this.showAllLanes(
346
348
  c,
347
349
  ((h = e.options) == null ? void 0 : h.showJunctionLane) || !1,
348
- ((f = e.options) == null ? void 0 : f.showRoadName) || !0
350
+ ((p = e.options) == null ? void 0 : p.showRoadName) || !0
349
351
  );
350
- const m = o.data.result.junctions;
351
- if (this.showJunction(m), e.options && e.options.centerMap !== !1) {
352
- const d = A.transformPointProjection([0, 0]);
352
+ const g = o.data.result.junctions;
353
+ if (this.showJunction(g), e.options && e.options.centerMap !== !1) {
354
+ const d = G.transformPointProjection([0, 0]);
353
355
  await this.view.goTo(d);
354
356
  }
355
357
  return this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick(), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
@@ -359,10 +361,10 @@ class S {
359
361
  * @param server
360
362
  * @param projectName
361
363
  */
362
- async showOpenDriveFromServer(e, t) {
363
- const i = `http://${e}/api/openDrive/analyzeXodr`, o = await g.get(i, {
364
+ async showOpenDriveFromServer(e, i) {
365
+ const t = `http://${e}/api/openDrive/analyzeXodr`, o = await y.get(t, {
364
366
  headers: {
365
- projectName: t
367
+ projectName: i
366
368
  },
367
369
  params: {
368
370
  analyze: !1,
@@ -373,8 +375,8 @@ class S {
373
375
  throw new Error(`OpenDriveRenderer: ${o.statusText}`);
374
376
  let s = o.data.result.json;
375
377
  s.startsWith(window.location.protocol) || (s = `${window.location.protocol}//${e}${s}`);
376
- const a = await (await fetch(s)).arrayBuffer(), n = G.inflate(a, { to: "string" }), r = JSON.parse(n);
377
- return await this.showAllLanes(r, !1, !1), { status: 0, message: "ok" };
378
+ const l = await (await fetch(s)).arrayBuffer(), r = j.inflate(l, { to: "string" }), a = JSON.parse(r);
379
+ return await this.showAllLanes(a, !1, !1), { status: 0, message: "ok" };
378
380
  }
379
381
  /**
380
382
  * 显示所有车道
@@ -383,87 +385,87 @@ class S {
383
385
  * @param showRoadName 是否显示道路名称
384
386
  * @returns
385
387
  */
386
- async showAllLanes(e, t, i) {
388
+ async showAllLanes(e, i, t) {
387
389
  const o = await this.laneLayer.queryFeatures();
388
390
  return o.features.length > 0 && this.laneLayer.applyEdits({
389
391
  deleteFeatures: o.features
390
- }), this.roadNameLayer.visible = i, new Promise((s) => {
391
- let l = 0;
392
+ }), this.roadNameLayer.visible = t, new Promise((s) => {
393
+ let n = 0;
392
394
  this.allLaneGraphics = [], this.allRefLineGraphics = [];
393
- const a = [];
394
- for (const r of e) {
395
- if (!t && r.junction !== "-1")
395
+ const l = [];
396
+ for (const a of e) {
397
+ if (!i && a.junction !== "-1")
396
398
  continue;
397
- const { id: c, refLine: m } = r;
398
- let h = r.name;
399
+ const { id: c, refLine: g } = a;
400
+ let h = a.name;
399
401
  h.includes("(") && (h = h.slice(0, h.indexOf("("))), h = h.replace(/(.)/g, "$1 ");
400
- const f = new p({
402
+ const p = new m({
401
403
  geometry: {
402
404
  type: "polyline",
403
- paths: [m]
405
+ paths: [g]
404
406
  },
405
407
  attributes: {
406
- ObjectID: l++,
408
+ ObjectID: n++,
407
409
  roadId: c,
408
410
  roadName: h
409
411
  }
410
412
  });
411
- this.allRefLineGraphics.push(f), r.laneSections.sort((d, y) => Number(d.id) - Number(y.id));
412
- for (let d = 0; d < r.laneSections.length; d++) {
413
- const y = r.laneSections[d], u = Number(y.id);
414
- for (const w of y.lanePaths) {
415
- const v = Number(w.id);
413
+ this.allRefLineGraphics.push(p), a.laneSections.sort((d, f) => Number(d.id) - Number(f.id));
414
+ for (let d = 0; d < a.laneSections.length; d++) {
415
+ const f = a.laneSections[d], b = Number(f.id);
416
+ for (const u of f.lanePaths) {
417
+ const v = Number(u.id);
416
418
  if (v === 0)
417
419
  continue;
418
- const C = w.type, I = w.innerPath.concat(
419
- w.outerPath.reverse()
420
+ const C = u.type, I = u.innerPath.concat(
421
+ u.outerPath.reverse()
420
422
  );
421
423
  if (I.length <= 3) {
422
424
  console.warn(`lane ${v} has less than 3 points`);
423
425
  continue;
424
426
  }
425
- I.push(w.innerPath[0]);
427
+ I.push(u.innerPath[0]);
426
428
  const N = new O({
427
429
  rings: [I]
428
430
  });
429
431
  if (N) {
430
- const D = new p({
432
+ const D = new m({
431
433
  geometry: N,
432
434
  attributes: {
433
- ObjectID: l++,
434
- id: `${c}+${u}+${v}`,
435
- fromNode: r.fromNode,
436
- toNode: r.toNode,
435
+ ObjectID: n++,
436
+ id: `${c}+${b}+${v}`,
437
+ fromNode: a.fromNode,
438
+ toNode: a.toNode,
437
439
  roadId: c,
438
- roadName: r.name,
439
- sectionId: u,
440
+ roadName: a.name,
441
+ sectionId: b,
440
442
  sectionIndex: d,
441
443
  laneId: v,
442
444
  type: C,
443
445
  sumoId: ""
444
446
  }
445
447
  });
446
- this.allLaneGraphics.push(D), a.push(D);
448
+ this.allLaneGraphics.push(D), l.push(D);
447
449
  }
448
450
  }
449
451
  }
450
452
  }
451
- const n = setInterval(() => {
452
- if (a.length > 0 || this.allRefLineGraphics.length > 0) {
453
- if (a.length > 0) {
454
- const r = a.splice(0, 100);
453
+ const r = setInterval(() => {
454
+ if (l.length > 0 || this.allRefLineGraphics.length > 0) {
455
+ if (l.length > 0) {
456
+ const a = l.splice(0, 100);
455
457
  this.laneLayer.applyEdits({
456
- addFeatures: r
458
+ addFeatures: a
457
459
  });
458
460
  }
459
461
  if (this.allRefLineGraphics.length > 0) {
460
- const r = this.allRefLineGraphics.splice(0, 10);
462
+ const a = this.allRefLineGraphics.splice(0, 10);
461
463
  this.roadNameLayer.applyEdits({
462
- addFeatures: r
464
+ addFeatures: a
463
465
  });
464
466
  }
465
467
  } else
466
- clearInterval(n), s();
468
+ clearInterval(r), s();
467
469
  }, 10);
468
470
  });
469
471
  }
@@ -473,30 +475,30 @@ class S {
473
475
  * @returns
474
476
  */
475
477
  showJunction(e) {
476
- const t = [];
477
- for (const i of e) {
478
- if (!i)
478
+ const i = [];
479
+ for (const t of e) {
480
+ if (!t)
479
481
  continue;
480
- this.junctionNames.set(i.id, i.name), i.nodeType = i.type;
481
- const o = new p({
482
+ this.junctionNames.set(t.id, t.name), t.nodeType = t.type;
483
+ const o = new m({
482
484
  geometry: {
483
485
  type: "point",
484
- x: i.coordinates[0],
485
- y: i.coordinates[1]
486
+ x: t.coordinates[0],
487
+ y: t.coordinates[1]
486
488
  },
487
489
  attributes: {
488
- ...i,
490
+ ...t,
489
491
  selected: !1,
490
492
  type: "OpenDriveJunction"
491
493
  },
492
494
  symbol: {
493
495
  type: "picture-marker",
494
- url: i.crossId ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png",
496
+ url: t.crossId ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png",
495
497
  width: 30,
496
498
  height: 30
497
499
  },
498
500
  popupTemplate: {
499
- title: i.name,
501
+ title: t.name,
500
502
  content: [
501
503
  {
502
504
  type: "fields",
@@ -514,9 +516,9 @@ class S {
514
516
  ]
515
517
  }
516
518
  });
517
- t.push(o);
519
+ i.push(o);
518
520
  }
519
- this.junctionLayer.addMany(t);
521
+ this.junctionLayer.addMany(i);
520
522
  }
521
523
  /**
522
524
  * 监听鼠标移动事件,高亮显示鼠标所在路段和路口
@@ -524,32 +526,32 @@ class S {
524
526
  monitorMouseMove() {
525
527
  const e = k.debounce(async (t) => {
526
528
  var l;
527
- const o = (l = (await this.view.hitTest(t, {
529
+ const s = (l = (await this.view.hitTest(t, {
528
530
  include: [this.laneLayer, this.junctionLayer]
529
531
  })).results) == null ? void 0 : l.filter(
530
- (a) => a.type === "graphic"
532
+ (r) => r.type === "graphic"
531
533
  );
532
- if (o.length === 0) {
534
+ if (s.length === 0) {
533
535
  this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = "", this.view.closePopup());
534
536
  return;
535
537
  }
536
- const s = o[0];
537
- if (this.hitGraphic = s.graphic, s.layer.id === "OpenDriveLane") {
538
- const a = `${this.hitGraphic.getAttribute(
538
+ const n = s[0];
539
+ if (this.hitGraphic = n.graphic, n.layer.id === "OpenDriveLane") {
540
+ const r = `${this.hitGraphic.getAttribute(
539
541
  "roadId"
540
542
  )}+${this.hitGraphic.getAttribute("sectionId")}`;
541
- if (a === this.currentSectionCode || this.sectionLayer.graphics.findIndex(
542
- (u) => u.getAttribute("id") === a
543
+ if (r === this.currentSectionCode || this.sectionLayer.graphics.findIndex(
544
+ (u) => u.getAttribute("id") === r
543
545
  ) >= 0)
544
546
  return;
545
- this.currentSectionCode = a;
546
- const r = this.allLaneGraphics.filter(
547
- (u) => `${u.attributes.roadId}+${u.attributes.sectionId}` === a
548
- ), c = L.union(
549
- r.map((u) => u.geometry)
550
- ), m = this.hitGraphic.getAttribute("fromNode"), h = this.hitGraphic.getAttribute("toNode"), f = this.junctionNames.get(m) || m, d = this.junctionNames.get(h) || h;
551
- this.highlightGraphic = new p({
552
- geometry: c,
547
+ this.currentSectionCode = r;
548
+ const c = this.allLaneGraphics.filter(
549
+ (u) => `${u.attributes.roadId}+${u.attributes.sectionId}` === r
550
+ ), g = L.union(
551
+ c.map((u) => u.geometry)
552
+ ), h = this.hitGraphic.getAttribute("fromNode"), p = this.hitGraphic.getAttribute("toNode"), d = this.junctionNames.get(h) || h, f = this.junctionNames.get(p) || p;
553
+ this.highlightGraphic = new m({
554
+ geometry: g,
553
555
  symbol: {
554
556
  type: "simple-fill",
555
557
  color: [0, 255, 255, 0.5],
@@ -561,11 +563,11 @@ class S {
561
563
  },
562
564
  attributes: {
563
565
  type: "OpenDriveSection",
564
- id: a,
566
+ id: r,
565
567
  selected: !1,
566
- fromNodeName: f,
567
- toNodeName: d,
568
- laneCount: r.length
568
+ fromNodeName: d,
569
+ toNodeName: f,
570
+ laneCount: c.length
569
571
  },
570
572
  popupTemplate: {
571
573
  title: this.hitGraphic.getAttribute("roadName"),
@@ -590,16 +592,16 @@ class S {
590
592
  ]
591
593
  }
592
594
  }), this.highlightLayer.removeAll(), this.highlightLayer.add(this.highlightGraphic);
593
- const y = this.view.toMap(t);
595
+ const b = this.view.toMap(t);
594
596
  this.view.openPopup({
595
597
  features: [this.highlightGraphic],
596
- location: y
598
+ location: b
597
599
  });
598
- } else if (s.layer.id === "OpenDriveJunction") {
599
- const a = this.hitGraphic.getAttribute("id");
600
- if (a === this.currentJunctionId)
600
+ } else if (n.layer.id === "OpenDriveJunction") {
601
+ const r = this.hitGraphic.getAttribute("id");
602
+ if (r === this.currentJunctionId)
601
603
  return;
602
- this.currentJunctionId = a, this.view.openPopup({
604
+ this.currentJunctionId = r, this.view.openPopup({
603
605
  features: [this.hitGraphic],
604
606
  location: this.hitGraphic.geometry
605
607
  });
@@ -609,67 +611,81 @@ class S {
609
611
  e(t).catch(() => {
610
612
  });
611
613
  });
614
+ const i = M.useAppDataStore;
615
+ $(
616
+ () => i.isSketching,
617
+ () => {
618
+ var t;
619
+ i.isSketching ? (t = this.mouseMoveHandler) == null || t.remove() : this.mouseMoveHandler = this.view.on(
620
+ "pointer-move",
621
+ async (o) => {
622
+ e(o).catch(() => {
623
+ });
624
+ }
625
+ );
626
+ }
627
+ );
612
628
  }
613
629
  /**
614
630
  * 监听鼠标点击事件,获取高亮要素的拓扑信息
615
631
  */
616
632
  monitorMouseClick() {
617
- const e = k.debounce(async (t) => {
618
- var n;
619
- const o = (n = (await this.view.hitTest(t, {
633
+ const e = k.debounce(async (i) => {
634
+ var r;
635
+ const o = (r = (await this.view.hitTest(i, {
620
636
  include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
621
- })).results) == null ? void 0 : n.filter(
622
- (r) => r.type === "graphic"
637
+ })).results) == null ? void 0 : r.filter(
638
+ (a) => a.type === "graphic"
623
639
  );
624
640
  if (o.length === 0)
625
641
  return;
626
- const s = o[0].graphic, l = s.getAttribute("type"), a = s.getAttribute("id");
627
- if (l === "OpenDriveJunction")
642
+ const s = o[0].graphic, n = s.getAttribute("type"), l = s.getAttribute("id");
643
+ if (n === "OpenDriveJunction")
628
644
  if (s.getAttribute("selected") === !1) {
629
- const r = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, c = await g.get(r, {
645
+ const a = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, c = await y.get(a, {
630
646
  params: {
631
- id: a,
647
+ id: l,
632
648
  projectName: this.projectName
633
649
  }
634
650
  });
635
651
  c.status === 200 && c.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
636
652
  type: "OpenDriveJunction",
637
- id: a,
653
+ id: l,
638
654
  details: c.data.result
639
655
  }), s.setAttribute("selected", !0), s.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(s, 50));
640
656
  } else {
641
657
  this.openDriveClickCallback && this.openDriveClickCallback({
642
658
  type: "OpenDriveJunction",
643
- id: a,
659
+ id: l,
644
660
  details: void 0
645
661
  }), s.setAttribute("selected", !1);
646
- const r = s.getAttribute("crossId");
647
- s.symbol.url = r ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(s, 30);
662
+ const a = s.getAttribute("crossId");
663
+ s.symbol.url = a ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(s, 30);
648
664
  }
649
- else if (l === "OpenDriveSection")
665
+ else if (n === "OpenDriveSection")
650
666
  if (s.getAttribute("selected"))
651
667
  this.sectionLayer.remove(s), this.openDriveClickCallback && this.openDriveClickCallback({
652
668
  type: "OpenDriveSection",
653
- id: a,
669
+ id: l,
654
670
  details: void 0
655
671
  });
656
672
  else {
657
673
  this.highlightLayer.remove(s), this.sectionLayer.add(s), s.setAttribute("selected", !0);
658
- const r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, c = await g.get(r, {
674
+ const a = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, c = await y.get(a, {
659
675
  params: {
660
- id: a,
676
+ id: l,
661
677
  projectName: this.projectName
662
678
  }
663
679
  });
664
680
  c.status === 200 && c.data.status === 0 && this.openDriveClickCallback && (s.setAttribute("edgeId", c.data.result.obj_id), this.openDriveClickCallback({
665
681
  type: "OpenDriveSection",
666
- id: a,
682
+ id: l,
667
683
  details: c.data.result
668
684
  }));
669
685
  }
670
686
  });
671
- this.mouseClickHandler = this.view.on("immediate-click", async (t) => {
672
- e(t).catch(() => {
687
+ this.mouseClickHandler = this.view.on("immediate-click", async (i) => {
688
+ e(i).catch(() => {
673
689
  });
674
690
  });
675
691
  }
@@ -678,15 +694,15 @@ class S {
678
694
  * @param graphic
679
695
  * @param targetSize
680
696
  */
681
- increasePictureMarkerSize(e, t) {
682
- const i = setInterval(() => {
697
+ increasePictureMarkerSize(e, i) {
698
+ const t = setInterval(() => {
683
699
  const o = e.symbol, s = o.width;
684
- s < t ? e.symbol = {
700
+ s < i ? e.symbol = {
685
701
  type: "picture-marker",
686
702
  url: o.url,
687
703
  width: s + 1,
688
704
  height: s + 1
689
- } : clearInterval(i);
705
+ } : clearInterval(t);
690
706
  }, 20);
691
707
  }
692
708
  /**
@@ -694,47 +710,47 @@ class S {
694
710
  * @param graphic
695
711
  * @param targetSize
696
712
  */
697
- decreasePictureMarkerSize(e, t) {
698
- const i = setInterval(() => {
713
+ decreasePictureMarkerSize(e, i) {
714
+ const t = setInterval(() => {
699
715
  const o = e.symbol, s = o.width;
700
- s > t ? e.symbol = {
716
+ s > i ? e.symbol = {
701
717
  type: "picture-marker",
702
718
  url: o.url,
703
719
  width: s - 1,
704
720
  height: s - 1
705
- } : clearInterval(i);
721
+ } : clearInterval(t);
706
722
  }, 20);
707
723
  }
708
724
  async getSumoInfo(e) {
709
725
  switch (e.type) {
710
726
  case "junction": {
711
- const t = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, i = await g.get(t, {
727
+ const i = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, t = await y.get(i, {
712
728
  params: {
713
729
  id: e.id,
714
730
  projectName: this.projectName
715
731
  }
716
732
  });
717
- return i.status === 200 ? i.data : { status: -1, message: `路口信息查询失败: ${e.id}` };
733
+ return t.status === 200 ? t.data : { status: -1, message: `路口信息查询失败: ${e.id}` };
718
734
  }
719
735
  case "edge": {
720
- const t = e.id.split("#");
721
- let i = t[0];
722
- i.startsWith("-") && (i = i.slice(1));
736
+ const i = e.id.split("#");
737
+ let t = i[0];
738
+ t.startsWith("-") && (t = t.slice(1));
723
739
  let o = 0;
724
- t.length === 2 && (o = Number(t[1]));
740
+ i.length === 2 && (o = Number(i[1]));
725
741
  const s = this.allLaneGraphics.find(
726
- (l) => l.getAttribute("roadId") === i && l.getAttribute("sectionIndex") === o
742
+ (n) => n.getAttribute("roadId") === t && n.getAttribute("sectionIndex") === o
727
743
  );
728
744
  if (s) {
729
- const l = `${i}+${s.getAttribute(
745
+ const n = `${t}+${s.getAttribute(
730
746
  "sectionId"
731
- )}`, a = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, n = await g.get(a, {
747
+ )}`, l = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, r = await y.get(l, {
732
748
  params: {
733
- id: l,
749
+ id: n,
734
750
  projectName: this.projectName
735
751
  }
736
752
  });
737
- return n.status === 200 ? n.data : { status: -1, message: `路段信息查询失败: ${l}` };
753
+ return r.status === 200 ? r.data : { status: -1, message: `路段信息查询失败: ${n}` };
738
754
  } else
739
755
  return { status: -1, message: "未知类型" };
740
756
  }
@@ -746,13 +762,13 @@ class S {
746
762
  * 清除OpenDrive内容
747
763
  */
748
764
  async clearOpenDrive() {
749
- var t, i;
765
+ var i, t;
750
766
  let e = await this.laneLayer.queryFeatures();
751
767
  e.features.length > 0 && await this.laneLayer.applyEdits({
752
768
  deleteFeatures: e.features
753
769
  }), e = await this.roadNameLayer.queryFeatures(), e.features.length > 0 && await this.roadNameLayer.applyEdits({
754
770
  deleteFeatures: e.features
755
- }), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), (t = this.mouseMoveHandler) == null || t.remove(), this.mouseMoveHandler = void 0, (i = this.mouseClickHandler) == null || i.remove(), this.mouseClickHandler = void 0;
771
+ }), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), (i = this.mouseMoveHandler) == null || i.remove(), this.mouseMoveHandler = void 0, (t = this.mouseClickHandler) == null || t.remove(), this.mouseClickHandler = void 0;
756
772
  }
757
773
  /**
758
774
  * 用sumo的id定位车道、基本段、路段
@@ -760,30 +776,30 @@ class S {
760
776
  * @returns
761
777
  */
762
778
  async findSumo(e) {
763
- const { type: t, id: i } = e, o = e.flash === void 0 ? !0 : e.flash;
764
- if (t === "junction")
765
- return await this.findJunction(i, o);
766
- if (t === "edge") {
767
- const s = i.split("+");
779
+ const { type: i, id: t } = e, o = e.flash === void 0 ? !0 : e.flash;
780
+ if (i === "junction")
781
+ return await this.findJunction(t, o);
782
+ if (i === "edge") {
783
+ const s = t.split("+");
768
784
  if (s.length > 2)
769
785
  return { status: -1, message: "id格式错误" };
770
- const l = s.length === 2 ? Number(s[1]) : void 0, a = s[0].split("#");
771
- if (a.length > 2)
786
+ const n = s.length === 2 ? Number(s[1]) : void 0, l = s[0].split("#");
787
+ if (l.length > 2)
772
788
  return { status: -1, message: "id格式错误" };
773
- const n = a[0], r = a.length === 2 ? Number(a[1]) : void 0;
774
- return await this.findLane({ roadsectId: n, segmentId: r, laneId: l, flash: o });
789
+ const r = l[0], a = l.length === 2 ? Number(l[1]) : void 0;
790
+ return await this.findLane({ roadsectId: r, segmentId: a, laneId: n, flash: o });
775
791
  } else
776
792
  return { status: -1, message: "未知类型" };
777
793
  }
778
- async findJunction(e, t) {
779
- const i = this.junctionLayer.graphics.find(
794
+ async findJunction(e, i) {
795
+ const t = this.junctionLayer.graphics.find(
780
796
  (o) => o.attributes.id === e
781
797
  );
782
- if (!i)
798
+ if (!t)
783
799
  return { status: -1, message: "未找到。请检查路口编号" };
784
- if (t) {
785
- const o = new p({
786
- geometry: i.geometry,
800
+ if (i) {
801
+ const o = new m({
802
+ geometry: t.geometry,
787
803
  symbol: {
788
804
  type: "simple-marker",
789
805
  style: "circle",
@@ -797,7 +813,7 @@ class S {
797
813
  });
798
814
  this.flashGraphic(o);
799
815
  }
800
- return await this.view.goTo(i.geometry, { duration: 1e3 }), { status: 0, message: "ok" };
816
+ return await this.view.goTo(t.geometry, { duration: 1e3 }), { status: 0, message: "ok" };
801
817
  }
802
818
  /**
803
819
  * 用sumo的id定位车道、基本段、路段
@@ -805,41 +821,41 @@ class S {
805
821
  * @returns
806
822
  */
807
823
  async findLane(e) {
808
- let { roadsectId: t, segmentId: i, laneId: o } = e;
809
- t.startsWith("-") && (t = t.slice(1));
824
+ let { roadsectId: i, segmentId: t, laneId: o } = e;
825
+ i.startsWith("-") && (i = i.slice(1));
810
826
  let s = this.allLaneGraphics.filter(
811
- (n) => n.attributes.roadId === t
827
+ (r) => r.attributes.roadId === i
812
828
  );
813
829
  if (s.length === 0)
814
830
  return { status: -1, message: "未找到。请检查路段编号" };
815
- if (i !== void 0) {
816
- const n = [];
817
- if (s.forEach((r) => {
818
- const c = Number(r.attributes.sectionId);
819
- n.indexOf(c) === -1 && n.push(c);
820
- }), n.sort((r, c) => r - c), i > n.length - 1)
831
+ if (t !== void 0) {
832
+ const r = [];
833
+ if (s.forEach((a) => {
834
+ const c = Number(a.attributes.sectionId);
835
+ r.indexOf(c) === -1 && r.push(c);
836
+ }), r.sort((a, c) => a - c), t > r.length - 1)
821
837
  return { status: -1, message: "未找到。请检查基本段编号" };
822
- i = n[i], s = s.filter(
823
- (r) => Number(r.attributes.sectionId) === i
838
+ t = r[t], s = s.filter(
839
+ (a) => Number(a.attributes.sectionId) === t
824
840
  );
825
841
  }
826
842
  if (o !== void 0) {
827
- const n = [];
828
- if (s.forEach((r) => {
829
- const c = Number(r.attributes.laneId);
830
- n.indexOf(c) === -1 && n.push(c);
831
- }), n.sort((r, c) => r - c), o > n.length - 1)
843
+ const r = [];
844
+ if (s.forEach((a) => {
845
+ const c = Number(a.attributes.laneId);
846
+ r.indexOf(c) === -1 && r.push(c);
847
+ }), r.sort((a, c) => a - c), o > r.length - 1)
832
848
  return { status: -1, message: "未找到。请检查车道编号" };
833
- o = n[o], s = s.filter(
834
- (r) => Number(r.attributes.laneId) === o
849
+ o = r[o], s = s.filter(
850
+ (a) => Number(a.attributes.laneId) === o
835
851
  );
836
852
  }
837
- const l = s.map(
838
- (n) => n.geometry
839
- ), a = L.union(l);
853
+ const n = s.map(
854
+ (r) => r.geometry
855
+ ), l = L.union(n);
840
856
  if (e.flash) {
841
- const n = new p({
842
- geometry: a,
857
+ const r = new m({
858
+ geometry: l,
843
859
  symbol: {
844
860
  type: "simple-fill",
845
861
  color: [255, 0, 0, 0.5],
@@ -850,9 +866,9 @@ class S {
850
866
  }
851
867
  }
852
868
  });
853
- this.flashGraphic(n);
869
+ this.flashGraphic(r);
854
870
  }
855
- return await this.view.goTo(a, { duration: 1e3 }), { status: 0, message: "ok" };
871
+ return await this.view.goTo(l, { duration: 1e3 }), { status: 0, message: "ok" };
856
872
  }
857
873
  /**
858
874
  * graphic渐隐渐显闪烁
@@ -860,9 +876,9 @@ class S {
860
876
  */
861
877
  flashGraphic(e) {
862
878
  this.flashLayer.removeAll(), this.flashLayer.add(e);
863
- let t = 0, i = !0;
879
+ let i = 0, t = !0;
864
880
  const o = setInterval(() => {
865
- 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));
881
+ t ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (t = !1, i++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (t = !0)), i >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(o));
866
882
  }, 10);
867
883
  }
868
884
  /**
@@ -871,20 +887,20 @@ class S {
871
887
  * @returns
872
888
  */
873
889
  unselectSumo(e) {
874
- if ((!e || e.type === "junction") && this.junctionLayer.graphics.forEach((t) => {
875
- if ((!e || !e.id || e.id === "" || e.id === t.getAttribute("id")) && t.getAttribute("selected")) {
876
- t.setAttribute("selected", !1);
877
- const i = t.getAttribute("crossId");
878
- t.symbol.url = i ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(t, 30);
890
+ if ((!e || e.type === "junction") && this.junctionLayer.graphics.forEach((i) => {
891
+ if ((!e || !e.id || e.id === "" || e.id === i.getAttribute("id")) && i.getAttribute("selected")) {
892
+ i.setAttribute("selected", !1);
893
+ const t = i.getAttribute("crossId");
894
+ i.symbol.url = t ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(i, 30);
879
895
  }
880
896
  }), !e || e.type === "edge")
881
897
  if (!e || !e.id || e.id === "")
882
898
  this.sectionLayer.removeAll();
883
899
  else {
884
- const t = this.sectionLayer.graphics.find(
885
- (i) => i.getAttribute("edgeId") === e.id
900
+ const i = this.sectionLayer.graphics.find(
901
+ (t) => t.getAttribute("edgeId") === e.id
886
902
  );
887
- t && this.sectionLayer.remove(t);
903
+ i && this.sectionLayer.remove(i);
888
904
  }
889
905
  return { status: 0, message: "ok" };
890
906
  }
@@ -896,24 +912,24 @@ class S {
896
912
  selectSumo(e) {
897
913
  switch (e.type) {
898
914
  case "junction":
899
- return this.junctionLayer.graphics.forEach((t) => {
900
- if (e.id === t.getAttribute("id"))
901
- return t.setAttribute("selected", !0), t.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(t, 50), { status: 0, message: "ok" };
915
+ return this.junctionLayer.graphics.forEach((i) => {
916
+ if (e.id === i.getAttribute("id"))
917
+ return i.setAttribute("selected", !0), i.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(i, 50), { status: 0, message: "ok" };
902
918
  }), { status: -1, message: "未找到路口" };
903
919
  case "edge": {
904
- const t = e.id.split("#");
905
- let i = t[0];
906
- i.startsWith("-") && (i = i.slice(1));
920
+ const i = e.id.split("#");
921
+ let t = i[0];
922
+ t.startsWith("-") && (t = t.slice(1));
907
923
  let o = 0;
908
- t.length === 2 && (o = Number(t[1]));
924
+ i.length === 2 && (o = Number(i[1]));
909
925
  const s = this.allLaneGraphics.filter(
910
- (l) => l.getAttribute("roadId") === i && l.getAttribute("sectionIndex") === o
926
+ (n) => n.getAttribute("roadId") === t && n.getAttribute("sectionIndex") === o
911
927
  );
912
928
  if (s.length > 0) {
913
- const l = L.union(
914
- s.map((n) => n.geometry)
915
- ), a = new p({
916
- geometry: l,
929
+ const n = L.union(
930
+ s.map((r) => r.geometry)
931
+ ), l = new m({
932
+ geometry: n,
917
933
  symbol: {
918
934
  type: "simple-fill",
919
935
  color: [0, 255, 255, 0.5],
@@ -929,7 +945,7 @@ class S {
929
945
  selected: !0
930
946
  }
931
947
  });
932
- return this.sectionLayer.add(a), { status: 0, message: "ok" };
948
+ return this.sectionLayer.add(l), { status: 0, message: "ok" };
933
949
  } else
934
950
  return { status: -1, message: "未找到路段" };
935
951
  }
@@ -942,5 +958,5 @@ class S {
942
958
  }
943
959
  }
944
960
  export {
945
- S as default
961
+ A as default
946
962
  };