gisviewer-vue3-arcgis 1.0.143 → 1.0.145

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.
Files changed (34) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +5 -17
  2. package/es/src/gis-map/gis-map.vue.mjs +109 -106
  3. package/es/src/gis-map/index.d.ts +5 -17
  4. package/es/src/gis-map/stores/appData.d.ts +1 -0
  5. package/es/src/gis-map/stores/appData.mjs +2 -1
  6. package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +3 -0
  7. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +258 -138
  8. package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +19 -19
  9. package/es/src/gis-map/utils/sketchView.d.ts +1 -1
  10. package/es/src/gis-map/utils/sketchView.mjs +16 -11
  11. package/es/src/types/index.d.ts +2 -2
  12. package/es/style.css +1 -1
  13. package/lib/src/gis-map/gis-map.vue.d.ts +5 -17
  14. package/lib/src/gis-map/gis-map.vue.js +1 -1
  15. package/lib/src/gis-map/index.d.ts +5 -17
  16. package/lib/src/gis-map/stores/appData.d.ts +1 -0
  17. package/lib/src/gis-map/stores/appData.js +1 -1
  18. package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +3 -0
  19. package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
  20. package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
  21. package/lib/src/gis-map/utils/sketchView.d.ts +1 -1
  22. package/lib/src/gis-map/utils/sketchView.js +1 -1
  23. package/lib/src/types/index.d.ts +2 -2
  24. package/package.json +2 -1
  25. package/es/_virtual/_plugin-vue_export-helper.mjs +0 -9
  26. package/es/src/gis-map/utils/components/sketch-tool.vue.d.ts +0 -18
  27. package/es/src/gis-map/utils/components/sketch-tool.vue.mjs +0 -7
  28. package/es/src/gis-map/utils/components/sketch-tool.vue2.mjs +0 -48
  29. package/es/src/gis-map/utils/components/sketch-tool.vue3.mjs +0 -4
  30. package/lib/_virtual/_plugin-vue_export-helper.js +0 -1
  31. package/lib/src/gis-map/utils/components/sketch-tool.vue.d.ts +0 -18
  32. package/lib/src/gis-map/utils/components/sketch-tool.vue.js +0 -1
  33. package/lib/src/gis-map/utils/components/sketch-tool.vue2.js +0 -1
  34. package/lib/src/gis-map/utils/components/sketch-tool.vue3.js +0 -1
