gisviewer-vue3-arcgis 1.0.143 → 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 -17
- package/es/src/gis-map/gis-map.vue.mjs +109 -106
- package/es/src/gis-map/index.d.ts +5 -17
- package/es/src/gis-map/stores/appData.d.ts +1 -0
- package/es/src/gis-map/stores/appData.mjs +2 -1
- 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 +258 -138
- 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 +16 -11
- package/es/src/types/index.d.ts +2 -2
- package/es/style.css +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +5 -17
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +5 -17
- package/lib/src/gis-map/stores/appData.d.ts +1 -0
- package/lib/src/gis-map/stores/appData.js +1 -1
- 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
- package/es/_virtual/_plugin-vue_export-helper.mjs +0 -9
- package/es/src/gis-map/utils/components/sketch-tool.vue.d.ts +0 -18
- package/es/src/gis-map/utils/components/sketch-tool.vue.mjs +0 -7
- package/es/src/gis-map/utils/components/sketch-tool.vue2.mjs +0 -48
- package/es/src/gis-map/utils/components/sketch-tool.vue3.mjs +0 -4
- package/lib/_virtual/_plugin-vue_export-helper.js +0 -1
- package/lib/src/gis-map/utils/components/sketch-tool.vue.d.ts +0 -18
- package/lib/src/gis-map/utils/components/sketch-tool.vue.js +0 -1
- package/lib/src/gis-map/utils/components/sketch-tool.vue2.js +0 -1
- package/lib/src/gis-map/utils/components/sketch-tool.vue3.js +0 -1
|
@@ -1,19 +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
|
-
|
|
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 $ {
|
|
12
16
|
constructor(e) {
|
|
13
17
|
this.junctionNames = /* @__PURE__ */ new Map(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.currentJunctionId = "", this.view = e, this.view.popup.visibleElements = {
|
|
14
18
|
collapseButton: !1,
|
|
15
19
|
actionBar: !1
|
|
16
|
-
}, this.laneLayer = new
|
|
20
|
+
}, this.laneLayer = new k({
|
|
17
21
|
id: "OpenDriveLane",
|
|
18
22
|
fields: [
|
|
19
23
|
{
|
|
@@ -231,7 +235,7 @@ class S {
|
|
|
231
235
|
}
|
|
232
236
|
]
|
|
233
237
|
}
|
|
234
|
-
}), this.roadNameLayer = new
|
|
238
|
+
}), this.roadNameLayer = new k({
|
|
235
239
|
id: "OpenDriveRoadName",
|
|
236
240
|
fields: [
|
|
237
241
|
{
|
|
@@ -281,23 +285,24 @@ class S {
|
|
|
281
285
|
}
|
|
282
286
|
}
|
|
283
287
|
]
|
|
284
|
-
}), 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([
|
|
285
289
|
this.laneLayer,
|
|
286
290
|
this.junctionLayer,
|
|
287
291
|
this.sectionLayer,
|
|
288
292
|
this.roadNameLayer,
|
|
289
293
|
this.highlightLayer,
|
|
290
294
|
this.flashLayer,
|
|
291
|
-
this.drawLayer
|
|
295
|
+
this.drawLayer,
|
|
296
|
+
this.splitLaneLayer
|
|
292
297
|
]);
|
|
293
298
|
}
|
|
294
299
|
static getInstance(e) {
|
|
295
|
-
return this.instance || (this.instance = new
|
|
300
|
+
return this.instance || (this.instance = new $(e)), this.instance;
|
|
296
301
|
}
|
|
297
302
|
async makeMd5FromFile(e) {
|
|
298
303
|
try {
|
|
299
304
|
const i = await (await fetch(e)).text();
|
|
300
|
-
return { status: 0, message: "ok", result:
|
|
305
|
+
return { status: 0, message: "ok", result: P(i) };
|
|
301
306
|
} catch (t) {
|
|
302
307
|
return { status: -1, message: t.message };
|
|
303
308
|
}
|
|
@@ -308,7 +313,7 @@ class S {
|
|
|
308
313
|
* @returns
|
|
309
314
|
*/
|
|
310
315
|
async showOpenDriveFromFile(e) {
|
|
311
|
-
var
|
|
316
|
+
var g, m;
|
|
312
317
|
this.openDriveClickCallback = e.selectedCallback, console.time("md5用时");
|
|
313
318
|
const t = await this.makeMd5FromFile(e.file);
|
|
314
319
|
if (t.status !== 0)
|
|
@@ -317,7 +322,7 @@ class S {
|
|
|
317
322
|
const i = `http://${this.openDriveServer}/api/openDrive/uploadXodr`;
|
|
318
323
|
let o;
|
|
319
324
|
try {
|
|
320
|
-
o = await
|
|
325
|
+
o = await b.post(
|
|
321
326
|
i,
|
|
322
327
|
{},
|
|
323
328
|
{
|
|
@@ -327,32 +332,40 @@ class S {
|
|
|
327
332
|
}
|
|
328
333
|
}
|
|
329
334
|
);
|
|
330
|
-
} catch (
|
|
331
|
-
return { status: -1, message:
|
|
335
|
+
} catch (u) {
|
|
336
|
+
return { status: -1, message: u.message };
|
|
332
337
|
}
|
|
333
338
|
if (o.status !== 200)
|
|
334
339
|
return { status: -1, message: o.statusText };
|
|
335
340
|
console.time("渲染用时");
|
|
336
341
|
const s = o.data.result.geoSetting;
|
|
337
|
-
|
|
342
|
+
F.setGeoData(
|
|
338
343
|
s.geoReference,
|
|
339
344
|
s.offsetX,
|
|
340
345
|
s.offsetY
|
|
341
346
|
);
|
|
342
|
-
let
|
|
343
|
-
|
|
344
|
-
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);
|
|
345
350
|
await this.showAllLanes(
|
|
346
|
-
|
|
347
|
-
((
|
|
348
|
-
((
|
|
351
|
+
n,
|
|
352
|
+
((g = e.options) == null ? void 0 : g.showJunctionLane) || !1,
|
|
353
|
+
((m = e.options) == null ? void 0 : m.showRoadName) || !0
|
|
349
354
|
);
|
|
350
|
-
const
|
|
351
|
-
if (this.showJunction(
|
|
352
|
-
const
|
|
353
|
-
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);
|
|
354
359
|
}
|
|
355
|
-
|
|
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" };
|
|
356
369
|
}
|
|
357
370
|
/**
|
|
358
371
|
* 从服务器载入OpenDrive文件解析结果并显示
|
|
@@ -360,7 +373,7 @@ class S {
|
|
|
360
373
|
* @param projectName
|
|
361
374
|
*/
|
|
362
375
|
async showOpenDriveFromServer(e, t) {
|
|
363
|
-
const i = `http://${e}/api/openDrive/analyzeXodr`, o = await
|
|
376
|
+
const i = `http://${e}/api/openDrive/analyzeXodr`, o = await b.get(i, {
|
|
364
377
|
headers: {
|
|
365
378
|
projectName: t
|
|
366
379
|
},
|
|
@@ -373,7 +386,7 @@ class S {
|
|
|
373
386
|
throw new Error(`OpenDriveRenderer: ${o.statusText}`);
|
|
374
387
|
let s = o.data.result.json;
|
|
375
388
|
s.startsWith(window.location.protocol) || (s = `${window.location.protocol}//${e}${s}`);
|
|
376
|
-
const a = await (await fetch(s)).arrayBuffer(),
|
|
389
|
+
const a = await (await fetch(s)).arrayBuffer(), l = O.inflate(a, { to: "string" }), r = JSON.parse(l);
|
|
377
390
|
return await this.showAllLanes(r, !1, !1), { status: 0, message: "ok" };
|
|
378
391
|
}
|
|
379
392
|
/**
|
|
@@ -388,67 +401,70 @@ class S {
|
|
|
388
401
|
return o.features.length > 0 && this.laneLayer.applyEdits({
|
|
389
402
|
deleteFeatures: o.features
|
|
390
403
|
}), this.roadNameLayer.visible = i, new Promise((s) => {
|
|
391
|
-
let
|
|
404
|
+
let c = 0;
|
|
392
405
|
this.allLaneGraphics = [], this.allRefLineGraphics = [];
|
|
393
406
|
const a = [];
|
|
394
407
|
for (const r of e) {
|
|
395
408
|
if (!t && r.junction !== "-1")
|
|
396
409
|
continue;
|
|
397
|
-
const { id:
|
|
398
|
-
let
|
|
399
|
-
|
|
400
|
-
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({
|
|
401
414
|
geometry: {
|
|
402
415
|
type: "polyline",
|
|
403
|
-
paths: [
|
|
416
|
+
paths: [h]
|
|
404
417
|
},
|
|
405
418
|
attributes: {
|
|
406
|
-
ObjectID:
|
|
407
|
-
roadId:
|
|
408
|
-
roadName:
|
|
419
|
+
ObjectID: c++,
|
|
420
|
+
roadId: n,
|
|
421
|
+
roadName: d
|
|
409
422
|
}
|
|
410
423
|
});
|
|
411
|
-
this.allRefLineGraphics.push(
|
|
412
|
-
for (let
|
|
413
|
-
const
|
|
414
|
-
for (const
|
|
415
|
-
const
|
|
416
|
-
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)
|
|
417
430
|
continue;
|
|
418
|
-
const
|
|
419
|
-
|
|
431
|
+
const v = f.type, M = [...f.outerPath], N = f.innerPath.concat(
|
|
432
|
+
M.reverse()
|
|
420
433
|
);
|
|
421
|
-
if (
|
|
422
|
-
console.warn(`lane ${
|
|
434
|
+
if (N.length <= 3) {
|
|
435
|
+
console.warn(`lane ${w} has less than 3 points`);
|
|
423
436
|
continue;
|
|
424
437
|
}
|
|
425
|
-
|
|
426
|
-
const
|
|
427
|
-
rings: [
|
|
438
|
+
N.push(f.innerPath[0]);
|
|
439
|
+
const A = new S({
|
|
440
|
+
rings: [N]
|
|
428
441
|
});
|
|
429
|
-
if (
|
|
430
|
-
const
|
|
431
|
-
geometry:
|
|
442
|
+
if (A) {
|
|
443
|
+
const j = new y({
|
|
444
|
+
geometry: A,
|
|
432
445
|
attributes: {
|
|
433
|
-
ObjectID:
|
|
434
|
-
id: `${
|
|
446
|
+
ObjectID: c++,
|
|
447
|
+
id: `${n}+${p}+${w}`,
|
|
435
448
|
fromNode: r.fromNode,
|
|
436
449
|
toNode: r.toNode,
|
|
437
|
-
roadId:
|
|
450
|
+
roadId: String(n),
|
|
438
451
|
roadName: r.name,
|
|
439
|
-
sectionId:
|
|
440
|
-
sectionIndex:
|
|
441
|
-
laneId:
|
|
442
|
-
type:
|
|
443
|
-
sumoId: ""
|
|
452
|
+
sectionId: String(p),
|
|
453
|
+
sectionIndex: m,
|
|
454
|
+
laneId: w,
|
|
455
|
+
type: v,
|
|
456
|
+
sumoId: "",
|
|
457
|
+
// 记录左右边线的起始点,用于按长度高亮车道的一部分
|
|
458
|
+
leftLine: f.innerPath,
|
|
459
|
+
rightLine: f.outerPath
|
|
444
460
|
}
|
|
445
461
|
});
|
|
446
|
-
this.allLaneGraphics.push(
|
|
462
|
+
this.allLaneGraphics.push(j), a.push(j);
|
|
447
463
|
}
|
|
448
464
|
}
|
|
449
465
|
}
|
|
450
466
|
}
|
|
451
|
-
const
|
|
467
|
+
const l = setInterval(() => {
|
|
452
468
|
if (a.length > 0 || this.allRefLineGraphics.length > 0) {
|
|
453
469
|
if (a.length > 0) {
|
|
454
470
|
const r = a.splice(0, 100);
|
|
@@ -463,7 +479,7 @@ class S {
|
|
|
463
479
|
});
|
|
464
480
|
}
|
|
465
481
|
} else
|
|
466
|
-
clearInterval(
|
|
482
|
+
clearInterval(l), s();
|
|
467
483
|
}, 10);
|
|
468
484
|
});
|
|
469
485
|
}
|
|
@@ -478,7 +494,7 @@ class S {
|
|
|
478
494
|
if (!i)
|
|
479
495
|
continue;
|
|
480
496
|
this.junctionNames.set(i.id, i.name), i.nodeType = i.type;
|
|
481
|
-
const o = new
|
|
497
|
+
const o = new y({
|
|
482
498
|
geometry: {
|
|
483
499
|
type: "point",
|
|
484
500
|
x: i.coordinates[0],
|
|
@@ -522,11 +538,11 @@ class S {
|
|
|
522
538
|
* 监听鼠标移动事件,高亮显示鼠标所在路段和路口
|
|
523
539
|
*/
|
|
524
540
|
monitorMouseMove() {
|
|
525
|
-
const e =
|
|
526
|
-
var
|
|
527
|
-
const o = (
|
|
541
|
+
const e = D.debounce(async (t) => {
|
|
542
|
+
var c;
|
|
543
|
+
const o = (c = (await this.view.hitTest(t, {
|
|
528
544
|
include: [this.laneLayer, this.junctionLayer]
|
|
529
|
-
})).results) == null ? void 0 :
|
|
545
|
+
})).results) == null ? void 0 : c.filter(
|
|
530
546
|
(a) => a.type === "graphic"
|
|
531
547
|
);
|
|
532
548
|
if (o.length === 0) {
|
|
@@ -539,17 +555,17 @@ class S {
|
|
|
539
555
|
"roadId"
|
|
540
556
|
)}+${this.hitGraphic.getAttribute("sectionId")}`;
|
|
541
557
|
if (a === this.currentSectionCode || this.sectionLayer.graphics.findIndex(
|
|
542
|
-
(
|
|
558
|
+
(p) => p.getAttribute("id") === a
|
|
543
559
|
) >= 0)
|
|
544
560
|
return;
|
|
545
561
|
this.currentSectionCode = a;
|
|
546
562
|
const r = this.allLaneGraphics.filter(
|
|
547
|
-
(
|
|
548
|
-
),
|
|
549
|
-
r.map((
|
|
550
|
-
),
|
|
551
|
-
this.highlightGraphic = new
|
|
552
|
-
geometry:
|
|
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,
|
|
553
569
|
symbol: {
|
|
554
570
|
type: "simple-fill",
|
|
555
571
|
color: [0, 255, 255, 0.5],
|
|
@@ -563,8 +579,8 @@ class S {
|
|
|
563
579
|
type: "OpenDriveSection",
|
|
564
580
|
id: a,
|
|
565
581
|
selected: !1,
|
|
566
|
-
fromNodeName:
|
|
567
|
-
toNodeName:
|
|
582
|
+
fromNodeName: g,
|
|
583
|
+
toNodeName: m,
|
|
568
584
|
laneCount: r.length
|
|
569
585
|
},
|
|
570
586
|
popupTemplate: {
|
|
@@ -590,10 +606,10 @@ class S {
|
|
|
590
606
|
]
|
|
591
607
|
}
|
|
592
608
|
}), this.highlightLayer.removeAll(), this.highlightLayer.add(this.highlightGraphic);
|
|
593
|
-
const
|
|
609
|
+
const u = this.view.toMap(t);
|
|
594
610
|
this.view.openPopup({
|
|
595
611
|
features: [this.highlightGraphic],
|
|
596
|
-
location:
|
|
612
|
+
location: u
|
|
597
613
|
});
|
|
598
614
|
} else if (s.layer.id === "OpenDriveJunction") {
|
|
599
615
|
const a = this.hitGraphic.getAttribute("id");
|
|
@@ -614,28 +630,28 @@ class S {
|
|
|
614
630
|
* 监听鼠标点击事件,获取高亮要素的拓扑信息
|
|
615
631
|
*/
|
|
616
632
|
monitorMouseClick() {
|
|
617
|
-
const e =
|
|
618
|
-
var
|
|
619
|
-
const o = (
|
|
633
|
+
const e = D.debounce(async (t) => {
|
|
634
|
+
var l;
|
|
635
|
+
const o = (l = (await this.view.hitTest(t, {
|
|
620
636
|
include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
|
|
621
|
-
})).results) == null ? void 0 :
|
|
637
|
+
})).results) == null ? void 0 : l.filter(
|
|
622
638
|
(r) => r.type === "graphic"
|
|
623
639
|
);
|
|
624
640
|
if (o.length === 0)
|
|
625
641
|
return;
|
|
626
|
-
const s = o[0].graphic,
|
|
627
|
-
if (
|
|
642
|
+
const s = o[0].graphic, c = s.getAttribute("type"), a = s.getAttribute("id");
|
|
643
|
+
if (c === "OpenDriveJunction")
|
|
628
644
|
if (s.getAttribute("selected") === !1) {
|
|
629
|
-
const r = `http://${this.openDriveServer}/api/sumo/getSumoJunction`,
|
|
645
|
+
const r = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, n = await b.get(r, {
|
|
630
646
|
params: {
|
|
631
647
|
id: a,
|
|
632
648
|
projectName: this.projectName
|
|
633
649
|
}
|
|
634
650
|
});
|
|
635
|
-
|
|
651
|
+
n.status === 200 && n.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
|
|
636
652
|
type: "OpenDriveJunction",
|
|
637
653
|
id: a,
|
|
638
|
-
details:
|
|
654
|
+
details: n.data.result
|
|
639
655
|
}), s.setAttribute("selected", !0), s.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(s, 50));
|
|
640
656
|
} else {
|
|
641
657
|
this.openDriveClickCallback && this.openDriveClickCallback({
|
|
@@ -646,7 +662,7 @@ class S {
|
|
|
646
662
|
const r = s.getAttribute("crossId");
|
|
647
663
|
s.symbol.url = r ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(s, 30);
|
|
648
664
|
}
|
|
649
|
-
else if (
|
|
665
|
+
else if (c === "OpenDriveSection")
|
|
650
666
|
if (s.getAttribute("selected"))
|
|
651
667
|
this.sectionLayer.remove(s), this.openDriveClickCallback && this.openDriveClickCallback({
|
|
652
668
|
type: "OpenDriveSection",
|
|
@@ -655,16 +671,16 @@ class S {
|
|
|
655
671
|
});
|
|
656
672
|
else {
|
|
657
673
|
this.highlightLayer.remove(s), this.sectionLayer.add(s), s.setAttribute("selected", !0);
|
|
658
|
-
const r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`,
|
|
674
|
+
const r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, n = await b.get(r, {
|
|
659
675
|
params: {
|
|
660
676
|
id: a,
|
|
661
677
|
projectName: this.projectName
|
|
662
678
|
}
|
|
663
679
|
});
|
|
664
|
-
|
|
680
|
+
n.status === 200 && n.data.status === 0 && this.openDriveClickCallback && (s.setAttribute("edgeId", n.data.result.obj_id), this.openDriveClickCallback({
|
|
665
681
|
type: "OpenDriveSection",
|
|
666
682
|
id: a,
|
|
667
|
-
details:
|
|
683
|
+
details: n.data.result
|
|
668
684
|
}));
|
|
669
685
|
}
|
|
670
686
|
});
|
|
@@ -708,7 +724,7 @@ class S {
|
|
|
708
724
|
async getSumoInfo(e) {
|
|
709
725
|
switch (e.type) {
|
|
710
726
|
case "junction": {
|
|
711
|
-
const t = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, i = await
|
|
727
|
+
const t = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, i = await b.get(t, {
|
|
712
728
|
params: {
|
|
713
729
|
id: e.id,
|
|
714
730
|
projectName: this.projectName
|
|
@@ -723,18 +739,18 @@ class S {
|
|
|
723
739
|
let o = 0;
|
|
724
740
|
t.length === 2 && (o = Number(t[1]));
|
|
725
741
|
const s = this.allLaneGraphics.find(
|
|
726
|
-
(
|
|
742
|
+
(c) => c.getAttribute("roadId") === i && c.getAttribute("sectionIndex") === o
|
|
727
743
|
);
|
|
728
744
|
if (s) {
|
|
729
|
-
const
|
|
745
|
+
const c = `${i}+${s.getAttribute(
|
|
730
746
|
"sectionId"
|
|
731
|
-
)}`, a = `http://${this.openDriveServer}/api/sumo/getSumoEdge`,
|
|
747
|
+
)}`, a = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, l = await b.get(a, {
|
|
732
748
|
params: {
|
|
733
|
-
id:
|
|
749
|
+
id: c,
|
|
734
750
|
projectName: this.projectName
|
|
735
751
|
}
|
|
736
752
|
});
|
|
737
|
-
return
|
|
753
|
+
return l.status === 200 ? l.data : { status: -1, message: `路段信息查询失败: ${c}` };
|
|
738
754
|
} else
|
|
739
755
|
return { status: -1, message: "未知类型" };
|
|
740
756
|
}
|
|
@@ -767,11 +783,11 @@ class S {
|
|
|
767
783
|
const s = i.split("+");
|
|
768
784
|
if (s.length > 2)
|
|
769
785
|
return { status: -1, message: "id格式错误" };
|
|
770
|
-
const
|
|
786
|
+
const c = s.length === 2 ? Number(s[1]) : void 0, a = s[0].split("#");
|
|
771
787
|
if (a.length > 2)
|
|
772
788
|
return { status: -1, message: "id格式错误" };
|
|
773
|
-
const
|
|
774
|
-
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 });
|
|
775
791
|
} else
|
|
776
792
|
return { status: -1, message: "未知类型" };
|
|
777
793
|
}
|
|
@@ -782,7 +798,7 @@ class S {
|
|
|
782
798
|
if (!i)
|
|
783
799
|
return { status: -1, message: "未找到。请检查路口编号" };
|
|
784
800
|
if (t) {
|
|
785
|
-
const o = new
|
|
801
|
+
const o = new y({
|
|
786
802
|
geometry: i.geometry,
|
|
787
803
|
symbol: {
|
|
788
804
|
type: "simple-marker",
|
|
@@ -808,37 +824,37 @@ class S {
|
|
|
808
824
|
let { roadsectId: t, segmentId: i, laneId: o } = e;
|
|
809
825
|
t.startsWith("-") && (t = t.slice(1));
|
|
810
826
|
let s = this.allLaneGraphics.filter(
|
|
811
|
-
(
|
|
827
|
+
(l) => l.attributes.roadId === t
|
|
812
828
|
);
|
|
813
829
|
if (s.length === 0)
|
|
814
830
|
return { status: -1, message: "未找到。请检查路段编号" };
|
|
815
831
|
if (i !== void 0) {
|
|
816
|
-
const
|
|
832
|
+
const l = [];
|
|
817
833
|
if (s.forEach((r) => {
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
}),
|
|
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)
|
|
821
837
|
return { status: -1, message: "未找到。请检查基本段编号" };
|
|
822
|
-
i =
|
|
838
|
+
i = l[i], s = s.filter(
|
|
823
839
|
(r) => Number(r.attributes.sectionId) === i
|
|
824
840
|
);
|
|
825
841
|
}
|
|
826
842
|
if (o !== void 0) {
|
|
827
|
-
const
|
|
843
|
+
const l = [];
|
|
828
844
|
if (s.forEach((r) => {
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
-
}),
|
|
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)
|
|
832
848
|
return { status: -1, message: "未找到。请检查车道编号" };
|
|
833
|
-
o =
|
|
849
|
+
o = l[o], s = s.filter(
|
|
834
850
|
(r) => Number(r.attributes.laneId) === o
|
|
835
851
|
);
|
|
836
852
|
}
|
|
837
|
-
const
|
|
838
|
-
(
|
|
839
|
-
), a = L.union(
|
|
853
|
+
const c = s.map(
|
|
854
|
+
(l) => l.geometry
|
|
855
|
+
), a = L.union(c);
|
|
840
856
|
if (e.flash) {
|
|
841
|
-
const
|
|
857
|
+
const l = new y({
|
|
842
858
|
geometry: a,
|
|
843
859
|
symbol: {
|
|
844
860
|
type: "simple-fill",
|
|
@@ -850,7 +866,7 @@ class S {
|
|
|
850
866
|
}
|
|
851
867
|
}
|
|
852
868
|
});
|
|
853
|
-
this.flashGraphic(
|
|
869
|
+
this.flashGraphic(l);
|
|
854
870
|
}
|
|
855
871
|
return await this.view.goTo(a, { duration: 1e3 }), { status: 0, message: "ok" };
|
|
856
872
|
}
|
|
@@ -902,18 +918,20 @@ class S {
|
|
|
902
918
|
}), { status: -1, message: "未找到路口" };
|
|
903
919
|
case "edge": {
|
|
904
920
|
const t = e.id.split("#");
|
|
905
|
-
let i = t[0];
|
|
921
|
+
let i = String(t[0]);
|
|
906
922
|
i.startsWith("-") && (i = i.slice(1));
|
|
907
|
-
let o = 0;
|
|
908
|
-
t.length === 2 && (o =
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
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,
|
|
917
935
|
symbol: {
|
|
918
936
|
type: "simple-fill",
|
|
919
937
|
color: [0, 255, 255, 0.5],
|
|
@@ -937,10 +955,112 @@ class S {
|
|
|
937
955
|
return { status: -1, message: "未知类型" };
|
|
938
956
|
}
|
|
939
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
|
+
}
|
|
940
1008
|
async splitLane(e) {
|
|
941
|
-
|
|
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();
|
|
942
1062
|
}
|
|
943
1063
|
}
|
|
944
1064
|
export {
|
|
945
|
-
|
|
1065
|
+
$ as default
|
|
946
1066
|
};
|