gisviewer-vue3-arcgis 1.0.263 → 1.0.265
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.
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +159 -148
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +17 -2
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +104 -74
- package/es/src/gis-map/utils/signal-control-area/show-area.mjs +11 -11
- package/es/src/types/index.d.ts +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +17 -2
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
- package/lib/src/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import I from "@arcgis/core/Graphic";
|
|
2
|
-
import * as
|
|
2
|
+
import * as j from "@arcgis/core/core/promiseUtils";
|
|
3
3
|
import * as $ from "@arcgis/core/core/reactiveUtils.js";
|
|
4
4
|
import { Polygon as S, Point as F } from "@arcgis/core/geometry";
|
|
5
5
|
import * as L from "@arcgis/core/geometry/geometryEngine";
|
|
@@ -310,13 +310,13 @@ class O {
|
|
|
310
310
|
return this.instance || (this.instance = new O(e)), this.instance;
|
|
311
311
|
}
|
|
312
312
|
async makeMd5FromFile(e) {
|
|
313
|
-
var
|
|
313
|
+
var i;
|
|
314
314
|
try {
|
|
315
315
|
const s = await (await fetch(e)).text();
|
|
316
|
-
let r = (
|
|
316
|
+
let r = (i = new J({
|
|
317
317
|
ignoreAttributes: !1,
|
|
318
318
|
allowBooleanAttributes: !0
|
|
319
|
-
}).parse(s).OpenDRIVE.userData) == null ? void 0 :
|
|
319
|
+
}).parse(s).OpenDRIVE.userData) == null ? void 0 : i.border;
|
|
320
320
|
return r ? r = JSON.parse(r) : r = [], { status: 0, message: "ok", result: { md5: E(s), border: r } };
|
|
321
321
|
} catch (o) {
|
|
322
322
|
return { status: -1, message: o.message };
|
|
@@ -335,8 +335,8 @@ class O {
|
|
|
335
335
|
u > this.junctionScale && p <= this.junctionScale ? this.updateAllJunctionSymbol("marker") : u <= this.junctionScale && p > this.junctionScale && this.updateAllJunctionSymbol("picture");
|
|
336
336
|
}
|
|
337
337
|
);
|
|
338
|
-
let
|
|
339
|
-
|
|
338
|
+
let i = e.file.split("/").pop() || "";
|
|
339
|
+
i = i.split(".").slice(0, -1).join("."), this.openDriveServer = e.server;
|
|
340
340
|
const o = `http://${this.openDriveServer}/api/openDrive/uploadXodr`;
|
|
341
341
|
let s;
|
|
342
342
|
try {
|
|
@@ -346,7 +346,7 @@ class O {
|
|
|
346
346
|
{
|
|
347
347
|
params: {
|
|
348
348
|
url: e.file,
|
|
349
|
-
projectName:
|
|
349
|
+
projectName: i
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
);
|
|
@@ -356,11 +356,11 @@ class O {
|
|
|
356
356
|
if (s.status !== 200)
|
|
357
357
|
return { status: -1, message: s.statusText };
|
|
358
358
|
console.time("渲染用时");
|
|
359
|
-
const
|
|
359
|
+
const t = s.data.result.geoSetting;
|
|
360
360
|
A.setGeoData(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
t.geoReference,
|
|
362
|
+
t.offsetX,
|
|
363
|
+
t.offsetY
|
|
364
364
|
);
|
|
365
365
|
let l = s.data.result.json;
|
|
366
366
|
l.startsWith(window.location.protocol) || (l = `${window.location.protocol}//${e.server}${l}`);
|
|
@@ -394,10 +394,10 @@ class O {
|
|
|
394
394
|
* @param server
|
|
395
395
|
* @param projectName
|
|
396
396
|
*/
|
|
397
|
-
async showOpenDriveFromServer(e,
|
|
397
|
+
async showOpenDriveFromServer(e, i) {
|
|
398
398
|
const o = `http://${e}/api/openDrive/analyzeXodr`, s = await w.get(o, {
|
|
399
399
|
headers: {
|
|
400
|
-
projectName:
|
|
400
|
+
projectName: i
|
|
401
401
|
},
|
|
402
402
|
params: {
|
|
403
403
|
analyze: !1,
|
|
@@ -406,11 +406,11 @@ class O {
|
|
|
406
406
|
});
|
|
407
407
|
if (s.status !== 200)
|
|
408
408
|
throw new Error(`OpenDriveRenderer: ${s.statusText}`);
|
|
409
|
-
let
|
|
410
|
-
|
|
411
|
-
const l = await fetch(
|
|
409
|
+
let t = s.data.result.json;
|
|
410
|
+
t.startsWith(window.location.protocol) || (t = `${window.location.protocol}//${e}${t}`);
|
|
411
|
+
const l = await fetch(t);
|
|
412
412
|
let r;
|
|
413
|
-
if (
|
|
413
|
+
if (t.endsWith("bin")) {
|
|
414
414
|
const a = await l.arrayBuffer(), c = M.inflate(a, { to: "string" });
|
|
415
415
|
r = JSON.parse(c);
|
|
416
416
|
} else
|
|
@@ -424,17 +424,17 @@ class O {
|
|
|
424
424
|
* @param showRoadName 是否显示道路名称
|
|
425
425
|
* @returns
|
|
426
426
|
*/
|
|
427
|
-
async showAllLanes(e,
|
|
427
|
+
async showAllLanes(e, i, o) {
|
|
428
428
|
const s = await this.laneLayer.queryFeatures();
|
|
429
429
|
return s.features.length > 0 && this.laneLayer.applyEdits({
|
|
430
430
|
deleteFeatures: s.features
|
|
431
|
-
}), this.roadNameLayer.visible = o, new Promise((
|
|
431
|
+
}), this.roadNameLayer.visible = o, new Promise((t) => {
|
|
432
432
|
var c;
|
|
433
433
|
let l = 0;
|
|
434
434
|
this.allLaneGraphics = [], this.allRefLineGraphics = [];
|
|
435
435
|
const r = [];
|
|
436
436
|
for (const n of e) {
|
|
437
|
-
if (!
|
|
437
|
+
if (!i && n.junction !== "-1")
|
|
438
438
|
continue;
|
|
439
439
|
const { id: d, refLine: y } = n;
|
|
440
440
|
let h = n.name;
|
|
@@ -457,20 +457,20 @@ class O {
|
|
|
457
457
|
const b = Number(f.id);
|
|
458
458
|
if (b === 0)
|
|
459
459
|
continue;
|
|
460
|
-
const B = f.type, P = [...f.outerPath],
|
|
460
|
+
const B = f.type, P = [...f.outerPath], k = f.innerPath.concat(
|
|
461
461
|
P.reverse()
|
|
462
462
|
);
|
|
463
|
-
if (
|
|
463
|
+
if (k.length <= 3) {
|
|
464
464
|
console.warn(`lane ${b} has less than 3 points`);
|
|
465
465
|
continue;
|
|
466
466
|
}
|
|
467
|
-
|
|
468
|
-
const
|
|
469
|
-
rings: [
|
|
467
|
+
k.push(f.innerPath[0]);
|
|
468
|
+
const N = new S({
|
|
469
|
+
rings: [k]
|
|
470
470
|
});
|
|
471
|
-
if (
|
|
472
|
-
const
|
|
473
|
-
geometry:
|
|
471
|
+
if (N) {
|
|
472
|
+
const C = new I({
|
|
473
|
+
geometry: N,
|
|
474
474
|
attributes: {
|
|
475
475
|
ObjectID: l++,
|
|
476
476
|
id: `${d}+${m}+${b}`,
|
|
@@ -490,7 +490,7 @@ class O {
|
|
|
490
490
|
roadsectBaseIds: (c = g.roadsectBaseIds) == null ? void 0 : c.toString()
|
|
491
491
|
}
|
|
492
492
|
});
|
|
493
|
-
this.allLaneGraphics.push(
|
|
493
|
+
this.allLaneGraphics.push(C), r.push(C);
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
}
|
|
@@ -510,7 +510,7 @@ class O {
|
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
512
|
} else
|
|
513
|
-
clearInterval(a),
|
|
513
|
+
clearInterval(a), t();
|
|
514
514
|
}, 10);
|
|
515
515
|
});
|
|
516
516
|
}
|
|
@@ -520,21 +520,21 @@ class O {
|
|
|
520
520
|
* @returns
|
|
521
521
|
*/
|
|
522
522
|
showJunction(e) {
|
|
523
|
-
const
|
|
523
|
+
const i = [];
|
|
524
524
|
let o;
|
|
525
525
|
this.xodrBorder.length > 0 && (o = new S({
|
|
526
526
|
rings: [this.xodrBorder]
|
|
527
527
|
}));
|
|
528
528
|
for (const s of e)
|
|
529
529
|
if (s && (this.junctionNames.set(s.id, s.name), s.nodeType = s.type, s.crossId)) {
|
|
530
|
-
const
|
|
530
|
+
const t = new F({
|
|
531
531
|
x: s.coordinates[0],
|
|
532
532
|
y: s.coordinates[1]
|
|
533
533
|
});
|
|
534
534
|
let l = !0;
|
|
535
|
-
if (o && (l = L.contains(o,
|
|
535
|
+
if (o && (l = L.contains(o, t)), l) {
|
|
536
536
|
const r = new I({
|
|
537
|
-
geometry:
|
|
537
|
+
geometry: t,
|
|
538
538
|
attributes: {
|
|
539
539
|
...s,
|
|
540
540
|
selected: !1,
|
|
@@ -542,18 +542,18 @@ class O {
|
|
|
542
542
|
},
|
|
543
543
|
symbol: this.getCrossGraphicSymbol(s, "marker")
|
|
544
544
|
});
|
|
545
|
-
|
|
545
|
+
i.push(r);
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
this.junctionLayer.addMany(
|
|
548
|
+
this.junctionLayer.addMany(i);
|
|
549
549
|
}
|
|
550
550
|
/**
|
|
551
551
|
* 监听鼠标移动事件,高亮显示鼠标所在路段和路口
|
|
552
552
|
*/
|
|
553
553
|
monitorMouseMove() {
|
|
554
|
-
const e =
|
|
554
|
+
const e = j.debounce(async (i) => {
|
|
555
555
|
var l;
|
|
556
|
-
const s = (l = (await this.view.hitTest(
|
|
556
|
+
const s = (l = (await this.view.hitTest(i, {
|
|
557
557
|
include: [this.laneLayer, this.junctionLayer]
|
|
558
558
|
})).results) == null ? void 0 : l.filter(
|
|
559
559
|
(r) => r.type === "graphic"
|
|
@@ -562,8 +562,8 @@ class O {
|
|
|
562
562
|
this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = ""), this.view.closePopup();
|
|
563
563
|
return;
|
|
564
564
|
}
|
|
565
|
-
const
|
|
566
|
-
if (this.hitGraphic =
|
|
565
|
+
const t = s[0];
|
|
566
|
+
if (this.hitGraphic = t.graphic, t.layer.id === "OpenDriveLane") {
|
|
567
567
|
const r = `${this.hitGraphic.getAttribute(
|
|
568
568
|
"roadId"
|
|
569
569
|
)}+${this.hitGraphic.getAttribute("sectionId")}`, a = this.hitGraphic.getAttribute("roadsectBaseIds");
|
|
@@ -594,7 +594,8 @@ class O {
|
|
|
594
594
|
fromNodeName: u,
|
|
595
595
|
toNodeName: p,
|
|
596
596
|
laneCount: n.length,
|
|
597
|
-
roadsectBaseIds: this.hitGraphic.getAttribute("roadsectBaseIds")
|
|
597
|
+
roadsectBaseIds: this.hitGraphic.getAttribute("roadsectBaseIds"),
|
|
598
|
+
roadId: this.hitGraphic.getAttribute("roadId")
|
|
598
599
|
},
|
|
599
600
|
popupTemplate: {
|
|
600
601
|
title: this.hitGraphic.getAttribute("roadName"),
|
|
@@ -620,15 +621,15 @@ class O {
|
|
|
620
621
|
}
|
|
621
622
|
});
|
|
622
623
|
this.highlightLayer.removeAll(), this.highlightLayer.add(g);
|
|
623
|
-
} else if (
|
|
624
|
+
} else if (t.layer.id === "OpenDriveJunction") {
|
|
624
625
|
const r = this.hitGraphic.getAttribute("id");
|
|
625
626
|
if (r === this.currentJunctionId)
|
|
626
627
|
return;
|
|
627
628
|
this.currentJunctionId = r;
|
|
628
629
|
}
|
|
629
630
|
});
|
|
630
|
-
this.mouseMoveHandler = this.view.on("pointer-move", async (
|
|
631
|
-
e(
|
|
631
|
+
this.mouseMoveHandler = this.view.on("pointer-move", async (i) => {
|
|
632
|
+
e(i).catch(() => {
|
|
632
633
|
});
|
|
633
634
|
});
|
|
634
635
|
}
|
|
@@ -636,18 +637,18 @@ class O {
|
|
|
636
637
|
* 监听鼠标点击事件,获取高亮要素的拓扑信息
|
|
637
638
|
*/
|
|
638
639
|
monitorMouseClick() {
|
|
639
|
-
const e =
|
|
640
|
+
const e = j.debounce(async (i) => {
|
|
640
641
|
var a;
|
|
641
|
-
const s = (a = (await this.view.hitTest(
|
|
642
|
+
const s = (a = (await this.view.hitTest(i, {
|
|
642
643
|
include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
|
|
643
644
|
})).results) == null ? void 0 : a.filter(
|
|
644
645
|
(c) => c.type === "graphic"
|
|
645
646
|
);
|
|
646
647
|
if (s.length === 0)
|
|
647
648
|
return;
|
|
648
|
-
const
|
|
649
|
+
const t = s[0].graphic, l = t.getAttribute("type"), r = t.getAttribute("id");
|
|
649
650
|
if (l === "OpenDriveJunction")
|
|
650
|
-
if (
|
|
651
|
+
if (t.getAttribute("selected") === !1) {
|
|
651
652
|
const c = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, n = await w.get(c, {
|
|
652
653
|
params: {
|
|
653
654
|
id: r,
|
|
@@ -658,24 +659,24 @@ class O {
|
|
|
658
659
|
type: "OpenDriveJunction",
|
|
659
660
|
id: r,
|
|
660
661
|
details: n.data.result
|
|
661
|
-
}),
|
|
662
|
+
}), t.setAttribute("selected", !0), t.symbol = {
|
|
662
663
|
type: "picture-marker",
|
|
663
664
|
url: "/GisViewerAssets/Images/point_red.png",
|
|
664
665
|
width: "20px",
|
|
665
666
|
height: "20px"
|
|
666
|
-
}, this.increasePictureMarkerSize(
|
|
667
|
+
}, this.increasePictureMarkerSize(t, 50));
|
|
667
668
|
} else
|
|
668
669
|
this.openDriveClickCallback && this.openDriveClickCallback({
|
|
669
670
|
type: "OpenDriveJunction",
|
|
670
671
|
id: r,
|
|
671
672
|
details: void 0
|
|
672
|
-
}),
|
|
673
|
-
|
|
673
|
+
}), t.setAttribute("selected", !1), t.symbol = this.getCrossGraphicSymbol(
|
|
674
|
+
t.attributes,
|
|
674
675
|
this.view.scale < this.junctionScale ? "picture" : "marker"
|
|
675
676
|
);
|
|
676
677
|
else
|
|
677
|
-
l === "OpenDriveSection" && (
|
|
678
|
-
(n) => n.getAttribute("roadsectBaseIds") ===
|
|
678
|
+
l === "OpenDriveSection" && (t.layer.id === "OpenDriveHighlight" ? (this.highlightLayer.removeAll(), this.sectionLayer.removeAll(), this.selectedSectionIds = [], this.sectionLayer.add(t), t.setAttribute("selected", !0), this.selectedSectionIds.push(r), this.splitLaneLayer.graphics.filter(
|
|
679
|
+
(n) => n.getAttribute("roadsectBaseIds") === t.getAttribute("roadsectBaseIds")
|
|
679
680
|
).forEach(
|
|
680
681
|
(n) => n.symbol = {
|
|
681
682
|
type: "simple-fill",
|
|
@@ -685,8 +686,15 @@ class O {
|
|
|
685
686
|
width: 2
|
|
686
687
|
}
|
|
687
688
|
}
|
|
688
|
-
)
|
|
689
|
-
|
|
689
|
+
), this.openDriveClickCallback && this.openDriveClickCallback({
|
|
690
|
+
type: "OpenDriveSection",
|
|
691
|
+
id: t.getAttribute("id"),
|
|
692
|
+
details: {
|
|
693
|
+
roadsectId: t.getAttribute("roadId"),
|
|
694
|
+
roadsectBaseIds: t.getAttribute("roadsectBaseIds")
|
|
695
|
+
}
|
|
696
|
+
})) : (this.splitLaneLayer.graphics.filter(
|
|
697
|
+
(n) => n.getAttribute("roadsectBaseIds") === t.getAttribute("roadsectBaseIds")
|
|
690
698
|
).forEach(
|
|
691
699
|
(n) => n.symbol = {
|
|
692
700
|
type: "simple-fill",
|
|
@@ -696,14 +704,17 @@ class O {
|
|
|
696
704
|
width: 1
|
|
697
705
|
}
|
|
698
706
|
}
|
|
699
|
-
), this.sectionLayer.remove(
|
|
700
|
-
type: "
|
|
701
|
-
id:
|
|
702
|
-
details:
|
|
707
|
+
), this.sectionLayer.remove(t), this.selectedSectionIds = [], this.openDriveClickCallback && this.openDriveClickCallback({
|
|
708
|
+
type: "CloseOpenDriveSection",
|
|
709
|
+
id: t.getAttribute("roadsectBaseIds"),
|
|
710
|
+
details: {
|
|
711
|
+
roadsectId: t.getAttribute("roadId"),
|
|
712
|
+
roadsectBaseIds: t.getAttribute("roadsectBaseIds")
|
|
713
|
+
}
|
|
703
714
|
})));
|
|
704
715
|
});
|
|
705
|
-
this.mouseClickHandler = this.view.on("immediate-click", async (
|
|
706
|
-
e(
|
|
716
|
+
this.mouseClickHandler = this.view.on("immediate-click", async (i) => {
|
|
717
|
+
e(i).catch(() => {
|
|
707
718
|
});
|
|
708
719
|
});
|
|
709
720
|
}
|
|
@@ -712,14 +723,14 @@ class O {
|
|
|
712
723
|
* @param graphic
|
|
713
724
|
* @param targetSize
|
|
714
725
|
*/
|
|
715
|
-
increasePictureMarkerSize(e,
|
|
726
|
+
increasePictureMarkerSize(e, i) {
|
|
716
727
|
const o = setInterval(() => {
|
|
717
|
-
const s = e.symbol,
|
|
718
|
-
|
|
728
|
+
const s = e.symbol, t = s.width;
|
|
729
|
+
t < i ? e.symbol = {
|
|
719
730
|
type: "picture-marker",
|
|
720
731
|
url: s.url,
|
|
721
|
-
width:
|
|
722
|
-
height:
|
|
732
|
+
width: t + 1,
|
|
733
|
+
height: t + 1
|
|
723
734
|
} : clearInterval(o);
|
|
724
735
|
}, 20);
|
|
725
736
|
}
|
|
@@ -728,21 +739,21 @@ class O {
|
|
|
728
739
|
* @param graphic
|
|
729
740
|
* @param targetSize
|
|
730
741
|
*/
|
|
731
|
-
decreasePictureMarkerSize(e,
|
|
742
|
+
decreasePictureMarkerSize(e, i) {
|
|
732
743
|
const o = setInterval(() => {
|
|
733
|
-
const s = e.symbol,
|
|
734
|
-
|
|
744
|
+
const s = e.symbol, t = s.width;
|
|
745
|
+
t > i ? e.symbol = {
|
|
735
746
|
type: "picture-marker",
|
|
736
747
|
url: s.url,
|
|
737
|
-
width:
|
|
738
|
-
height:
|
|
748
|
+
width: t - 1,
|
|
749
|
+
height: t - 1
|
|
739
750
|
} : clearInterval(o);
|
|
740
751
|
}, 20);
|
|
741
752
|
}
|
|
742
753
|
async getSumoInfo(e) {
|
|
743
754
|
switch (e.type) {
|
|
744
755
|
case "junction": {
|
|
745
|
-
const
|
|
756
|
+
const i = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, o = await w.get(i, {
|
|
746
757
|
params: {
|
|
747
758
|
id: e.id,
|
|
748
759
|
projectName: this.projectName
|
|
@@ -751,16 +762,16 @@ class O {
|
|
|
751
762
|
return o.status === 200 ? o.data : { status: -1, message: `路口信息查询失败: ${e.id}` };
|
|
752
763
|
}
|
|
753
764
|
case "edge": {
|
|
754
|
-
const
|
|
755
|
-
let o =
|
|
765
|
+
const i = e.id.split("#");
|
|
766
|
+
let o = i[0];
|
|
756
767
|
o.startsWith("-") && (o = o.slice(1));
|
|
757
768
|
let s = 0;
|
|
758
|
-
|
|
759
|
-
const
|
|
769
|
+
i.length === 2 && (s = Number(i[1]));
|
|
770
|
+
const t = this.allLaneGraphics.find(
|
|
760
771
|
(l) => l.getAttribute("roadId") === o && l.getAttribute("sectionIndex") === s
|
|
761
772
|
);
|
|
762
|
-
if (
|
|
763
|
-
const l = `${o}+${
|
|
773
|
+
if (t) {
|
|
774
|
+
const l = `${o}+${t.getAttribute(
|
|
764
775
|
"sectionId"
|
|
765
776
|
)}`, r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, a = await w.get(r, {
|
|
766
777
|
params: {
|
|
@@ -783,13 +794,13 @@ class O {
|
|
|
783
794
|
* 清除OpenDrive内容
|
|
784
795
|
*/
|
|
785
796
|
async clearOpenDrive() {
|
|
786
|
-
var
|
|
797
|
+
var i, o, s;
|
|
787
798
|
let e = await this.laneLayer.queryFeatures();
|
|
788
799
|
e.features.length > 0 && await this.laneLayer.applyEdits({
|
|
789
800
|
deleteFeatures: e.features
|
|
790
801
|
}), e = await this.roadNameLayer.queryFeatures(), e.features.length > 0 && await this.roadNameLayer.applyEdits({
|
|
791
802
|
deleteFeatures: e.features
|
|
792
|
-
}), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), this.borderLayer.removeAll(), (
|
|
803
|
+
}), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), this.borderLayer.removeAll(), (i = this.mouseMoveHandler) == null || i.remove(), this.mouseMoveHandler = void 0, (o = this.mouseClickHandler) == null || o.remove(), this.mouseClickHandler = void 0, (s = this.scaleWatch) == null || s.remove(), this.scaleWatch = void 0;
|
|
793
804
|
}
|
|
794
805
|
/**
|
|
795
806
|
* 用sumo的id定位车道、基本段、路段
|
|
@@ -797,14 +808,14 @@ class O {
|
|
|
797
808
|
* @returns
|
|
798
809
|
*/
|
|
799
810
|
async findSumo(e) {
|
|
800
|
-
const { type:
|
|
801
|
-
if (
|
|
811
|
+
const { type: i, id: o } = e, s = e.flash === void 0 ? !0 : e.flash;
|
|
812
|
+
if (i === "junction")
|
|
802
813
|
return await this.findJunction(o, s);
|
|
803
|
-
if (
|
|
804
|
-
const
|
|
805
|
-
if (
|
|
814
|
+
if (i === "edge") {
|
|
815
|
+
const t = o.split("_");
|
|
816
|
+
if (t.length > 2)
|
|
806
817
|
return { status: -1, message: "id格式错误" };
|
|
807
|
-
const l =
|
|
818
|
+
const l = t.length === 2 ? Number(t[1]) : void 0, r = t[0].split("#");
|
|
808
819
|
if (r.length > 2)
|
|
809
820
|
return { status: -1, message: "id格式错误" };
|
|
810
821
|
const a = r[0], c = r.length === 2 ? Number(r[1]) : void 0;
|
|
@@ -812,13 +823,13 @@ class O {
|
|
|
812
823
|
} else
|
|
813
824
|
return { status: -1, message: "未知类型" };
|
|
814
825
|
}
|
|
815
|
-
async findJunction(e,
|
|
826
|
+
async findJunction(e, i) {
|
|
816
827
|
const o = this.junctionLayer.graphics.find(
|
|
817
828
|
(s) => s.attributes.id === e
|
|
818
829
|
);
|
|
819
830
|
if (!o)
|
|
820
831
|
return { status: -1, message: "未找到。请检查路口编号" };
|
|
821
|
-
if (
|
|
832
|
+
if (i) {
|
|
822
833
|
const s = new I({
|
|
823
834
|
geometry: o.geometry,
|
|
824
835
|
symbol: {
|
|
@@ -842,36 +853,36 @@ class O {
|
|
|
842
853
|
* @returns
|
|
843
854
|
*/
|
|
844
855
|
async findLane(e) {
|
|
845
|
-
let { roadsectId:
|
|
846
|
-
|
|
847
|
-
let
|
|
848
|
-
(a) => a.attributes.roadId ===
|
|
856
|
+
let { roadsectId: i, segmentId: o, laneId: s } = e;
|
|
857
|
+
i.startsWith("-") && (i = i.slice(1));
|
|
858
|
+
let t = this.allLaneGraphics.filter(
|
|
859
|
+
(a) => a.attributes.roadId === i
|
|
849
860
|
);
|
|
850
|
-
if (
|
|
861
|
+
if (t.length === 0)
|
|
851
862
|
return { status: -1, message: "未找到。请检查路段编号" };
|
|
852
863
|
if (o !== void 0) {
|
|
853
864
|
const a = [];
|
|
854
|
-
if (
|
|
865
|
+
if (t.forEach((c) => {
|
|
855
866
|
const n = Number(c.attributes.sectionId);
|
|
856
867
|
a.indexOf(n) === -1 && a.push(n);
|
|
857
868
|
}), a.sort((c, n) => c - n), o > a.length - 1)
|
|
858
869
|
return { status: -1, message: "未找到。请检查基本段编号" };
|
|
859
|
-
o = a[o],
|
|
870
|
+
o = a[o], t = t.filter(
|
|
860
871
|
(c) => Number(c.attributes.sectionId) === o
|
|
861
872
|
);
|
|
862
873
|
}
|
|
863
874
|
if (s !== void 0) {
|
|
864
875
|
const a = [];
|
|
865
|
-
if (
|
|
876
|
+
if (t.forEach((c) => {
|
|
866
877
|
const n = Number(c.attributes.laneId);
|
|
867
878
|
a.indexOf(n) === -1 && a.push(n);
|
|
868
879
|
}), a.sort((c, n) => c - n), s > a.length - 1)
|
|
869
880
|
return { status: -1, message: "未找到。请检查车道编号" };
|
|
870
|
-
s = a[s],
|
|
881
|
+
s = a[s], t = t.filter(
|
|
871
882
|
(c) => Number(c.attributes.laneId) === s
|
|
872
883
|
);
|
|
873
884
|
}
|
|
874
|
-
const l =
|
|
885
|
+
const l = t.map(
|
|
875
886
|
(a) => a.geometry
|
|
876
887
|
), r = L.union(l);
|
|
877
888
|
if (e.flash) {
|
|
@@ -896,9 +907,9 @@ class O {
|
|
|
896
907
|
*/
|
|
897
908
|
flashGraphic(e) {
|
|
898
909
|
this.flashLayer.removeAll(), this.flashLayer.add(e);
|
|
899
|
-
let
|
|
910
|
+
let i = 0, o = !0;
|
|
900
911
|
const s = setInterval(() => {
|
|
901
|
-
o ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (o = !1,
|
|
912
|
+
o ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (o = !1, i++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (o = !0)), i >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(s));
|
|
902
913
|
}, 10);
|
|
903
914
|
}
|
|
904
915
|
/**
|
|
@@ -907,19 +918,19 @@ class O {
|
|
|
907
918
|
* @returns
|
|
908
919
|
*/
|
|
909
920
|
unselectSumo(e) {
|
|
910
|
-
if (e ? e.type === "junction" && this.junctionLayer.graphics.forEach((
|
|
911
|
-
(!e || !e.id || e.id === "" || e.id ===
|
|
912
|
-
|
|
921
|
+
if (e ? e.type === "junction" && this.junctionLayer.graphics.forEach((i) => {
|
|
922
|
+
(!e || !e.id || e.id === "" || e.id === i.getAttribute("id")) && i.getAttribute("selected") && (i.setAttribute("selected", !1), i.symbol = this.getCrossGraphicSymbol(
|
|
923
|
+
i.attributes,
|
|
913
924
|
this.view.scale < this.junctionScale ? "picture" : "marker"
|
|
914
925
|
));
|
|
915
926
|
}) : (this.highlightLayer.removeAll(), this.sectionLayer.removeAll(), this.selectedSectionIds = [], this.splitLaneLayer.removeAll()), !e || e.type === "edge") {
|
|
916
|
-
let
|
|
917
|
-
!e || !e.id || e.id === "" ?
|
|
927
|
+
let i;
|
|
928
|
+
!e || !e.id || e.id === "" ? i = this.sectionLayer.graphics.toArray() : i = this.sectionLayer.graphics.filter((o) => o.getAttribute("edgeId") === e.id).toArray(), i.length > 0 && (i.forEach((o) => {
|
|
918
929
|
const s = o.getAttribute("id");
|
|
919
930
|
this.selectedSectionIds = this.selectedSectionIds.filter(
|
|
920
|
-
(
|
|
931
|
+
(t) => t !== s
|
|
921
932
|
);
|
|
922
|
-
}), this.sectionLayer.removeMany(
|
|
933
|
+
}), this.sectionLayer.removeMany(i));
|
|
923
934
|
}
|
|
924
935
|
return { status: 0, message: "ok" };
|
|
925
936
|
}
|
|
@@ -931,24 +942,24 @@ class O {
|
|
|
931
942
|
async selectSumo(e) {
|
|
932
943
|
switch (e.type) {
|
|
933
944
|
case "junction":
|
|
934
|
-
return this.junctionLayer.graphics.forEach((
|
|
935
|
-
if (e.id ===
|
|
936
|
-
return
|
|
945
|
+
return this.junctionLayer.graphics.forEach((i) => {
|
|
946
|
+
if (e.id === i.getAttribute("id"))
|
|
947
|
+
return i.setAttribute("selected", !0), i.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(i, 50), { status: 0, message: "ok" };
|
|
937
948
|
}), { status: -1, message: "未找到路口" };
|
|
938
949
|
case "edge": {
|
|
939
|
-
const
|
|
940
|
-
let o = String(
|
|
950
|
+
const i = e.id.split("#");
|
|
951
|
+
let o = String(i[0]);
|
|
941
952
|
o.startsWith("-") && (o = o.slice(1));
|
|
942
953
|
let s = 0;
|
|
943
|
-
|
|
944
|
-
let
|
|
945
|
-
if (
|
|
954
|
+
i.length === 2 && (s = Number(i[1]));
|
|
955
|
+
let t = [];
|
|
956
|
+
if (i.length === 1 ? t = this.allLaneGraphics.filter(
|
|
946
957
|
(l) => l.getAttribute("roadId") === o
|
|
947
|
-
) :
|
|
958
|
+
) : i.length === 2 && (t = this.allLaneGraphics.filter(
|
|
948
959
|
(l) => l.getAttribute("roadId") === o && l.getAttribute("sectionIndex") === s
|
|
949
|
-
)),
|
|
960
|
+
)), t.length > 0) {
|
|
950
961
|
const l = /* @__PURE__ */ new Map();
|
|
951
|
-
return
|
|
962
|
+
return t.forEach((r) => {
|
|
952
963
|
const a = r.getAttribute("roadId") + "+" + r.getAttribute("sectionId");
|
|
953
964
|
this.selectedSectionIds.includes(a) || this.selectedSectionIds.push(a);
|
|
954
965
|
let c = l.get(a);
|
|
@@ -982,12 +993,12 @@ class O {
|
|
|
982
993
|
}
|
|
983
994
|
}
|
|
984
995
|
async geometrySearch(e) {
|
|
985
|
-
const
|
|
996
|
+
const i = new S({
|
|
986
997
|
rings: [e]
|
|
987
998
|
}), o = await this.laneLayer.queryFeatures({
|
|
988
|
-
geometry:
|
|
999
|
+
geometry: i,
|
|
989
1000
|
outFields: ["*"]
|
|
990
|
-
}), s = [],
|
|
1001
|
+
}), s = [], t = [];
|
|
991
1002
|
for (const a of o.features) {
|
|
992
1003
|
const c = a.getAttribute("roadId"), n = a.getAttribute("sectionIndex"), d = `${c}#${n}`;
|
|
993
1004
|
if (s.indexOf(d) === -1) {
|
|
@@ -1001,12 +1012,12 @@ class O {
|
|
|
1001
1012
|
projectName: this.projectName
|
|
1002
1013
|
}
|
|
1003
1014
|
});
|
|
1004
|
-
h.status === 200 && h.data.status === 0 &&
|
|
1015
|
+
h.status === 200 && h.data.status === 0 && t.push(h.data.result);
|
|
1005
1016
|
}
|
|
1006
1017
|
}
|
|
1007
1018
|
const l = this.junctionLayer.graphics.filter((a) => {
|
|
1008
1019
|
const c = a.geometry;
|
|
1009
|
-
return L.contains(
|
|
1020
|
+
return L.contains(i, c);
|
|
1010
1021
|
}), r = [];
|
|
1011
1022
|
for (const a of l) {
|
|
1012
1023
|
const c = a.getAttribute("id");
|
|
@@ -1027,7 +1038,7 @@ class O {
|
|
|
1027
1038
|
message: "ok",
|
|
1028
1039
|
result: {
|
|
1029
1040
|
junctions: r,
|
|
1030
|
-
edges:
|
|
1041
|
+
edges: t
|
|
1031
1042
|
}
|
|
1032
1043
|
};
|
|
1033
1044
|
}
|
|
@@ -1040,8 +1051,8 @@ class O {
|
|
|
1040
1051
|
const o = e.id.split("_");
|
|
1041
1052
|
if (o.length !== 2)
|
|
1042
1053
|
return { status: -1, message: "车道编号格式错误" };
|
|
1043
|
-
const s = Number(o[1]),
|
|
1044
|
-
let r =
|
|
1054
|
+
const s = Number(o[1]), t = o[0].split("#"), l = t.length === 2 ? Number(t[1]) : 0;
|
|
1055
|
+
let r = t[0];
|
|
1045
1056
|
r.startsWith("-") && (r = r.slice(1));
|
|
1046
1057
|
const a = this.allLaneGraphics.filter((b) => b.getAttribute("roadId") === r && b.getAttribute("sectionIndex") === l);
|
|
1047
1058
|
if (a.length === 0)
|
|
@@ -1093,27 +1104,27 @@ class O {
|
|
|
1093
1104
|
* @param params
|
|
1094
1105
|
*/
|
|
1095
1106
|
blockLane(e) {
|
|
1096
|
-
const
|
|
1107
|
+
const i = this.allLaneGraphics.filter((s) => {
|
|
1097
1108
|
var l;
|
|
1098
|
-
let
|
|
1099
|
-
return
|
|
1100
|
-
}), o =
|
|
1101
|
-
const
|
|
1109
|
+
let t = String(s.getAttribute("laneId"));
|
|
1110
|
+
return t.startsWith("-") && (t = t.slice(1)), s.getAttribute("roadId") === e.roadsectId && ((l = s.getAttribute("roadsectBaseIds")) == null ? void 0 : l.includes(e.roadsectBaseId)) && t === String(e.laneId);
|
|
1111
|
+
}), o = i.map((s) => {
|
|
1112
|
+
const t = s.clone();
|
|
1102
1113
|
return console.log(
|
|
1103
|
-
|
|
1114
|
+
i[0].getAttribute("roadsectBaseIds"),
|
|
1104
1115
|
this.selectedSectionIds,
|
|
1105
1116
|
this.selectedSectionIds.includes(
|
|
1106
|
-
|
|
1117
|
+
i[0].getAttribute("roadsectBaseIds")
|
|
1107
1118
|
)
|
|
1108
|
-
),
|
|
1119
|
+
), t.symbol = {
|
|
1109
1120
|
type: "simple-fill",
|
|
1110
1121
|
color: this.selectedSectionIds.includes(
|
|
1111
|
-
|
|
1122
|
+
i[0].getAttribute("roadsectBaseIds")
|
|
1112
1123
|
) ? [255, 69, 0, 0.8] : [255, 0, 0, 0.8],
|
|
1113
1124
|
outline: {
|
|
1114
1125
|
color: "red"
|
|
1115
1126
|
}
|
|
1116
|
-
},
|
|
1127
|
+
}, t;
|
|
1117
1128
|
});
|
|
1118
1129
|
this.splitLaneLayer.addMany(o), A.viewGoto(this.view, o);
|
|
1119
1130
|
}
|
|
@@ -1125,14 +1136,14 @@ class O {
|
|
|
1125
1136
|
this.allLaneGraphics.forEach((o) => {
|
|
1126
1137
|
o.getAttribute("roadsectBaseIds") || console.log(o.attributes);
|
|
1127
1138
|
});
|
|
1128
|
-
const
|
|
1139
|
+
const i = this.allLaneGraphics.filter((o) => {
|
|
1129
1140
|
var s;
|
|
1130
1141
|
return (s = o.getAttribute("roadsectBaseIds")) == null ? void 0 : s.includes(e.id);
|
|
1131
1142
|
});
|
|
1132
|
-
if (
|
|
1143
|
+
if (i.length > 0) {
|
|
1133
1144
|
const o = L.union(
|
|
1134
|
-
|
|
1135
|
-
), s =
|
|
1145
|
+
i.map((r) => r.geometry)
|
|
1146
|
+
), s = i[0].getAttribute("roadsectBaseIds"), t = new I({
|
|
1136
1147
|
geometry: o,
|
|
1137
1148
|
symbol: {
|
|
1138
1149
|
type: "simple-fill",
|
|
@@ -1148,7 +1159,7 @@ class O {
|
|
|
1148
1159
|
roadsectBaseIds: s
|
|
1149
1160
|
}
|
|
1150
1161
|
});
|
|
1151
|
-
this.sectionLayer.removeAll(), this.sectionLayer.add(
|
|
1162
|
+
this.sectionLayer.removeAll(), this.sectionLayer.add(t), A.viewGoto(this.view, [t]), this.selectedSectionIds = [s];
|
|
1152
1163
|
const l = this.splitLaneLayer.graphics.filter(
|
|
1153
1164
|
(r) => {
|
|
1154
1165
|
var a;
|
|
@@ -1173,13 +1184,13 @@ class O {
|
|
|
1173
1184
|
* @param symbolStyle
|
|
1174
1185
|
*/
|
|
1175
1186
|
updateAllJunctionSymbol(e) {
|
|
1176
|
-
const
|
|
1177
|
-
this.junctionLayer.removeAll(),
|
|
1187
|
+
const i = this.junctionLayer.graphics.clone();
|
|
1188
|
+
this.junctionLayer.removeAll(), i.forEach((o) => {
|
|
1178
1189
|
o.getAttribute("selected") || (o.symbol = this.getCrossGraphicSymbol(
|
|
1179
1190
|
o.attributes,
|
|
1180
1191
|
e
|
|
1181
1192
|
));
|
|
1182
|
-
}), this.junctionLayer.addMany(
|
|
1193
|
+
}), this.junctionLayer.addMany(i.toArray());
|
|
1183
1194
|
}
|
|
1184
1195
|
/**
|
|
1185
1196
|
* 生成路口点符号。在不同比例尺下,使用不同的符号
|
|
@@ -1187,16 +1198,16 @@ class O {
|
|
|
1187
1198
|
* @param symbolType
|
|
1188
1199
|
* @returns
|
|
1189
1200
|
*/
|
|
1190
|
-
getCrossGraphicSymbol(e,
|
|
1201
|
+
getCrossGraphicSymbol(e, i) {
|
|
1191
1202
|
const o = e.crossId !== "" && e.crossId !== void 0 && e.crossId !== null;
|
|
1192
|
-
if (
|
|
1203
|
+
if (i === "marker")
|
|
1193
1204
|
return {
|
|
1194
1205
|
type: "picture-marker",
|
|
1195
1206
|
url: `/GisViewerAssets/Images/cross/${o ? "gis_xhj_blue" : "gis_lkcz_xz"}.png`,
|
|
1196
1207
|
width: "32px",
|
|
1197
1208
|
height: "32px"
|
|
1198
1209
|
};
|
|
1199
|
-
if (
|
|
1210
|
+
if (i === "picture")
|
|
1200
1211
|
return o ? {
|
|
1201
1212
|
type: "cim",
|
|
1202
1213
|
data: {
|