@@ -1,19 +1,23 @@
1
- import p from "@arcgis/core/Graphic";
2
- import * as k from "@arcgis/core/core/promiseUtils";
3
- import { Polygon as O } from "@arcgis/core/geometry";
1
+ import y from "@arcgis/core/Graphic";
2
+ import * as D from "@arcgis/core/core/promiseUtils";
3
+ import { Polygon as S } 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";
8
- import F from "md5";
9
- import G from "pako";
10
- import A from "../common-utils.mjs";
11
- class S {
5
+ import k from "@arcgis/core/layers/FeatureLayer";
6
+ import I from "@arcgis/core/layers/GraphicsLayer";
7
+ import * as G from "@turf/helpers";
8
+ import { lineSliceAlong as C } from "@turf/line-slice-along";
9
+ import b from "axios";
10
+ import P from "md5";
11
+ import O from "pako";
12
+ import { watch as x } from "vue";
13
+ import J from "../../stores/index.mjs";
14
+ import F from "../common-utils.mjs";
15
+ class $ {
12
16
  constructor(e) {
13
17
  this.junctionNames = /* @__PURE__ */ new Map(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.currentJunctionId = "", this.view = e, this.view.popup.visibleElements = {
14
18
  collapseButton: !1,
15
19
  actionBar: !1
16
- }, this.laneLayer = new j({
20
+ }, this.laneLayer = new k({
17
21
  id: "OpenDriveLane",
18
22
  fields: [
19
23
  {
@@ -231,7 +235,7 @@ class S {
231
235
  }
232
236
  ]
233
237
  }
234
- }), this.roadNameLayer = new j({
238
+ }), this.roadNameLayer = new k({
235
239
  id: "OpenDriveRoadName",
236
240
  fields: [
237
241
  {
@@ -281,23 +285,24 @@ class S {
281
285
  }
282
286
  }
283
287
  ]
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([
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([
285
289
  this.laneLayer,
286
290
  this.junctionLayer,
287
291
  this.sectionLayer,
288
292
  this.roadNameLayer,
289
293
  this.highlightLayer,
290
294
  this.flashLayer,
291
- this.drawLayer
295
+ this.drawLayer,
296
+ this.splitLaneLayer
292
297
  ]);
293
298
  }
294
299
  static getInstance(e) {
295
- return this.instance || (this.instance = new S(e)), this.instance;
300
+ return this.instance || (this.instance = new $(e)), this.instance;
296
301
  }
297
302
  async makeMd5FromFile(e) {
298
303
  try {
299
304
  const i = await (await fetch(e)).text();
300
- return { status: 0, message: "ok", result: F(i) };
305
+ return { status: 0, message: "ok", result: P(i) };
301
306
  } catch (t) {
302
307
  return { status: -1, message: t.message };
303
308
  }
@@ -308,7 +313,7 @@ class S {
308
313
  * @returns
309
314
  */
310
315
  async showOpenDriveFromFile(e) {
311
- var h, f;
316
+ var g, m;
312
317
  this.openDriveClickCallback = e.selectedCallback, console.time("md5用时");
313
318
  const t = await this.makeMd5FromFile(e.file);
314
319
  if (t.status !== 0)
@@ -317,7 +322,7 @@ class S {
317
322
  const i = `http://${this.openDriveServer}/api/openDrive/uploadXodr`;
318
323
  let o;
319
324
  try {
320
- o = await g.post(
325
+ o = await b.post(
321
326
  i,
322
327
  {},
323
328
  {
@@ -327,32 +332,40 @@ class S {
327
332
  }
328
333
  }
329
334
  );
330
- } catch (d) {
331
- return { status: -1, message: d.message };
335
+ } catch (u) {
336
+ return { status: -1, message: u.message };
332
337
  }
333
338
  if (o.status !== 200)
334
339
  return { status: -1, message: o.statusText };
335
340
  console.time("渲染用时");
336
341
  const s = o.data.result.geoSetting;
337
- A.setGeoData(
342
+ F.setGeoData(
338
343
  s.geoReference,
339
344
  s.offsetX,
340
345
  s.offsetY
341
346
  );
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);
347
+ let c = o.data.result.json;
348
+ 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);
345
350
  await this.showAllLanes(
346
- c,
347
- ((h = e.options) == null ? void 0 : h.showJunctionLane) || !1,
348
- ((f = e.options) == null ? void 0 : f.showRoadName) || !0
351
+ n,
352
+ ((g = e.options) == null ? void 0 : g.showJunctionLane) || !1,
353
+ ((m = e.options) == null ? void 0 : m.showRoadName) || !0
349
354
  );
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]);
353
- await this.view.goTo(d);
355
+ const h = o.data.result.junctions;
356
+ if (this.showJunction(h), e.options && e.options.centerMap !== !1) {
357
+ const u = F.transformPointProjection([0, 0]);
358
+ await this.view.goTo(u);
354
359
  }
355
- return this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick(), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
360
+ this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick();
361
+ const d = J.useAppDataStore;
362
+ return x(
363
+ () => d.isSketching,
364
+ () => {
365
+ var u, p;
366
+ d.isSketching ? ((u = this.mouseMoveHandler) == null || u.remove(), this.mouseMoveHandler = void 0, (p = this.mouseClickHandler) == null || p.remove(), this.mouseClickHandler = void 0) : (this.monitorMouseMove(), this.monitorMouseClick());
367
+ }
368
+ ), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
356
369
  }
357
370
  /**
358
371
  * 从服务器载入OpenDrive文件解析结果并显示
@@ -360,7 +373,7 @@ class S {
360
373
  * @param projectName
361
374
  */
362
375
  async showOpenDriveFromServer(e, t) {
363
- const i = `http://${e}/api/openDrive/analyzeXodr`, o = await g.get(i, {
376
+ const i = `http://${e}/api/openDrive/analyzeXodr`, o = await b.get(i, {
364
377
  headers: {
365
378
  projectName: t
366
379
  },
@@ -373,7 +386,7 @@ class S {
373
386
  throw new Error(`OpenDriveRenderer: ${o.statusText}`);
374
387
  let s = o.data.result.json;
375
388
  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);
389
+ const a = await (await fetch(s)).arrayBuffer(), l = O.inflate(a, { to: "string" }), r = JSON.parse(l);
377
390
  return await this.showAllLanes(r, !1, !1), { status: 0, message: "ok" };
378
391
  }
379
392
  /**
@@ -388,67 +401,70 @@ class S {
388
401
  return o.features.length > 0 && this.laneLayer.applyEdits({
389
402
  deleteFeatures: o.features
390
403
  }), this.roadNameLayer.visible = i, new Promise((s) => {
391
- let l = 0;
404
+ let c = 0;
392
405
  this.allLaneGraphics = [], this.allRefLineGraphics = [];
393
406
  const a = [];
394
407
  for (const r of e) {
395
408
  if (!t && r.junction !== "-1")
396
409
  continue;
397
- const { id: c, refLine: m } = r;
398
- let h = r.name;
399
- h.includes("(") && (h = h.slice(0, h.indexOf("("))), h = h.replace(/(.)/g, "$1 ");
400
- const f = new p({
410
+ const { id: n, refLine: h } = r;
411
+ let d = r.name;
412
+ d.includes("(") && (d = d.slice(0, d.indexOf("("))), d = d.replace(/(.)/g, "$1 ");
413
+ const g = new y({
401
414
  geometry: {
402
415
  type: "polyline",
403
- paths: [m]
416
+ paths: [h]
404
417
  },
405
418
  attributes: {
406
- ObjectID: l++,
407
- roadId: c,
408
- roadName: h
419
+ ObjectID: c++,
420
+ roadId: n,
421
+ roadName: d
409
422
  }
410
423
  });
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);
416
- if (v === 0)
424
+ this.allRefLineGraphics.push(g), r.laneSections.sort((m, u) => Number(m.id) - Number(u.id));
425
+ for (let m = 0; m < r.laneSections.length; m++) {
426
+ const u = r.laneSections[m], p = Number(u.id);
427
+ for (const f of u.lanePaths) {
428
+ const w = Number(f.id);
429
+ if (w === 0)
417
430
  continue;
418
- const C = w.type, I = w.innerPath.concat(
419
- w.outerPath.reverse()
431
+ const v = f.type, M = [...f.outerPath], N = f.innerPath.concat(
432
+ M.reverse()
420
433
  );
421
- if (I.length <= 3) {
422
- console.warn(`lane ${v} has less than 3 points`);
434
+ if (N.length <= 3) {
435
+ console.warn(`lane ${w} has less than 3 points`);
423
436
  continue;
424
437
  }
425
- I.push(w.innerPath[0]);
426
- const N = new O({
427
- rings: [I]
438
+ N.push(f.innerPath[0]);
439
+ const A = new S({
440
+ rings: [N]
428
441
  });
429
- if (N) {
430
- const D = new p({
431
- geometry: N,
442
+ if (A) {
443
+ const j = new y({
444
+ geometry: A,
432
445
  attributes: {
433
- ObjectID: l++,
434
- id: `${c}+${u}+${v}`,
446
+ ObjectID: c++,
447
+ id: `${n}+${p}+${w}`,
435
448
  fromNode: r.fromNode,
436
449
  toNode: r.toNode,
437
- roadId: c,
450
+ roadId: String(n),
438
451
  roadName: r.name,
439
- sectionId: u,
440
- sectionIndex: d,
441
- laneId: v,
442
- type: C,
443
- sumoId: ""
452
+ sectionId: String(p),
453
+ sectionIndex: m,
454
+ laneId: w,
455
+ type: v,
456
+ sumoId: "",
457
+ // 记录左右边线的起始点,用于按长度高亮车道的一部分
458
+ leftLine: f.innerPath,
459
+ rightLine: f.outerPath
444
460
  }
445
461
  });
446
- this.allLaneGraphics.push(D), a.push(D);
462
+ this.allLaneGraphics.push(j), a.push(j);
447
463
  }
448
464
  }
449
465
  }
450
466
  }
451
- const n = setInterval(() => {
467
+ const l = setInterval(() => {
452
468
  if (a.length > 0 || this.allRefLineGraphics.length > 0) {
453
469
  if (a.length > 0) {
454
470
  const r = a.splice(0, 100);
@@ -463,7 +479,7 @@ class S {
463
479
  });
464
480
  }
465
481
  } else
466
- clearInterval(n), s();
482
+ clearInterval(l), s();
467
483
  }, 10);
468
484
  });
469
485
  }
@@ -478,7 +494,7 @@ class S {
478
494
  if (!i)
479
495
  continue;
480
496
  this.junctionNames.set(i.id, i.name), i.nodeType = i.type;
481
- const o = new p({
497
+ const o = new y({
482
498
  geometry: {
483
499
  type: "point",
484
500
  x: i.coordinates[0],
@@ -522,11 +538,11 @@ class S {
522
538
  * 监听鼠标移动事件,高亮显示鼠标所在路段和路口
523
539
  */
524
540
  monitorMouseMove() {
525
- const e = k.debounce(async (t) => {
526
- var l;
527
- const o = (l = (await this.view.hitTest(t, {
541
+ const e = D.debounce(async (t) => {
542
+ var c;
543
+ const o = (c = (await this.view.hitTest(t, {
528
544
  include: [this.laneLayer, this.junctionLayer]
529
- })).results) == null ? void 0 : l.filter(
545
+ })).results) == null ? void 0 : c.filter(
530
546
  (a) => a.type === "graphic"
531
547
  );
532
548
  if (o.length === 0) {
@@ -539,17 +555,17 @@ class S {
539
555
  "roadId"
540
556
  )}+${this.hitGraphic.getAttribute("sectionId")}`;
541
557
  if (a === this.currentSectionCode || this.sectionLayer.graphics.findIndex(
542
- (u) => u.getAttribute("id") === a
558
+ (p) => p.getAttribute("id") === a
543
559
  ) >= 0)
544
560
  return;
545
561
  this.currentSectionCode = a;
546
562
  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,
563
+ (p) => `${p.attributes.roadId}+${p.attributes.sectionId}` === a
564
+ ), n = L.union(
565
+ r.map((p) => p.geometry)
566
+ ), h = this.hitGraphic.getAttribute("fromNode"), d = this.hitGraphic.getAttribute("toNode"), g = this.junctionNames.get(h) || h, m = this.junctionNames.get(d) || d;
567
+ this.highlightGraphic = new y({
568
+ geometry: n,
553
569
  symbol: {
554
570
  type: "simple-fill",
555
571
  color: [0, 255, 255, 0.5],
@@ -563,8 +579,8 @@ class S {
563
579
  type: "OpenDriveSection",
564
580
  id: a,
565
581
  selected: !1,
566
- fromNodeName: f,
567
- toNodeName: d,
582
+ fromNodeName: g,
583
+ toNodeName: m,
568
584
  laneCount: r.length
569
585
  },
570
586
  popupTemplate: {
@@ -590,10 +606,10 @@ class S {
590
606
  ]
591
607
  }
592
608
  }), this.highlightLayer.removeAll(), this.highlightLayer.add(this.highlightGraphic);
593
- const y = this.view.toMap(t);
609
+ const u = this.view.toMap(t);
594
610
  this.view.openPopup({
595
611
  features: [this.highlightGraphic],
596
- location: y
612
+ location: u
597
613
  });
598
614
  } else if (s.layer.id === "OpenDriveJunction") {
599
615
  const a = this.hitGraphic.getAttribute("id");
@@ -614,28 +630,28 @@ class S {
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 = D.debounce(async (t) => {
634
+ var l;
635
+ const o = (l = (await this.view.hitTest(t, {
620
636
  include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
621
- })).results) == null ? void 0 : n.filter(
637
+ })).results) == null ? void 0 : l.filter(
622
638
  (r) => r.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, c = s.getAttribute("type"), a = s.getAttribute("id");
643
+ if (c === "OpenDriveJunction")
628
644
  if (s.getAttribute("selected") === !1) {
629
- const r = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, c = await g.get(r, {
645
+ const r = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, n = await b.get(r, {
630
646
  params: {
631
647
  id: a,
632
648
  projectName: this.projectName
633
649
  }
634
650
  });
635
- c.status === 200 && c.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
651
+ n.status === 200 && n.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
636
652
  type: "OpenDriveJunction",
637
653
  id: a,
638
- details: c.data.result
654
+ details: n.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({
@@ -646,7 +662,7 @@ class S {
646
662
  const r = s.getAttribute("crossId");
647
663
  s.symbol.url = r ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(s, 30);
648
664
  }
649
- else if (l === "OpenDriveSection")
665
+ else if (c === "OpenDriveSection")
650
666
  if (s.getAttribute("selected"))
651
667
  this.sectionLayer.remove(s), this.openDriveClickCallback && this.openDriveClickCallback({
652
668
  type: "OpenDriveSection",
@@ -655,16 +671,16 @@ class S {
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 r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, n = await b.get(r, {
659
675
  params: {
660
676
  id: a,
661
677
  projectName: this.projectName
662
678
  }
663
679
  });
664
- c.status === 200 && c.data.status === 0 && this.openDriveClickCallback && (s.setAttribute("edgeId", c.data.result.obj_id), this.openDriveClickCallback({
680
+ n.status === 200 && n.data.status === 0 && this.openDriveClickCallback && (s.setAttribute("edgeId", n.data.result.obj_id), this.openDriveClickCallback({
665
681
  type: "OpenDriveSection",
666
682
  id: a,
667
- details: c.data.result
683
+ details: n.data.result
668
684
  }));
669
685
  }
670
686
  });
@@ -708,7 +724,7 @@ class S {
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 t = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, i = await b.get(t, {
712
728
  params: {
713
729
  id: e.id,
714
730
  projectName: this.projectName
@@ -723,18 +739,18 @@ class S {
723
739
  let o = 0;
724
740
  t.length === 2 && (o = Number(t[1]));
725
741
  const s = this.allLaneGraphics.find(
726
- (l) => l.getAttribute("roadId") === i && l.getAttribute("sectionIndex") === o
742
+ (c) => c.getAttribute("roadId") === i && c.getAttribute("sectionIndex") === o
727
743
  );
728
744
  if (s) {
729
- const l = `${i}+${s.getAttribute(
745
+ const c = `${i}+${s.getAttribute(
730
746
  "sectionId"
731
- )}`, a = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, n = await g.get(a, {
747
+ )}`, a = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, l = await b.get(a, {
732
748
  params: {
733
- id: l,
749
+ id: c,
734
750
  projectName: this.projectName
735
751
  }
736
752
  });
737
- return n.status === 200 ? n.data : { status: -1, message: `路段信息查询失败: ${l}` };
753
+ return l.status === 200 ? l.data : { status: -1, message: `路段信息查询失败: ${c}` };
738
754
  } else
739
755
  return { status: -1, message: "未知类型" };
740
756
  }
@@ -767,11 +783,11 @@ class S {
767
783
  const s = i.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("#");
786
+ const c = s.length === 2 ? Number(s[1]) : void 0, a = s[0].split("#");
771
787
  if (a.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 l = a[0], r = a.length === 2 ? Number(a[1]) : void 0;
790
+ return await this.findLane({ roadsectId: l, segmentId: r, laneId: c, flash: o });
775
791
  } else
776
792
  return { status: -1, message: "未知类型" };
777
793
  }
@@ -782,7 +798,7 @@ class S {
782
798
  if (!i)
783
799
  return { status: -1, message: "未找到。请检查路口编号" };
784
800
  if (t) {
785
- const o = new p({
801
+ const o = new y({
786
802
  geometry: i.geometry,
787
803
  symbol: {
788
804
  type: "simple-marker",
@@ -808,37 +824,37 @@ class S {
808
824
  let { roadsectId: t, segmentId: i, laneId: o } = e;
809
825
  t.startsWith("-") && (t = t.slice(1));
810
826
  let s = this.allLaneGraphics.filter(
811
- (n) => n.attributes.roadId === t
827
+ (l) => l.attributes.roadId === t
812
828
  );
813
829
  if (s.length === 0)
814
830
  return { status: -1, message: "未找到。请检查路段编号" };
815
831
  if (i !== void 0) {
816
- const n = [];
832
+ const l = [];
817
833
  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)
834
+ const n = Number(r.attributes.sectionId);
835
+ l.indexOf(n) === -1 && l.push(n);
836
+ }), l.sort((r, n) => r - n), i > l.length - 1)
821
837
  return { status: -1, message: "未找到。请检查基本段编号" };
822
- i = n[i], s = s.filter(
838
+ i = l[i], s = s.filter(
823
839
  (r) => Number(r.attributes.sectionId) === i
824
840
  );
825
841
  }
826
842
  if (o !== void 0) {
827
- const n = [];
843
+ const l = [];
828
844
  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)
845
+ const n = Number(r.attributes.laneId);
846
+ l.indexOf(n) === -1 && l.push(n);
847
+ }), l.sort((r, n) => r - n), o > l.length - 1)
832
848
  return { status: -1, message: "未找到。请检查车道编号" };
833
- o = n[o], s = s.filter(
849
+ o = l[o], s = s.filter(
834
850
  (r) => Number(r.attributes.laneId) === o
835
851
  );
836
852
  }
837
- const l = s.map(
838
- (n) => n.geometry
839
- ), a = L.union(l);
853
+ const c = s.map(
854
+ (l) => l.geometry
855
+ ), a = L.union(c);
840
856
  if (e.flash) {
841
- const n = new p({
857
+ const l = new y({
842
858
  geometry: a,
843
859
  symbol: {
844
860
  type: "simple-fill",
@@ -850,7 +866,7 @@ class S {
850
866
  }
851
867
  }
852
868
  });
853
- this.flashGraphic(n);
869
+ this.flashGraphic(l);
854
870
  }
855
871
  return await this.view.goTo(a, { duration: 1e3 }), { status: 0, message: "ok" };
856
872
  }
@@ -902,18 +918,20 @@ class S {
902
918
  }), { status: -1, message: "未找到路口" };
903
919
  case "edge": {
904
920
  const t = e.id.split("#");
905
- let i = t[0];
921
+ let i = String(t[0]);
906
922
  i.startsWith("-") && (i = i.slice(1));
907
- let o = 0;
908
- t.length === 2 && (o = Number(t[1]));
909
- const s = this.allLaneGraphics.filter(
910
- (l) => l.getAttribute("roadId") === i && l.getAttribute("sectionIndex") === o
911
- );
912
- if (s.length > 0) {
913
- const l = L.union(
914
- s.map((n) => n.geometry)
915
- ), a = new p({
916
- geometry: l,
923
+ let o = "0";
924
+ t.length === 2 && (o = String(t[1]));
925
+ let s = [];
926
+ if (t.length === 1 ? s = this.allLaneGraphics.filter(
927
+ (c) => c.getAttribute("roadId") === i
928
+ ) : t.length === 2 && (s = this.allLaneGraphics.filter(
929
+ (c) => c.getAttribute("roadId") === i && c.getAttribute("sectionId") === o
930
+ )), s.length > 0) {
931
+ const c = L.union(
932
+ s.map((l) => l.geometry)
933
+ ), a = new y({
934
+ geometry: c,
917
935
  symbol: {
918
936
  type: "simple-fill",
919
937
  color: [0, 255, 255, 0.5],
@@ -937,10 +955,112 @@ class S {
937
955
  return { status: -1, message: "未知类型" };
938
956
  }
939
957
  }
958
+ async geometrySearch(e) {
959
+ const t = new S({
960
+ rings: [e]
961
+ }), i = await this.laneLayer.queryFeatures({
962
+ geometry: t,
963
+ outFields: ["*"]
964
+ }), o = [], s = [];
965
+ for (const l of i.features) {
966
+ const r = l.getAttribute("roadId"), n = l.getAttribute("sectionId"), h = `${r}#${n}`;
967
+ if (o.indexOf(h) === -1) {
968
+ o.push(h), this.selectSumo({
969
+ type: "edge",
970
+ id: h
971
+ });
972
+ const d = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, g = await b.get(d, {
973
+ params: {
974
+ id: `${r}+${n}`,
975
+ projectName: this.projectName
976
+ }
977
+ });
978
+ g.status === 200 && g.data.status === 0 && s.push(g.data.result);
979
+ }
980
+ }
981
+ const c = this.junctionLayer.graphics.filter((l) => {
982
+ const r = l.geometry;
983
+ return L.contains(t, r);
984
+ }), a = [];
985
+ for (const l of c) {
986
+ const r = l.getAttribute("id");
987
+ this.selectSumo({
988
+ type: "junction",
989
+ id: r
990
+ });
991
+ const n = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, h = await b.get(n, {
992
+ params: {
993
+ id: r,
994
+ projectName: this.projectName
995
+ }
996
+ });
997
+ h.status === 200 && h.data.status === 0 && a.push(h.data.result);
998
+ }
999
+ return {
1000
+ status: 0,
1001
+ message: "ok",
1002
+ result: {
1003
+ junctions: a,
1004
+ edges: s
1005
+ }
1006
+ };
1007
+ }
940
1008
  async splitLane(e) {
941
- return { status: 0, message: "ok", result: e };
1009
+ const i = e.id.split("+");
1010
+ if (i.length !== 2)
1011
+ return { status: -1, message: "车道编号格式错误" };
1012
+ const o = Number(i[1]), s = i[0].split("#"), c = s.length === 2 ? Number(s[1]) : 0;
1013
+ let a = s[0];
1014
+ a.startsWith("-") && (a = a.slice(1));
1015
+ const l = this.allLaneGraphics.filter((v) => v.getAttribute("roadId") === a && v.getAttribute("sectionIndex") === c);
1016
+ if (l.length === 0)
1017
+ return { status: -1, message: "未找到路段" };
1018
+ const r = l.length - o, n = l.find(
1019
+ (v) => Math.abs(v.getAttribute("laneId")) === r
1020
+ );
1021
+ if (!n)
1022
+ return { status: -1, message: "未找到车道" };
1023
+ const h = e.start || 0, d = e.end || 100, g = G.lineString(n.getAttribute("leftLine")), m = C(g, h, d, {
1024
+ units: "meters"
1025
+ }), u = G.lineString(n.getAttribute("rightLine")), p = C(u, h, d, {
1026
+ units: "meters"
1027
+ }), f = m.geometry.coordinates.concat(
1028
+ p.geometry.coordinates.reverse()
1029
+ );
1030
+ f.push(f[f.length - 1]);
1031
+ const w = new y({
1032
+ geometry: new S({
1033
+ rings: [f]
1034
+ }),
1035
+ 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"),
1047
+ leftLine: m.geometry.coordinates,
1048
+ rightLine: p.geometry.coordinates
1049
+ },
1050
+ symbol: {
1051
+ type: "simple-fill",
1052
+ color: [255, 0, 0, 0.8],
1053
+ outline: {
1054
+ color: "red"
1055
+ }
1056
+ }
1057
+ });
1058
+ return this.splitLaneLayer.add(w), this.view.goTo(w), { status: 0, message: "ok", result: e };
1059
+ }
1060
+ clearSplitLane() {
1061
+ this.splitLaneLayer.removeAll();
942
1062
  }
943
1063
  }
944
1064
  export {
945
- S as default
1065
+ $ as default
946
1066
  };