gisviewer-vue3-arcgis 1.0.119 → 1.0.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/src/gis-map/utils/common-utils.d.ts +4 -3
- package/es/src/gis-map/utils/common-utils.mjs +21 -8
- package/es/src/gis-map/utils/map-initializer.mjs +100 -99
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +23 -3
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +290 -136
- package/es/src/gis-map/utils/open-drive-renderer/junction.d.ts +2 -1
- package/es/src/gis-map/utils/open-drive-renderer/road.d.ts +2 -0
- package/es/src/gis-map/utils/open-drive-renderer/road.mjs +16 -8
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +20 -0
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +154 -104
- package/es/src/types/index.d.ts +11 -0
- package/lib/src/gis-map/utils/common-utils.d.ts +4 -3
- package/lib/src/gis-map/utils/common-utils.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 +23 -3
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +2 -1
- package/lib/src/gis-map/utils/open-drive-renderer/junction.d.ts +2 -1
- package/lib/src/gis-map/utils/open-drive-renderer/road.d.ts +2 -0
- package/lib/src/gis-map/utils/open-drive-renderer/road.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +20 -0
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +1 -1
- package/lib/src/types/index.d.ts +11 -0
- package/package.json +1 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import L from "@arcgis/core/
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import d from "@arcgis/core/Graphic";
|
|
2
|
+
import * as O from "@arcgis/core/core/promiseUtils";
|
|
3
|
+
import { Polygon as C } from "@arcgis/core/geometry";
|
|
4
|
+
import * as L from "@arcgis/core/geometry/geometryEngineAsync";
|
|
5
|
+
import G from "@arcgis/core/layers/FeatureLayer";
|
|
6
|
+
import D from "@arcgis/core/layers/GraphicsLayer";
|
|
7
|
+
import f from "axios";
|
|
7
8
|
import j from "pako";
|
|
8
|
-
import
|
|
9
|
-
|
|
9
|
+
import S from "../common-utils.mjs";
|
|
10
|
+
import F from "./wasm-loader.mjs";
|
|
11
|
+
class N {
|
|
10
12
|
constructor(e) {
|
|
11
|
-
this.wasmLoader =
|
|
13
|
+
this.wasmLoader = F.getInstance(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.currentJunctionId = "", this.view = e, this.laneLayer = new G({
|
|
12
14
|
id: "OpenDriveLane",
|
|
13
15
|
fields: [
|
|
14
16
|
{
|
|
@@ -216,7 +218,7 @@ class I {
|
|
|
216
218
|
}
|
|
217
219
|
]
|
|
218
220
|
}
|
|
219
|
-
}), this.roadNameLayer = new
|
|
221
|
+
}), this.roadNameLayer = new G({
|
|
220
222
|
id: "OpenDriveRoadName",
|
|
221
223
|
fields: [
|
|
222
224
|
{
|
|
@@ -266,117 +268,137 @@ class I {
|
|
|
266
268
|
}
|
|
267
269
|
}
|
|
268
270
|
]
|
|
269
|
-
}), this.junctionLayer = new
|
|
271
|
+
}), this.junctionLayer = new D({ id: "OpenDriveJunction" }), this.highlightLayer = new D({ id: "OpenDriveHighlight" }), this.view.map.addMany([
|
|
270
272
|
this.laneLayer,
|
|
271
273
|
this.junctionLayer,
|
|
272
|
-
this.
|
|
273
|
-
this.
|
|
274
|
+
this.roadNameLayer,
|
|
275
|
+
this.highlightLayer
|
|
274
276
|
]);
|
|
275
277
|
}
|
|
276
278
|
static getInstance(e) {
|
|
277
|
-
return this.instance || (this.instance = new
|
|
279
|
+
return this.instance || (this.instance = new N(e)), this.instance;
|
|
278
280
|
}
|
|
279
281
|
async showOpenDriveFromFile(e) {
|
|
280
|
-
var
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
var u, c;
|
|
283
|
+
this.projectName = Date.now().toString(), this.openDriveServer = e.server;
|
|
284
|
+
const o = `http://${this.openDriveServer}/api/openDrive/uploadXodr`, i = await f.post(o, null, {
|
|
285
|
+
params: {
|
|
286
|
+
url: e.file,
|
|
287
|
+
projectName: this.projectName
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
if (i.status !== 200)
|
|
291
|
+
throw new Error(`OpenDriveRenderer: ${i.statusText}`);
|
|
284
292
|
console.time("渲染用时");
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
293
|
+
const s = i.data.result.geoSetting;
|
|
294
|
+
S.setGeoData(
|
|
295
|
+
s.geoReference,
|
|
296
|
+
s.offsetX,
|
|
297
|
+
s.offsetY
|
|
298
|
+
);
|
|
299
|
+
let t = i.data.result.json;
|
|
300
|
+
t.startsWith(window.location.protocol) || (t = `${window.location.protocol}//${e.server}${t}`);
|
|
301
|
+
const l = await (await fetch(t)).arrayBuffer(), a = j.inflate(l, { to: "string" }), r = JSON.parse(a);
|
|
302
|
+
await this.showAllLanes(
|
|
303
|
+
r,
|
|
304
|
+
((u = e.options) == null ? void 0 : u.showJunctionLane) || !1,
|
|
289
305
|
((c = e.options) == null ? void 0 : c.showRoadName) || !0
|
|
290
|
-
)
|
|
306
|
+
);
|
|
307
|
+
const n = i.data.result.junctions;
|
|
308
|
+
if (this.showJunction(n), e.options && e.options.centerMap !== !1) {
|
|
309
|
+
const m = S.transformPointProjection([0, 0]);
|
|
310
|
+
await this.view.goTo(m);
|
|
311
|
+
}
|
|
312
|
+
return this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick(), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
|
|
291
313
|
}
|
|
292
314
|
/**
|
|
293
315
|
* 从服务器载入OpenDrive文件解析结果并显示
|
|
294
316
|
* @param server
|
|
295
317
|
* @param projectName
|
|
296
318
|
*/
|
|
297
|
-
async showOpenDriveFromServer(e,
|
|
298
|
-
const
|
|
319
|
+
async showOpenDriveFromServer(e, o) {
|
|
320
|
+
const i = `http://${e}/api/openDrive/analyzeXodr`, s = await f.get(i, {
|
|
299
321
|
headers: {
|
|
300
|
-
projectName:
|
|
322
|
+
projectName: o
|
|
301
323
|
},
|
|
302
324
|
params: {
|
|
303
325
|
analyze: !1,
|
|
304
326
|
compressed: !0
|
|
305
327
|
}
|
|
306
328
|
});
|
|
307
|
-
if (
|
|
308
|
-
throw new Error(`OpenDriveRenderer: ${
|
|
309
|
-
let
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
return await this.showAllLanes(
|
|
329
|
+
if (s.status !== 200)
|
|
330
|
+
throw new Error(`OpenDriveRenderer: ${s.statusText}`);
|
|
331
|
+
let t = s.data.result.json;
|
|
332
|
+
t.startsWith(window.location.protocol) || (t = `${window.location.protocol}//${e}${t}`);
|
|
333
|
+
const l = await (await fetch(t)).arrayBuffer(), a = j.inflate(l, { to: "string" }), r = JSON.parse(a);
|
|
334
|
+
return await this.showAllLanes(r, !1, !1), { status: 0, message: "ok" };
|
|
313
335
|
}
|
|
314
|
-
async showAllLanes(e,
|
|
315
|
-
const
|
|
316
|
-
return
|
|
317
|
-
deleteFeatures:
|
|
318
|
-
}), this.roadNameLayer.visible =
|
|
319
|
-
let
|
|
336
|
+
async showAllLanes(e, o, i) {
|
|
337
|
+
const s = await this.laneLayer.queryFeatures();
|
|
338
|
+
return s.features.length > 0 && this.laneLayer.applyEdits({
|
|
339
|
+
deleteFeatures: s.features
|
|
340
|
+
}), this.roadNameLayer.visible = i, new Promise((t) => {
|
|
341
|
+
let h = 0;
|
|
320
342
|
this.allLaneGraphics = [], this.allRefLineGraphics = [];
|
|
343
|
+
const l = [];
|
|
321
344
|
for (const r of e) {
|
|
322
|
-
if (!
|
|
345
|
+
if (!o && r.junction !== "-1")
|
|
323
346
|
continue;
|
|
324
|
-
const { id:
|
|
325
|
-
let
|
|
326
|
-
|
|
327
|
-
const
|
|
347
|
+
const { id: n, refLine: u } = r;
|
|
348
|
+
let c = r.name;
|
|
349
|
+
c.includes("(") && (c = c.slice(0, c.indexOf("("))), c = c.replace(/(.)/g, "$1 ");
|
|
350
|
+
const m = new d({
|
|
328
351
|
geometry: {
|
|
329
352
|
type: "polyline",
|
|
330
|
-
paths: [
|
|
353
|
+
paths: [u]
|
|
331
354
|
},
|
|
332
355
|
attributes: {
|
|
333
|
-
ObjectID:
|
|
334
|
-
roadId:
|
|
335
|
-
roadName:
|
|
356
|
+
ObjectID: h++,
|
|
357
|
+
roadId: n,
|
|
358
|
+
roadName: c
|
|
336
359
|
}
|
|
337
360
|
});
|
|
338
|
-
this.allRefLineGraphics.push(
|
|
339
|
-
for (const
|
|
340
|
-
const
|
|
341
|
-
for (const
|
|
342
|
-
const
|
|
343
|
-
if (
|
|
361
|
+
this.allRefLineGraphics.push(m);
|
|
362
|
+
for (const w of r.laneSections) {
|
|
363
|
+
const b = Number(w.id);
|
|
364
|
+
for (const p of w.lanePaths) {
|
|
365
|
+
const y = Number(p.id);
|
|
366
|
+
if (y === 0)
|
|
344
367
|
continue;
|
|
345
|
-
const
|
|
346
|
-
|
|
368
|
+
const k = p.type, g = p.innerPath.concat(
|
|
369
|
+
p.outerPath.reverse()
|
|
347
370
|
);
|
|
348
|
-
if (
|
|
349
|
-
console.warn(`lane ${
|
|
371
|
+
if (g.length <= 3) {
|
|
372
|
+
console.warn(`lane ${y} has less than 3 points`);
|
|
350
373
|
continue;
|
|
351
374
|
}
|
|
352
|
-
|
|
353
|
-
const
|
|
354
|
-
rings: [
|
|
375
|
+
g.push(p.innerPath[0]);
|
|
376
|
+
const v = new C({
|
|
377
|
+
rings: [g]
|
|
355
378
|
});
|
|
356
|
-
if (
|
|
357
|
-
const
|
|
358
|
-
geometry:
|
|
379
|
+
if (v) {
|
|
380
|
+
const I = new d({
|
|
381
|
+
geometry: v,
|
|
359
382
|
attributes: {
|
|
360
|
-
ObjectID:
|
|
361
|
-
id: `${
|
|
362
|
-
roadId:
|
|
383
|
+
ObjectID: h++,
|
|
384
|
+
id: `${n}+${b}+${y}`,
|
|
385
|
+
roadId: n,
|
|
363
386
|
roadName: r.name,
|
|
364
|
-
sectionId:
|
|
365
|
-
laneId:
|
|
366
|
-
type:
|
|
387
|
+
sectionId: b,
|
|
388
|
+
laneId: y,
|
|
389
|
+
type: k,
|
|
367
390
|
sumoId: ""
|
|
368
391
|
}
|
|
369
392
|
});
|
|
370
|
-
this.allLaneGraphics.push(
|
|
393
|
+
this.allLaneGraphics.push(I), l.push(I);
|
|
371
394
|
}
|
|
372
395
|
}
|
|
373
396
|
}
|
|
374
397
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
const r = this.allLaneGraphics.splice(0, 100);
|
|
398
|
+
const a = setInterval(() => {
|
|
399
|
+
if (l.length > 0 || this.allRefLineGraphics.length > 0) {
|
|
400
|
+
if (l.length > 0) {
|
|
401
|
+
const r = l.splice(0, 100);
|
|
380
402
|
this.laneLayer.applyEdits({
|
|
381
403
|
addFeatures: r
|
|
382
404
|
});
|
|
@@ -388,38 +410,170 @@ class I {
|
|
|
388
410
|
});
|
|
389
411
|
}
|
|
390
412
|
} else
|
|
391
|
-
clearInterval(
|
|
413
|
+
clearInterval(a), t();
|
|
392
414
|
}, 10);
|
|
393
415
|
});
|
|
394
416
|
}
|
|
395
|
-
|
|
417
|
+
showJunction(e) {
|
|
418
|
+
const o = [];
|
|
396
419
|
for (const i of e) {
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
id: i.id,
|
|
403
|
-
name: i.name
|
|
420
|
+
const s = new d({
|
|
421
|
+
geometry: {
|
|
422
|
+
type: "point",
|
|
423
|
+
x: i.coordinates[0],
|
|
424
|
+
y: i.coordinates[1]
|
|
404
425
|
},
|
|
426
|
+
attributes: { ...i, selected: !1 },
|
|
405
427
|
symbol: {
|
|
406
|
-
type: "
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
color: "white",
|
|
411
|
-
width: 1
|
|
412
|
-
}
|
|
428
|
+
type: "picture-marker",
|
|
429
|
+
url: i.crossId ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/normal-cross.png",
|
|
430
|
+
width: 30,
|
|
431
|
+
height: 30
|
|
413
432
|
}
|
|
414
433
|
});
|
|
415
|
-
|
|
434
|
+
o.push(s);
|
|
416
435
|
}
|
|
436
|
+
this.junctionLayer.addMany(o);
|
|
417
437
|
}
|
|
438
|
+
/**
|
|
439
|
+
* 监听鼠标移动事件,高亮显示鼠标所在路段和路口
|
|
440
|
+
*/
|
|
441
|
+
monitorMouseMove() {
|
|
442
|
+
const e = O.debounce(async (o) => {
|
|
443
|
+
var h;
|
|
444
|
+
const s = (h = (await this.view.hitTest(o, {
|
|
445
|
+
include: [this.laneLayer, this.junctionLayer]
|
|
446
|
+
})).results) == null ? void 0 : h.filter(
|
|
447
|
+
(l) => l.type === "graphic"
|
|
448
|
+
);
|
|
449
|
+
if (s.length === 0) {
|
|
450
|
+
this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll());
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
const t = s[0];
|
|
454
|
+
if (this.hitGraphic = t.graphic, t.layer.id === "OpenDriveLane") {
|
|
455
|
+
const l = `${this.hitGraphic.attributes.roadId}+${this.hitGraphic.attributes.sectionId}`;
|
|
456
|
+
if (l === this.currentSectionCode)
|
|
457
|
+
return;
|
|
458
|
+
this.currentSectionCode = l;
|
|
459
|
+
const a = this.allLaneGraphics.filter(
|
|
460
|
+
(n) => `${n.attributes.roadId}+${n.attributes.sectionId}` === l
|
|
461
|
+
), r = await L.union(
|
|
462
|
+
a.map((n) => n.geometry)
|
|
463
|
+
);
|
|
464
|
+
this.highlightGraphic = new d({
|
|
465
|
+
geometry: r,
|
|
466
|
+
symbol: {
|
|
467
|
+
type: "simple-fill",
|
|
468
|
+
color: [255, 0, 0, 0.5],
|
|
469
|
+
style: "solid",
|
|
470
|
+
outline: {
|
|
471
|
+
color: "red",
|
|
472
|
+
width: 2
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
attributes: {
|
|
476
|
+
type: "OpenDriveSection",
|
|
477
|
+
id: l,
|
|
478
|
+
detail: ""
|
|
479
|
+
}
|
|
480
|
+
}), this.highlightLayer.removeAll(), this.highlightLayer.add(this.highlightGraphic);
|
|
481
|
+
} else if (t.layer.id === "OpenDriveJunction") {
|
|
482
|
+
const l = this.hitGraphic.attributes.id;
|
|
483
|
+
if (l === this.currentJunctionId)
|
|
484
|
+
return;
|
|
485
|
+
this.currentJunctionId = l, this.highlightGraphic = new d({
|
|
486
|
+
geometry: this.hitGraphic.geometry,
|
|
487
|
+
symbol: {
|
|
488
|
+
type: "simple-marker",
|
|
489
|
+
style: "circle",
|
|
490
|
+
size: 40,
|
|
491
|
+
color: [0, 0, 0, 0],
|
|
492
|
+
outline: {
|
|
493
|
+
color: [0, 0, 0, 0]
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
attributes: {
|
|
497
|
+
type: "OpenDriveJunction",
|
|
498
|
+
id: l
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
const a = new d({
|
|
502
|
+
geometry: this.hitGraphic.geometry,
|
|
503
|
+
symbol: {
|
|
504
|
+
type: "text",
|
|
505
|
+
color: "black",
|
|
506
|
+
backgroundColor: "gray",
|
|
507
|
+
text: `${this.hitGraphic.attributes.name}
|
|
508
|
+
${this.hitGraphic.attributes.id}`,
|
|
509
|
+
font: {
|
|
510
|
+
size: 10
|
|
511
|
+
},
|
|
512
|
+
yoffset: 40
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
this.highlightLayer.removeAll(), this.highlightLayer.addMany([this.highlightGraphic, a]);
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
this.mouseMoveHandler = this.view.on("pointer-move", async (o) => {
|
|
519
|
+
e(o).catch(() => {
|
|
520
|
+
});
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* 监听鼠标点击事件,获取高亮要素的拓扑信息
|
|
525
|
+
*/
|
|
526
|
+
monitorMouseClick() {
|
|
527
|
+
this.mouseClickHandler = this.view.on("immediate-click", async () => {
|
|
528
|
+
var e, o;
|
|
529
|
+
if (this.hitGraphic && !this.currentSectionCode) {
|
|
530
|
+
if (this.currentJunctionId)
|
|
531
|
+
if (this.hitGraphic.getAttribute("selected") === !1) {
|
|
532
|
+
const i = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, s = await f.get(i, {
|
|
533
|
+
params: {
|
|
534
|
+
id: this.currentJunctionId,
|
|
535
|
+
projectName: this.projectName
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
s.status === 200 && s.data.status === 0 && ((e = this.highlightGraphic) == null || e.setAttribute("detail", s.data.result), this.hitGraphic.setAttribute("selected", !0), this.hitGraphic.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(this.hitGraphic, 50));
|
|
539
|
+
} else
|
|
540
|
+
(o = this.highlightGraphic) == null || o.setAttribute("detail", void 0), this.hitGraphic.setAttribute("selected", !1), this.hitGraphic.symbol.url = "/GisViewerAssets/Images/point_green.png", this.decreasePictureMarkerSize(this.hitGraphic, 30);
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
increasePictureMarkerSize(e, o) {
|
|
545
|
+
const i = setInterval(() => {
|
|
546
|
+
const s = e.symbol, t = s.width;
|
|
547
|
+
t < o ? e.symbol = {
|
|
548
|
+
type: "picture-marker",
|
|
549
|
+
url: s.url,
|
|
550
|
+
width: t + 1,
|
|
551
|
+
height: t + 1
|
|
552
|
+
} : clearInterval(i);
|
|
553
|
+
}, 20);
|
|
554
|
+
}
|
|
555
|
+
decreasePictureMarkerSize(e, o) {
|
|
556
|
+
const i = setInterval(() => {
|
|
557
|
+
const s = e.symbol, t = s.width;
|
|
558
|
+
t > o ? e.symbol = {
|
|
559
|
+
type: "picture-marker",
|
|
560
|
+
url: s.url,
|
|
561
|
+
width: t - 1,
|
|
562
|
+
height: t - 1
|
|
563
|
+
} : clearInterval(i);
|
|
564
|
+
}, 20);
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* 清除OpenDrive内容
|
|
568
|
+
*/
|
|
418
569
|
async clearOpenDrive() {
|
|
419
|
-
|
|
420
|
-
e
|
|
570
|
+
var o, i;
|
|
571
|
+
let e = await this.laneLayer.queryFeatures();
|
|
572
|
+
e.features.length > 0 && await this.laneLayer.applyEdits({
|
|
573
|
+
deleteFeatures: e.features
|
|
574
|
+
}), e = await this.roadNameLayer.queryFeatures(), e.features.length > 0 && await this.roadNameLayer.applyEdits({
|
|
421
575
|
deleteFeatures: e.features
|
|
422
|
-
}), this.wasmLoader.clear();
|
|
576
|
+
}), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.wasmLoader.clear(), (o = this.mouseMoveHandler) == null || o.remove(), (i = this.mouseClickHandler) == null || i.remove();
|
|
423
577
|
}
|
|
424
578
|
/**
|
|
425
579
|
* 用sumo的id定位车道、基本段、路段
|
|
@@ -427,16 +581,16 @@ class I {
|
|
|
427
581
|
* @returns
|
|
428
582
|
*/
|
|
429
583
|
async findSumo(e) {
|
|
430
|
-
const { id:
|
|
431
|
-
if (
|
|
584
|
+
const { id: o } = e, i = e.flash === void 0 ? !0 : e.flash, s = o.split("+");
|
|
585
|
+
if (s.length > 2)
|
|
432
586
|
return { status: -1, message: "id格式错误" };
|
|
433
|
-
const
|
|
434
|
-
if (
|
|
587
|
+
const t = s.length === 2 ? Number(s[1]) : void 0, h = s[0].split("#");
|
|
588
|
+
if (h.length > 2)
|
|
435
589
|
return { status: -1, message: "id格式错误" };
|
|
436
|
-
let
|
|
437
|
-
|
|
438
|
-
const
|
|
439
|
-
return await this.findLane({ roadsectId:
|
|
590
|
+
let l = h[0];
|
|
591
|
+
l.startsWith("-") && (l = l.slice(1));
|
|
592
|
+
const a = h.length === 2 ? Number(h[1]) : void 0;
|
|
593
|
+
return await this.findLane({ roadsectId: l, segmentId: a, laneId: t, flash: i });
|
|
440
594
|
}
|
|
441
595
|
/**
|
|
442
596
|
* 用sumo的id定位车道、基本段、路段
|
|
@@ -444,42 +598,42 @@ class I {
|
|
|
444
598
|
* @returns
|
|
445
599
|
*/
|
|
446
600
|
async findLane(e) {
|
|
447
|
-
let { segmentId:
|
|
448
|
-
const { roadsectId:
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
601
|
+
let { segmentId: o, laneId: i } = e;
|
|
602
|
+
const { roadsectId: s } = e;
|
|
603
|
+
let t = this.allLaneGraphics.filter(
|
|
604
|
+
(a) => a.attributes.roadId === s
|
|
605
|
+
);
|
|
606
|
+
if (t.length === 0)
|
|
452
607
|
return { status: -1, message: "未找到。请检查路段编号" };
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}), l.sort((t, h) => t - h), i > l.length - 1)
|
|
608
|
+
if (o !== void 0) {
|
|
609
|
+
const a = [];
|
|
610
|
+
if (t.forEach((r) => {
|
|
611
|
+
const n = Number(r.attributes.sectionId);
|
|
612
|
+
a.indexOf(n) === -1 && a.push(n);
|
|
613
|
+
}), a.sort((r, n) => r - n), o > a.length - 1)
|
|
460
614
|
return { status: -1, message: "未找到。请检查基本段编号" };
|
|
461
|
-
|
|
462
|
-
(
|
|
615
|
+
o = a[o], t = t.filter(
|
|
616
|
+
(r) => Number(r.attributes.sectionId) === o
|
|
463
617
|
);
|
|
464
618
|
}
|
|
465
|
-
if (
|
|
466
|
-
const
|
|
467
|
-
if (
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
}),
|
|
619
|
+
if (i !== void 0) {
|
|
620
|
+
const a = [];
|
|
621
|
+
if (t.forEach((r) => {
|
|
622
|
+
const n = Number(r.attributes.laneId);
|
|
623
|
+
a.indexOf(n) === -1 && a.push(n);
|
|
624
|
+
}), a.sort((r, n) => r - n), i > a.length - 1)
|
|
471
625
|
return { status: -1, message: "未找到。请检查车道编号" };
|
|
472
|
-
|
|
473
|
-
(
|
|
626
|
+
i = a[i], t = t.filter(
|
|
627
|
+
(r) => Number(r.attributes.laneId) === i
|
|
474
628
|
);
|
|
475
629
|
}
|
|
476
|
-
const
|
|
477
|
-
(
|
|
478
|
-
),
|
|
630
|
+
const h = t.map(
|
|
631
|
+
(a) => a.geometry
|
|
632
|
+
), l = await L.union(h);
|
|
479
633
|
if (e.flash) {
|
|
480
634
|
this.highlightLayer.removeAll();
|
|
481
|
-
const
|
|
482
|
-
geometry:
|
|
635
|
+
const a = new d({
|
|
636
|
+
geometry: l,
|
|
483
637
|
symbol: {
|
|
484
638
|
type: "simple-fill",
|
|
485
639
|
color: [255, 0, 0, 0.5],
|
|
@@ -490,18 +644,18 @@ class I {
|
|
|
490
644
|
}
|
|
491
645
|
}
|
|
492
646
|
});
|
|
493
|
-
this.highlightLayer.add(
|
|
494
|
-
let
|
|
495
|
-
const
|
|
496
|
-
|
|
647
|
+
this.highlightLayer.add(a);
|
|
648
|
+
let r = 0, n = !0;
|
|
649
|
+
const u = setInterval(() => {
|
|
650
|
+
n ? (this.highlightLayer.opacity -= 0.02, this.highlightLayer.opacity <= 0.1 && (n = !1, r++)) : (this.highlightLayer.opacity += 0.02, this.highlightLayer.opacity >= 1 && (n = !0)), r > 5 && (this.highlightLayer.removeAll(), this.highlightLayer.opacity = 1, clearInterval(u));
|
|
497
651
|
}, 20);
|
|
498
652
|
}
|
|
499
|
-
return
|
|
653
|
+
return await this.view.goTo(l, { duration: 1e3 }), { status: 0, message: "ok" };
|
|
500
654
|
}
|
|
501
655
|
async splitLane(e) {
|
|
502
656
|
return { status: 0, message: "ok", result: e };
|
|
503
657
|
}
|
|
504
658
|
}
|
|
505
659
|
export {
|
|
506
|
-
|
|
660
|
+
N as default
|
|
507
661
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILaneInfo } from '../../../types';
|
|
1
|
+
import { IJunctionTableData, ILaneInfo } from '../../../types';
|
|
2
2
|
interface ILink {
|
|
3
3
|
incoming: ILaneInfo;
|
|
4
4
|
connecting: ILaneInfo;
|
|
@@ -9,6 +9,7 @@ export default class Junction {
|
|
|
9
9
|
name: string;
|
|
10
10
|
/** 路口内的行车通道,包含进口道->转接道->出口道三个车道 */
|
|
11
11
|
laneLinks: Array<ILink>;
|
|
12
|
+
tableData: IJunctionTableData | undefined;
|
|
12
13
|
/** 进口车道按roadId归类, */
|
|
13
14
|
private incomingLanes;
|
|
14
15
|
private outline;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
class
|
|
1
|
+
import h from "../common-utils.mjs";
|
|
2
|
+
import a from "./lane-section.mjs";
|
|
3
|
+
class S {
|
|
4
4
|
constructor(e) {
|
|
5
5
|
this.id = e.id, this.name = e.name, this.length = e.length, this.junction = e.junction, this.sToLaneSection = /* @__PURE__ */ new Map();
|
|
6
|
-
const t =
|
|
7
|
-
this.refLine =
|
|
6
|
+
const t = h.getStdVecEntries(e.ref_line, !0);
|
|
7
|
+
this.refLine = h.transformLineProjection(t);
|
|
8
8
|
for (const i of [!0, !1]) {
|
|
9
9
|
const o = i ? e.predecessor : e.successor, r = {
|
|
10
10
|
elementId: o.id,
|
|
@@ -13,11 +13,11 @@ class g {
|
|
|
13
13
|
};
|
|
14
14
|
i ? this.predecessor = r : this.successor = r;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
h.getStdVecEntries(
|
|
17
17
|
e.odr_lanesections,
|
|
18
18
|
!0
|
|
19
19
|
).forEach((i) => {
|
|
20
|
-
const o = new
|
|
20
|
+
const o = new a(i, this);
|
|
21
21
|
this.sToLaneSection.set(o.s0, o);
|
|
22
22
|
}), this.borders = this.getBorderLine();
|
|
23
23
|
const n = [];
|
|
@@ -47,6 +47,14 @@ class g {
|
|
|
47
47
|
const e = [...this.sToLaneSection.keys()];
|
|
48
48
|
return e.sort((t, s) => t - s), this.sToLaneSection.get(e[e.length - 1]);
|
|
49
49
|
}
|
|
50
|
+
getLaneSectionIndex(e) {
|
|
51
|
+
return [...this.sToLaneSection.keys()].indexOf(e);
|
|
52
|
+
}
|
|
53
|
+
getLaneSectionLength(e) {
|
|
54
|
+
const t = [...this.sToLaneSection.keys()], s = t.indexOf(e);
|
|
55
|
+
let n = 0;
|
|
56
|
+
return s === 0 ? t.length === 1 ? n = this.length : n = t[1] : s === t.length - 1 ? n = this.length - t[t.length - 1] : n = t[s + 1] - e, n;
|
|
57
|
+
}
|
|
50
58
|
/**
|
|
51
59
|
* 是否是最后一个路段的里程值
|
|
52
60
|
* @param s
|
|
@@ -109,5 +117,5 @@ class g {
|
|
|
109
117
|
}
|
|
110
118
|
}
|
|
111
119
|
export {
|
|
112
|
-
|
|
120
|
+
S as default
|
|
113
121
|
};
|
|
@@ -7,6 +7,7 @@ export default class WasmLoader {
|
|
|
7
7
|
static getInstance(): WasmLoader;
|
|
8
8
|
roadList: Map<string, Road>;
|
|
9
9
|
junctionList: Map<string, Junction>;
|
|
10
|
+
private junctionTableData;
|
|
10
11
|
private isWasmLoaded;
|
|
11
12
|
private ModuleOpenDrive;
|
|
12
13
|
private ModuleOpenDriveMap;
|
|
@@ -18,6 +19,11 @@ export default class WasmLoader {
|
|
|
18
19
|
*/
|
|
19
20
|
load(file: string): Promise<IResult>;
|
|
20
21
|
clear(): void;
|
|
22
|
+
/**
|
|
23
|
+
* 读取xodr中wasm接口不提供的数据
|
|
24
|
+
* @param fileText
|
|
25
|
+
*/
|
|
26
|
+
private readXodrString;
|
|
21
27
|
/**
|
|
22
28
|
* 解析路网
|
|
23
29
|
*/
|
|
@@ -85,4 +91,18 @@ export default class WasmLoader {
|
|
|
85
91
|
getRoadStopLine(junctionId: string): IResult;
|
|
86
92
|
getLaneStopLine(laneInfo: ILaneInfo): IResult;
|
|
87
93
|
getLaneCenterLine(laneInfo: ILaneInfo): IResult;
|
|
94
|
+
getSumoEdgeInfo(sectionCode: string): {
|
|
95
|
+
obj_id: string;
|
|
96
|
+
obj_type: number;
|
|
97
|
+
obj_desc: string;
|
|
98
|
+
obj_info: {
|
|
99
|
+
obj_id: string;
|
|
100
|
+
length: number;
|
|
101
|
+
from: string;
|
|
102
|
+
to: string;
|
|
103
|
+
numLanes: number;
|
|
104
|
+
type: string;
|
|
105
|
+
laneList: any[];
|
|
106
|
+
};
|
|
107
|
+
} | undefined;
|
|
88
108
|
}
|