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