gisviewer-vue3-arcgis 1.0.262 → 1.0.264
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 +370 -300
- 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/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/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
- 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
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import { Polygon as S, Point as
|
|
2
|
+
import * as j from "@arcgis/core/core/promiseUtils";
|
|
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], k = f.innerPath.concat(
|
|
461
|
+
P.reverse()
|
|
462
462
|
);
|
|
463
|
-
if (
|
|
464
|
-
console.warn(`lane ${
|
|
463
|
+
if (k.length <= 3) {
|
|
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
|
-
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(
|
|
493
|
+
this.allLaneGraphics.push(C), r.push(C);
|
|
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 =
|
|
555
|
-
var
|
|
556
|
-
const s = (
|
|
554
|
+
const e = j.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,50 @@ class O {
|
|
|
636
636
|
* 监听鼠标点击事件,获取高亮要素的拓扑信息
|
|
637
637
|
*/
|
|
638
638
|
monitorMouseClick() {
|
|
639
|
-
const e =
|
|
639
|
+
const e = j.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
|
-
|
|
650
|
-
|
|
651
|
-
|
|
648
|
+
const i = s[0].graphic;
|
|
649
|
+
console.log(i.attributes);
|
|
650
|
+
const l = i.getAttribute("type"), r = i.getAttribute("id");
|
|
651
|
+
if (l === "OpenDriveJunction")
|
|
652
|
+
if (i.getAttribute("selected") === !1) {
|
|
653
|
+
const c = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, n = await w.get(c, {
|
|
652
654
|
params: {
|
|
653
|
-
id:
|
|
655
|
+
id: r,
|
|
654
656
|
projectName: this.projectName
|
|
655
657
|
}
|
|
656
658
|
});
|
|
657
|
-
|
|
659
|
+
n.status === 200 && n.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
|
|
658
660
|
type: "OpenDriveJunction",
|
|
659
|
-
id:
|
|
660
|
-
details:
|
|
661
|
-
}),
|
|
661
|
+
id: r,
|
|
662
|
+
details: n.data.result
|
|
663
|
+
}), i.setAttribute("selected", !0), i.symbol = {
|
|
662
664
|
type: "picture-marker",
|
|
663
665
|
url: "/GisViewerAssets/Images/point_red.png",
|
|
664
666
|
width: "20px",
|
|
665
667
|
height: "20px"
|
|
666
|
-
}, this.increasePictureMarkerSize(
|
|
668
|
+
}, this.increasePictureMarkerSize(i, 50));
|
|
667
669
|
} else
|
|
668
670
|
this.openDriveClickCallback && this.openDriveClickCallback({
|
|
669
671
|
type: "OpenDriveJunction",
|
|
670
|
-
id:
|
|
672
|
+
id: r,
|
|
671
673
|
details: void 0
|
|
672
|
-
}),
|
|
673
|
-
|
|
674
|
+
}), i.setAttribute("selected", !1), i.symbol = this.getCrossGraphicSymbol(
|
|
675
|
+
i.attributes,
|
|
674
676
|
this.view.scale < this.junctionScale ? "picture" : "marker"
|
|
675
677
|
);
|
|
676
678
|
else
|
|
677
|
-
|
|
678
|
-
(
|
|
679
|
+
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(
|
|
680
|
+
(n) => n.getAttribute("roadsectBaseIds") === i.getAttribute("roadsectBaseIds")
|
|
679
681
|
).forEach(
|
|
680
|
-
(
|
|
682
|
+
(n) => n.symbol = {
|
|
681
683
|
type: "simple-fill",
|
|
682
684
|
color: [255, 69, 0],
|
|
683
685
|
outline: {
|
|
@@ -685,10 +687,14 @@ class O {
|
|
|
685
687
|
width: 2
|
|
686
688
|
}
|
|
687
689
|
}
|
|
688
|
-
)
|
|
689
|
-
|
|
690
|
+
), this.openDriveClickCallback && this.openDriveClickCallback({
|
|
691
|
+
type: "OpenDriveSection",
|
|
692
|
+
id: i.getAttribute("roadsectBaseIds"),
|
|
693
|
+
details: void 0
|
|
694
|
+
})) : (this.splitLaneLayer.graphics.filter(
|
|
695
|
+
(n) => n.getAttribute("roadsectBaseIds") === i.getAttribute("roadsectBaseIds")
|
|
690
696
|
).forEach(
|
|
691
|
-
(
|
|
697
|
+
(n) => n.symbol = {
|
|
692
698
|
type: "simple-fill",
|
|
693
699
|
color: [255, 0, 0, 0.8],
|
|
694
700
|
outline: {
|
|
@@ -696,16 +702,14 @@ class O {
|
|
|
696
702
|
width: 1
|
|
697
703
|
}
|
|
698
704
|
}
|
|
699
|
-
), this.sectionLayer.remove(
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
type: "OpenDriveSection",
|
|
703
|
-
id: t.getAttribute("edgeId"),
|
|
705
|
+
), this.sectionLayer.remove(i), this.selectedSectionIds = [], this.openDriveClickCallback && this.openDriveClickCallback({
|
|
706
|
+
type: "CloseOpenDriveSection",
|
|
707
|
+
id: i.getAttribute("roadsectBaseIds"),
|
|
704
708
|
details: void 0
|
|
705
709
|
})));
|
|
706
710
|
});
|
|
707
|
-
this.mouseClickHandler = this.view.on("immediate-click", async (
|
|
708
|
-
e(
|
|
711
|
+
this.mouseClickHandler = this.view.on("immediate-click", async (t) => {
|
|
712
|
+
e(t).catch(() => {
|
|
709
713
|
});
|
|
710
714
|
});
|
|
711
715
|
}
|
|
@@ -714,14 +718,14 @@ class O {
|
|
|
714
718
|
* @param graphic
|
|
715
719
|
* @param targetSize
|
|
716
720
|
*/
|
|
717
|
-
increasePictureMarkerSize(e,
|
|
721
|
+
increasePictureMarkerSize(e, t) {
|
|
718
722
|
const o = setInterval(() => {
|
|
719
|
-
const s = e.symbol,
|
|
720
|
-
|
|
723
|
+
const s = e.symbol, i = s.width;
|
|
724
|
+
i < t ? e.symbol = {
|
|
721
725
|
type: "picture-marker",
|
|
722
726
|
url: s.url,
|
|
723
|
-
width:
|
|
724
|
-
height:
|
|
727
|
+
width: i + 1,
|
|
728
|
+
height: i + 1
|
|
725
729
|
} : clearInterval(o);
|
|
726
730
|
}, 20);
|
|
727
731
|
}
|
|
@@ -730,21 +734,21 @@ class O {
|
|
|
730
734
|
* @param graphic
|
|
731
735
|
* @param targetSize
|
|
732
736
|
*/
|
|
733
|
-
decreasePictureMarkerSize(e,
|
|
737
|
+
decreasePictureMarkerSize(e, t) {
|
|
734
738
|
const o = setInterval(() => {
|
|
735
|
-
const s = e.symbol,
|
|
736
|
-
|
|
739
|
+
const s = e.symbol, i = s.width;
|
|
740
|
+
i > t ? e.symbol = {
|
|
737
741
|
type: "picture-marker",
|
|
738
742
|
url: s.url,
|
|
739
|
-
width:
|
|
740
|
-
height:
|
|
743
|
+
width: i - 1,
|
|
744
|
+
height: i - 1
|
|
741
745
|
} : clearInterval(o);
|
|
742
746
|
}, 20);
|
|
743
747
|
}
|
|
744
748
|
async getSumoInfo(e) {
|
|
745
749
|
switch (e.type) {
|
|
746
750
|
case "junction": {
|
|
747
|
-
const
|
|
751
|
+
const t = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, o = await w.get(t, {
|
|
748
752
|
params: {
|
|
749
753
|
id: e.id,
|
|
750
754
|
projectName: this.projectName
|
|
@@ -753,24 +757,24 @@ class O {
|
|
|
753
757
|
return o.status === 200 ? o.data : { status: -1, message: `路口信息查询失败: ${e.id}` };
|
|
754
758
|
}
|
|
755
759
|
case "edge": {
|
|
756
|
-
const
|
|
757
|
-
let o =
|
|
760
|
+
const t = e.id.split("#");
|
|
761
|
+
let o = t[0];
|
|
758
762
|
o.startsWith("-") && (o = o.slice(1));
|
|
759
763
|
let s = 0;
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
(
|
|
764
|
+
t.length === 2 && (s = Number(t[1]));
|
|
765
|
+
const i = this.allLaneGraphics.find(
|
|
766
|
+
(l) => l.getAttribute("roadId") === o && l.getAttribute("sectionIndex") === s
|
|
763
767
|
);
|
|
764
|
-
if (
|
|
765
|
-
const
|
|
768
|
+
if (i) {
|
|
769
|
+
const l = `${o}+${i.getAttribute(
|
|
766
770
|
"sectionId"
|
|
767
|
-
)}`,
|
|
771
|
+
)}`, r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, a = await w.get(r, {
|
|
768
772
|
params: {
|
|
769
|
-
id:
|
|
773
|
+
id: l,
|
|
770
774
|
projectName: this.projectName
|
|
771
775
|
}
|
|
772
776
|
});
|
|
773
|
-
return a.status === 200 ? a.data : { status: -1, message: `路段信息查询失败: ${
|
|
777
|
+
return a.status === 200 ? a.data : { status: -1, message: `路段信息查询失败: ${l}` };
|
|
774
778
|
} else
|
|
775
779
|
return { status: -1, message: "未知类型" };
|
|
776
780
|
}
|
|
@@ -785,13 +789,13 @@ class O {
|
|
|
785
789
|
* 清除OpenDrive内容
|
|
786
790
|
*/
|
|
787
791
|
async clearOpenDrive() {
|
|
788
|
-
var
|
|
792
|
+
var t, o, s;
|
|
789
793
|
let e = await this.laneLayer.queryFeatures();
|
|
790
794
|
e.features.length > 0 && await this.laneLayer.applyEdits({
|
|
791
795
|
deleteFeatures: e.features
|
|
792
796
|
}), e = await this.roadNameLayer.queryFeatures(), e.features.length > 0 && await this.roadNameLayer.applyEdits({
|
|
793
797
|
deleteFeatures: e.features
|
|
794
|
-
}), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), this.borderLayer.removeAll(), (
|
|
798
|
+
}), 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
799
|
}
|
|
796
800
|
/**
|
|
797
801
|
* 用sumo的id定位车道、基本段、路段
|
|
@@ -799,28 +803,28 @@ class O {
|
|
|
799
803
|
* @returns
|
|
800
804
|
*/
|
|
801
805
|
async findSumo(e) {
|
|
802
|
-
const { type:
|
|
803
|
-
if (
|
|
806
|
+
const { type: t, id: o } = e, s = e.flash === void 0 ? !0 : e.flash;
|
|
807
|
+
if (t === "junction")
|
|
804
808
|
return await this.findJunction(o, s);
|
|
805
|
-
if (
|
|
806
|
-
const
|
|
807
|
-
if (
|
|
809
|
+
if (t === "edge") {
|
|
810
|
+
const i = o.split("_");
|
|
811
|
+
if (i.length > 2)
|
|
808
812
|
return { status: -1, message: "id格式错误" };
|
|
809
|
-
const
|
|
810
|
-
if (
|
|
813
|
+
const l = i.length === 2 ? Number(i[1]) : void 0, r = i[0].split("#");
|
|
814
|
+
if (r.length > 2)
|
|
811
815
|
return { status: -1, message: "id格式错误" };
|
|
812
|
-
const a =
|
|
813
|
-
return await this.findLane({ roadsectId: a, segmentId:
|
|
816
|
+
const a = r[0], c = r.length === 2 ? Number(r[1]) : void 0;
|
|
817
|
+
return await this.findLane({ roadsectId: a, segmentId: c, laneId: l, flash: s });
|
|
814
818
|
} else
|
|
815
819
|
return { status: -1, message: "未知类型" };
|
|
816
820
|
}
|
|
817
|
-
async findJunction(e,
|
|
821
|
+
async findJunction(e, t) {
|
|
818
822
|
const o = this.junctionLayer.graphics.find(
|
|
819
823
|
(s) => s.attributes.id === e
|
|
820
824
|
);
|
|
821
825
|
if (!o)
|
|
822
826
|
return { status: -1, message: "未找到。请检查路口编号" };
|
|
823
|
-
if (
|
|
827
|
+
if (t) {
|
|
824
828
|
const s = new I({
|
|
825
829
|
geometry: o.geometry,
|
|
826
830
|
symbol: {
|
|
@@ -844,41 +848,41 @@ class O {
|
|
|
844
848
|
* @returns
|
|
845
849
|
*/
|
|
846
850
|
async findLane(e) {
|
|
847
|
-
let { roadsectId:
|
|
848
|
-
|
|
849
|
-
let
|
|
850
|
-
(a) => a.attributes.roadId ===
|
|
851
|
+
let { roadsectId: t, segmentId: o, laneId: s } = e;
|
|
852
|
+
t.startsWith("-") && (t = t.slice(1));
|
|
853
|
+
let i = this.allLaneGraphics.filter(
|
|
854
|
+
(a) => a.attributes.roadId === t
|
|
851
855
|
);
|
|
852
|
-
if (
|
|
856
|
+
if (i.length === 0)
|
|
853
857
|
return { status: -1, message: "未找到。请检查路段编号" };
|
|
854
858
|
if (o !== void 0) {
|
|
855
859
|
const a = [];
|
|
856
|
-
if (
|
|
857
|
-
const
|
|
858
|
-
a.indexOf(
|
|
859
|
-
}), a.sort((
|
|
860
|
+
if (i.forEach((c) => {
|
|
861
|
+
const n = Number(c.attributes.sectionId);
|
|
862
|
+
a.indexOf(n) === -1 && a.push(n);
|
|
863
|
+
}), a.sort((c, n) => c - n), o > a.length - 1)
|
|
860
864
|
return { status: -1, message: "未找到。请检查基本段编号" };
|
|
861
|
-
o = a[o],
|
|
862
|
-
(
|
|
865
|
+
o = a[o], i = i.filter(
|
|
866
|
+
(c) => Number(c.attributes.sectionId) === o
|
|
863
867
|
);
|
|
864
868
|
}
|
|
865
869
|
if (s !== void 0) {
|
|
866
870
|
const a = [];
|
|
867
|
-
if (
|
|
868
|
-
const
|
|
869
|
-
a.indexOf(
|
|
870
|
-
}), a.sort((
|
|
871
|
+
if (i.forEach((c) => {
|
|
872
|
+
const n = Number(c.attributes.laneId);
|
|
873
|
+
a.indexOf(n) === -1 && a.push(n);
|
|
874
|
+
}), a.sort((c, n) => c - n), s > a.length - 1)
|
|
871
875
|
return { status: -1, message: "未找到。请检查车道编号" };
|
|
872
|
-
s = a[s],
|
|
873
|
-
(
|
|
876
|
+
s = a[s], i = i.filter(
|
|
877
|
+
(c) => Number(c.attributes.laneId) === s
|
|
874
878
|
);
|
|
875
879
|
}
|
|
876
|
-
const
|
|
880
|
+
const l = i.map(
|
|
877
881
|
(a) => a.geometry
|
|
878
|
-
),
|
|
882
|
+
), r = L.union(l);
|
|
879
883
|
if (e.flash) {
|
|
880
884
|
const a = new I({
|
|
881
|
-
geometry:
|
|
885
|
+
geometry: r,
|
|
882
886
|
symbol: {
|
|
883
887
|
type: "simple-fill",
|
|
884
888
|
color: [0, 255, 255, 0.6],
|
|
@@ -890,7 +894,7 @@ class O {
|
|
|
890
894
|
});
|
|
891
895
|
this.flashGraphic(a);
|
|
892
896
|
}
|
|
893
|
-
return await this.view.goTo(
|
|
897
|
+
return await this.view.goTo(r, { duration: 1e3 }), { status: 0, message: "ok" };
|
|
894
898
|
}
|
|
895
899
|
/**
|
|
896
900
|
* graphic渐隐渐显闪烁
|
|
@@ -898,9 +902,9 @@ class O {
|
|
|
898
902
|
*/
|
|
899
903
|
flashGraphic(e) {
|
|
900
904
|
this.flashLayer.removeAll(), this.flashLayer.add(e);
|
|
901
|
-
let
|
|
905
|
+
let t = 0, o = !0;
|
|
902
906
|
const s = setInterval(() => {
|
|
903
|
-
o ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (o = !1,
|
|
907
|
+
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
908
|
}, 10);
|
|
905
909
|
}
|
|
906
910
|
/**
|
|
@@ -909,19 +913,19 @@ class O {
|
|
|
909
913
|
* @returns
|
|
910
914
|
*/
|
|
911
915
|
unselectSumo(e) {
|
|
912
|
-
if (
|
|
913
|
-
(!e || !e.id || e.id === "" || e.id ===
|
|
914
|
-
|
|
916
|
+
if (e ? e.type === "junction" && this.junctionLayer.graphics.forEach((t) => {
|
|
917
|
+
(!e || !e.id || e.id === "" || e.id === t.getAttribute("id")) && t.getAttribute("selected") && (t.setAttribute("selected", !1), t.symbol = this.getCrossGraphicSymbol(
|
|
918
|
+
t.attributes,
|
|
915
919
|
this.view.scale < this.junctionScale ? "picture" : "marker"
|
|
916
920
|
));
|
|
917
|
-
}), !e || e.type === "edge") {
|
|
918
|
-
let
|
|
919
|
-
!e || !e.id || e.id === "" ?
|
|
921
|
+
}) : (this.highlightLayer.removeAll(), this.sectionLayer.removeAll(), this.selectedSectionIds = [], this.splitLaneLayer.removeAll()), !e || e.type === "edge") {
|
|
922
|
+
let t;
|
|
923
|
+
!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
924
|
const s = o.getAttribute("id");
|
|
921
925
|
this.selectedSectionIds = this.selectedSectionIds.filter(
|
|
922
|
-
(
|
|
926
|
+
(i) => i !== s
|
|
923
927
|
);
|
|
924
|
-
}), this.sectionLayer.removeMany(
|
|
928
|
+
}), this.sectionLayer.removeMany(t));
|
|
925
929
|
}
|
|
926
930
|
return { status: 0, message: "ok" };
|
|
927
931
|
}
|
|
@@ -933,31 +937,31 @@ class O {
|
|
|
933
937
|
async selectSumo(e) {
|
|
934
938
|
switch (e.type) {
|
|
935
939
|
case "junction":
|
|
936
|
-
return this.junctionLayer.graphics.forEach((
|
|
937
|
-
if (e.id ===
|
|
938
|
-
return
|
|
940
|
+
return this.junctionLayer.graphics.forEach((t) => {
|
|
941
|
+
if (e.id === t.getAttribute("id"))
|
|
942
|
+
return t.setAttribute("selected", !0), t.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(t, 50), { status: 0, message: "ok" };
|
|
939
943
|
}), { status: -1, message: "未找到路口" };
|
|
940
944
|
case "edge": {
|
|
941
|
-
const
|
|
942
|
-
let o = String(
|
|
945
|
+
const t = e.id.split("#");
|
|
946
|
+
let o = String(t[0]);
|
|
943
947
|
o.startsWith("-") && (o = o.slice(1));
|
|
944
948
|
let s = 0;
|
|
945
|
-
|
|
946
|
-
let
|
|
947
|
-
if (
|
|
948
|
-
(
|
|
949
|
-
) :
|
|
950
|
-
(
|
|
951
|
-
)),
|
|
952
|
-
const
|
|
953
|
-
return
|
|
954
|
-
const a =
|
|
949
|
+
t.length === 2 && (s = Number(t[1]));
|
|
950
|
+
let i = [];
|
|
951
|
+
if (t.length === 1 ? i = this.allLaneGraphics.filter(
|
|
952
|
+
(l) => l.getAttribute("roadId") === o
|
|
953
|
+
) : t.length === 2 && (i = this.allLaneGraphics.filter(
|
|
954
|
+
(l) => l.getAttribute("roadId") === o && l.getAttribute("sectionIndex") === s
|
|
955
|
+
)), i.length > 0) {
|
|
956
|
+
const l = /* @__PURE__ */ new Map();
|
|
957
|
+
return i.forEach((r) => {
|
|
958
|
+
const a = r.getAttribute("roadId") + "+" + r.getAttribute("sectionId");
|
|
955
959
|
this.selectedSectionIds.includes(a) || this.selectedSectionIds.push(a);
|
|
956
|
-
let
|
|
957
|
-
|
|
958
|
-
}),
|
|
959
|
-
const
|
|
960
|
-
geometry:
|
|
960
|
+
let c = l.get(a);
|
|
961
|
+
c ? c.push(r.geometry) : (c = [r.geometry], l.set(a, c));
|
|
962
|
+
}), l.forEach(async (r, a) => {
|
|
963
|
+
const c = L.union(r), n = new I({
|
|
964
|
+
geometry: c,
|
|
961
965
|
symbol: {
|
|
962
966
|
type: "simple-fill",
|
|
963
967
|
color: [0, 255, 255, 0.5],
|
|
@@ -974,7 +978,7 @@ class O {
|
|
|
974
978
|
selected: !0
|
|
975
979
|
}
|
|
976
980
|
});
|
|
977
|
-
this.sectionLayer.add(
|
|
981
|
+
this.sectionLayer.add(n), await this.view.goTo(n);
|
|
978
982
|
}), { status: 0, message: "ok" };
|
|
979
983
|
} else
|
|
980
984
|
return { status: -1, message: "未找到路段" };
|
|
@@ -984,96 +988,101 @@ class O {
|
|
|
984
988
|
}
|
|
985
989
|
}
|
|
986
990
|
async geometrySearch(e) {
|
|
987
|
-
const
|
|
991
|
+
const t = new S({
|
|
988
992
|
rings: [e]
|
|
989
993
|
}), o = await this.laneLayer.queryFeatures({
|
|
990
|
-
geometry:
|
|
994
|
+
geometry: t,
|
|
991
995
|
outFields: ["*"]
|
|
992
|
-
}), s = [],
|
|
996
|
+
}), s = [], i = [];
|
|
993
997
|
for (const a of o.features) {
|
|
994
|
-
const
|
|
998
|
+
const c = a.getAttribute("roadId"), n = a.getAttribute("sectionIndex"), d = `${c}#${n}`;
|
|
995
999
|
if (s.indexOf(d) === -1) {
|
|
996
1000
|
s.push(d), this.selectSumo({
|
|
997
1001
|
type: "edge",
|
|
998
1002
|
id: d
|
|
999
1003
|
});
|
|
1000
|
-
const y = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, h = await
|
|
1004
|
+
const y = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, h = await w.get(y, {
|
|
1001
1005
|
params: {
|
|
1002
|
-
id: `${
|
|
1006
|
+
id: `${c}+${a.getAttribute("sectionId")}`,
|
|
1003
1007
|
projectName: this.projectName
|
|
1004
1008
|
}
|
|
1005
1009
|
});
|
|
1006
|
-
h.status === 200 && h.data.status === 0 &&
|
|
1010
|
+
h.status === 200 && h.data.status === 0 && i.push(h.data.result);
|
|
1007
1011
|
}
|
|
1008
1012
|
}
|
|
1009
|
-
const
|
|
1010
|
-
const
|
|
1011
|
-
return L.contains(
|
|
1012
|
-
}),
|
|
1013
|
-
for (const a of
|
|
1014
|
-
const
|
|
1013
|
+
const l = this.junctionLayer.graphics.filter((a) => {
|
|
1014
|
+
const c = a.geometry;
|
|
1015
|
+
return L.contains(t, c);
|
|
1016
|
+
}), r = [];
|
|
1017
|
+
for (const a of l) {
|
|
1018
|
+
const c = a.getAttribute("id");
|
|
1015
1019
|
this.selectSumo({
|
|
1016
1020
|
type: "junction",
|
|
1017
|
-
id:
|
|
1021
|
+
id: c
|
|
1018
1022
|
});
|
|
1019
|
-
const
|
|
1023
|
+
const n = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, d = await w.get(n, {
|
|
1020
1024
|
params: {
|
|
1021
|
-
id:
|
|
1025
|
+
id: c,
|
|
1022
1026
|
projectName: this.projectName
|
|
1023
1027
|
}
|
|
1024
1028
|
});
|
|
1025
|
-
d.status === 200 && d.data.status === 0 &&
|
|
1029
|
+
d.status === 200 && d.data.status === 0 && r.push(d.data.result);
|
|
1026
1030
|
}
|
|
1027
1031
|
return {
|
|
1028
1032
|
status: 0,
|
|
1029
1033
|
message: "ok",
|
|
1030
1034
|
result: {
|
|
1031
|
-
junctions:
|
|
1032
|
-
edges:
|
|
1035
|
+
junctions: r,
|
|
1036
|
+
edges: i
|
|
1033
1037
|
}
|
|
1034
1038
|
};
|
|
1035
1039
|
}
|
|
1040
|
+
/**
|
|
1041
|
+
* 封闭车道,使用sumo的id
|
|
1042
|
+
* @param params
|
|
1043
|
+
* @returns
|
|
1044
|
+
*/
|
|
1036
1045
|
async splitLane(e) {
|
|
1037
1046
|
const o = e.id.split("_");
|
|
1038
1047
|
if (o.length !== 2)
|
|
1039
1048
|
return { status: -1, message: "车道编号格式错误" };
|
|
1040
|
-
const s = Number(o[1]),
|
|
1041
|
-
let
|
|
1042
|
-
|
|
1043
|
-
const a = this.allLaneGraphics.filter((
|
|
1049
|
+
const s = Number(o[1]), i = o[0].split("#"), l = i.length === 2 ? Number(i[1]) : 0;
|
|
1050
|
+
let r = i[0];
|
|
1051
|
+
r.startsWith("-") && (r = r.slice(1));
|
|
1052
|
+
const a = this.allLaneGraphics.filter((b) => b.getAttribute("roadId") === r && b.getAttribute("sectionIndex") === l);
|
|
1044
1053
|
if (a.length === 0)
|
|
1045
1054
|
return { status: -1, message: "未找到路段" };
|
|
1046
|
-
const
|
|
1047
|
-
(
|
|
1055
|
+
const c = a.length - s, n = a.find(
|
|
1056
|
+
(b) => Math.abs(b.getAttribute("laneId")) === c
|
|
1048
1057
|
);
|
|
1049
|
-
if (!
|
|
1058
|
+
if (!n)
|
|
1050
1059
|
return { status: -1, message: "未找到车道" };
|
|
1051
|
-
const d = e.start || 0, y = e.end || 100, h = G.lineString(
|
|
1060
|
+
const d = e.start || 0, y = e.end || 100, h = G.lineString(n.getAttribute("leftLine")), u = x(h, d, y, {
|
|
1052
1061
|
units: "meters"
|
|
1053
|
-
}), p = G.lineString(
|
|
1062
|
+
}), p = G.lineString(n.getAttribute("rightLine")), g = x(p, d, y, {
|
|
1054
1063
|
units: "meters"
|
|
1055
|
-
}),
|
|
1056
|
-
|
|
1064
|
+
}), m = u.geometry.coordinates.concat(
|
|
1065
|
+
g.geometry.coordinates.reverse()
|
|
1057
1066
|
);
|
|
1058
|
-
|
|
1067
|
+
m.push(m[m.length - 1]);
|
|
1059
1068
|
const f = new I({
|
|
1060
1069
|
geometry: new S({
|
|
1061
|
-
rings: [
|
|
1070
|
+
rings: [m]
|
|
1062
1071
|
}),
|
|
1063
1072
|
attributes: {
|
|
1064
|
-
ObjectID:
|
|
1065
|
-
id:
|
|
1066
|
-
fromNode:
|
|
1067
|
-
toNode:
|
|
1068
|
-
roadId:
|
|
1069
|
-
roadName:
|
|
1070
|
-
sectionId:
|
|
1071
|
-
sectionIndex:
|
|
1072
|
-
laneId:
|
|
1073
|
-
type:
|
|
1074
|
-
sumoId:
|
|
1073
|
+
ObjectID: n.getAttribute("ObjectID"),
|
|
1074
|
+
id: n.getAttribute("id"),
|
|
1075
|
+
fromNode: n.getAttribute("fromNode"),
|
|
1076
|
+
toNode: n.getAttribute("toNode"),
|
|
1077
|
+
roadId: n.getAttribute("roadId"),
|
|
1078
|
+
roadName: n.getAttribute("roadName"),
|
|
1079
|
+
sectionId: n.getAttribute("sectionId"),
|
|
1080
|
+
sectionIndex: n.getAttribute("sectionIndex"),
|
|
1081
|
+
laneId: n.getAttribute("laneId"),
|
|
1082
|
+
type: n.getAttribute("type"),
|
|
1083
|
+
sumoId: n.getAttribute("sumoId"),
|
|
1075
1084
|
leftLine: u.geometry.coordinates,
|
|
1076
|
-
rightLine:
|
|
1085
|
+
rightLine: g.geometry.coordinates
|
|
1077
1086
|
},
|
|
1078
1087
|
symbol: {
|
|
1079
1088
|
type: "simple-fill",
|
|
@@ -1083,39 +1092,100 @@ class O {
|
|
|
1083
1092
|
}
|
|
1084
1093
|
}
|
|
1085
1094
|
});
|
|
1086
|
-
return this.splitLaneLayer.add(f),
|
|
1095
|
+
return this.splitLaneLayer.add(f), A.viewGoto(this.view, [f]), { status: 0, message: "ok", result: { coordinates: m } };
|
|
1087
1096
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1097
|
+
/**
|
|
1098
|
+
* 封闭车道,使用可计算路网的id
|
|
1099
|
+
* @param params
|
|
1100
|
+
*/
|
|
1101
|
+
blockLane(e) {
|
|
1102
|
+
const t = this.allLaneGraphics.filter((s) => {
|
|
1103
|
+
var l;
|
|
1104
|
+
let i = String(s.getAttribute("laneId"));
|
|
1105
|
+
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);
|
|
1106
|
+
}), o = t.map((s) => {
|
|
1107
|
+
const i = s.clone();
|
|
1108
|
+
return console.log(
|
|
1109
|
+
t[0].getAttribute("roadsectBaseIds"),
|
|
1110
|
+
this.selectedSectionIds,
|
|
1111
|
+
this.selectedSectionIds.includes(
|
|
1112
|
+
t[0].getAttribute("roadsectBaseIds")
|
|
1113
|
+
)
|
|
1114
|
+
), i.symbol = {
|
|
1095
1115
|
type: "simple-fill",
|
|
1096
|
-
color:
|
|
1116
|
+
color: this.selectedSectionIds.includes(
|
|
1117
|
+
t[0].getAttribute("roadsectBaseIds")
|
|
1118
|
+
) ? [255, 69, 0, 0.8] : [255, 0, 0, 0.8],
|
|
1097
1119
|
outline: {
|
|
1098
1120
|
color: "red"
|
|
1099
1121
|
}
|
|
1100
|
-
},
|
|
1122
|
+
}, i;
|
|
1101
1123
|
});
|
|
1102
|
-
this.splitLaneLayer.addMany(o),
|
|
1124
|
+
this.splitLaneLayer.addMany(o), A.viewGoto(this.view, o);
|
|
1103
1125
|
}
|
|
1104
1126
|
clearSplitLane() {
|
|
1105
1127
|
this.splitLaneLayer.removeAll();
|
|
1106
1128
|
}
|
|
1129
|
+
selectComputable(e) {
|
|
1130
|
+
if (e.type === "roadsectBase") {
|
|
1131
|
+
this.allLaneGraphics.forEach((o) => {
|
|
1132
|
+
o.getAttribute("roadsectBaseIds") || console.log(o.attributes);
|
|
1133
|
+
});
|
|
1134
|
+
const t = this.allLaneGraphics.filter((o) => {
|
|
1135
|
+
var s;
|
|
1136
|
+
return (s = o.getAttribute("roadsectBaseIds")) == null ? void 0 : s.includes(e.id);
|
|
1137
|
+
});
|
|
1138
|
+
if (t.length > 0) {
|
|
1139
|
+
const o = L.union(
|
|
1140
|
+
t.map((r) => r.geometry)
|
|
1141
|
+
), s = t[0].getAttribute("roadsectBaseIds"), i = new I({
|
|
1142
|
+
geometry: o,
|
|
1143
|
+
symbol: {
|
|
1144
|
+
type: "simple-fill",
|
|
1145
|
+
color: [0, 255, 255, 0.5],
|
|
1146
|
+
style: "solid",
|
|
1147
|
+
outline: {
|
|
1148
|
+
color: [0, 255, 255],
|
|
1149
|
+
width: 1
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
attributes: {
|
|
1153
|
+
type: "OpenDriveSection",
|
|
1154
|
+
roadsectBaseIds: s
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
this.sectionLayer.removeAll(), this.sectionLayer.add(i), A.viewGoto(this.view, [i]), this.selectedSectionIds = [s];
|
|
1158
|
+
const l = this.splitLaneLayer.graphics.filter(
|
|
1159
|
+
(r) => {
|
|
1160
|
+
var a;
|
|
1161
|
+
return (a = r.getAttribute("roadsectBaseIds")) == null ? void 0 : a.includes(e.id);
|
|
1162
|
+
}
|
|
1163
|
+
);
|
|
1164
|
+
l.length > 0 && l.forEach(
|
|
1165
|
+
(r) => r.symbol = {
|
|
1166
|
+
type: "simple-fill",
|
|
1167
|
+
color: [255, 69, 0],
|
|
1168
|
+
outline: {
|
|
1169
|
+
color: "red",
|
|
1170
|
+
width: 2
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1107
1177
|
/**
|
|
1108
1178
|
* 更新所有路口的symbol
|
|
1109
1179
|
* @param symbolStyle
|
|
1110
1180
|
*/
|
|
1111
1181
|
updateAllJunctionSymbol(e) {
|
|
1112
|
-
const
|
|
1113
|
-
this.junctionLayer.removeAll(),
|
|
1182
|
+
const t = this.junctionLayer.graphics.clone();
|
|
1183
|
+
this.junctionLayer.removeAll(), t.forEach((o) => {
|
|
1114
1184
|
o.getAttribute("selected") || (o.symbol = this.getCrossGraphicSymbol(
|
|
1115
1185
|
o.attributes,
|
|
1116
1186
|
e
|
|
1117
1187
|
));
|
|
1118
|
-
}), this.junctionLayer.addMany(
|
|
1188
|
+
}), this.junctionLayer.addMany(t.toArray());
|
|
1119
1189
|
}
|
|
1120
1190
|
/**
|
|
1121
1191
|
* 生成路口点符号。在不同比例尺下,使用不同的符号
|
|
@@ -1123,16 +1193,16 @@ class O {
|
|
|
1123
1193
|
* @param symbolType
|
|
1124
1194
|
* @returns
|
|
1125
1195
|
*/
|
|
1126
|
-
getCrossGraphicSymbol(e,
|
|
1196
|
+
getCrossGraphicSymbol(e, t) {
|
|
1127
1197
|
const o = e.crossId !== "" && e.crossId !== void 0 && e.crossId !== null;
|
|
1128
|
-
if (
|
|
1198
|
+
if (t === "marker")
|
|
1129
1199
|
return {
|
|
1130
1200
|
type: "picture-marker",
|
|
1131
1201
|
url: `/GisViewerAssets/Images/cross/${o ? "gis_xhj_blue" : "gis_lkcz_xz"}.png`,
|
|
1132
1202
|
width: "32px",
|
|
1133
1203
|
height: "32px"
|
|
1134
1204
|
};
|
|
1135
|
-
if (
|
|
1205
|
+
if (t === "picture")
|
|
1136
1206
|
return o ? {
|
|
1137
1207
|
type: "cim",
|
|
1138
1208
|
data: {
|