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