gisviewer-vue3-arcgis 1.0.262 → 1.0.263
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/gis-map.vue.d.ts +4 -0
- package/es/src/gis-map/gis-map.vue.mjs +91 -87
- package/es/src/gis-map/index.d.ts +4 -0
- package/es/src/gis-map/utils/dbscan-cluster/index.d.ts +0 -1
- package/es/src/gis-map/utils/dbscan-cluster/index.mjs +4 -4
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +11 -1
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +357 -293
- package/lib/src/gis-map/gis-map.vue.d.ts +4 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +4 -0
- package/lib/src/gis-map/utils/dbscan-cluster/index.d.ts +0 -1
- package/lib/src/gis-map/utils/dbscan-cluster/index.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +11 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/package.json +1 -1
- package/es/src/gis-map/utils/GreenWaveline.d.ts +0 -68
- package/lib/src/gis-map/utils/GreenWaveline.d.ts +0 -68
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import I from "@arcgis/core/Graphic";
|
|
2
2
|
import * as C from "@arcgis/core/core/promiseUtils";
|
|
3
|
-
import * as
|
|
4
|
-
import { Polygon as S, Point as
|
|
3
|
+
import * as $ from "@arcgis/core/core/reactiveUtils.js";
|
|
4
|
+
import { Polygon as S, Point as F } from "@arcgis/core/geometry";
|
|
5
5
|
import * as L from "@arcgis/core/geometry/geometryEngine";
|
|
6
6
|
import D from "@arcgis/core/layers/FeatureLayer";
|
|
7
|
-
import
|
|
7
|
+
import v from "@arcgis/core/layers/GraphicsLayer";
|
|
8
8
|
import * as G from "@turf/helpers";
|
|
9
9
|
import { lineSliceAlong as x } from "@turf/line-slice-along";
|
|
10
|
-
import
|
|
11
|
-
import { XMLParser as
|
|
12
|
-
import
|
|
10
|
+
import w from "axios";
|
|
11
|
+
import { XMLParser as J } from "fast-xml-parser";
|
|
12
|
+
import E from "md5";
|
|
13
13
|
import M from "pako";
|
|
14
14
|
import { watch as R } from "vue";
|
|
15
15
|
import T from "../../stores/index.mjs";
|
|
16
|
-
import
|
|
16
|
+
import A from "../common-utils.mjs";
|
|
17
17
|
class O {
|
|
18
18
|
constructor(e) {
|
|
19
19
|
this.junctionNames = /* @__PURE__ */ new Map(), this.junctionScale = 5e3, this.xodrBorder = [], this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.selectedSectionIds = [], this.currentJunctionId = "", this.view = e, this.laneLayer = new D({
|
|
@@ -294,7 +294,7 @@ class O {
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
]
|
|
297
|
-
}), this.junctionLayer = new
|
|
297
|
+
}), 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.borderLayer = new v({ id: "OpenDriveBorder" }), this.view.map.addMany([
|
|
298
298
|
this.laneLayer,
|
|
299
299
|
this.sectionLayer,
|
|
300
300
|
this.roadNameLayer,
|
|
@@ -310,14 +310,14 @@ 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 t;
|
|
314
314
|
try {
|
|
315
315
|
const s = await (await fetch(e)).text();
|
|
316
|
-
let
|
|
316
|
+
let r = (t = new J({
|
|
317
317
|
ignoreAttributes: !1,
|
|
318
318
|
allowBooleanAttributes: !0
|
|
319
|
-
}).parse(s).OpenDRIVE.userData) == null ? void 0 :
|
|
320
|
-
return
|
|
319
|
+
}).parse(s).OpenDRIVE.userData) == null ? void 0 : t.border;
|
|
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 };
|
|
323
323
|
}
|
|
@@ -329,24 +329,24 @@ class O {
|
|
|
329
329
|
*/
|
|
330
330
|
async showOpenDriveFromFile(e) {
|
|
331
331
|
var d, y, h;
|
|
332
|
-
this.openDriveClickCallback = e.selectedCallback, this.scaleWatch =
|
|
332
|
+
this.openDriveClickCallback = e.selectedCallback, this.scaleWatch = $.watch(
|
|
333
333
|
() => this.view.scale,
|
|
334
334
|
(u, p) => {
|
|
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 t = e.file.split("/").pop() || "";
|
|
339
|
+
t = t.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 {
|
|
343
|
-
s = await
|
|
343
|
+
s = await w.post(
|
|
344
344
|
o,
|
|
345
345
|
{},
|
|
346
346
|
{
|
|
347
347
|
params: {
|
|
348
348
|
url: e.file,
|
|
349
|
-
projectName:
|
|
349
|
+
projectName: t
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
);
|
|
@@ -356,21 +356,21 @@ class O {
|
|
|
356
356
|
if (s.status !== 200)
|
|
357
357
|
return { status: -1, message: s.statusText };
|
|
358
358
|
console.time("渲染用时");
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
359
|
+
const i = s.data.result.geoSetting;
|
|
360
|
+
A.setGeoData(
|
|
361
|
+
i.geoReference,
|
|
362
|
+
i.offsetX,
|
|
363
|
+
i.offsetY
|
|
364
364
|
);
|
|
365
|
-
let
|
|
366
|
-
|
|
367
|
-
const
|
|
365
|
+
let l = s.data.result.json;
|
|
366
|
+
l.startsWith(window.location.protocol) || (l = `${window.location.protocol}//${e.server}${l}`);
|
|
367
|
+
const r = await fetch(l);
|
|
368
368
|
let a;
|
|
369
|
-
if (
|
|
370
|
-
const u = await
|
|
369
|
+
if (l.endsWith("bin")) {
|
|
370
|
+
const u = await r.arrayBuffer(), p = M.inflate(u, { to: "string" });
|
|
371
371
|
a = JSON.parse(p);
|
|
372
372
|
} else
|
|
373
|
-
a = await
|
|
373
|
+
a = await r.json();
|
|
374
374
|
if (await this.showAllLanes(
|
|
375
375
|
a,
|
|
376
376
|
((d = e.options) == null ? void 0 : d.showJunctionLane) || !1,
|
|
@@ -380,12 +380,12 @@ class O {
|
|
|
380
380
|
this.showJunction(u);
|
|
381
381
|
}
|
|
382
382
|
e.options && e.options.centerMap !== !1 && await this.view.goTo(this.allLaneGraphics), this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick();
|
|
383
|
-
const
|
|
383
|
+
const n = T.useAppDataStore;
|
|
384
384
|
return R(
|
|
385
|
-
() =>
|
|
385
|
+
() => n.isSketching,
|
|
386
386
|
() => {
|
|
387
387
|
var u, p;
|
|
388
|
-
|
|
388
|
+
n.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());
|
|
389
389
|
}
|
|
390
390
|
), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
|
|
391
391
|
}
|
|
@@ -394,10 +394,10 @@ class O {
|
|
|
394
394
|
* @param server
|
|
395
395
|
* @param projectName
|
|
396
396
|
*/
|
|
397
|
-
async showOpenDriveFromServer(e,
|
|
398
|
-
const o = `http://${e}/api/openDrive/analyzeXodr`, s = await
|
|
397
|
+
async showOpenDriveFromServer(e, t) {
|
|
398
|
+
const o = `http://${e}/api/openDrive/analyzeXodr`, s = await w.get(o, {
|
|
399
399
|
headers: {
|
|
400
|
-
projectName:
|
|
400
|
+
projectName: t
|
|
401
401
|
},
|
|
402
402
|
params: {
|
|
403
403
|
analyze: !1,
|
|
@@ -406,16 +406,16 @@ class O {
|
|
|
406
406
|
});
|
|
407
407
|
if (s.status !== 200)
|
|
408
408
|
throw new Error(`OpenDriveRenderer: ${s.statusText}`);
|
|
409
|
-
let
|
|
410
|
-
|
|
411
|
-
const
|
|
412
|
-
let
|
|
413
|
-
if (
|
|
414
|
-
const a = await
|
|
415
|
-
|
|
409
|
+
let i = s.data.result.json;
|
|
410
|
+
i.startsWith(window.location.protocol) || (i = `${window.location.protocol}//${e}${i}`);
|
|
411
|
+
const l = await fetch(i);
|
|
412
|
+
let r;
|
|
413
|
+
if (i.endsWith("bin")) {
|
|
414
|
+
const a = await l.arrayBuffer(), c = M.inflate(a, { to: "string" });
|
|
415
|
+
r = JSON.parse(c);
|
|
416
416
|
} else
|
|
417
|
-
|
|
418
|
-
return await this.showAllLanes(
|
|
417
|
+
r = await l.json();
|
|
418
|
+
return await this.showAllLanes(r, !1, !1), { status: 0, message: "ok" };
|
|
419
419
|
}
|
|
420
420
|
/**
|
|
421
421
|
* 显示所有车道
|
|
@@ -424,20 +424,20 @@ class O {
|
|
|
424
424
|
* @param showRoadName 是否显示道路名称
|
|
425
425
|
* @returns
|
|
426
426
|
*/
|
|
427
|
-
async showAllLanes(e,
|
|
427
|
+
async showAllLanes(e, t, 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((
|
|
432
|
-
var
|
|
433
|
-
let
|
|
431
|
+
}), this.roadNameLayer.visible = o, new Promise((i) => {
|
|
432
|
+
var c;
|
|
433
|
+
let l = 0;
|
|
434
434
|
this.allLaneGraphics = [], this.allRefLineGraphics = [];
|
|
435
|
-
const
|
|
436
|
-
for (const
|
|
437
|
-
if (!
|
|
435
|
+
const r = [];
|
|
436
|
+
for (const n of e) {
|
|
437
|
+
if (!t && n.junction !== "-1")
|
|
438
438
|
continue;
|
|
439
|
-
const { id: d, refLine: y } =
|
|
440
|
-
let h =
|
|
439
|
+
const { id: d, refLine: y } = n;
|
|
440
|
+
let h = n.name;
|
|
441
441
|
h.includes("(") && (h = h.slice(0, h.indexOf("("))), h = h.replace(/(.)/g, "$1 ");
|
|
442
442
|
const u = new I({
|
|
443
443
|
geometry: {
|
|
@@ -445,72 +445,72 @@ class O {
|
|
|
445
445
|
paths: [y]
|
|
446
446
|
},
|
|
447
447
|
attributes: {
|
|
448
|
-
ObjectID:
|
|
448
|
+
ObjectID: l++,
|
|
449
449
|
roadId: d,
|
|
450
450
|
roadName: h
|
|
451
451
|
}
|
|
452
452
|
});
|
|
453
|
-
this.allRefLineGraphics.push(u),
|
|
454
|
-
for (let p = 0; p <
|
|
455
|
-
const
|
|
456
|
-
for (const f of
|
|
457
|
-
const
|
|
458
|
-
if (
|
|
453
|
+
this.allRefLineGraphics.push(u), n.laneSections.sort((p, g) => Number(p.id) - Number(g.id));
|
|
454
|
+
for (let p = 0; p < n.laneSections.length; p++) {
|
|
455
|
+
const g = n.laneSections[p], m = Number(g.id);
|
|
456
|
+
for (const f of g.lanePaths) {
|
|
457
|
+
const b = Number(f.id);
|
|
458
|
+
if (b === 0)
|
|
459
459
|
continue;
|
|
460
|
-
const
|
|
461
|
-
|
|
460
|
+
const B = f.type, P = [...f.outerPath], N = f.innerPath.concat(
|
|
461
|
+
P.reverse()
|
|
462
462
|
);
|
|
463
|
-
if (
|
|
464
|
-
console.warn(`lane ${
|
|
463
|
+
if (N.length <= 3) {
|
|
464
|
+
console.warn(`lane ${b} has less than 3 points`);
|
|
465
465
|
continue;
|
|
466
466
|
}
|
|
467
|
-
|
|
467
|
+
N.push(f.innerPath[0]);
|
|
468
468
|
const k = new S({
|
|
469
|
-
rings: [
|
|
469
|
+
rings: [N]
|
|
470
470
|
});
|
|
471
471
|
if (k) {
|
|
472
472
|
const j = new I({
|
|
473
473
|
geometry: k,
|
|
474
474
|
attributes: {
|
|
475
|
-
ObjectID:
|
|
476
|
-
id: `${d}+${
|
|
477
|
-
fromNode:
|
|
478
|
-
toNode:
|
|
475
|
+
ObjectID: l++,
|
|
476
|
+
id: `${d}+${m}+${b}`,
|
|
477
|
+
fromNode: n.fromNode,
|
|
478
|
+
toNode: n.toNode,
|
|
479
479
|
roadId: String(d),
|
|
480
|
-
roadName:
|
|
481
|
-
sectionId: String(
|
|
480
|
+
roadName: n.name,
|
|
481
|
+
sectionId: String(m),
|
|
482
482
|
sectionIndex: p,
|
|
483
|
-
laneId:
|
|
484
|
-
type:
|
|
483
|
+
laneId: b,
|
|
484
|
+
type: B,
|
|
485
485
|
sumoId: "",
|
|
486
486
|
// 记录左右边线的起始点,用于按长度高亮车道的一部分
|
|
487
487
|
leftLine: f.innerPath,
|
|
488
488
|
rightLine: f.outerPath,
|
|
489
489
|
// array转为逗号分隔的字符串
|
|
490
|
-
roadsectBaseIds: (
|
|
490
|
+
roadsectBaseIds: (c = g.roadsectBaseIds) == null ? void 0 : c.toString()
|
|
491
491
|
}
|
|
492
492
|
});
|
|
493
|
-
this.allLaneGraphics.push(j),
|
|
493
|
+
this.allLaneGraphics.push(j), r.push(j);
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
const a = setInterval(() => {
|
|
499
|
-
if (
|
|
500
|
-
if (
|
|
501
|
-
const
|
|
499
|
+
if (r.length > 0 || this.allRefLineGraphics.length > 0) {
|
|
500
|
+
if (r.length > 0) {
|
|
501
|
+
const n = r.splice(0, 100);
|
|
502
502
|
this.laneLayer.applyEdits({
|
|
503
|
-
addFeatures:
|
|
503
|
+
addFeatures: n
|
|
504
504
|
});
|
|
505
505
|
}
|
|
506
506
|
if (this.allRefLineGraphics.length > 0) {
|
|
507
|
-
const
|
|
507
|
+
const n = this.allRefLineGraphics.splice(0, 10);
|
|
508
508
|
this.roadNameLayer.applyEdits({
|
|
509
|
-
addFeatures:
|
|
509
|
+
addFeatures: n
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
512
|
} else
|
|
513
|
-
clearInterval(a),
|
|
513
|
+
clearInterval(a), i();
|
|
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 t = [];
|
|
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 i = new F({
|
|
531
531
|
x: s.coordinates[0],
|
|
532
532
|
y: s.coordinates[1]
|
|
533
533
|
});
|
|
534
|
-
let
|
|
535
|
-
if (o && (
|
|
536
|
-
const
|
|
537
|
-
geometry:
|
|
534
|
+
let l = !0;
|
|
535
|
+
if (o && (l = L.contains(o, i)), l) {
|
|
536
|
+
const r = new I({
|
|
537
|
+
geometry: i,
|
|
538
538
|
attributes: {
|
|
539
539
|
...s,
|
|
540
540
|
selected: !1,
|
|
@@ -542,42 +542,42 @@ class O {
|
|
|
542
542
|
},
|
|
543
543
|
symbol: this.getCrossGraphicSymbol(s, "marker")
|
|
544
544
|
});
|
|
545
|
-
|
|
545
|
+
t.push(r);
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
this.junctionLayer.addMany(
|
|
548
|
+
this.junctionLayer.addMany(t);
|
|
549
549
|
}
|
|
550
550
|
/**
|
|
551
551
|
* 监听鼠标移动事件,高亮显示鼠标所在路段和路口
|
|
552
552
|
*/
|
|
553
553
|
monitorMouseMove() {
|
|
554
|
-
const e = C.debounce(async (
|
|
555
|
-
var
|
|
556
|
-
const s = (
|
|
554
|
+
const e = C.debounce(async (t) => {
|
|
555
|
+
var l;
|
|
556
|
+
const s = (l = (await this.view.hitTest(t, {
|
|
557
557
|
include: [this.laneLayer, this.junctionLayer]
|
|
558
|
-
})).results) == null ? void 0 :
|
|
559
|
-
(
|
|
558
|
+
})).results) == null ? void 0 : l.filter(
|
|
559
|
+
(r) => r.type === "graphic"
|
|
560
560
|
);
|
|
561
561
|
if (s.length === 0) {
|
|
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 =
|
|
567
|
-
const
|
|
565
|
+
const i = s[0];
|
|
566
|
+
if (this.hitGraphic = i.graphic, i.layer.id === "OpenDriveLane") {
|
|
567
|
+
const r = `${this.hitGraphic.getAttribute(
|
|
568
568
|
"roadId"
|
|
569
|
-
)}+${this.hitGraphic.getAttribute("sectionId")}
|
|
570
|
-
if (this.currentSectionCode ===
|
|
571
|
-
(m) => m.getAttribute("id") ===
|
|
569
|
+
)}+${this.hitGraphic.getAttribute("sectionId")}`, a = this.hitGraphic.getAttribute("roadsectBaseIds");
|
|
570
|
+
if (this.currentSectionCode === r || this.selectedSectionIds.includes(a) || this.sectionLayer.graphics.findIndex(
|
|
571
|
+
(m) => m.getAttribute("id") === r
|
|
572
572
|
) >= 0)
|
|
573
573
|
return;
|
|
574
|
-
this.currentSectionCode =
|
|
575
|
-
const
|
|
576
|
-
(m) => `${m.attributes.roadId}+${m.attributes.sectionId}` ===
|
|
577
|
-
),
|
|
578
|
-
|
|
579
|
-
),
|
|
580
|
-
geometry:
|
|
574
|
+
this.currentSectionCode = r;
|
|
575
|
+
const n = this.allLaneGraphics.filter(
|
|
576
|
+
(m) => `${m.attributes.roadId}+${m.attributes.sectionId}` === r
|
|
577
|
+
), d = L.union(
|
|
578
|
+
n.map((m) => m.geometry)
|
|
579
|
+
), y = this.hitGraphic.getAttribute("fromNode"), h = this.hitGraphic.getAttribute("toNode"), u = this.junctionNames.get(y) || y, p = this.junctionNames.get(h) || h, g = new I({
|
|
580
|
+
geometry: d,
|
|
581
581
|
symbol: {
|
|
582
582
|
type: "simple-fill",
|
|
583
583
|
color: [0, 255, 255, 0.5],
|
|
@@ -589,11 +589,11 @@ class O {
|
|
|
589
589
|
},
|
|
590
590
|
attributes: {
|
|
591
591
|
type: "OpenDriveSection",
|
|
592
|
-
id:
|
|
592
|
+
id: r,
|
|
593
593
|
selected: !1,
|
|
594
|
-
fromNodeName:
|
|
595
|
-
toNodeName:
|
|
596
|
-
laneCount:
|
|
594
|
+
fromNodeName: u,
|
|
595
|
+
toNodeName: p,
|
|
596
|
+
laneCount: n.length,
|
|
597
597
|
roadsectBaseIds: this.hitGraphic.getAttribute("roadsectBaseIds")
|
|
598
598
|
},
|
|
599
599
|
popupTemplate: {
|
|
@@ -619,16 +619,16 @@ class O {
|
|
|
619
619
|
]
|
|
620
620
|
}
|
|
621
621
|
});
|
|
622
|
-
this.highlightLayer.removeAll(), this.highlightLayer.add(
|
|
623
|
-
} else if (
|
|
624
|
-
const
|
|
625
|
-
if (
|
|
622
|
+
this.highlightLayer.removeAll(), this.highlightLayer.add(g);
|
|
623
|
+
} else if (i.layer.id === "OpenDriveJunction") {
|
|
624
|
+
const r = this.hitGraphic.getAttribute("id");
|
|
625
|
+
if (r === this.currentJunctionId)
|
|
626
626
|
return;
|
|
627
|
-
this.currentJunctionId =
|
|
627
|
+
this.currentJunctionId = r;
|
|
628
628
|
}
|
|
629
629
|
});
|
|
630
|
-
this.mouseMoveHandler = this.view.on("pointer-move", async (
|
|
631
|
-
e(
|
|
630
|
+
this.mouseMoveHandler = this.view.on("pointer-move", async (t) => {
|
|
631
|
+
e(t).catch(() => {
|
|
632
632
|
});
|
|
633
633
|
});
|
|
634
634
|
}
|
|
@@ -636,48 +636,48 @@ class O {
|
|
|
636
636
|
* 监听鼠标点击事件,获取高亮要素的拓扑信息
|
|
637
637
|
*/
|
|
638
638
|
monitorMouseClick() {
|
|
639
|
-
const e = C.debounce(async (
|
|
639
|
+
const e = C.debounce(async (t) => {
|
|
640
640
|
var a;
|
|
641
|
-
const s = (a = (await this.view.hitTest(
|
|
641
|
+
const s = (a = (await this.view.hitTest(t, {
|
|
642
642
|
include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
|
|
643
643
|
})).results) == null ? void 0 : a.filter(
|
|
644
|
-
(
|
|
644
|
+
(c) => c.type === "graphic"
|
|
645
645
|
);
|
|
646
646
|
if (s.length === 0)
|
|
647
647
|
return;
|
|
648
|
-
const
|
|
649
|
-
if (
|
|
650
|
-
if (
|
|
651
|
-
const
|
|
648
|
+
const i = s[0].graphic, l = i.getAttribute("type"), r = i.getAttribute("id");
|
|
649
|
+
if (l === "OpenDriveJunction")
|
|
650
|
+
if (i.getAttribute("selected") === !1) {
|
|
651
|
+
const c = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, n = await w.get(c, {
|
|
652
652
|
params: {
|
|
653
|
-
id:
|
|
653
|
+
id: r,
|
|
654
654
|
projectName: this.projectName
|
|
655
655
|
}
|
|
656
656
|
});
|
|
657
|
-
|
|
657
|
+
n.status === 200 && n.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
|
|
658
658
|
type: "OpenDriveJunction",
|
|
659
|
-
id:
|
|
660
|
-
details:
|
|
661
|
-
}),
|
|
659
|
+
id: r,
|
|
660
|
+
details: n.data.result
|
|
661
|
+
}), i.setAttribute("selected", !0), i.symbol = {
|
|
662
662
|
type: "picture-marker",
|
|
663
663
|
url: "/GisViewerAssets/Images/point_red.png",
|
|
664
664
|
width: "20px",
|
|
665
665
|
height: "20px"
|
|
666
|
-
}, this.increasePictureMarkerSize(
|
|
666
|
+
}, this.increasePictureMarkerSize(i, 50));
|
|
667
667
|
} else
|
|
668
668
|
this.openDriveClickCallback && this.openDriveClickCallback({
|
|
669
669
|
type: "OpenDriveJunction",
|
|
670
|
-
id:
|
|
670
|
+
id: r,
|
|
671
671
|
details: void 0
|
|
672
|
-
}),
|
|
673
|
-
|
|
672
|
+
}), i.setAttribute("selected", !1), i.symbol = this.getCrossGraphicSymbol(
|
|
673
|
+
i.attributes,
|
|
674
674
|
this.view.scale < this.junctionScale ? "picture" : "marker"
|
|
675
675
|
);
|
|
676
676
|
else
|
|
677
|
-
|
|
678
|
-
(
|
|
677
|
+
l === "OpenDriveSection" && (i.layer.id === "OpenDriveHighlight" ? (this.highlightLayer.removeAll(), this.sectionLayer.removeAll(), this.selectedSectionIds = [], this.sectionLayer.add(i), i.setAttribute("selected", !0), this.selectedSectionIds.push(r), this.splitLaneLayer.graphics.filter(
|
|
678
|
+
(n) => n.getAttribute("roadsectBaseIds") === i.getAttribute("roadsectBaseIds")
|
|
679
679
|
).forEach(
|
|
680
|
-
(
|
|
680
|
+
(n) => n.symbol = {
|
|
681
681
|
type: "simple-fill",
|
|
682
682
|
color: [255, 69, 0],
|
|
683
683
|
outline: {
|
|
@@ -686,9 +686,9 @@ class O {
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
)) : (this.splitLaneLayer.graphics.filter(
|
|
689
|
-
(
|
|
689
|
+
(n) => n.getAttribute("roadsectBaseIds") === i.getAttribute("roadsectBaseIds")
|
|
690
690
|
).forEach(
|
|
691
|
-
(
|
|
691
|
+
(n) => n.symbol = {
|
|
692
692
|
type: "simple-fill",
|
|
693
693
|
color: [255, 0, 0, 0.8],
|
|
694
694
|
outline: {
|
|
@@ -696,16 +696,14 @@ class O {
|
|
|
696
696
|
width: 1
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
|
-
), this.sectionLayer.remove(
|
|
700
|
-
(r) => r !== n
|
|
701
|
-
), this.openDriveClickCallback && this.openDriveClickCallback({
|
|
699
|
+
), this.sectionLayer.remove(i), this.selectedSectionIds = [], this.openDriveClickCallback && this.openDriveClickCallback({
|
|
702
700
|
type: "OpenDriveSection",
|
|
703
|
-
id:
|
|
701
|
+
id: i.getAttribute("edgeId"),
|
|
704
702
|
details: void 0
|
|
705
703
|
})));
|
|
706
704
|
});
|
|
707
|
-
this.mouseClickHandler = this.view.on("immediate-click", async (
|
|
708
|
-
e(
|
|
705
|
+
this.mouseClickHandler = this.view.on("immediate-click", async (t) => {
|
|
706
|
+
e(t).catch(() => {
|
|
709
707
|
});
|
|
710
708
|
});
|
|
711
709
|
}
|
|
@@ -714,14 +712,14 @@ class O {
|
|
|
714
712
|
* @param graphic
|
|
715
713
|
* @param targetSize
|
|
716
714
|
*/
|
|
717
|
-
increasePictureMarkerSize(e,
|
|
715
|
+
increasePictureMarkerSize(e, t) {
|
|
718
716
|
const o = setInterval(() => {
|
|
719
|
-
const s = e.symbol,
|
|
720
|
-
|
|
717
|
+
const s = e.symbol, i = s.width;
|
|
718
|
+
i < t ? e.symbol = {
|
|
721
719
|
type: "picture-marker",
|
|
722
720
|
url: s.url,
|
|
723
|
-
width:
|
|
724
|
-
height:
|
|
721
|
+
width: i + 1,
|
|
722
|
+
height: i + 1
|
|
725
723
|
} : clearInterval(o);
|
|
726
724
|
}, 20);
|
|
727
725
|
}
|
|
@@ -730,21 +728,21 @@ class O {
|
|
|
730
728
|
* @param graphic
|
|
731
729
|
* @param targetSize
|
|
732
730
|
*/
|
|
733
|
-
decreasePictureMarkerSize(e,
|
|
731
|
+
decreasePictureMarkerSize(e, t) {
|
|
734
732
|
const o = setInterval(() => {
|
|
735
|
-
const s = e.symbol,
|
|
736
|
-
|
|
733
|
+
const s = e.symbol, i = s.width;
|
|
734
|
+
i > t ? e.symbol = {
|
|
737
735
|
type: "picture-marker",
|
|
738
736
|
url: s.url,
|
|
739
|
-
width:
|
|
740
|
-
height:
|
|
737
|
+
width: i - 1,
|
|
738
|
+
height: i - 1
|
|
741
739
|
} : clearInterval(o);
|
|
742
740
|
}, 20);
|
|
743
741
|
}
|
|
744
742
|
async getSumoInfo(e) {
|
|
745
743
|
switch (e.type) {
|
|
746
744
|
case "junction": {
|
|
747
|
-
const
|
|
745
|
+
const t = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, o = await w.get(t, {
|
|
748
746
|
params: {
|
|
749
747
|
id: e.id,
|
|
750
748
|
projectName: this.projectName
|
|
@@ -753,24 +751,24 @@ class O {
|
|
|
753
751
|
return o.status === 200 ? o.data : { status: -1, message: `路口信息查询失败: ${e.id}` };
|
|
754
752
|
}
|
|
755
753
|
case "edge": {
|
|
756
|
-
const
|
|
757
|
-
let o =
|
|
754
|
+
const t = e.id.split("#");
|
|
755
|
+
let o = t[0];
|
|
758
756
|
o.startsWith("-") && (o = o.slice(1));
|
|
759
757
|
let s = 0;
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
(
|
|
758
|
+
t.length === 2 && (s = Number(t[1]));
|
|
759
|
+
const i = this.allLaneGraphics.find(
|
|
760
|
+
(l) => l.getAttribute("roadId") === o && l.getAttribute("sectionIndex") === s
|
|
763
761
|
);
|
|
764
|
-
if (
|
|
765
|
-
const
|
|
762
|
+
if (i) {
|
|
763
|
+
const l = `${o}+${i.getAttribute(
|
|
766
764
|
"sectionId"
|
|
767
|
-
)}`,
|
|
765
|
+
)}`, r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, a = await w.get(r, {
|
|
768
766
|
params: {
|
|
769
|
-
id:
|
|
767
|
+
id: l,
|
|
770
768
|
projectName: this.projectName
|
|
771
769
|
}
|
|
772
770
|
});
|
|
773
|
-
return a.status === 200 ? a.data : { status: -1, message: `路段信息查询失败: ${
|
|
771
|
+
return a.status === 200 ? a.data : { status: -1, message: `路段信息查询失败: ${l}` };
|
|
774
772
|
} else
|
|
775
773
|
return { status: -1, message: "未知类型" };
|
|
776
774
|
}
|
|
@@ -785,13 +783,13 @@ class O {
|
|
|
785
783
|
* 清除OpenDrive内容
|
|
786
784
|
*/
|
|
787
785
|
async clearOpenDrive() {
|
|
788
|
-
var
|
|
786
|
+
var t, o, s;
|
|
789
787
|
let e = await this.laneLayer.queryFeatures();
|
|
790
788
|
e.features.length > 0 && await this.laneLayer.applyEdits({
|
|
791
789
|
deleteFeatures: e.features
|
|
792
790
|
}), e = await this.roadNameLayer.queryFeatures(), e.features.length > 0 && await this.roadNameLayer.applyEdits({
|
|
793
791
|
deleteFeatures: e.features
|
|
794
|
-
}), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), this.borderLayer.removeAll(), (
|
|
792
|
+
}), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), this.borderLayer.removeAll(), (t = this.mouseMoveHandler) == null || t.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;
|
|
795
793
|
}
|
|
796
794
|
/**
|
|
797
795
|
* 用sumo的id定位车道、基本段、路段
|
|
@@ -799,28 +797,28 @@ class O {
|
|
|
799
797
|
* @returns
|
|
800
798
|
*/
|
|
801
799
|
async findSumo(e) {
|
|
802
|
-
const { type:
|
|
803
|
-
if (
|
|
800
|
+
const { type: t, id: o } = e, s = e.flash === void 0 ? !0 : e.flash;
|
|
801
|
+
if (t === "junction")
|
|
804
802
|
return await this.findJunction(o, s);
|
|
805
|
-
if (
|
|
806
|
-
const
|
|
807
|
-
if (
|
|
803
|
+
if (t === "edge") {
|
|
804
|
+
const i = o.split("_");
|
|
805
|
+
if (i.length > 2)
|
|
808
806
|
return { status: -1, message: "id格式错误" };
|
|
809
|
-
const
|
|
810
|
-
if (
|
|
807
|
+
const l = i.length === 2 ? Number(i[1]) : void 0, r = i[0].split("#");
|
|
808
|
+
if (r.length > 2)
|
|
811
809
|
return { status: -1, message: "id格式错误" };
|
|
812
|
-
const a =
|
|
813
|
-
return await this.findLane({ roadsectId: a, segmentId:
|
|
810
|
+
const a = r[0], c = r.length === 2 ? Number(r[1]) : void 0;
|
|
811
|
+
return await this.findLane({ roadsectId: a, segmentId: c, laneId: l, flash: s });
|
|
814
812
|
} else
|
|
815
813
|
return { status: -1, message: "未知类型" };
|
|
816
814
|
}
|
|
817
|
-
async findJunction(e,
|
|
815
|
+
async findJunction(e, t) {
|
|
818
816
|
const o = this.junctionLayer.graphics.find(
|
|
819
817
|
(s) => s.attributes.id === e
|
|
820
818
|
);
|
|
821
819
|
if (!o)
|
|
822
820
|
return { status: -1, message: "未找到。请检查路口编号" };
|
|
823
|
-
if (
|
|
821
|
+
if (t) {
|
|
824
822
|
const s = new I({
|
|
825
823
|
geometry: o.geometry,
|
|
826
824
|
symbol: {
|
|
@@ -844,41 +842,41 @@ class O {
|
|
|
844
842
|
* @returns
|
|
845
843
|
*/
|
|
846
844
|
async findLane(e) {
|
|
847
|
-
let { roadsectId:
|
|
848
|
-
|
|
849
|
-
let
|
|
850
|
-
(a) => a.attributes.roadId ===
|
|
845
|
+
let { roadsectId: t, segmentId: o, laneId: s } = e;
|
|
846
|
+
t.startsWith("-") && (t = t.slice(1));
|
|
847
|
+
let i = this.allLaneGraphics.filter(
|
|
848
|
+
(a) => a.attributes.roadId === t
|
|
851
849
|
);
|
|
852
|
-
if (
|
|
850
|
+
if (i.length === 0)
|
|
853
851
|
return { status: -1, message: "未找到。请检查路段编号" };
|
|
854
852
|
if (o !== void 0) {
|
|
855
853
|
const a = [];
|
|
856
|
-
if (
|
|
857
|
-
const
|
|
858
|
-
a.indexOf(
|
|
859
|
-
}), a.sort((
|
|
854
|
+
if (i.forEach((c) => {
|
|
855
|
+
const n = Number(c.attributes.sectionId);
|
|
856
|
+
a.indexOf(n) === -1 && a.push(n);
|
|
857
|
+
}), a.sort((c, n) => c - n), o > a.length - 1)
|
|
860
858
|
return { status: -1, message: "未找到。请检查基本段编号" };
|
|
861
|
-
o = a[o],
|
|
862
|
-
(
|
|
859
|
+
o = a[o], i = i.filter(
|
|
860
|
+
(c) => Number(c.attributes.sectionId) === o
|
|
863
861
|
);
|
|
864
862
|
}
|
|
865
863
|
if (s !== void 0) {
|
|
866
864
|
const a = [];
|
|
867
|
-
if (
|
|
868
|
-
const
|
|
869
|
-
a.indexOf(
|
|
870
|
-
}), a.sort((
|
|
865
|
+
if (i.forEach((c) => {
|
|
866
|
+
const n = Number(c.attributes.laneId);
|
|
867
|
+
a.indexOf(n) === -1 && a.push(n);
|
|
868
|
+
}), a.sort((c, n) => c - n), s > a.length - 1)
|
|
871
869
|
return { status: -1, message: "未找到。请检查车道编号" };
|
|
872
|
-
s = a[s],
|
|
873
|
-
(
|
|
870
|
+
s = a[s], i = i.filter(
|
|
871
|
+
(c) => Number(c.attributes.laneId) === s
|
|
874
872
|
);
|
|
875
873
|
}
|
|
876
|
-
const
|
|
874
|
+
const l = i.map(
|
|
877
875
|
(a) => a.geometry
|
|
878
|
-
),
|
|
876
|
+
), r = L.union(l);
|
|
879
877
|
if (e.flash) {
|
|
880
878
|
const a = new I({
|
|
881
|
-
geometry:
|
|
879
|
+
geometry: r,
|
|
882
880
|
symbol: {
|
|
883
881
|
type: "simple-fill",
|
|
884
882
|
color: [0, 255, 255, 0.6],
|
|
@@ -890,7 +888,7 @@ class O {
|
|
|
890
888
|
});
|
|
891
889
|
this.flashGraphic(a);
|
|
892
890
|
}
|
|
893
|
-
return await this.view.goTo(
|
|
891
|
+
return await this.view.goTo(r, { duration: 1e3 }), { status: 0, message: "ok" };
|
|
894
892
|
}
|
|
895
893
|
/**
|
|
896
894
|
* graphic渐隐渐显闪烁
|
|
@@ -898,9 +896,9 @@ class O {
|
|
|
898
896
|
*/
|
|
899
897
|
flashGraphic(e) {
|
|
900
898
|
this.flashLayer.removeAll(), this.flashLayer.add(e);
|
|
901
|
-
let
|
|
899
|
+
let t = 0, o = !0;
|
|
902
900
|
const s = setInterval(() => {
|
|
903
|
-
o ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (o = !1,
|
|
901
|
+
o ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (o = !1, t++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (o = !0)), t >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(s));
|
|
904
902
|
}, 10);
|
|
905
903
|
}
|
|
906
904
|
/**
|
|
@@ -909,19 +907,19 @@ class O {
|
|
|
909
907
|
* @returns
|
|
910
908
|
*/
|
|
911
909
|
unselectSumo(e) {
|
|
912
|
-
if (
|
|
913
|
-
(!e || !e.id || e.id === "" || e.id ===
|
|
914
|
-
|
|
910
|
+
if (e ? e.type === "junction" && this.junctionLayer.graphics.forEach((t) => {
|
|
911
|
+
(!e || !e.id || e.id === "" || e.id === t.getAttribute("id")) && t.getAttribute("selected") && (t.setAttribute("selected", !1), t.symbol = this.getCrossGraphicSymbol(
|
|
912
|
+
t.attributes,
|
|
915
913
|
this.view.scale < this.junctionScale ? "picture" : "marker"
|
|
916
914
|
));
|
|
917
|
-
}), !e || e.type === "edge") {
|
|
918
|
-
let
|
|
919
|
-
!e || !e.id || e.id === "" ?
|
|
915
|
+
}) : (this.highlightLayer.removeAll(), this.sectionLayer.removeAll(), this.selectedSectionIds = [], this.splitLaneLayer.removeAll()), !e || e.type === "edge") {
|
|
916
|
+
let t;
|
|
917
|
+
!e || !e.id || e.id === "" ? t = this.sectionLayer.graphics.toArray() : t = this.sectionLayer.graphics.filter((o) => o.getAttribute("edgeId") === e.id).toArray(), t.length > 0 && (t.forEach((o) => {
|
|
920
918
|
const s = o.getAttribute("id");
|
|
921
919
|
this.selectedSectionIds = this.selectedSectionIds.filter(
|
|
922
|
-
(
|
|
920
|
+
(i) => i !== s
|
|
923
921
|
);
|
|
924
|
-
}), this.sectionLayer.removeMany(
|
|
922
|
+
}), this.sectionLayer.removeMany(t));
|
|
925
923
|
}
|
|
926
924
|
return { status: 0, message: "ok" };
|
|
927
925
|
}
|
|
@@ -933,31 +931,31 @@ class O {
|
|
|
933
931
|
async selectSumo(e) {
|
|
934
932
|
switch (e.type) {
|
|
935
933
|
case "junction":
|
|
936
|
-
return this.junctionLayer.graphics.forEach((
|
|
937
|
-
if (e.id ===
|
|
938
|
-
return
|
|
934
|
+
return this.junctionLayer.graphics.forEach((t) => {
|
|
935
|
+
if (e.id === t.getAttribute("id"))
|
|
936
|
+
return t.setAttribute("selected", !0), t.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(t, 50), { status: 0, message: "ok" };
|
|
939
937
|
}), { status: -1, message: "未找到路口" };
|
|
940
938
|
case "edge": {
|
|
941
|
-
const
|
|
942
|
-
let o = String(
|
|
939
|
+
const t = e.id.split("#");
|
|
940
|
+
let o = String(t[0]);
|
|
943
941
|
o.startsWith("-") && (o = o.slice(1));
|
|
944
942
|
let s = 0;
|
|
945
|
-
|
|
946
|
-
let
|
|
947
|
-
if (
|
|
948
|
-
(
|
|
949
|
-
) :
|
|
950
|
-
(
|
|
951
|
-
)),
|
|
952
|
-
const
|
|
953
|
-
return
|
|
954
|
-
const a =
|
|
943
|
+
t.length === 2 && (s = Number(t[1]));
|
|
944
|
+
let i = [];
|
|
945
|
+
if (t.length === 1 ? i = this.allLaneGraphics.filter(
|
|
946
|
+
(l) => l.getAttribute("roadId") === o
|
|
947
|
+
) : t.length === 2 && (i = this.allLaneGraphics.filter(
|
|
948
|
+
(l) => l.getAttribute("roadId") === o && l.getAttribute("sectionIndex") === s
|
|
949
|
+
)), i.length > 0) {
|
|
950
|
+
const l = /* @__PURE__ */ new Map();
|
|
951
|
+
return i.forEach((r) => {
|
|
952
|
+
const a = r.getAttribute("roadId") + "+" + r.getAttribute("sectionId");
|
|
955
953
|
this.selectedSectionIds.includes(a) || this.selectedSectionIds.push(a);
|
|
956
|
-
let
|
|
957
|
-
|
|
958
|
-
}),
|
|
959
|
-
const
|
|
960
|
-
geometry:
|
|
954
|
+
let c = l.get(a);
|
|
955
|
+
c ? c.push(r.geometry) : (c = [r.geometry], l.set(a, c));
|
|
956
|
+
}), l.forEach(async (r, a) => {
|
|
957
|
+
const c = L.union(r), n = new I({
|
|
958
|
+
geometry: c,
|
|
961
959
|
symbol: {
|
|
962
960
|
type: "simple-fill",
|
|
963
961
|
color: [0, 255, 255, 0.5],
|
|
@@ -974,7 +972,7 @@ class O {
|
|
|
974
972
|
selected: !0
|
|
975
973
|
}
|
|
976
974
|
});
|
|
977
|
-
this.sectionLayer.add(
|
|
975
|
+
this.sectionLayer.add(n), await this.view.goTo(n);
|
|
978
976
|
}), { status: 0, message: "ok" };
|
|
979
977
|
} else
|
|
980
978
|
return { status: -1, message: "未找到路段" };
|
|
@@ -984,96 +982,101 @@ class O {
|
|
|
984
982
|
}
|
|
985
983
|
}
|
|
986
984
|
async geometrySearch(e) {
|
|
987
|
-
const
|
|
985
|
+
const t = new S({
|
|
988
986
|
rings: [e]
|
|
989
987
|
}), o = await this.laneLayer.queryFeatures({
|
|
990
|
-
geometry:
|
|
988
|
+
geometry: t,
|
|
991
989
|
outFields: ["*"]
|
|
992
|
-
}), s = [],
|
|
990
|
+
}), s = [], i = [];
|
|
993
991
|
for (const a of o.features) {
|
|
994
|
-
const
|
|
992
|
+
const c = a.getAttribute("roadId"), n = a.getAttribute("sectionIndex"), d = `${c}#${n}`;
|
|
995
993
|
if (s.indexOf(d) === -1) {
|
|
996
994
|
s.push(d), this.selectSumo({
|
|
997
995
|
type: "edge",
|
|
998
996
|
id: d
|
|
999
997
|
});
|
|
1000
|
-
const y = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, h = await
|
|
998
|
+
const y = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, h = await w.get(y, {
|
|
1001
999
|
params: {
|
|
1002
|
-
id: `${
|
|
1000
|
+
id: `${c}+${a.getAttribute("sectionId")}`,
|
|
1003
1001
|
projectName: this.projectName
|
|
1004
1002
|
}
|
|
1005
1003
|
});
|
|
1006
|
-
h.status === 200 && h.data.status === 0 &&
|
|
1004
|
+
h.status === 200 && h.data.status === 0 && i.push(h.data.result);
|
|
1007
1005
|
}
|
|
1008
1006
|
}
|
|
1009
|
-
const
|
|
1010
|
-
const
|
|
1011
|
-
return L.contains(
|
|
1012
|
-
}),
|
|
1013
|
-
for (const a of
|
|
1014
|
-
const
|
|
1007
|
+
const l = this.junctionLayer.graphics.filter((a) => {
|
|
1008
|
+
const c = a.geometry;
|
|
1009
|
+
return L.contains(t, c);
|
|
1010
|
+
}), r = [];
|
|
1011
|
+
for (const a of l) {
|
|
1012
|
+
const c = a.getAttribute("id");
|
|
1015
1013
|
this.selectSumo({
|
|
1016
1014
|
type: "junction",
|
|
1017
|
-
id:
|
|
1015
|
+
id: c
|
|
1018
1016
|
});
|
|
1019
|
-
const
|
|
1017
|
+
const n = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, d = await w.get(n, {
|
|
1020
1018
|
params: {
|
|
1021
|
-
id:
|
|
1019
|
+
id: c,
|
|
1022
1020
|
projectName: this.projectName
|
|
1023
1021
|
}
|
|
1024
1022
|
});
|
|
1025
|
-
d.status === 200 && d.data.status === 0 &&
|
|
1023
|
+
d.status === 200 && d.data.status === 0 && r.push(d.data.result);
|
|
1026
1024
|
}
|
|
1027
1025
|
return {
|
|
1028
1026
|
status: 0,
|
|
1029
1027
|
message: "ok",
|
|
1030
1028
|
result: {
|
|
1031
|
-
junctions:
|
|
1032
|
-
edges:
|
|
1029
|
+
junctions: r,
|
|
1030
|
+
edges: i
|
|
1033
1031
|
}
|
|
1034
1032
|
};
|
|
1035
1033
|
}
|
|
1034
|
+
/**
|
|
1035
|
+
* 封闭车道,使用sumo的id
|
|
1036
|
+
* @param params
|
|
1037
|
+
* @returns
|
|
1038
|
+
*/
|
|
1036
1039
|
async splitLane(e) {
|
|
1037
1040
|
const o = e.id.split("_");
|
|
1038
1041
|
if (o.length !== 2)
|
|
1039
1042
|
return { status: -1, message: "车道编号格式错误" };
|
|
1040
|
-
const s = Number(o[1]),
|
|
1041
|
-
let
|
|
1042
|
-
|
|
1043
|
-
const a = this.allLaneGraphics.filter((
|
|
1043
|
+
const s = Number(o[1]), i = o[0].split("#"), l = i.length === 2 ? Number(i[1]) : 0;
|
|
1044
|
+
let r = i[0];
|
|
1045
|
+
r.startsWith("-") && (r = r.slice(1));
|
|
1046
|
+
const a = this.allLaneGraphics.filter((b) => b.getAttribute("roadId") === r && b.getAttribute("sectionIndex") === l);
|
|
1044
1047
|
if (a.length === 0)
|
|
1045
1048
|
return { status: -1, message: "未找到路段" };
|
|
1046
|
-
const
|
|
1047
|
-
(
|
|
1049
|
+
const c = a.length - s, n = a.find(
|
|
1050
|
+
(b) => Math.abs(b.getAttribute("laneId")) === c
|
|
1048
1051
|
);
|
|
1049
|
-
if (!
|
|
1052
|
+
if (!n)
|
|
1050
1053
|
return { status: -1, message: "未找到车道" };
|
|
1051
|
-
const d = e.start || 0, y = e.end || 100, h = G.lineString(
|
|
1054
|
+
const d = e.start || 0, y = e.end || 100, h = G.lineString(n.getAttribute("leftLine")), u = x(h, d, y, {
|
|
1052
1055
|
units: "meters"
|
|
1053
|
-
}), p = G.lineString(
|
|
1056
|
+
}), p = G.lineString(n.getAttribute("rightLine")), g = x(p, d, y, {
|
|
1054
1057
|
units: "meters"
|
|
1055
|
-
}),
|
|
1056
|
-
|
|
1058
|
+
}), m = u.geometry.coordinates.concat(
|
|
1059
|
+
g.geometry.coordinates.reverse()
|
|
1057
1060
|
);
|
|
1058
|
-
|
|
1061
|
+
m.push(m[m.length - 1]);
|
|
1059
1062
|
const f = new I({
|
|
1060
1063
|
geometry: new S({
|
|
1061
|
-
rings: [
|
|
1064
|
+
rings: [m]
|
|
1062
1065
|
}),
|
|
1063
1066
|
attributes: {
|
|
1064
|
-
ObjectID:
|
|
1065
|
-
id:
|
|
1066
|
-
fromNode:
|
|
1067
|
-
toNode:
|
|
1068
|
-
roadId:
|
|
1069
|
-
roadName:
|
|
1070
|
-
sectionId:
|
|
1071
|
-
sectionIndex:
|
|
1072
|
-
laneId:
|
|
1073
|
-
type:
|
|
1074
|
-
sumoId:
|
|
1067
|
+
ObjectID: n.getAttribute("ObjectID"),
|
|
1068
|
+
id: n.getAttribute("id"),
|
|
1069
|
+
fromNode: n.getAttribute("fromNode"),
|
|
1070
|
+
toNode: n.getAttribute("toNode"),
|
|
1071
|
+
roadId: n.getAttribute("roadId"),
|
|
1072
|
+
roadName: n.getAttribute("roadName"),
|
|
1073
|
+
sectionId: n.getAttribute("sectionId"),
|
|
1074
|
+
sectionIndex: n.getAttribute("sectionIndex"),
|
|
1075
|
+
laneId: n.getAttribute("laneId"),
|
|
1076
|
+
type: n.getAttribute("type"),
|
|
1077
|
+
sumoId: n.getAttribute("sumoId"),
|
|
1075
1078
|
leftLine: u.geometry.coordinates,
|
|
1076
|
-
rightLine:
|
|
1079
|
+
rightLine: g.geometry.coordinates
|
|
1077
1080
|
},
|
|
1078
1081
|
symbol: {
|
|
1079
1082
|
type: "simple-fill",
|
|
@@ -1083,39 +1086,100 @@ class O {
|
|
|
1083
1086
|
}
|
|
1084
1087
|
}
|
|
1085
1088
|
});
|
|
1086
|
-
return this.splitLaneLayer.add(f),
|
|
1089
|
+
return this.splitLaneLayer.add(f), A.viewGoto(this.view, [f]), { status: 0, message: "ok", result: { coordinates: m } };
|
|
1087
1090
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1091
|
+
/**
|
|
1092
|
+
* 封闭车道,使用可计算路网的id
|
|
1093
|
+
* @param params
|
|
1094
|
+
*/
|
|
1095
|
+
blockLane(e) {
|
|
1096
|
+
const t = this.allLaneGraphics.filter((s) => {
|
|
1097
|
+
var l;
|
|
1098
|
+
let i = String(s.getAttribute("laneId"));
|
|
1099
|
+
return i.startsWith("-") && (i = i.slice(1)), s.getAttribute("roadId") === e.roadsectId && ((l = s.getAttribute("roadsectBaseIds")) == null ? void 0 : l.includes(e.roadsectBaseId)) && i === String(e.laneId);
|
|
1100
|
+
}), o = t.map((s) => {
|
|
1101
|
+
const i = s.clone();
|
|
1102
|
+
return console.log(
|
|
1103
|
+
t[0].getAttribute("roadsectBaseIds"),
|
|
1104
|
+
this.selectedSectionIds,
|
|
1105
|
+
this.selectedSectionIds.includes(
|
|
1106
|
+
t[0].getAttribute("roadsectBaseIds")
|
|
1107
|
+
)
|
|
1108
|
+
), i.symbol = {
|
|
1095
1109
|
type: "simple-fill",
|
|
1096
|
-
color:
|
|
1110
|
+
color: this.selectedSectionIds.includes(
|
|
1111
|
+
t[0].getAttribute("roadsectBaseIds")
|
|
1112
|
+
) ? [255, 69, 0, 0.8] : [255, 0, 0, 0.8],
|
|
1097
1113
|
outline: {
|
|
1098
1114
|
color: "red"
|
|
1099
1115
|
}
|
|
1100
|
-
},
|
|
1116
|
+
}, i;
|
|
1101
1117
|
});
|
|
1102
|
-
this.splitLaneLayer.addMany(o),
|
|
1118
|
+
this.splitLaneLayer.addMany(o), A.viewGoto(this.view, o);
|
|
1103
1119
|
}
|
|
1104
1120
|
clearSplitLane() {
|
|
1105
1121
|
this.splitLaneLayer.removeAll();
|
|
1106
1122
|
}
|
|
1123
|
+
selectComputable(e) {
|
|
1124
|
+
if (e.type === "roadsectBase") {
|
|
1125
|
+
this.allLaneGraphics.forEach((o) => {
|
|
1126
|
+
o.getAttribute("roadsectBaseIds") || console.log(o.attributes);
|
|
1127
|
+
});
|
|
1128
|
+
const t = this.allLaneGraphics.filter((o) => {
|
|
1129
|
+
var s;
|
|
1130
|
+
return (s = o.getAttribute("roadsectBaseIds")) == null ? void 0 : s.includes(e.id);
|
|
1131
|
+
});
|
|
1132
|
+
if (t.length > 0) {
|
|
1133
|
+
const o = L.union(
|
|
1134
|
+
t.map((r) => r.geometry)
|
|
1135
|
+
), s = t[0].getAttribute("roadsectBaseIds"), i = new I({
|
|
1136
|
+
geometry: o,
|
|
1137
|
+
symbol: {
|
|
1138
|
+
type: "simple-fill",
|
|
1139
|
+
color: [0, 255, 255, 0.5],
|
|
1140
|
+
style: "solid",
|
|
1141
|
+
outline: {
|
|
1142
|
+
color: [0, 255, 255],
|
|
1143
|
+
width: 1
|
|
1144
|
+
}
|
|
1145
|
+
},
|
|
1146
|
+
attributes: {
|
|
1147
|
+
type: "OpenDriveSection",
|
|
1148
|
+
roadsectBaseIds: s
|
|
1149
|
+
}
|
|
1150
|
+
});
|
|
1151
|
+
this.sectionLayer.removeAll(), this.sectionLayer.add(i), A.viewGoto(this.view, [i]), this.selectedSectionIds = [s];
|
|
1152
|
+
const l = this.splitLaneLayer.graphics.filter(
|
|
1153
|
+
(r) => {
|
|
1154
|
+
var a;
|
|
1155
|
+
return (a = r.getAttribute("roadsectBaseIds")) == null ? void 0 : a.includes(e.id);
|
|
1156
|
+
}
|
|
1157
|
+
);
|
|
1158
|
+
l.length > 0 && l.forEach(
|
|
1159
|
+
(r) => r.symbol = {
|
|
1160
|
+
type: "simple-fill",
|
|
1161
|
+
color: [255, 69, 0],
|
|
1162
|
+
outline: {
|
|
1163
|
+
color: "red",
|
|
1164
|
+
width: 2
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1107
1171
|
/**
|
|
1108
1172
|
* 更新所有路口的symbol
|
|
1109
1173
|
* @param symbolStyle
|
|
1110
1174
|
*/
|
|
1111
1175
|
updateAllJunctionSymbol(e) {
|
|
1112
|
-
const
|
|
1113
|
-
this.junctionLayer.removeAll(),
|
|
1176
|
+
const t = this.junctionLayer.graphics.clone();
|
|
1177
|
+
this.junctionLayer.removeAll(), t.forEach((o) => {
|
|
1114
1178
|
o.getAttribute("selected") || (o.symbol = this.getCrossGraphicSymbol(
|
|
1115
1179
|
o.attributes,
|
|
1116
1180
|
e
|
|
1117
1181
|
));
|
|
1118
|
-
}), this.junctionLayer.addMany(
|
|
1182
|
+
}), this.junctionLayer.addMany(t.toArray());
|
|
1119
1183
|
}
|
|
1120
1184
|
/**
|
|
1121
1185
|
* 生成路口点符号。在不同比例尺下,使用不同的符号
|
|
@@ -1123,16 +1187,16 @@ class O {
|
|
|
1123
1187
|
* @param symbolType
|
|
1124
1188
|
* @returns
|
|
1125
1189
|
*/
|
|
1126
|
-
getCrossGraphicSymbol(e,
|
|
1190
|
+
getCrossGraphicSymbol(e, t) {
|
|
1127
1191
|
const o = e.crossId !== "" && e.crossId !== void 0 && e.crossId !== null;
|
|
1128
|
-
if (
|
|
1192
|
+
if (t === "marker")
|
|
1129
1193
|
return {
|
|
1130
1194
|
type: "picture-marker",
|
|
1131
1195
|
url: `/GisViewerAssets/Images/cross/${o ? "gis_xhj_blue" : "gis_lkcz_xz"}.png`,
|
|
1132
1196
|
width: "32px",
|
|
1133
1197
|
height: "32px"
|
|
1134
1198
|
};
|
|
1135
|
-
if (
|
|
1199
|
+
if (t === "picture")
|
|
1136
1200
|
return o ? {
|
|
1137
1201
|
type: "cim",
|
|
1138
1202
|
data: {
|