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.
- package/es/src/gis-map/utils/map-initializer.mjs +43 -35
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +1 -1
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +259 -247
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +12 -15
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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:
|
|
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
|
|
325
|
+
let r;
|
|
324
326
|
try {
|
|
325
|
-
|
|
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 (
|
|
339
|
-
return { status: -1, message:
|
|
340
|
+
if (r.status !== 200)
|
|
341
|
+
return { status: -1, message: r.statusText };
|
|
340
342
|
console.time("渲染用时");
|
|
341
|
-
const s =
|
|
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 =
|
|
349
|
+
let c = r.data.result.json;
|
|
348
350
|
c.startsWith(window.location.protocol) || (c = `${window.location.protocol}//${e.server}${c}`);
|
|
349
|
-
const
|
|
351
|
+
const a = await (await fetch(c)).arrayBuffer(), o = O.inflate(a, { to: "string" }), l = JSON.parse(o);
|
|
350
352
|
await this.showAllLanes(
|
|
351
|
-
|
|
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
|
|
356
|
-
this.showJunction(
|
|
357
|
-
const
|
|
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
|
-
() =>
|
|
361
|
+
() => h.isSketching,
|
|
360
362
|
() => {
|
|
361
|
-
var m,
|
|
362
|
-
|
|
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`,
|
|
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 (
|
|
382
|
-
throw new Error(`OpenDriveRenderer: ${
|
|
383
|
-
let s =
|
|
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
|
|
386
|
-
return await this.showAllLanes(
|
|
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
|
|
397
|
-
return
|
|
398
|
-
deleteFeatures:
|
|
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
|
|
403
|
-
|
|
404
|
-
|
|
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:
|
|
408
|
-
let
|
|
409
|
-
|
|
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: [
|
|
414
|
+
paths: [d]
|
|
414
415
|
},
|
|
415
416
|
attributes: {
|
|
416
417
|
ObjectID: c++,
|
|
417
|
-
roadId:
|
|
418
|
-
roadName:
|
|
418
|
+
roadId: l,
|
|
419
|
+
roadName: h
|
|
419
420
|
}
|
|
420
421
|
});
|
|
421
|
-
this.allRefLineGraphics.push(g),
|
|
422
|
-
for (let p = 0; p <
|
|
423
|
-
const m =
|
|
424
|
-
for (const
|
|
425
|
-
const w = Number(
|
|
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
|
|
429
|
-
|
|
429
|
+
const I = u.type, M = [...u.outerPath], S = u.innerPath.concat(
|
|
430
|
+
M.reverse()
|
|
430
431
|
);
|
|
431
|
-
if (
|
|
432
|
+
if (S.length <= 3) {
|
|
432
433
|
console.warn(`lane ${w} has less than 3 points`);
|
|
433
434
|
continue;
|
|
434
435
|
}
|
|
435
|
-
|
|
436
|
-
const A = new
|
|
437
|
-
rings: [
|
|
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: `${
|
|
445
|
-
fromNode:
|
|
446
|
-
toNode:
|
|
447
|
-
roadId: String(
|
|
448
|
-
roadName:
|
|
449
|
-
sectionId: String(
|
|
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:
|
|
453
|
+
type: I,
|
|
453
454
|
sumoId: "",
|
|
454
455
|
// 记录左右边线的起始点,用于按长度高亮车道的一部分
|
|
455
|
-
leftLine:
|
|
456
|
-
rightLine:
|
|
456
|
+
leftLine: u.innerPath,
|
|
457
|
+
rightLine: u.outerPath
|
|
457
458
|
}
|
|
458
459
|
});
|
|
459
|
-
this.allLaneGraphics.push(D),
|
|
460
|
+
this.allLaneGraphics.push(D), n.push(D);
|
|
460
461
|
}
|
|
461
462
|
}
|
|
462
463
|
}
|
|
463
464
|
}
|
|
464
|
-
const
|
|
465
|
-
if (
|
|
466
|
-
if (
|
|
467
|
-
const
|
|
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:
|
|
470
|
+
addFeatures: o
|
|
470
471
|
});
|
|
471
472
|
}
|
|
472
473
|
if (this.allRefLineGraphics.length > 0) {
|
|
473
|
-
const
|
|
474
|
+
const o = this.allRefLineGraphics.splice(0, 10);
|
|
474
475
|
this.roadNameLayer.applyEdits({
|
|
475
|
-
addFeatures:
|
|
476
|
+
addFeatures: o
|
|
476
477
|
});
|
|
477
478
|
}
|
|
478
479
|
} else
|
|
479
|
-
clearInterval(
|
|
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
|
|
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(
|
|
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
|
|
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
|
-
(
|
|
544
|
+
(n) => n.type === "graphic"
|
|
544
545
|
);
|
|
545
|
-
if (
|
|
546
|
-
this.currentSectionCode !== "" && (this.currentSectionCode = "", this.
|
|
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 =
|
|
550
|
+
const s = r[0];
|
|
550
551
|
if (this.hitGraphic = s.graphic, s.layer.id === "OpenDriveLane") {
|
|
551
|
-
const
|
|
552
|
+
const n = `${this.hitGraphic.getAttribute(
|
|
552
553
|
"roadId"
|
|
553
554
|
)}+${this.hitGraphic.getAttribute("sectionId")}`;
|
|
554
|
-
if (
|
|
555
|
-
(u) => u.getAttribute("id") ===
|
|
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 =
|
|
559
|
-
const
|
|
560
|
-
(u) => `${u.attributes.roadId}+${u.attributes.sectionId}` ===
|
|
561
|
-
),
|
|
562
|
-
|
|
563
|
-
),
|
|
564
|
-
|
|
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:
|
|
577
|
+
id: n,
|
|
578
578
|
selected: !1,
|
|
579
579
|
fromNodeName: g,
|
|
580
580
|
toNodeName: p,
|
|
581
|
-
laneCount:
|
|
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
|
-
})
|
|
606
|
-
|
|
605
|
+
});
|
|
606
|
+
this.highlightLayer.removeAll(), this.highlightLayer.add(m);
|
|
607
|
+
const f = this.view.toMap(t);
|
|
607
608
|
this.view.openPopup({
|
|
608
|
-
features: [
|
|
609
|
-
location:
|
|
609
|
+
features: [m],
|
|
610
|
+
location: f
|
|
610
611
|
});
|
|
611
612
|
} else if (s.layer.id === "OpenDriveJunction") {
|
|
612
|
-
const
|
|
613
|
-
if (
|
|
613
|
+
const n = this.hitGraphic.getAttribute("id");
|
|
614
|
+
if (n === this.currentJunctionId)
|
|
614
615
|
return;
|
|
615
|
-
this.currentJunctionId =
|
|
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
|
|
632
|
-
const
|
|
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 :
|
|
635
|
-
(
|
|
635
|
+
})).results) == null ? void 0 : a.filter(
|
|
636
|
+
(o) => o.type === "graphic"
|
|
636
637
|
);
|
|
637
|
-
if (
|
|
638
|
+
if (r.length === 0)
|
|
638
639
|
return;
|
|
639
|
-
const s =
|
|
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
|
|
643
|
+
const o = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, l = await b.get(o, {
|
|
643
644
|
params: {
|
|
644
|
-
id:
|
|
645
|
+
id: n,
|
|
645
646
|
projectName: this.projectName
|
|
646
647
|
}
|
|
647
648
|
});
|
|
648
|
-
|
|
649
|
+
l.status === 200 && l.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
|
|
649
650
|
type: "OpenDriveJunction",
|
|
650
|
-
id:
|
|
651
|
-
details:
|
|
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:
|
|
657
|
+
id: n,
|
|
657
658
|
details: void 0
|
|
658
659
|
}), s.setAttribute("selected", !1);
|
|
659
|
-
const
|
|
660
|
-
s.symbol.url =
|
|
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.
|
|
664
|
-
this.
|
|
665
|
-
|
|
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:
|
|
668
|
+
id: n,
|
|
674
669
|
projectName: this.projectName
|
|
675
670
|
}
|
|
676
671
|
});
|
|
677
|
-
|
|
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:
|
|
680
|
-
details:
|
|
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
|
|
701
|
+
const r = e.symbol, s = r.width;
|
|
697
702
|
s < t ? e.symbol = {
|
|
698
703
|
type: "picture-marker",
|
|
699
|
-
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
|
|
717
|
+
const r = e.symbol, s = r.width;
|
|
713
718
|
s > t ? e.symbol = {
|
|
714
719
|
type: "picture-marker",
|
|
715
|
-
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
|
|
737
|
-
t.length === 2 && (
|
|
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") ===
|
|
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
|
-
)}`,
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
784
|
-
if (
|
|
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
|
|
787
|
-
return await this.findLane({ roadsectId:
|
|
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
|
-
(
|
|
798
|
+
(r) => r.attributes.id === e
|
|
794
799
|
);
|
|
795
800
|
if (!i)
|
|
796
801
|
return { status: -1, message: "未找到。请检查路口编号" };
|
|
797
802
|
if (t) {
|
|
798
|
-
const
|
|
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(
|
|
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:
|
|
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
|
-
(
|
|
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
|
|
830
|
-
if (s.forEach((
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
}),
|
|
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 =
|
|
836
|
-
(
|
|
840
|
+
i = a[i], s = s.filter(
|
|
841
|
+
(o) => Number(o.attributes.sectionId) === i
|
|
837
842
|
);
|
|
838
843
|
}
|
|
839
|
-
if (
|
|
840
|
-
const
|
|
841
|
-
if (s.forEach((
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
}),
|
|
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
|
-
|
|
847
|
-
(
|
|
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
|
-
(
|
|
852
|
-
),
|
|
856
|
+
(a) => a.geometry
|
|
857
|
+
), n = L.union(c);
|
|
853
858
|
if (e.flash) {
|
|
854
|
-
const
|
|
855
|
-
geometry:
|
|
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(
|
|
871
|
+
this.flashGraphic(a);
|
|
867
872
|
}
|
|
868
|
-
return await this.view.goTo(
|
|
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
|
|
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(
|
|
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
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
(
|
|
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
|
-
|
|
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
|
|
921
|
-
t.length === 2 && (
|
|
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("
|
|
931
|
+
(c) => c.getAttribute("roadId") === i && c.getAttribute("sectionIndex") === r
|
|
927
932
|
)), s.length > 0) {
|
|
928
|
-
const c =
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
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
|
-
|
|
942
|
-
|
|
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
|
|
968
|
+
const t = new N({
|
|
957
969
|
rings: [e]
|
|
958
970
|
}), i = await this.laneLayer.queryFeatures({
|
|
959
971
|
geometry: t,
|
|
960
972
|
outFields: ["*"]
|
|
961
|
-
}),
|
|
962
|
-
for (const
|
|
963
|
-
const
|
|
964
|
-
if (
|
|
965
|
-
|
|
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:
|
|
979
|
+
id: d
|
|
968
980
|
});
|
|
969
|
-
const
|
|
981
|
+
const h = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, g = await b.get(h, {
|
|
970
982
|
params: {
|
|
971
|
-
id: `${
|
|
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((
|
|
979
|
-
const
|
|
980
|
-
return L.contains(t,
|
|
981
|
-
}),
|
|
982
|
-
for (const
|
|
983
|
-
const
|
|
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:
|
|
998
|
+
id: o
|
|
987
999
|
});
|
|
988
|
-
const
|
|
1000
|
+
const l = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, d = await b.get(l, {
|
|
989
1001
|
params: {
|
|
990
|
-
id:
|
|
1002
|
+
id: o,
|
|
991
1003
|
projectName: this.projectName
|
|
992
1004
|
}
|
|
993
1005
|
});
|
|
994
|
-
|
|
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:
|
|
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
|
|
1010
|
-
let
|
|
1011
|
-
|
|
1012
|
-
const
|
|
1013
|
-
if (
|
|
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
|
|
1016
|
-
(
|
|
1027
|
+
const o = a.length - r, l = a.find(
|
|
1028
|
+
(I) => Math.abs(I.getAttribute("laneId")) === o
|
|
1017
1029
|
);
|
|
1018
|
-
if (!
|
|
1030
|
+
if (!l)
|
|
1019
1031
|
return { status: -1, message: "未找到车道" };
|
|
1020
|
-
const
|
|
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(
|
|
1034
|
+
}), m = G.lineString(l.getAttribute("rightLine")), f = C(m, d, h, {
|
|
1023
1035
|
units: "meters"
|
|
1024
|
-
}),
|
|
1025
|
-
|
|
1036
|
+
}), u = p.geometry.coordinates.concat(
|
|
1037
|
+
f.geometry.coordinates.reverse()
|
|
1026
1038
|
);
|
|
1027
|
-
|
|
1039
|
+
u.push(u[u.length - 1]);
|
|
1028
1040
|
const w = new y({
|
|
1029
|
-
geometry: new
|
|
1030
|
-
rings: [
|
|
1041
|
+
geometry: new N({
|
|
1042
|
+
rings: [u]
|
|
1031
1043
|
}),
|
|
1032
1044
|
attributes: {
|
|
1033
|
-
ObjectID:
|
|
1034
|
-
id:
|
|
1035
|
-
fromNode:
|
|
1036
|
-
toNode:
|
|
1037
|
-
roadId:
|
|
1038
|
-
roadName:
|
|
1039
|
-
sectionId:
|
|
1040
|
-
sectionIndex:
|
|
1041
|
-
laneId:
|
|
1042
|
-
type:
|
|
1043
|
-
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:
|
|
1057
|
+
rightLine: f.geometry.coordinates
|
|
1046
1058
|
},
|
|
1047
1059
|
symbol: {
|
|
1048
1060
|
type: "simple-fill",
|