gisviewer-vue3-arcgis 1.0.159 → 1.0.161
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/common-utils.d.ts +6 -0
- package/es/src/gis-map/utils/common-utils.mjs +56 -43
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +27 -22
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +8 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +251 -125
- package/es/src/gis-map/utils/overlay.mjs +26 -13
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +5 -5
- package/lib/src/gis-map/utils/common-utils.d.ts +6 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +8 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/overlay.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
1
|
+
import g from "@arcgis/core/Graphic";
|
|
2
|
+
import * as C from "@arcgis/core/core/promiseUtils";
|
|
3
|
+
import * as $ from "@arcgis/core/core/reactiveUtils.js";
|
|
3
4
|
import { Polygon as N } from "@arcgis/core/geometry";
|
|
4
5
|
import * as L from "@arcgis/core/geometry/geometryEngine";
|
|
5
6
|
import k from "@arcgis/core/layers/FeatureLayer";
|
|
6
7
|
import I from "@arcgis/core/layers/GraphicsLayer";
|
|
7
|
-
import * as
|
|
8
|
-
import { lineSliceAlong as
|
|
8
|
+
import * as D from "@turf/helpers";
|
|
9
|
+
import { lineSliceAlong as G } from "@turf/line-slice-along";
|
|
9
10
|
import b from "axios";
|
|
10
|
-
import { XMLParser as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { watch as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
class
|
|
11
|
+
import { XMLParser as F } from "fast-xml-parser";
|
|
12
|
+
import P from "md5";
|
|
13
|
+
import x from "pako";
|
|
14
|
+
import { watch as E } from "vue";
|
|
15
|
+
import R from "../../stores/index.mjs";
|
|
16
|
+
import J from "../common-utils.mjs";
|
|
17
|
+
class M {
|
|
17
18
|
constructor(e) {
|
|
18
|
-
this.junctionNames = /* @__PURE__ */ new Map(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.selectedSectionIds = [], this.currentJunctionId = "", this.view = e, this.laneLayer = new k({
|
|
19
|
+
this.junctionNames = /* @__PURE__ */ new Map(), this.junctionScale = 5e3, this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.selectedSectionIds = [], this.currentJunctionId = "", this.view = e, this.laneLayer = new k({
|
|
19
20
|
id: "OpenDriveLane",
|
|
20
21
|
fields: [
|
|
21
22
|
{
|
|
@@ -290,9 +291,9 @@ class x {
|
|
|
290
291
|
]
|
|
291
292
|
}), this.junctionLayer = new I({ id: "OpenDriveJunction" }), this.sectionLayer = new I({ id: "OpenDriveSection" }), this.highlightLayer = new I({ id: "OpenDriveHighlight" }), this.flashLayer = new I({ id: "OpenDriveFlash" }), this.drawLayer = new I({ id: "Draw" }), this.splitLaneLayer = new I({ id: "SplitLane" }), this.borderLayer = new I({ id: "OpenDriveBorder" }), this.view.map.addMany([
|
|
292
293
|
this.laneLayer,
|
|
293
|
-
this.junctionLayer,
|
|
294
294
|
this.sectionLayer,
|
|
295
295
|
this.roadNameLayer,
|
|
296
|
+
this.junctionLayer,
|
|
296
297
|
this.highlightLayer,
|
|
297
298
|
this.flashLayer,
|
|
298
299
|
this.drawLayer,
|
|
@@ -301,16 +302,16 @@ class x {
|
|
|
301
302
|
]);
|
|
302
303
|
}
|
|
303
304
|
static getInstance(e) {
|
|
304
|
-
return this.instance || (this.instance = new
|
|
305
|
+
return this.instance || (this.instance = new M(e)), this.instance;
|
|
305
306
|
}
|
|
306
307
|
async makeMd5FromFile(e) {
|
|
307
308
|
var t;
|
|
308
309
|
try {
|
|
309
|
-
const r = await (await fetch(e)).text(), n = (t = new
|
|
310
|
+
const r = await (await fetch(e)).text(), n = (t = new F({
|
|
310
311
|
ignoreAttributes: !1,
|
|
311
312
|
allowBooleanAttributes: !0
|
|
312
313
|
}).parse(r).OpenDRIVE.userData) == null ? void 0 : t.border;
|
|
313
|
-
return { status: 0, message: "ok", result: { md5:
|
|
314
|
+
return { status: 0, message: "ok", result: { md5: P(r), border: n } };
|
|
314
315
|
} catch (i) {
|
|
315
316
|
return { status: -1, message: i.message };
|
|
316
317
|
}
|
|
@@ -321,8 +322,23 @@ class x {
|
|
|
321
322
|
* @returns
|
|
322
323
|
*/
|
|
323
324
|
async showOpenDriveFromFile(e) {
|
|
324
|
-
var f,
|
|
325
|
-
this.openDriveClickCallback = e.selectedCallback,
|
|
325
|
+
var f, y;
|
|
326
|
+
this.openDriveClickCallback = e.selectedCallback, $.watch(
|
|
327
|
+
() => this.view.scale,
|
|
328
|
+
(p, h) => {
|
|
329
|
+
p > this.junctionScale && h <= this.junctionScale ? (console.log(p, h), this.junctionLayer.graphics.forEach((m) => {
|
|
330
|
+
m.symbol = this.getCrossGraphicSymbol(
|
|
331
|
+
m.attributes,
|
|
332
|
+
"marker"
|
|
333
|
+
);
|
|
334
|
+
})) : p <= this.junctionScale && h > this.junctionScale && (console.log(p, h), this.junctionLayer.graphics.forEach((m) => {
|
|
335
|
+
m.symbol = this.getCrossGraphicSymbol(
|
|
336
|
+
m.attributes,
|
|
337
|
+
"picture"
|
|
338
|
+
);
|
|
339
|
+
}));
|
|
340
|
+
}
|
|
341
|
+
), console.time("md5用时");
|
|
326
342
|
const t = await this.makeMd5FromFile(e.file);
|
|
327
343
|
if (t.status !== 0)
|
|
328
344
|
return t;
|
|
@@ -340,34 +356,34 @@ class x {
|
|
|
340
356
|
}
|
|
341
357
|
}
|
|
342
358
|
);
|
|
343
|
-
} catch (
|
|
344
|
-
return { status: -1, message:
|
|
359
|
+
} catch (p) {
|
|
360
|
+
return { status: -1, message: p.message };
|
|
345
361
|
}
|
|
346
362
|
if (r.status !== 200)
|
|
347
363
|
return { status: -1, message: r.statusText };
|
|
348
364
|
console.time("渲染用时");
|
|
349
365
|
const s = r.data.result.geoSetting;
|
|
350
|
-
|
|
366
|
+
J.setGeoData(
|
|
351
367
|
s.geoReference,
|
|
352
368
|
s.offsetX,
|
|
353
369
|
s.offsetY
|
|
354
370
|
);
|
|
355
371
|
let c = r.data.result.json;
|
|
356
372
|
c.startsWith(window.location.protocol) || (c = `${window.location.protocol}//${e.server}${c}`);
|
|
357
|
-
const a = await (await fetch(c)).arrayBuffer(), o =
|
|
373
|
+
const a = await (await fetch(c)).arrayBuffer(), o = x.inflate(a, { to: "string" }), l = JSON.parse(o);
|
|
358
374
|
await this.showAllLanes(
|
|
359
375
|
l,
|
|
360
376
|
((f = e.options) == null ? void 0 : f.showJunctionLane) || !1,
|
|
361
|
-
((
|
|
377
|
+
((y = e.options) == null ? void 0 : y.showRoadName) || !0
|
|
362
378
|
);
|
|
363
379
|
const d = r.data.result.junctions;
|
|
364
380
|
this.showJunction(d), e.options && e.options.centerMap !== !1 && await this.view.goTo(this.allLaneGraphics), this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick();
|
|
365
|
-
const
|
|
366
|
-
return
|
|
367
|
-
() =>
|
|
381
|
+
const u = R.useAppDataStore;
|
|
382
|
+
return E(
|
|
383
|
+
() => u.isSketching,
|
|
368
384
|
() => {
|
|
369
|
-
var
|
|
370
|
-
|
|
385
|
+
var p, h;
|
|
386
|
+
u.isSketching ? ((p = this.mouseMoveHandler) == null || p.remove(), this.mouseMoveHandler = void 0, (h = this.mouseClickHandler) == null || h.remove(), this.mouseClickHandler = void 0) : (this.monitorMouseMove(), this.monitorMouseClick());
|
|
371
387
|
}
|
|
372
388
|
), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
|
|
373
389
|
}
|
|
@@ -390,7 +406,7 @@ class x {
|
|
|
390
406
|
throw new Error(`OpenDriveRenderer: ${r.statusText}`);
|
|
391
407
|
let s = r.data.result.json;
|
|
392
408
|
s.startsWith(window.location.protocol) || (s = `${window.location.protocol}//${e}${s}`);
|
|
393
|
-
const n = await (await fetch(s)).arrayBuffer(), a =
|
|
409
|
+
const n = await (await fetch(s)).arrayBuffer(), a = x.inflate(n, { to: "string" }), o = JSON.parse(a);
|
|
394
410
|
return await this.showAllLanes(o, !1, !1), { status: 0, message: "ok" };
|
|
395
411
|
}
|
|
396
412
|
/**
|
|
@@ -412,9 +428,9 @@ class x {
|
|
|
412
428
|
if (!t && o.junction !== "-1")
|
|
413
429
|
continue;
|
|
414
430
|
const { id: l, refLine: d } = o;
|
|
415
|
-
let
|
|
416
|
-
|
|
417
|
-
const f = new
|
|
431
|
+
let u = o.name;
|
|
432
|
+
u.includes("(") && (u = u.slice(0, u.indexOf("("))), u = u.replace(/(.)/g, "$1 ");
|
|
433
|
+
const f = new g({
|
|
418
434
|
geometry: {
|
|
419
435
|
type: "polyline",
|
|
420
436
|
paths: [d]
|
|
@@ -422,48 +438,48 @@ class x {
|
|
|
422
438
|
attributes: {
|
|
423
439
|
ObjectID: c++,
|
|
424
440
|
roadId: l,
|
|
425
|
-
roadName:
|
|
441
|
+
roadName: u
|
|
426
442
|
}
|
|
427
443
|
});
|
|
428
|
-
this.allRefLineGraphics.push(f), o.laneSections.sort((
|
|
429
|
-
for (let
|
|
430
|
-
const
|
|
431
|
-
for (const
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
444
|
+
this.allRefLineGraphics.push(f), o.laneSections.sort((y, p) => Number(y.id) - Number(p.id));
|
|
445
|
+
for (let y = 0; y < o.laneSections.length; y++) {
|
|
446
|
+
const p = o.laneSections[y], h = Number(p.id);
|
|
447
|
+
for (const m of p.lanePaths) {
|
|
448
|
+
const v = Number(m.id);
|
|
449
|
+
if (v === 0)
|
|
434
450
|
continue;
|
|
435
|
-
const
|
|
436
|
-
|
|
451
|
+
const w = m.type, O = [...m.outerPath], S = m.innerPath.concat(
|
|
452
|
+
O.reverse()
|
|
437
453
|
);
|
|
438
454
|
if (S.length <= 3) {
|
|
439
|
-
console.warn(`lane ${
|
|
455
|
+
console.warn(`lane ${v} has less than 3 points`);
|
|
440
456
|
continue;
|
|
441
457
|
}
|
|
442
|
-
S.push(
|
|
458
|
+
S.push(m.innerPath[0]);
|
|
443
459
|
const A = new N({
|
|
444
460
|
rings: [S]
|
|
445
461
|
});
|
|
446
462
|
if (A) {
|
|
447
|
-
const
|
|
463
|
+
const j = new g({
|
|
448
464
|
geometry: A,
|
|
449
465
|
attributes: {
|
|
450
466
|
ObjectID: c++,
|
|
451
|
-
id: `${l}+${
|
|
467
|
+
id: `${l}+${h}+${v}`,
|
|
452
468
|
fromNode: o.fromNode,
|
|
453
469
|
toNode: o.toNode,
|
|
454
470
|
roadId: String(l),
|
|
455
471
|
roadName: o.name,
|
|
456
|
-
sectionId: String(
|
|
457
|
-
sectionIndex:
|
|
458
|
-
laneId:
|
|
459
|
-
type:
|
|
472
|
+
sectionId: String(h),
|
|
473
|
+
sectionIndex: y,
|
|
474
|
+
laneId: v,
|
|
475
|
+
type: w,
|
|
460
476
|
sumoId: "",
|
|
461
477
|
// 记录左右边线的起始点,用于按长度高亮车道的一部分
|
|
462
|
-
leftLine:
|
|
463
|
-
rightLine:
|
|
478
|
+
leftLine: m.innerPath,
|
|
479
|
+
rightLine: m.outerPath
|
|
464
480
|
}
|
|
465
481
|
});
|
|
466
|
-
this.allLaneGraphics.push(
|
|
482
|
+
this.allLaneGraphics.push(j), n.push(j);
|
|
467
483
|
}
|
|
468
484
|
}
|
|
469
485
|
}
|
|
@@ -498,7 +514,7 @@ class x {
|
|
|
498
514
|
if (!i)
|
|
499
515
|
continue;
|
|
500
516
|
this.junctionNames.set(i.id, i.name), i.nodeType = i.type;
|
|
501
|
-
const r = new
|
|
517
|
+
const r = new g({
|
|
502
518
|
geometry: {
|
|
503
519
|
type: "point",
|
|
504
520
|
x: i.coordinates[0],
|
|
@@ -509,31 +525,34 @@ class x {
|
|
|
509
525
|
selected: !1,
|
|
510
526
|
type: "OpenDriveJunction"
|
|
511
527
|
},
|
|
512
|
-
symbol:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
528
|
+
symbol: this.getCrossGraphicSymbol(i, "marker")
|
|
529
|
+
// symbol: {
|
|
530
|
+
// type: 'picture-marker',
|
|
531
|
+
// url: junctionTableData.crossId
|
|
532
|
+
// ? '/GisViewerAssets/Images/xhj_1.png'
|
|
533
|
+
// : '/GisViewerAssets/Images/xhj_2.png',
|
|
534
|
+
// width: '18px',
|
|
535
|
+
// height: '28px',
|
|
536
|
+
// yoffset: '9px'
|
|
537
|
+
// } as any,
|
|
538
|
+
// popupTemplate: {
|
|
539
|
+
// title: junctionTableData.name,
|
|
540
|
+
// content: [
|
|
541
|
+
// {
|
|
542
|
+
// type: 'fields',
|
|
543
|
+
// fieldInfos: [
|
|
544
|
+
// {
|
|
545
|
+
// fieldName: 'id',
|
|
546
|
+
// label: '路口编号'
|
|
547
|
+
// },
|
|
548
|
+
// {
|
|
549
|
+
// fieldName: 'crossId',
|
|
550
|
+
// label: '信号机编号'
|
|
551
|
+
// }
|
|
552
|
+
// ]
|
|
553
|
+
// }
|
|
554
|
+
// ]
|
|
555
|
+
// }
|
|
537
556
|
});
|
|
538
557
|
t.push(r);
|
|
539
558
|
}
|
|
@@ -543,7 +562,7 @@ class x {
|
|
|
543
562
|
* 监听鼠标移动事件,高亮显示鼠标所在路段和路口
|
|
544
563
|
*/
|
|
545
564
|
monitorMouseMove() {
|
|
546
|
-
const e =
|
|
565
|
+
const e = C.debounce(async (t) => {
|
|
547
566
|
var c;
|
|
548
567
|
const r = (c = (await this.view.hitTest(t, {
|
|
549
568
|
include: [this.laneLayer, this.junctionLayer]
|
|
@@ -560,15 +579,15 @@ class x {
|
|
|
560
579
|
"roadId"
|
|
561
580
|
)}+${this.hitGraphic.getAttribute("sectionId")}`;
|
|
562
581
|
if (this.currentSectionCode === n || this.selectedSectionIds.includes(n) || this.sectionLayer.graphics.findIndex(
|
|
563
|
-
(
|
|
582
|
+
(h) => h.getAttribute("id") === n
|
|
564
583
|
) >= 0)
|
|
565
584
|
return;
|
|
566
585
|
this.currentSectionCode = n;
|
|
567
586
|
const o = this.allLaneGraphics.filter(
|
|
568
|
-
(
|
|
587
|
+
(h) => `${h.attributes.roadId}+${h.attributes.sectionId}` === n
|
|
569
588
|
), l = L.union(
|
|
570
|
-
o.map((
|
|
571
|
-
), d = this.hitGraphic.getAttribute("fromNode"),
|
|
589
|
+
o.map((h) => h.geometry)
|
|
590
|
+
), d = this.hitGraphic.getAttribute("fromNode"), u = this.hitGraphic.getAttribute("toNode"), f = this.junctionNames.get(d) || d, y = this.junctionNames.get(u) || u, p = new g({
|
|
572
591
|
geometry: l,
|
|
573
592
|
symbol: {
|
|
574
593
|
type: "simple-fill",
|
|
@@ -584,7 +603,7 @@ class x {
|
|
|
584
603
|
id: n,
|
|
585
604
|
selected: !1,
|
|
586
605
|
fromNodeName: f,
|
|
587
|
-
toNodeName:
|
|
606
|
+
toNodeName: y,
|
|
588
607
|
laneCount: o.length
|
|
589
608
|
},
|
|
590
609
|
popupTemplate: {
|
|
@@ -610,20 +629,12 @@ class x {
|
|
|
610
629
|
]
|
|
611
630
|
}
|
|
612
631
|
});
|
|
613
|
-
this.highlightLayer.removeAll(), this.highlightLayer.add(
|
|
614
|
-
const g = this.view.toMap(t);
|
|
615
|
-
this.view.openPopup({
|
|
616
|
-
features: [m],
|
|
617
|
-
location: g
|
|
618
|
-
});
|
|
632
|
+
this.highlightLayer.removeAll(), this.highlightLayer.add(p);
|
|
619
633
|
} else if (s.layer.id === "OpenDriveJunction") {
|
|
620
634
|
const n = this.hitGraphic.getAttribute("id");
|
|
621
635
|
if (n === this.currentJunctionId)
|
|
622
636
|
return;
|
|
623
|
-
this.currentJunctionId = n
|
|
624
|
-
features: [this.hitGraphic],
|
|
625
|
-
location: this.hitGraphic.geometry
|
|
626
|
-
});
|
|
637
|
+
this.currentJunctionId = n;
|
|
627
638
|
}
|
|
628
639
|
});
|
|
629
640
|
this.mouseMoveHandler = this.view.on("pointer-move", async (t) => {
|
|
@@ -635,7 +646,7 @@ class x {
|
|
|
635
646
|
* 监听鼠标点击事件,获取高亮要素的拓扑信息
|
|
636
647
|
*/
|
|
637
648
|
monitorMouseClick() {
|
|
638
|
-
const e =
|
|
649
|
+
const e = C.debounce(async (t) => {
|
|
639
650
|
var a;
|
|
640
651
|
const r = (a = (await this.view.hitTest(t, {
|
|
641
652
|
include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
|
|
@@ -657,16 +668,21 @@ class x {
|
|
|
657
668
|
type: "OpenDriveJunction",
|
|
658
669
|
id: n,
|
|
659
670
|
details: l.data.result
|
|
660
|
-
}), s.setAttribute("selected", !0), s.symbol
|
|
661
|
-
|
|
671
|
+
}), s.setAttribute("selected", !0), s.symbol = {
|
|
672
|
+
type: "picture-marker",
|
|
673
|
+
url: "/GisViewerAssets/Images/point_red.png",
|
|
674
|
+
width: "20px",
|
|
675
|
+
height: "20px"
|
|
676
|
+
}, this.increasePictureMarkerSize(s, 50));
|
|
677
|
+
} else
|
|
662
678
|
this.openDriveClickCallback && this.openDriveClickCallback({
|
|
663
679
|
type: "OpenDriveJunction",
|
|
664
680
|
id: n,
|
|
665
681
|
details: void 0
|
|
666
|
-
}), s.setAttribute("selected", !1)
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
682
|
+
}), s.setAttribute("selected", !1), s.symbol = this.getCrossGraphicSymbol(
|
|
683
|
+
s.attributes,
|
|
684
|
+
this.view.scale < this.junctionScale ? "picture" : "marker"
|
|
685
|
+
);
|
|
670
686
|
else if (c === "OpenDriveSection")
|
|
671
687
|
if (s.layer.id === "OpenDriveHighlight") {
|
|
672
688
|
this.highlightLayer.remove(s), this.sectionLayer.add(s), s.setAttribute("selected", !0), this.selectedSectionIds.push(n);
|
|
@@ -807,15 +823,15 @@ class x {
|
|
|
807
823
|
if (!i)
|
|
808
824
|
return { status: -1, message: "未找到。请检查路口编号" };
|
|
809
825
|
if (t) {
|
|
810
|
-
const r = new
|
|
826
|
+
const r = new g({
|
|
811
827
|
geometry: i.geometry,
|
|
812
828
|
symbol: {
|
|
813
829
|
type: "simple-marker",
|
|
814
830
|
style: "circle",
|
|
815
831
|
size: 30,
|
|
816
|
-
color: [0,
|
|
832
|
+
color: [0, 255, 255, 0.8],
|
|
817
833
|
outline: {
|
|
818
|
-
color:
|
|
834
|
+
color: [0, 255, 255],
|
|
819
835
|
width: 1
|
|
820
836
|
}
|
|
821
837
|
}
|
|
@@ -863,7 +879,7 @@ class x {
|
|
|
863
879
|
(a) => a.geometry
|
|
864
880
|
), n = L.union(c);
|
|
865
881
|
if (e.flash) {
|
|
866
|
-
const a = new
|
|
882
|
+
const a = new g({
|
|
867
883
|
geometry: n,
|
|
868
884
|
symbol: {
|
|
869
885
|
type: "simple-fill",
|
|
@@ -896,11 +912,10 @@ class x {
|
|
|
896
912
|
*/
|
|
897
913
|
unselectSumo(e) {
|
|
898
914
|
if ((!e || e.type === "junction") && this.junctionLayer.graphics.forEach((t) => {
|
|
899
|
-
|
|
900
|
-
t.
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
}
|
|
915
|
+
(!e || !e.id || e.id === "" || e.id === t.getAttribute("id")) && t.getAttribute("selected") && (t.setAttribute("selected", !1), t.symbol = this.getCrossGraphicSymbol(
|
|
916
|
+
t.attributes,
|
|
917
|
+
this.view.scale < this.junctionScale ? "picture" : "marker"
|
|
918
|
+
));
|
|
904
919
|
}), !e || e.type === "edge") {
|
|
905
920
|
let t;
|
|
906
921
|
!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) => {
|
|
@@ -943,7 +958,7 @@ class x {
|
|
|
943
958
|
let o = c.get(a);
|
|
944
959
|
o ? o.push(n.geometry) : (o = [n.geometry], c.set(a, o));
|
|
945
960
|
}), c.forEach((n, a) => {
|
|
946
|
-
const o = L.union(n), l = new
|
|
961
|
+
const o = L.union(n), l = new g({
|
|
947
962
|
geometry: o,
|
|
948
963
|
symbol: {
|
|
949
964
|
type: "simple-fill",
|
|
@@ -984,7 +999,7 @@ class x {
|
|
|
984
999
|
type: "edge",
|
|
985
1000
|
id: d
|
|
986
1001
|
});
|
|
987
|
-
const
|
|
1002
|
+
const u = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, f = await b.get(u, {
|
|
988
1003
|
params: {
|
|
989
1004
|
id: `${o}+${a.getAttribute("sectionId")}`,
|
|
990
1005
|
projectName: this.projectName
|
|
@@ -1027,25 +1042,25 @@ class x {
|
|
|
1027
1042
|
const r = Number(i[1]), s = i[0].split("#"), c = s.length === 2 ? Number(s[1]) : 0;
|
|
1028
1043
|
let n = s[0];
|
|
1029
1044
|
n.startsWith("-") && (n = n.slice(1));
|
|
1030
|
-
const a = this.allLaneGraphics.filter((
|
|
1045
|
+
const a = this.allLaneGraphics.filter((w) => w.getAttribute("roadId") === n && w.getAttribute("sectionIndex") === c);
|
|
1031
1046
|
if (a.length === 0)
|
|
1032
1047
|
return { status: -1, message: "未找到路段" };
|
|
1033
1048
|
const o = a.length - r, l = a.find(
|
|
1034
|
-
(
|
|
1049
|
+
(w) => Math.abs(w.getAttribute("laneId")) === o
|
|
1035
1050
|
);
|
|
1036
1051
|
if (!l)
|
|
1037
1052
|
return { status: -1, message: "未找到车道" };
|
|
1038
|
-
const d = e.start || 0,
|
|
1053
|
+
const d = e.start || 0, u = e.end || 100, f = D.lineString(l.getAttribute("leftLine")), y = G(f, d, u, {
|
|
1039
1054
|
units: "meters"
|
|
1040
|
-
}),
|
|
1055
|
+
}), p = D.lineString(l.getAttribute("rightLine")), h = G(p, d, u, {
|
|
1041
1056
|
units: "meters"
|
|
1042
|
-
}),
|
|
1043
|
-
|
|
1057
|
+
}), m = y.geometry.coordinates.concat(
|
|
1058
|
+
h.geometry.coordinates.reverse()
|
|
1044
1059
|
);
|
|
1045
|
-
|
|
1046
|
-
const
|
|
1060
|
+
m.push(m[m.length - 1]);
|
|
1061
|
+
const v = new g({
|
|
1047
1062
|
geometry: new N({
|
|
1048
|
-
rings: [
|
|
1063
|
+
rings: [m]
|
|
1049
1064
|
}),
|
|
1050
1065
|
attributes: {
|
|
1051
1066
|
ObjectID: l.getAttribute("ObjectID"),
|
|
@@ -1059,8 +1074,8 @@ class x {
|
|
|
1059
1074
|
laneId: l.getAttribute("laneId"),
|
|
1060
1075
|
type: l.getAttribute("type"),
|
|
1061
1076
|
sumoId: l.getAttribute("sumoId"),
|
|
1062
|
-
leftLine:
|
|
1063
|
-
rightLine:
|
|
1077
|
+
leftLine: y.geometry.coordinates,
|
|
1078
|
+
rightLine: h.geometry.coordinates
|
|
1064
1079
|
},
|
|
1065
1080
|
symbol: {
|
|
1066
1081
|
type: "simple-fill",
|
|
@@ -1070,12 +1085,123 @@ class x {
|
|
|
1070
1085
|
}
|
|
1071
1086
|
}
|
|
1072
1087
|
});
|
|
1073
|
-
return this.splitLaneLayer.add(
|
|
1088
|
+
return this.splitLaneLayer.add(v), this.view.goTo(v), { status: 0, message: "ok", result: e };
|
|
1074
1089
|
}
|
|
1075
1090
|
clearSplitLane() {
|
|
1076
1091
|
this.splitLaneLayer.removeAll();
|
|
1077
1092
|
}
|
|
1093
|
+
/**
|
|
1094
|
+
* 生成路口点符号。在不同比例尺下,使用不同的符号
|
|
1095
|
+
* @param attributes
|
|
1096
|
+
* @param symbolType
|
|
1097
|
+
* @returns
|
|
1098
|
+
*/
|
|
1099
|
+
getCrossGraphicSymbol(e, t) {
|
|
1100
|
+
const i = e.crossId !== "" && e.crossId !== void 0 && e.crossId !== null;
|
|
1101
|
+
if (t === "marker")
|
|
1102
|
+
return {
|
|
1103
|
+
type: "picture-marker",
|
|
1104
|
+
url: `/GisViewerAssets/Images/xhj_${i ? 4 : 2}.png`,
|
|
1105
|
+
width: "18px",
|
|
1106
|
+
height: "28px",
|
|
1107
|
+
yOffset: "12px"
|
|
1108
|
+
};
|
|
1109
|
+
if (t === "picture")
|
|
1110
|
+
return i ? {
|
|
1111
|
+
type: "cim",
|
|
1112
|
+
data: {
|
|
1113
|
+
type: "CIMSymbolReference",
|
|
1114
|
+
primitiveOverrides: [
|
|
1115
|
+
{
|
|
1116
|
+
// 将textGraphic的TextString替换为graphic.attributes.name
|
|
1117
|
+
type: "CIMPrimitiveOverride",
|
|
1118
|
+
primitiveName: "textGraphic",
|
|
1119
|
+
propertyName: "TextString",
|
|
1120
|
+
valueExpressionInfo: {
|
|
1121
|
+
type: "CIMExpressionInfo",
|
|
1122
|
+
title: "Custom",
|
|
1123
|
+
expression: 'Replace($feature.name, "与", "/") + " " + $feature.crossId',
|
|
1124
|
+
returnType: "Default"
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
symbol: {
|
|
1129
|
+
type: "CIMPointSymbol",
|
|
1130
|
+
symbolLayers: [
|
|
1131
|
+
// 路口名称
|
|
1132
|
+
{
|
|
1133
|
+
type: "CIMVectorMarker",
|
|
1134
|
+
size: 32,
|
|
1135
|
+
colorLocked: !0,
|
|
1136
|
+
anchorPointUnits: "Relative",
|
|
1137
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
1138
|
+
markerGraphics: [
|
|
1139
|
+
{
|
|
1140
|
+
type: "CIMMarkerGraphic",
|
|
1141
|
+
primitiveName: "textGraphic",
|
|
1142
|
+
geometry: { x: 0, y: 0 },
|
|
1143
|
+
symbol: {
|
|
1144
|
+
type: "CIMTextSymbol",
|
|
1145
|
+
height: 12,
|
|
1146
|
+
horizontalAlignment: "Center",
|
|
1147
|
+
offsetX: 0,
|
|
1148
|
+
offsetY: i ? 50 : 40,
|
|
1149
|
+
haloSize: 2,
|
|
1150
|
+
haloSymbol: {
|
|
1151
|
+
type: "CIMPolygonSymbol",
|
|
1152
|
+
symbolLayers: [
|
|
1153
|
+
{
|
|
1154
|
+
type: "CIMSolidFill",
|
|
1155
|
+
enable: !0,
|
|
1156
|
+
color: [255, 255, 255, 255]
|
|
1157
|
+
}
|
|
1158
|
+
]
|
|
1159
|
+
},
|
|
1160
|
+
symbol: {
|
|
1161
|
+
type: "CIMPolygonSymbol",
|
|
1162
|
+
symbolLayers: [
|
|
1163
|
+
{
|
|
1164
|
+
type: "CIMSolidFill",
|
|
1165
|
+
enable: !0,
|
|
1166
|
+
color: [0, 0, 0, 255]
|
|
1167
|
+
}
|
|
1168
|
+
]
|
|
1169
|
+
},
|
|
1170
|
+
verticalAlignment: "Center"
|
|
1171
|
+
},
|
|
1172
|
+
textString: ""
|
|
1173
|
+
}
|
|
1174
|
+
],
|
|
1175
|
+
scaleSymbolsProportionally: !0,
|
|
1176
|
+
respectFrame: !0
|
|
1177
|
+
},
|
|
1178
|
+
// 路口图标
|
|
1179
|
+
{
|
|
1180
|
+
type: "CIMPictureMarker",
|
|
1181
|
+
enable: !0,
|
|
1182
|
+
anchorPoint: {
|
|
1183
|
+
x: 0,
|
|
1184
|
+
y: 0
|
|
1185
|
+
},
|
|
1186
|
+
anchorPointUnits: "Relative",
|
|
1187
|
+
size: 45,
|
|
1188
|
+
rotateClockwise: !0,
|
|
1189
|
+
textureFilter: "Picture",
|
|
1190
|
+
url: "/GisViewerAssets/Images/xhj_4.png",
|
|
1191
|
+
offsetY: i ? 22 : 15
|
|
1192
|
+
}
|
|
1193
|
+
]
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
} : {
|
|
1197
|
+
type: "picture-marker",
|
|
1198
|
+
url: "/GisViewerAssets/Images/xhj_2.png",
|
|
1199
|
+
width: "27px",
|
|
1200
|
+
height: "42px",
|
|
1201
|
+
yOffset: "22px"
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1078
1204
|
}
|
|
1079
1205
|
export {
|
|
1080
|
-
|
|
1206
|
+
M as default
|
|
1081
1207
|
};
|