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