gisviewer-vue3-arcgis 1.0.144 → 1.0.145
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 +5 -0
- package/es/src/gis-map/gis-map.vue.mjs +70 -62
- package/es/src/gis-map/index.d.ts +5 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +3 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +372 -268
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +19 -19
- package/es/src/gis-map/utils/sketchView.d.ts +1 -1
- package/es/src/gis-map/utils/sketchView.mjs +14 -14
- package/es/src/types/index.d.ts +2 -2
- package/lib/src/gis-map/gis-map.vue.d.ts +5 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +5 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +3 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/lib/src/gis-map/utils/sketchView.d.ts +1 -1
- package/lib/src/gis-map/utils/sketchView.js +1 -1
- package/lib/src/types/index.d.ts +2 -2
- package/package.json +2 -1
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import { Polygon as
|
|
1
|
+
import y from "@arcgis/core/Graphic";
|
|
2
|
+
import * as D from "@arcgis/core/core/promiseUtils";
|
|
3
|
+
import { Polygon as S } from "@arcgis/core/geometry";
|
|
4
4
|
import * as L from "@arcgis/core/geometry/geometryEngine";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
5
|
+
import k from "@arcgis/core/layers/FeatureLayer";
|
|
6
|
+
import I from "@arcgis/core/layers/GraphicsLayer";
|
|
7
|
+
import * as G from "@turf/helpers";
|
|
8
|
+
import { lineSliceAlong as C } from "@turf/line-slice-along";
|
|
9
|
+
import b from "axios";
|
|
10
|
+
import P from "md5";
|
|
11
|
+
import O from "pako";
|
|
12
|
+
import { watch as x } from "vue";
|
|
13
|
+
import J from "../../stores/index.mjs";
|
|
14
|
+
import F from "../common-utils.mjs";
|
|
15
|
+
class $ {
|
|
14
16
|
constructor(e) {
|
|
15
17
|
this.junctionNames = /* @__PURE__ */ new Map(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.currentJunctionId = "", this.view = e, this.view.popup.visibleElements = {
|
|
16
18
|
collapseButton: !1,
|
|
17
19
|
actionBar: !1
|
|
18
|
-
}, this.laneLayer = new
|
|
20
|
+
}, this.laneLayer = new k({
|
|
19
21
|
id: "OpenDriveLane",
|
|
20
22
|
fields: [
|
|
21
23
|
{
|
|
@@ -233,7 +235,7 @@ class A {
|
|
|
233
235
|
}
|
|
234
236
|
]
|
|
235
237
|
}
|
|
236
|
-
}), this.roadNameLayer = new
|
|
238
|
+
}), this.roadNameLayer = new k({
|
|
237
239
|
id: "OpenDriveRoadName",
|
|
238
240
|
fields: [
|
|
239
241
|
{
|
|
@@ -283,25 +285,26 @@ class A {
|
|
|
283
285
|
}
|
|
284
286
|
}
|
|
285
287
|
]
|
|
286
|
-
}), this.junctionLayer = new
|
|
288
|
+
}), 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.view.map.addMany([
|
|
287
289
|
this.laneLayer,
|
|
288
290
|
this.junctionLayer,
|
|
289
291
|
this.sectionLayer,
|
|
290
292
|
this.roadNameLayer,
|
|
291
293
|
this.highlightLayer,
|
|
292
294
|
this.flashLayer,
|
|
293
|
-
this.drawLayer
|
|
295
|
+
this.drawLayer,
|
|
296
|
+
this.splitLaneLayer
|
|
294
297
|
]);
|
|
295
298
|
}
|
|
296
299
|
static getInstance(e) {
|
|
297
|
-
return this.instance || (this.instance = new
|
|
300
|
+
return this.instance || (this.instance = new $(e)), this.instance;
|
|
298
301
|
}
|
|
299
302
|
async makeMd5FromFile(e) {
|
|
300
303
|
try {
|
|
301
|
-
const
|
|
302
|
-
return { status: 0, message: "ok", result:
|
|
303
|
-
} catch (
|
|
304
|
-
return { status: -1, message:
|
|
304
|
+
const i = await (await fetch(e)).text();
|
|
305
|
+
return { status: 0, message: "ok", result: P(i) };
|
|
306
|
+
} catch (t) {
|
|
307
|
+
return { status: -1, message: t.message };
|
|
305
308
|
}
|
|
306
309
|
}
|
|
307
310
|
/**
|
|
@@ -310,17 +313,17 @@ class A {
|
|
|
310
313
|
* @returns
|
|
311
314
|
*/
|
|
312
315
|
async showOpenDriveFromFile(e) {
|
|
313
|
-
var
|
|
316
|
+
var g, m;
|
|
314
317
|
this.openDriveClickCallback = e.selectedCallback, console.time("md5用时");
|
|
315
|
-
const
|
|
316
|
-
if (
|
|
317
|
-
return
|
|
318
|
-
this.projectName =
|
|
319
|
-
const
|
|
318
|
+
const t = await this.makeMd5FromFile(e.file);
|
|
319
|
+
if (t.status !== 0)
|
|
320
|
+
return t;
|
|
321
|
+
this.projectName = t.result, console.timeEnd("md5用时"), this.openDriveServer = e.server, await this.makeMd5FromFile(e.file);
|
|
322
|
+
const i = `http://${this.openDriveServer}/api/openDrive/uploadXodr`;
|
|
320
323
|
let o;
|
|
321
324
|
try {
|
|
322
|
-
o = await
|
|
323
|
-
|
|
325
|
+
o = await b.post(
|
|
326
|
+
i,
|
|
324
327
|
{},
|
|
325
328
|
{
|
|
326
329
|
params: {
|
|
@@ -329,42 +332,50 @@ class A {
|
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
334
|
);
|
|
332
|
-
} catch (
|
|
333
|
-
return { status: -1, message:
|
|
335
|
+
} catch (u) {
|
|
336
|
+
return { status: -1, message: u.message };
|
|
334
337
|
}
|
|
335
338
|
if (o.status !== 200)
|
|
336
339
|
return { status: -1, message: o.statusText };
|
|
337
340
|
console.time("渲染用时");
|
|
338
341
|
const s = o.data.result.geoSetting;
|
|
339
|
-
|
|
342
|
+
F.setGeoData(
|
|
340
343
|
s.geoReference,
|
|
341
344
|
s.offsetX,
|
|
342
345
|
s.offsetY
|
|
343
346
|
);
|
|
344
|
-
let
|
|
345
|
-
|
|
346
|
-
const
|
|
347
|
+
let c = o.data.result.json;
|
|
348
|
+
c.startsWith(window.location.protocol) || (c = `${window.location.protocol}//${e.server}${c}`);
|
|
349
|
+
const l = await (await fetch(c)).arrayBuffer(), r = O.inflate(l, { to: "string" }), n = JSON.parse(r);
|
|
347
350
|
await this.showAllLanes(
|
|
348
|
-
|
|
349
|
-
((
|
|
350
|
-
((
|
|
351
|
+
n,
|
|
352
|
+
((g = e.options) == null ? void 0 : g.showJunctionLane) || !1,
|
|
353
|
+
((m = e.options) == null ? void 0 : m.showRoadName) || !0
|
|
351
354
|
);
|
|
352
|
-
const
|
|
353
|
-
if (this.showJunction(
|
|
354
|
-
const
|
|
355
|
-
await this.view.goTo(
|
|
355
|
+
const h = o.data.result.junctions;
|
|
356
|
+
if (this.showJunction(h), e.options && e.options.centerMap !== !1) {
|
|
357
|
+
const u = F.transformPointProjection([0, 0]);
|
|
358
|
+
await this.view.goTo(u);
|
|
356
359
|
}
|
|
357
|
-
|
|
360
|
+
this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick();
|
|
361
|
+
const d = J.useAppDataStore;
|
|
362
|
+
return x(
|
|
363
|
+
() => d.isSketching,
|
|
364
|
+
() => {
|
|
365
|
+
var u, p;
|
|
366
|
+
d.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());
|
|
367
|
+
}
|
|
368
|
+
), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
|
|
358
369
|
}
|
|
359
370
|
/**
|
|
360
371
|
* 从服务器载入OpenDrive文件解析结果并显示
|
|
361
372
|
* @param server
|
|
362
373
|
* @param projectName
|
|
363
374
|
*/
|
|
364
|
-
async showOpenDriveFromServer(e,
|
|
365
|
-
const
|
|
375
|
+
async showOpenDriveFromServer(e, t) {
|
|
376
|
+
const i = `http://${e}/api/openDrive/analyzeXodr`, o = await b.get(i, {
|
|
366
377
|
headers: {
|
|
367
|
-
projectName:
|
|
378
|
+
projectName: t
|
|
368
379
|
},
|
|
369
380
|
params: {
|
|
370
381
|
analyze: !1,
|
|
@@ -375,8 +386,8 @@ class A {
|
|
|
375
386
|
throw new Error(`OpenDriveRenderer: ${o.statusText}`);
|
|
376
387
|
let s = o.data.result.json;
|
|
377
388
|
s.startsWith(window.location.protocol) || (s = `${window.location.protocol}//${e}${s}`);
|
|
378
|
-
const
|
|
379
|
-
return await this.showAllLanes(
|
|
389
|
+
const a = await (await fetch(s)).arrayBuffer(), l = O.inflate(a, { to: "string" }), r = JSON.parse(l);
|
|
390
|
+
return await this.showAllLanes(r, !1, !1), { status: 0, message: "ok" };
|
|
380
391
|
}
|
|
381
392
|
/**
|
|
382
393
|
* 显示所有车道
|
|
@@ -385,87 +396,90 @@ class A {
|
|
|
385
396
|
* @param showRoadName 是否显示道路名称
|
|
386
397
|
* @returns
|
|
387
398
|
*/
|
|
388
|
-
async showAllLanes(e,
|
|
399
|
+
async showAllLanes(e, t, i) {
|
|
389
400
|
const o = await this.laneLayer.queryFeatures();
|
|
390
401
|
return o.features.length > 0 && this.laneLayer.applyEdits({
|
|
391
402
|
deleteFeatures: o.features
|
|
392
|
-
}), this.roadNameLayer.visible =
|
|
393
|
-
let
|
|
403
|
+
}), this.roadNameLayer.visible = i, new Promise((s) => {
|
|
404
|
+
let c = 0;
|
|
394
405
|
this.allLaneGraphics = [], this.allRefLineGraphics = [];
|
|
395
|
-
const
|
|
396
|
-
for (const
|
|
397
|
-
if (!
|
|
406
|
+
const a = [];
|
|
407
|
+
for (const r of e) {
|
|
408
|
+
if (!t && r.junction !== "-1")
|
|
398
409
|
continue;
|
|
399
|
-
const { id:
|
|
400
|
-
let
|
|
401
|
-
|
|
402
|
-
const
|
|
410
|
+
const { id: n, refLine: h } = r;
|
|
411
|
+
let d = r.name;
|
|
412
|
+
d.includes("(") && (d = d.slice(0, d.indexOf("("))), d = d.replace(/(.)/g, "$1 ");
|
|
413
|
+
const g = new y({
|
|
403
414
|
geometry: {
|
|
404
415
|
type: "polyline",
|
|
405
|
-
paths: [
|
|
416
|
+
paths: [h]
|
|
406
417
|
},
|
|
407
418
|
attributes: {
|
|
408
|
-
ObjectID:
|
|
409
|
-
roadId:
|
|
410
|
-
roadName:
|
|
419
|
+
ObjectID: c++,
|
|
420
|
+
roadId: n,
|
|
421
|
+
roadName: d
|
|
411
422
|
}
|
|
412
423
|
});
|
|
413
|
-
this.allRefLineGraphics.push(
|
|
414
|
-
for (let
|
|
415
|
-
const
|
|
416
|
-
for (const
|
|
417
|
-
const
|
|
418
|
-
if (
|
|
424
|
+
this.allRefLineGraphics.push(g), r.laneSections.sort((m, u) => Number(m.id) - Number(u.id));
|
|
425
|
+
for (let m = 0; m < r.laneSections.length; m++) {
|
|
426
|
+
const u = r.laneSections[m], p = Number(u.id);
|
|
427
|
+
for (const f of u.lanePaths) {
|
|
428
|
+
const w = Number(f.id);
|
|
429
|
+
if (w === 0)
|
|
419
430
|
continue;
|
|
420
|
-
const
|
|
421
|
-
|
|
431
|
+
const v = f.type, M = [...f.outerPath], N = f.innerPath.concat(
|
|
432
|
+
M.reverse()
|
|
422
433
|
);
|
|
423
|
-
if (
|
|
424
|
-
console.warn(`lane ${
|
|
434
|
+
if (N.length <= 3) {
|
|
435
|
+
console.warn(`lane ${w} has less than 3 points`);
|
|
425
436
|
continue;
|
|
426
437
|
}
|
|
427
|
-
|
|
428
|
-
const
|
|
429
|
-
rings: [
|
|
438
|
+
N.push(f.innerPath[0]);
|
|
439
|
+
const A = new S({
|
|
440
|
+
rings: [N]
|
|
430
441
|
});
|
|
431
|
-
if (
|
|
432
|
-
const
|
|
433
|
-
geometry:
|
|
442
|
+
if (A) {
|
|
443
|
+
const j = new y({
|
|
444
|
+
geometry: A,
|
|
434
445
|
attributes: {
|
|
435
|
-
ObjectID:
|
|
436
|
-
id: `${
|
|
437
|
-
fromNode:
|
|
438
|
-
toNode:
|
|
439
|
-
roadId:
|
|
440
|
-
roadName:
|
|
441
|
-
sectionId:
|
|
442
|
-
sectionIndex:
|
|
443
|
-
laneId:
|
|
444
|
-
type:
|
|
445
|
-
sumoId: ""
|
|
446
|
+
ObjectID: c++,
|
|
447
|
+
id: `${n}+${p}+${w}`,
|
|
448
|
+
fromNode: r.fromNode,
|
|
449
|
+
toNode: r.toNode,
|
|
450
|
+
roadId: String(n),
|
|
451
|
+
roadName: r.name,
|
|
452
|
+
sectionId: String(p),
|
|
453
|
+
sectionIndex: m,
|
|
454
|
+
laneId: w,
|
|
455
|
+
type: v,
|
|
456
|
+
sumoId: "",
|
|
457
|
+
// 记录左右边线的起始点,用于按长度高亮车道的一部分
|
|
458
|
+
leftLine: f.innerPath,
|
|
459
|
+
rightLine: f.outerPath
|
|
446
460
|
}
|
|
447
461
|
});
|
|
448
|
-
this.allLaneGraphics.push(
|
|
462
|
+
this.allLaneGraphics.push(j), a.push(j);
|
|
449
463
|
}
|
|
450
464
|
}
|
|
451
465
|
}
|
|
452
466
|
}
|
|
453
|
-
const
|
|
454
|
-
if (
|
|
455
|
-
if (
|
|
456
|
-
const
|
|
467
|
+
const l = setInterval(() => {
|
|
468
|
+
if (a.length > 0 || this.allRefLineGraphics.length > 0) {
|
|
469
|
+
if (a.length > 0) {
|
|
470
|
+
const r = a.splice(0, 100);
|
|
457
471
|
this.laneLayer.applyEdits({
|
|
458
|
-
addFeatures:
|
|
472
|
+
addFeatures: r
|
|
459
473
|
});
|
|
460
474
|
}
|
|
461
475
|
if (this.allRefLineGraphics.length > 0) {
|
|
462
|
-
const
|
|
476
|
+
const r = this.allRefLineGraphics.splice(0, 10);
|
|
463
477
|
this.roadNameLayer.applyEdits({
|
|
464
|
-
addFeatures:
|
|
478
|
+
addFeatures: r
|
|
465
479
|
});
|
|
466
480
|
}
|
|
467
481
|
} else
|
|
468
|
-
clearInterval(
|
|
482
|
+
clearInterval(l), s();
|
|
469
483
|
}, 10);
|
|
470
484
|
});
|
|
471
485
|
}
|
|
@@ -475,30 +489,30 @@ class A {
|
|
|
475
489
|
* @returns
|
|
476
490
|
*/
|
|
477
491
|
showJunction(e) {
|
|
478
|
-
const
|
|
479
|
-
for (const
|
|
480
|
-
if (!
|
|
492
|
+
const t = [];
|
|
493
|
+
for (const i of e) {
|
|
494
|
+
if (!i)
|
|
481
495
|
continue;
|
|
482
|
-
this.junctionNames.set(
|
|
483
|
-
const o = new
|
|
496
|
+
this.junctionNames.set(i.id, i.name), i.nodeType = i.type;
|
|
497
|
+
const o = new y({
|
|
484
498
|
geometry: {
|
|
485
499
|
type: "point",
|
|
486
|
-
x:
|
|
487
|
-
y:
|
|
500
|
+
x: i.coordinates[0],
|
|
501
|
+
y: i.coordinates[1]
|
|
488
502
|
},
|
|
489
503
|
attributes: {
|
|
490
|
-
...
|
|
504
|
+
...i,
|
|
491
505
|
selected: !1,
|
|
492
506
|
type: "OpenDriveJunction"
|
|
493
507
|
},
|
|
494
508
|
symbol: {
|
|
495
509
|
type: "picture-marker",
|
|
496
|
-
url:
|
|
510
|
+
url: i.crossId ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png",
|
|
497
511
|
width: 30,
|
|
498
512
|
height: 30
|
|
499
513
|
},
|
|
500
514
|
popupTemplate: {
|
|
501
|
-
title:
|
|
515
|
+
title: i.name,
|
|
502
516
|
content: [
|
|
503
517
|
{
|
|
504
518
|
type: "fields",
|
|
@@ -516,42 +530,42 @@ class A {
|
|
|
516
530
|
]
|
|
517
531
|
}
|
|
518
532
|
});
|
|
519
|
-
|
|
533
|
+
t.push(o);
|
|
520
534
|
}
|
|
521
|
-
this.junctionLayer.addMany(
|
|
535
|
+
this.junctionLayer.addMany(t);
|
|
522
536
|
}
|
|
523
537
|
/**
|
|
524
538
|
* 监听鼠标移动事件,高亮显示鼠标所在路段和路口
|
|
525
539
|
*/
|
|
526
540
|
monitorMouseMove() {
|
|
527
|
-
const e =
|
|
528
|
-
var
|
|
529
|
-
const
|
|
541
|
+
const e = D.debounce(async (t) => {
|
|
542
|
+
var c;
|
|
543
|
+
const o = (c = (await this.view.hitTest(t, {
|
|
530
544
|
include: [this.laneLayer, this.junctionLayer]
|
|
531
|
-
})).results) == null ? void 0 :
|
|
532
|
-
(
|
|
545
|
+
})).results) == null ? void 0 : c.filter(
|
|
546
|
+
(a) => a.type === "graphic"
|
|
533
547
|
);
|
|
534
|
-
if (
|
|
548
|
+
if (o.length === 0) {
|
|
535
549
|
this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = "", this.view.closePopup());
|
|
536
550
|
return;
|
|
537
551
|
}
|
|
538
|
-
const
|
|
539
|
-
if (this.hitGraphic =
|
|
540
|
-
const
|
|
552
|
+
const s = o[0];
|
|
553
|
+
if (this.hitGraphic = s.graphic, s.layer.id === "OpenDriveLane") {
|
|
554
|
+
const a = `${this.hitGraphic.getAttribute(
|
|
541
555
|
"roadId"
|
|
542
556
|
)}+${this.hitGraphic.getAttribute("sectionId")}`;
|
|
543
|
-
if (
|
|
544
|
-
(
|
|
557
|
+
if (a === this.currentSectionCode || this.sectionLayer.graphics.findIndex(
|
|
558
|
+
(p) => p.getAttribute("id") === a
|
|
545
559
|
) >= 0)
|
|
546
560
|
return;
|
|
547
|
-
this.currentSectionCode =
|
|
548
|
-
const
|
|
549
|
-
(
|
|
550
|
-
),
|
|
551
|
-
|
|
552
|
-
), h = this.hitGraphic.getAttribute("fromNode"),
|
|
553
|
-
this.highlightGraphic = new
|
|
554
|
-
geometry:
|
|
561
|
+
this.currentSectionCode = a;
|
|
562
|
+
const r = this.allLaneGraphics.filter(
|
|
563
|
+
(p) => `${p.attributes.roadId}+${p.attributes.sectionId}` === a
|
|
564
|
+
), n = L.union(
|
|
565
|
+
r.map((p) => p.geometry)
|
|
566
|
+
), h = this.hitGraphic.getAttribute("fromNode"), d = this.hitGraphic.getAttribute("toNode"), g = this.junctionNames.get(h) || h, m = this.junctionNames.get(d) || d;
|
|
567
|
+
this.highlightGraphic = new y({
|
|
568
|
+
geometry: n,
|
|
555
569
|
symbol: {
|
|
556
570
|
type: "simple-fill",
|
|
557
571
|
color: [0, 255, 255, 0.5],
|
|
@@ -563,11 +577,11 @@ class A {
|
|
|
563
577
|
},
|
|
564
578
|
attributes: {
|
|
565
579
|
type: "OpenDriveSection",
|
|
566
|
-
id:
|
|
580
|
+
id: a,
|
|
567
581
|
selected: !1,
|
|
568
|
-
fromNodeName:
|
|
569
|
-
toNodeName:
|
|
570
|
-
laneCount:
|
|
582
|
+
fromNodeName: g,
|
|
583
|
+
toNodeName: m,
|
|
584
|
+
laneCount: r.length
|
|
571
585
|
},
|
|
572
586
|
popupTemplate: {
|
|
573
587
|
title: this.hitGraphic.getAttribute("roadName"),
|
|
@@ -592,16 +606,16 @@ class A {
|
|
|
592
606
|
]
|
|
593
607
|
}
|
|
594
608
|
}), this.highlightLayer.removeAll(), this.highlightLayer.add(this.highlightGraphic);
|
|
595
|
-
const
|
|
609
|
+
const u = this.view.toMap(t);
|
|
596
610
|
this.view.openPopup({
|
|
597
611
|
features: [this.highlightGraphic],
|
|
598
|
-
location:
|
|
612
|
+
location: u
|
|
599
613
|
});
|
|
600
|
-
} else if (
|
|
601
|
-
const
|
|
602
|
-
if (
|
|
614
|
+
} else if (s.layer.id === "OpenDriveJunction") {
|
|
615
|
+
const a = this.hitGraphic.getAttribute("id");
|
|
616
|
+
if (a === this.currentJunctionId)
|
|
603
617
|
return;
|
|
604
|
-
this.currentJunctionId =
|
|
618
|
+
this.currentJunctionId = a, this.view.openPopup({
|
|
605
619
|
features: [this.hitGraphic],
|
|
606
620
|
location: this.hitGraphic.geometry
|
|
607
621
|
});
|
|
@@ -611,81 +625,67 @@ class A {
|
|
|
611
625
|
e(t).catch(() => {
|
|
612
626
|
});
|
|
613
627
|
});
|
|
614
|
-
const i = M.useAppDataStore;
|
|
615
|
-
$(
|
|
616
|
-
() => i.isSketching,
|
|
617
|
-
() => {
|
|
618
|
-
var t;
|
|
619
|
-
i.isSketching ? (t = this.mouseMoveHandler) == null || t.remove() : this.mouseMoveHandler = this.view.on(
|
|
620
|
-
"pointer-move",
|
|
621
|
-
async (o) => {
|
|
622
|
-
e(o).catch(() => {
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
);
|
|
626
|
-
}
|
|
627
|
-
);
|
|
628
628
|
}
|
|
629
629
|
/**
|
|
630
630
|
* 监听鼠标点击事件,获取高亮要素的拓扑信息
|
|
631
631
|
*/
|
|
632
632
|
monitorMouseClick() {
|
|
633
|
-
const e =
|
|
634
|
-
var
|
|
635
|
-
const o = (
|
|
633
|
+
const e = D.debounce(async (t) => {
|
|
634
|
+
var l;
|
|
635
|
+
const o = (l = (await this.view.hitTest(t, {
|
|
636
636
|
include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
|
|
637
|
-
})).results) == null ? void 0 :
|
|
638
|
-
(
|
|
637
|
+
})).results) == null ? void 0 : l.filter(
|
|
638
|
+
(r) => r.type === "graphic"
|
|
639
639
|
);
|
|
640
640
|
if (o.length === 0)
|
|
641
641
|
return;
|
|
642
|
-
const s = o[0].graphic,
|
|
643
|
-
if (
|
|
642
|
+
const s = o[0].graphic, c = s.getAttribute("type"), a = s.getAttribute("id");
|
|
643
|
+
if (c === "OpenDriveJunction")
|
|
644
644
|
if (s.getAttribute("selected") === !1) {
|
|
645
|
-
const
|
|
645
|
+
const r = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, n = await b.get(r, {
|
|
646
646
|
params: {
|
|
647
|
-
id:
|
|
647
|
+
id: a,
|
|
648
648
|
projectName: this.projectName
|
|
649
649
|
}
|
|
650
650
|
});
|
|
651
|
-
|
|
651
|
+
n.status === 200 && n.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
|
|
652
652
|
type: "OpenDriveJunction",
|
|
653
|
-
id:
|
|
654
|
-
details:
|
|
653
|
+
id: a,
|
|
654
|
+
details: n.data.result
|
|
655
655
|
}), s.setAttribute("selected", !0), s.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(s, 50));
|
|
656
656
|
} else {
|
|
657
657
|
this.openDriveClickCallback && this.openDriveClickCallback({
|
|
658
658
|
type: "OpenDriveJunction",
|
|
659
|
-
id:
|
|
659
|
+
id: a,
|
|
660
660
|
details: void 0
|
|
661
661
|
}), s.setAttribute("selected", !1);
|
|
662
|
-
const
|
|
663
|
-
s.symbol.url =
|
|
662
|
+
const r = s.getAttribute("crossId");
|
|
663
|
+
s.symbol.url = r ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(s, 30);
|
|
664
664
|
}
|
|
665
|
-
else if (
|
|
665
|
+
else if (c === "OpenDriveSection")
|
|
666
666
|
if (s.getAttribute("selected"))
|
|
667
667
|
this.sectionLayer.remove(s), this.openDriveClickCallback && this.openDriveClickCallback({
|
|
668
668
|
type: "OpenDriveSection",
|
|
669
|
-
id:
|
|
669
|
+
id: a,
|
|
670
670
|
details: void 0
|
|
671
671
|
});
|
|
672
672
|
else {
|
|
673
673
|
this.highlightLayer.remove(s), this.sectionLayer.add(s), s.setAttribute("selected", !0);
|
|
674
|
-
const
|
|
674
|
+
const r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, n = await b.get(r, {
|
|
675
675
|
params: {
|
|
676
|
-
id:
|
|
676
|
+
id: a,
|
|
677
677
|
projectName: this.projectName
|
|
678
678
|
}
|
|
679
679
|
});
|
|
680
|
-
|
|
680
|
+
n.status === 200 && n.data.status === 0 && this.openDriveClickCallback && (s.setAttribute("edgeId", n.data.result.obj_id), this.openDriveClickCallback({
|
|
681
681
|
type: "OpenDriveSection",
|
|
682
|
-
id:
|
|
683
|
-
details:
|
|
682
|
+
id: a,
|
|
683
|
+
details: n.data.result
|
|
684
684
|
}));
|
|
685
685
|
}
|
|
686
686
|
});
|
|
687
|
-
this.mouseClickHandler = this.view.on("immediate-click", async (
|
|
688
|
-
e(
|
|
687
|
+
this.mouseClickHandler = this.view.on("immediate-click", async (t) => {
|
|
688
|
+
e(t).catch(() => {
|
|
689
689
|
});
|
|
690
690
|
});
|
|
691
691
|
}
|
|
@@ -694,15 +694,15 @@ class A {
|
|
|
694
694
|
* @param graphic
|
|
695
695
|
* @param targetSize
|
|
696
696
|
*/
|
|
697
|
-
increasePictureMarkerSize(e,
|
|
698
|
-
const
|
|
697
|
+
increasePictureMarkerSize(e, t) {
|
|
698
|
+
const i = setInterval(() => {
|
|
699
699
|
const o = e.symbol, s = o.width;
|
|
700
|
-
s <
|
|
700
|
+
s < t ? e.symbol = {
|
|
701
701
|
type: "picture-marker",
|
|
702
702
|
url: o.url,
|
|
703
703
|
width: s + 1,
|
|
704
704
|
height: s + 1
|
|
705
|
-
} : clearInterval(
|
|
705
|
+
} : clearInterval(i);
|
|
706
706
|
}, 20);
|
|
707
707
|
}
|
|
708
708
|
/**
|
|
@@ -710,47 +710,47 @@ class A {
|
|
|
710
710
|
* @param graphic
|
|
711
711
|
* @param targetSize
|
|
712
712
|
*/
|
|
713
|
-
decreasePictureMarkerSize(e,
|
|
714
|
-
const
|
|
713
|
+
decreasePictureMarkerSize(e, t) {
|
|
714
|
+
const i = setInterval(() => {
|
|
715
715
|
const o = e.symbol, s = o.width;
|
|
716
|
-
s >
|
|
716
|
+
s > t ? e.symbol = {
|
|
717
717
|
type: "picture-marker",
|
|
718
718
|
url: o.url,
|
|
719
719
|
width: s - 1,
|
|
720
720
|
height: s - 1
|
|
721
|
-
} : clearInterval(
|
|
721
|
+
} : clearInterval(i);
|
|
722
722
|
}, 20);
|
|
723
723
|
}
|
|
724
724
|
async getSumoInfo(e) {
|
|
725
725
|
switch (e.type) {
|
|
726
726
|
case "junction": {
|
|
727
|
-
const
|
|
727
|
+
const t = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, i = await b.get(t, {
|
|
728
728
|
params: {
|
|
729
729
|
id: e.id,
|
|
730
730
|
projectName: this.projectName
|
|
731
731
|
}
|
|
732
732
|
});
|
|
733
|
-
return
|
|
733
|
+
return i.status === 200 ? i.data : { status: -1, message: `路口信息查询失败: ${e.id}` };
|
|
734
734
|
}
|
|
735
735
|
case "edge": {
|
|
736
|
-
const
|
|
737
|
-
let
|
|
738
|
-
|
|
736
|
+
const t = e.id.split("#");
|
|
737
|
+
let i = t[0];
|
|
738
|
+
i.startsWith("-") && (i = i.slice(1));
|
|
739
739
|
let o = 0;
|
|
740
|
-
|
|
740
|
+
t.length === 2 && (o = Number(t[1]));
|
|
741
741
|
const s = this.allLaneGraphics.find(
|
|
742
|
-
(
|
|
742
|
+
(c) => c.getAttribute("roadId") === i && c.getAttribute("sectionIndex") === o
|
|
743
743
|
);
|
|
744
744
|
if (s) {
|
|
745
|
-
const
|
|
745
|
+
const c = `${i}+${s.getAttribute(
|
|
746
746
|
"sectionId"
|
|
747
|
-
)}`,
|
|
747
|
+
)}`, a = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, l = await b.get(a, {
|
|
748
748
|
params: {
|
|
749
|
-
id:
|
|
749
|
+
id: c,
|
|
750
750
|
projectName: this.projectName
|
|
751
751
|
}
|
|
752
752
|
});
|
|
753
|
-
return
|
|
753
|
+
return l.status === 200 ? l.data : { status: -1, message: `路段信息查询失败: ${c}` };
|
|
754
754
|
} else
|
|
755
755
|
return { status: -1, message: "未知类型" };
|
|
756
756
|
}
|
|
@@ -762,13 +762,13 @@ class A {
|
|
|
762
762
|
* 清除OpenDrive内容
|
|
763
763
|
*/
|
|
764
764
|
async clearOpenDrive() {
|
|
765
|
-
var
|
|
765
|
+
var t, i;
|
|
766
766
|
let e = await this.laneLayer.queryFeatures();
|
|
767
767
|
e.features.length > 0 && await this.laneLayer.applyEdits({
|
|
768
768
|
deleteFeatures: e.features
|
|
769
769
|
}), e = await this.roadNameLayer.queryFeatures(), e.features.length > 0 && await this.roadNameLayer.applyEdits({
|
|
770
770
|
deleteFeatures: e.features
|
|
771
|
-
}), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), (
|
|
771
|
+
}), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), (t = this.mouseMoveHandler) == null || t.remove(), this.mouseMoveHandler = void 0, (i = this.mouseClickHandler) == null || i.remove(), this.mouseClickHandler = void 0;
|
|
772
772
|
}
|
|
773
773
|
/**
|
|
774
774
|
* 用sumo的id定位车道、基本段、路段
|
|
@@ -776,30 +776,30 @@ class A {
|
|
|
776
776
|
* @returns
|
|
777
777
|
*/
|
|
778
778
|
async findSumo(e) {
|
|
779
|
-
const { type:
|
|
780
|
-
if (
|
|
781
|
-
return await this.findJunction(
|
|
782
|
-
if (
|
|
783
|
-
const s =
|
|
779
|
+
const { type: t, id: i } = e, o = e.flash === void 0 ? !0 : e.flash;
|
|
780
|
+
if (t === "junction")
|
|
781
|
+
return await this.findJunction(i, o);
|
|
782
|
+
if (t === "edge") {
|
|
783
|
+
const s = i.split("+");
|
|
784
784
|
if (s.length > 2)
|
|
785
785
|
return { status: -1, message: "id格式错误" };
|
|
786
|
-
const
|
|
787
|
-
if (
|
|
786
|
+
const c = s.length === 2 ? Number(s[1]) : void 0, a = s[0].split("#");
|
|
787
|
+
if (a.length > 2)
|
|
788
788
|
return { status: -1, message: "id格式错误" };
|
|
789
|
-
const
|
|
790
|
-
return await this.findLane({ roadsectId:
|
|
789
|
+
const l = a[0], r = a.length === 2 ? Number(a[1]) : void 0;
|
|
790
|
+
return await this.findLane({ roadsectId: l, segmentId: r, laneId: c, flash: o });
|
|
791
791
|
} else
|
|
792
792
|
return { status: -1, message: "未知类型" };
|
|
793
793
|
}
|
|
794
|
-
async findJunction(e,
|
|
795
|
-
const
|
|
794
|
+
async findJunction(e, t) {
|
|
795
|
+
const i = this.junctionLayer.graphics.find(
|
|
796
796
|
(o) => o.attributes.id === e
|
|
797
797
|
);
|
|
798
|
-
if (!
|
|
798
|
+
if (!i)
|
|
799
799
|
return { status: -1, message: "未找到。请检查路口编号" };
|
|
800
|
-
if (
|
|
801
|
-
const o = new
|
|
802
|
-
geometry:
|
|
800
|
+
if (t) {
|
|
801
|
+
const o = new y({
|
|
802
|
+
geometry: i.geometry,
|
|
803
803
|
symbol: {
|
|
804
804
|
type: "simple-marker",
|
|
805
805
|
style: "circle",
|
|
@@ -813,7 +813,7 @@ class A {
|
|
|
813
813
|
});
|
|
814
814
|
this.flashGraphic(o);
|
|
815
815
|
}
|
|
816
|
-
return await this.view.goTo(
|
|
816
|
+
return await this.view.goTo(i.geometry, { duration: 1e3 }), { status: 0, message: "ok" };
|
|
817
817
|
}
|
|
818
818
|
/**
|
|
819
819
|
* 用sumo的id定位车道、基本段、路段
|
|
@@ -821,41 +821,41 @@ class A {
|
|
|
821
821
|
* @returns
|
|
822
822
|
*/
|
|
823
823
|
async findLane(e) {
|
|
824
|
-
let { roadsectId:
|
|
825
|
-
|
|
824
|
+
let { roadsectId: t, segmentId: i, laneId: o } = e;
|
|
825
|
+
t.startsWith("-") && (t = t.slice(1));
|
|
826
826
|
let s = this.allLaneGraphics.filter(
|
|
827
|
-
(
|
|
827
|
+
(l) => l.attributes.roadId === t
|
|
828
828
|
);
|
|
829
829
|
if (s.length === 0)
|
|
830
830
|
return { status: -1, message: "未找到。请检查路段编号" };
|
|
831
|
-
if (
|
|
832
|
-
const
|
|
833
|
-
if (s.forEach((
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
}),
|
|
831
|
+
if (i !== void 0) {
|
|
832
|
+
const l = [];
|
|
833
|
+
if (s.forEach((r) => {
|
|
834
|
+
const n = Number(r.attributes.sectionId);
|
|
835
|
+
l.indexOf(n) === -1 && l.push(n);
|
|
836
|
+
}), l.sort((r, n) => r - n), i > l.length - 1)
|
|
837
837
|
return { status: -1, message: "未找到。请检查基本段编号" };
|
|
838
|
-
|
|
839
|
-
(
|
|
838
|
+
i = l[i], s = s.filter(
|
|
839
|
+
(r) => Number(r.attributes.sectionId) === i
|
|
840
840
|
);
|
|
841
841
|
}
|
|
842
842
|
if (o !== void 0) {
|
|
843
|
-
const
|
|
844
|
-
if (s.forEach((
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
}),
|
|
843
|
+
const l = [];
|
|
844
|
+
if (s.forEach((r) => {
|
|
845
|
+
const n = Number(r.attributes.laneId);
|
|
846
|
+
l.indexOf(n) === -1 && l.push(n);
|
|
847
|
+
}), l.sort((r, n) => r - n), o > l.length - 1)
|
|
848
848
|
return { status: -1, message: "未找到。请检查车道编号" };
|
|
849
|
-
o =
|
|
850
|
-
(
|
|
849
|
+
o = l[o], s = s.filter(
|
|
850
|
+
(r) => Number(r.attributes.laneId) === o
|
|
851
851
|
);
|
|
852
852
|
}
|
|
853
|
-
const
|
|
854
|
-
(
|
|
855
|
-
),
|
|
853
|
+
const c = s.map(
|
|
854
|
+
(l) => l.geometry
|
|
855
|
+
), a = L.union(c);
|
|
856
856
|
if (e.flash) {
|
|
857
|
-
const
|
|
858
|
-
geometry:
|
|
857
|
+
const l = new y({
|
|
858
|
+
geometry: a,
|
|
859
859
|
symbol: {
|
|
860
860
|
type: "simple-fill",
|
|
861
861
|
color: [255, 0, 0, 0.5],
|
|
@@ -866,9 +866,9 @@ class A {
|
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
});
|
|
869
|
-
this.flashGraphic(
|
|
869
|
+
this.flashGraphic(l);
|
|
870
870
|
}
|
|
871
|
-
return await this.view.goTo(
|
|
871
|
+
return await this.view.goTo(a, { duration: 1e3 }), { status: 0, message: "ok" };
|
|
872
872
|
}
|
|
873
873
|
/**
|
|
874
874
|
* graphic渐隐渐显闪烁
|
|
@@ -876,9 +876,9 @@ class A {
|
|
|
876
876
|
*/
|
|
877
877
|
flashGraphic(e) {
|
|
878
878
|
this.flashLayer.removeAll(), this.flashLayer.add(e);
|
|
879
|
-
let
|
|
879
|
+
let t = 0, i = !0;
|
|
880
880
|
const o = setInterval(() => {
|
|
881
|
-
|
|
881
|
+
i ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (i = !1, t++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (i = !0)), t >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(o));
|
|
882
882
|
}, 10);
|
|
883
883
|
}
|
|
884
884
|
/**
|
|
@@ -887,20 +887,20 @@ class A {
|
|
|
887
887
|
* @returns
|
|
888
888
|
*/
|
|
889
889
|
unselectSumo(e) {
|
|
890
|
-
if ((!e || e.type === "junction") && this.junctionLayer.graphics.forEach((
|
|
891
|
-
if ((!e || !e.id || e.id === "" || e.id ===
|
|
892
|
-
|
|
893
|
-
const
|
|
894
|
-
|
|
890
|
+
if ((!e || e.type === "junction") && this.junctionLayer.graphics.forEach((t) => {
|
|
891
|
+
if ((!e || !e.id || e.id === "" || e.id === t.getAttribute("id")) && t.getAttribute("selected")) {
|
|
892
|
+
t.setAttribute("selected", !1);
|
|
893
|
+
const i = t.getAttribute("crossId");
|
|
894
|
+
t.symbol.url = i ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(t, 30);
|
|
895
895
|
}
|
|
896
896
|
}), !e || e.type === "edge")
|
|
897
897
|
if (!e || !e.id || e.id === "")
|
|
898
898
|
this.sectionLayer.removeAll();
|
|
899
899
|
else {
|
|
900
|
-
const
|
|
901
|
-
(
|
|
900
|
+
const t = this.sectionLayer.graphics.find(
|
|
901
|
+
(i) => i.getAttribute("edgeId") === e.id
|
|
902
902
|
);
|
|
903
|
-
|
|
903
|
+
t && this.sectionLayer.remove(t);
|
|
904
904
|
}
|
|
905
905
|
return { status: 0, message: "ok" };
|
|
906
906
|
}
|
|
@@ -912,24 +912,26 @@ class A {
|
|
|
912
912
|
selectSumo(e) {
|
|
913
913
|
switch (e.type) {
|
|
914
914
|
case "junction":
|
|
915
|
-
return this.junctionLayer.graphics.forEach((
|
|
916
|
-
if (e.id ===
|
|
917
|
-
return
|
|
915
|
+
return this.junctionLayer.graphics.forEach((t) => {
|
|
916
|
+
if (e.id === t.getAttribute("id"))
|
|
917
|
+
return t.setAttribute("selected", !0), t.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(t, 50), { status: 0, message: "ok" };
|
|
918
918
|
}), { status: -1, message: "未找到路口" };
|
|
919
919
|
case "edge": {
|
|
920
|
-
const
|
|
921
|
-
let
|
|
922
|
-
|
|
923
|
-
let o = 0;
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
geometry
|
|
920
|
+
const t = e.id.split("#");
|
|
921
|
+
let i = String(t[0]);
|
|
922
|
+
i.startsWith("-") && (i = i.slice(1));
|
|
923
|
+
let o = "0";
|
|
924
|
+
t.length === 2 && (o = String(t[1]));
|
|
925
|
+
let s = [];
|
|
926
|
+
if (t.length === 1 ? s = this.allLaneGraphics.filter(
|
|
927
|
+
(c) => c.getAttribute("roadId") === i
|
|
928
|
+
) : t.length === 2 && (s = this.allLaneGraphics.filter(
|
|
929
|
+
(c) => c.getAttribute("roadId") === i && c.getAttribute("sectionId") === o
|
|
930
|
+
)), s.length > 0) {
|
|
931
|
+
const c = L.union(
|
|
932
|
+
s.map((l) => l.geometry)
|
|
933
|
+
), a = new y({
|
|
934
|
+
geometry: c,
|
|
933
935
|
symbol: {
|
|
934
936
|
type: "simple-fill",
|
|
935
937
|
color: [0, 255, 255, 0.5],
|
|
@@ -945,7 +947,7 @@ class A {
|
|
|
945
947
|
selected: !0
|
|
946
948
|
}
|
|
947
949
|
});
|
|
948
|
-
return this.sectionLayer.add(
|
|
950
|
+
return this.sectionLayer.add(a), { status: 0, message: "ok" };
|
|
949
951
|
} else
|
|
950
952
|
return { status: -1, message: "未找到路段" };
|
|
951
953
|
}
|
|
@@ -953,10 +955,112 @@ class A {
|
|
|
953
955
|
return { status: -1, message: "未知类型" };
|
|
954
956
|
}
|
|
955
957
|
}
|
|
958
|
+
async geometrySearch(e) {
|
|
959
|
+
const t = new S({
|
|
960
|
+
rings: [e]
|
|
961
|
+
}), i = await this.laneLayer.queryFeatures({
|
|
962
|
+
geometry: t,
|
|
963
|
+
outFields: ["*"]
|
|
964
|
+
}), o = [], s = [];
|
|
965
|
+
for (const l of i.features) {
|
|
966
|
+
const r = l.getAttribute("roadId"), n = l.getAttribute("sectionId"), h = `${r}#${n}`;
|
|
967
|
+
if (o.indexOf(h) === -1) {
|
|
968
|
+
o.push(h), this.selectSumo({
|
|
969
|
+
type: "edge",
|
|
970
|
+
id: h
|
|
971
|
+
});
|
|
972
|
+
const d = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, g = await b.get(d, {
|
|
973
|
+
params: {
|
|
974
|
+
id: `${r}+${n}`,
|
|
975
|
+
projectName: this.projectName
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
g.status === 200 && g.data.status === 0 && s.push(g.data.result);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
const c = this.junctionLayer.graphics.filter((l) => {
|
|
982
|
+
const r = l.geometry;
|
|
983
|
+
return L.contains(t, r);
|
|
984
|
+
}), a = [];
|
|
985
|
+
for (const l of c) {
|
|
986
|
+
const r = l.getAttribute("id");
|
|
987
|
+
this.selectSumo({
|
|
988
|
+
type: "junction",
|
|
989
|
+
id: r
|
|
990
|
+
});
|
|
991
|
+
const n = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, h = await b.get(n, {
|
|
992
|
+
params: {
|
|
993
|
+
id: r,
|
|
994
|
+
projectName: this.projectName
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
h.status === 200 && h.data.status === 0 && a.push(h.data.result);
|
|
998
|
+
}
|
|
999
|
+
return {
|
|
1000
|
+
status: 0,
|
|
1001
|
+
message: "ok",
|
|
1002
|
+
result: {
|
|
1003
|
+
junctions: a,
|
|
1004
|
+
edges: s
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
956
1008
|
async splitLane(e) {
|
|
957
|
-
|
|
1009
|
+
const i = e.id.split("+");
|
|
1010
|
+
if (i.length !== 2)
|
|
1011
|
+
return { status: -1, message: "车道编号格式错误" };
|
|
1012
|
+
const o = Number(i[1]), s = i[0].split("#"), c = s.length === 2 ? Number(s[1]) : 0;
|
|
1013
|
+
let a = s[0];
|
|
1014
|
+
a.startsWith("-") && (a = a.slice(1));
|
|
1015
|
+
const l = this.allLaneGraphics.filter((v) => v.getAttribute("roadId") === a && v.getAttribute("sectionIndex") === c);
|
|
1016
|
+
if (l.length === 0)
|
|
1017
|
+
return { status: -1, message: "未找到路段" };
|
|
1018
|
+
const r = l.length - o, n = l.find(
|
|
1019
|
+
(v) => Math.abs(v.getAttribute("laneId")) === r
|
|
1020
|
+
);
|
|
1021
|
+
if (!n)
|
|
1022
|
+
return { status: -1, message: "未找到车道" };
|
|
1023
|
+
const h = e.start || 0, d = e.end || 100, g = G.lineString(n.getAttribute("leftLine")), m = C(g, h, d, {
|
|
1024
|
+
units: "meters"
|
|
1025
|
+
}), u = G.lineString(n.getAttribute("rightLine")), p = C(u, h, d, {
|
|
1026
|
+
units: "meters"
|
|
1027
|
+
}), f = m.geometry.coordinates.concat(
|
|
1028
|
+
p.geometry.coordinates.reverse()
|
|
1029
|
+
);
|
|
1030
|
+
f.push(f[f.length - 1]);
|
|
1031
|
+
const w = new y({
|
|
1032
|
+
geometry: new S({
|
|
1033
|
+
rings: [f]
|
|
1034
|
+
}),
|
|
1035
|
+
attributes: {
|
|
1036
|
+
ObjectID: n.getAttribute("ObjectID"),
|
|
1037
|
+
id: n.getAttribute("id"),
|
|
1038
|
+
fromNode: n.getAttribute("fromNode"),
|
|
1039
|
+
toNode: n.getAttribute("toNode"),
|
|
1040
|
+
roadId: n.getAttribute("roadId"),
|
|
1041
|
+
roadName: n.getAttribute("roadName"),
|
|
1042
|
+
sectionId: n.getAttribute("sectionId"),
|
|
1043
|
+
sectionIndex: n.getAttribute("sectionIndex"),
|
|
1044
|
+
laneId: n.getAttribute("laneId"),
|
|
1045
|
+
type: n.getAttribute("type"),
|
|
1046
|
+
sumoId: n.getAttribute("sumoId"),
|
|
1047
|
+
leftLine: m.geometry.coordinates,
|
|
1048
|
+
rightLine: p.geometry.coordinates
|
|
1049
|
+
},
|
|
1050
|
+
symbol: {
|
|
1051
|
+
type: "simple-fill",
|
|
1052
|
+
color: [255, 0, 0, 0.8],
|
|
1053
|
+
outline: {
|
|
1054
|
+
color: "red"
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
return this.splitLaneLayer.add(w), this.view.goTo(w), { status: 0, message: "ok", result: e };
|
|
1059
|
+
}
|
|
1060
|
+
clearSplitLane() {
|
|
1061
|
+
this.splitLaneLayer.removeAll();
|
|
958
1062
|
}
|
|
959
1063
|
}
|
|
960
1064
|
export {
|
|
961
|
-
|
|
1065
|
+
$ as default
|
|
962
1066
|
};
|