gisviewer-vue3-arcgis 1.0.143 → 1.0.144
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 +0 -17
- package/es/src/gis-map/gis-map.vue.mjs +110 -115
- package/es/src/gis-map/index.d.ts +0 -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.mjs +231 -215
- package/es/src/gis-map/utils/sketchView.mjs +16 -11
- package/es/style.css +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +0 -17
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +0 -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.js +1 -1
- package/lib/src/gis-map/utils/sketchView.js +1 -1
- package/package.json +1 -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,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import m from "@arcgis/core/Graphic";
|
|
2
2
|
import * as k from "@arcgis/core/core/promiseUtils";
|
|
3
3
|
import { Polygon as O } from "@arcgis/core/geometry";
|
|
4
4
|
import * as L from "@arcgis/core/geometry/geometryEngine";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import S from "@arcgis/core/layers/FeatureLayer";
|
|
6
|
+
import w from "@arcgis/core/layers/GraphicsLayer";
|
|
7
|
+
import y from "axios";
|
|
8
8
|
import F from "md5";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
9
|
+
import j from "pako";
|
|
10
|
+
import { watch as $ } from "vue";
|
|
11
|
+
import M from "../../stores/index.mjs";
|
|
12
|
+
import G from "../common-utils.mjs";
|
|
13
|
+
class A {
|
|
12
14
|
constructor(e) {
|
|
13
15
|
this.junctionNames = /* @__PURE__ */ new Map(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.currentJunctionId = "", this.view = e, this.view.popup.visibleElements = {
|
|
14
16
|
collapseButton: !1,
|
|
15
17
|
actionBar: !1
|
|
16
|
-
}, this.laneLayer = new
|
|
18
|
+
}, this.laneLayer = new S({
|
|
17
19
|
id: "OpenDriveLane",
|
|
18
20
|
fields: [
|
|
19
21
|
{
|
|
@@ -231,7 +233,7 @@ class S {
|
|
|
231
233
|
}
|
|
232
234
|
]
|
|
233
235
|
}
|
|
234
|
-
}), this.roadNameLayer = new
|
|
236
|
+
}), this.roadNameLayer = new S({
|
|
235
237
|
id: "OpenDriveRoadName",
|
|
236
238
|
fields: [
|
|
237
239
|
{
|
|
@@ -281,7 +283,7 @@ class S {
|
|
|
281
283
|
}
|
|
282
284
|
}
|
|
283
285
|
]
|
|
284
|
-
}), this.junctionLayer = new
|
|
286
|
+
}), 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.view.map.addMany([
|
|
285
287
|
this.laneLayer,
|
|
286
288
|
this.junctionLayer,
|
|
287
289
|
this.sectionLayer,
|
|
@@ -292,14 +294,14 @@ class S {
|
|
|
292
294
|
]);
|
|
293
295
|
}
|
|
294
296
|
static getInstance(e) {
|
|
295
|
-
return this.instance || (this.instance = new
|
|
297
|
+
return this.instance || (this.instance = new A(e)), this.instance;
|
|
296
298
|
}
|
|
297
299
|
async makeMd5FromFile(e) {
|
|
298
300
|
try {
|
|
299
|
-
const
|
|
300
|
-
return { status: 0, message: "ok", result: F(
|
|
301
|
-
} catch (
|
|
302
|
-
return { status: -1, message:
|
|
301
|
+
const t = await (await fetch(e)).text();
|
|
302
|
+
return { status: 0, message: "ok", result: F(t) };
|
|
303
|
+
} catch (i) {
|
|
304
|
+
return { status: -1, message: i.message };
|
|
303
305
|
}
|
|
304
306
|
}
|
|
305
307
|
/**
|
|
@@ -308,17 +310,17 @@ class S {
|
|
|
308
310
|
* @returns
|
|
309
311
|
*/
|
|
310
312
|
async showOpenDriveFromFile(e) {
|
|
311
|
-
var h,
|
|
313
|
+
var h, p;
|
|
312
314
|
this.openDriveClickCallback = e.selectedCallback, console.time("md5用时");
|
|
313
|
-
const
|
|
314
|
-
if (
|
|
315
|
-
return
|
|
316
|
-
this.projectName =
|
|
317
|
-
const
|
|
315
|
+
const i = await this.makeMd5FromFile(e.file);
|
|
316
|
+
if (i.status !== 0)
|
|
317
|
+
return i;
|
|
318
|
+
this.projectName = i.result, console.timeEnd("md5用时"), this.openDriveServer = e.server, await this.makeMd5FromFile(e.file);
|
|
319
|
+
const t = `http://${this.openDriveServer}/api/openDrive/uploadXodr`;
|
|
318
320
|
let o;
|
|
319
321
|
try {
|
|
320
|
-
o = await
|
|
321
|
-
|
|
322
|
+
o = await y.post(
|
|
323
|
+
t,
|
|
322
324
|
{},
|
|
323
325
|
{
|
|
324
326
|
params: {
|
|
@@ -334,22 +336,22 @@ class S {
|
|
|
334
336
|
return { status: -1, message: o.statusText };
|
|
335
337
|
console.time("渲染用时");
|
|
336
338
|
const s = o.data.result.geoSetting;
|
|
337
|
-
|
|
339
|
+
G.setGeoData(
|
|
338
340
|
s.geoReference,
|
|
339
341
|
s.offsetX,
|
|
340
342
|
s.offsetY
|
|
341
343
|
);
|
|
342
|
-
let
|
|
343
|
-
|
|
344
|
-
const
|
|
344
|
+
let n = o.data.result.json;
|
|
345
|
+
n.startsWith(window.location.protocol) || (n = `${window.location.protocol}//${e.server}${n}`);
|
|
346
|
+
const r = await (await fetch(n)).arrayBuffer(), a = j.inflate(r, { to: "string" }), c = JSON.parse(a);
|
|
345
347
|
await this.showAllLanes(
|
|
346
348
|
c,
|
|
347
349
|
((h = e.options) == null ? void 0 : h.showJunctionLane) || !1,
|
|
348
|
-
((
|
|
350
|
+
((p = e.options) == null ? void 0 : p.showRoadName) || !0
|
|
349
351
|
);
|
|
350
|
-
const
|
|
351
|
-
if (this.showJunction(
|
|
352
|
-
const d =
|
|
352
|
+
const g = o.data.result.junctions;
|
|
353
|
+
if (this.showJunction(g), e.options && e.options.centerMap !== !1) {
|
|
354
|
+
const d = G.transformPointProjection([0, 0]);
|
|
353
355
|
await this.view.goTo(d);
|
|
354
356
|
}
|
|
355
357
|
return this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick(), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
|
|
@@ -359,10 +361,10 @@ class S {
|
|
|
359
361
|
* @param server
|
|
360
362
|
* @param projectName
|
|
361
363
|
*/
|
|
362
|
-
async showOpenDriveFromServer(e,
|
|
363
|
-
const
|
|
364
|
+
async showOpenDriveFromServer(e, i) {
|
|
365
|
+
const t = `http://${e}/api/openDrive/analyzeXodr`, o = await y.get(t, {
|
|
364
366
|
headers: {
|
|
365
|
-
projectName:
|
|
367
|
+
projectName: i
|
|
366
368
|
},
|
|
367
369
|
params: {
|
|
368
370
|
analyze: !1,
|
|
@@ -373,8 +375,8 @@ class S {
|
|
|
373
375
|
throw new Error(`OpenDriveRenderer: ${o.statusText}`);
|
|
374
376
|
let s = o.data.result.json;
|
|
375
377
|
s.startsWith(window.location.protocol) || (s = `${window.location.protocol}//${e}${s}`);
|
|
376
|
-
const
|
|
377
|
-
return await this.showAllLanes(
|
|
378
|
+
const l = await (await fetch(s)).arrayBuffer(), r = j.inflate(l, { to: "string" }), a = JSON.parse(r);
|
|
379
|
+
return await this.showAllLanes(a, !1, !1), { status: 0, message: "ok" };
|
|
378
380
|
}
|
|
379
381
|
/**
|
|
380
382
|
* 显示所有车道
|
|
@@ -383,87 +385,87 @@ class S {
|
|
|
383
385
|
* @param showRoadName 是否显示道路名称
|
|
384
386
|
* @returns
|
|
385
387
|
*/
|
|
386
|
-
async showAllLanes(e,
|
|
388
|
+
async showAllLanes(e, i, t) {
|
|
387
389
|
const o = await this.laneLayer.queryFeatures();
|
|
388
390
|
return o.features.length > 0 && this.laneLayer.applyEdits({
|
|
389
391
|
deleteFeatures: o.features
|
|
390
|
-
}), this.roadNameLayer.visible =
|
|
391
|
-
let
|
|
392
|
+
}), this.roadNameLayer.visible = t, new Promise((s) => {
|
|
393
|
+
let n = 0;
|
|
392
394
|
this.allLaneGraphics = [], this.allRefLineGraphics = [];
|
|
393
|
-
const
|
|
394
|
-
for (const
|
|
395
|
-
if (!
|
|
395
|
+
const l = [];
|
|
396
|
+
for (const a of e) {
|
|
397
|
+
if (!i && a.junction !== "-1")
|
|
396
398
|
continue;
|
|
397
|
-
const { id: c, refLine:
|
|
398
|
-
let h =
|
|
399
|
+
const { id: c, refLine: g } = a;
|
|
400
|
+
let h = a.name;
|
|
399
401
|
h.includes("(") && (h = h.slice(0, h.indexOf("("))), h = h.replace(/(.)/g, "$1 ");
|
|
400
|
-
const
|
|
402
|
+
const p = new m({
|
|
401
403
|
geometry: {
|
|
402
404
|
type: "polyline",
|
|
403
|
-
paths: [
|
|
405
|
+
paths: [g]
|
|
404
406
|
},
|
|
405
407
|
attributes: {
|
|
406
|
-
ObjectID:
|
|
408
|
+
ObjectID: n++,
|
|
407
409
|
roadId: c,
|
|
408
410
|
roadName: h
|
|
409
411
|
}
|
|
410
412
|
});
|
|
411
|
-
this.allRefLineGraphics.push(
|
|
412
|
-
for (let d = 0; d <
|
|
413
|
-
const
|
|
414
|
-
for (const
|
|
415
|
-
const v = Number(
|
|
413
|
+
this.allRefLineGraphics.push(p), a.laneSections.sort((d, f) => Number(d.id) - Number(f.id));
|
|
414
|
+
for (let d = 0; d < a.laneSections.length; d++) {
|
|
415
|
+
const f = a.laneSections[d], b = Number(f.id);
|
|
416
|
+
for (const u of f.lanePaths) {
|
|
417
|
+
const v = Number(u.id);
|
|
416
418
|
if (v === 0)
|
|
417
419
|
continue;
|
|
418
|
-
const C =
|
|
419
|
-
|
|
420
|
+
const C = u.type, I = u.innerPath.concat(
|
|
421
|
+
u.outerPath.reverse()
|
|
420
422
|
);
|
|
421
423
|
if (I.length <= 3) {
|
|
422
424
|
console.warn(`lane ${v} has less than 3 points`);
|
|
423
425
|
continue;
|
|
424
426
|
}
|
|
425
|
-
I.push(
|
|
427
|
+
I.push(u.innerPath[0]);
|
|
426
428
|
const N = new O({
|
|
427
429
|
rings: [I]
|
|
428
430
|
});
|
|
429
431
|
if (N) {
|
|
430
|
-
const D = new
|
|
432
|
+
const D = new m({
|
|
431
433
|
geometry: N,
|
|
432
434
|
attributes: {
|
|
433
|
-
ObjectID:
|
|
434
|
-
id: `${c}+${
|
|
435
|
-
fromNode:
|
|
436
|
-
toNode:
|
|
435
|
+
ObjectID: n++,
|
|
436
|
+
id: `${c}+${b}+${v}`,
|
|
437
|
+
fromNode: a.fromNode,
|
|
438
|
+
toNode: a.toNode,
|
|
437
439
|
roadId: c,
|
|
438
|
-
roadName:
|
|
439
|
-
sectionId:
|
|
440
|
+
roadName: a.name,
|
|
441
|
+
sectionId: b,
|
|
440
442
|
sectionIndex: d,
|
|
441
443
|
laneId: v,
|
|
442
444
|
type: C,
|
|
443
445
|
sumoId: ""
|
|
444
446
|
}
|
|
445
447
|
});
|
|
446
|
-
this.allLaneGraphics.push(D),
|
|
448
|
+
this.allLaneGraphics.push(D), l.push(D);
|
|
447
449
|
}
|
|
448
450
|
}
|
|
449
451
|
}
|
|
450
452
|
}
|
|
451
|
-
const
|
|
452
|
-
if (
|
|
453
|
-
if (
|
|
454
|
-
const
|
|
453
|
+
const r = setInterval(() => {
|
|
454
|
+
if (l.length > 0 || this.allRefLineGraphics.length > 0) {
|
|
455
|
+
if (l.length > 0) {
|
|
456
|
+
const a = l.splice(0, 100);
|
|
455
457
|
this.laneLayer.applyEdits({
|
|
456
|
-
addFeatures:
|
|
458
|
+
addFeatures: a
|
|
457
459
|
});
|
|
458
460
|
}
|
|
459
461
|
if (this.allRefLineGraphics.length > 0) {
|
|
460
|
-
const
|
|
462
|
+
const a = this.allRefLineGraphics.splice(0, 10);
|
|
461
463
|
this.roadNameLayer.applyEdits({
|
|
462
|
-
addFeatures:
|
|
464
|
+
addFeatures: a
|
|
463
465
|
});
|
|
464
466
|
}
|
|
465
467
|
} else
|
|
466
|
-
clearInterval(
|
|
468
|
+
clearInterval(r), s();
|
|
467
469
|
}, 10);
|
|
468
470
|
});
|
|
469
471
|
}
|
|
@@ -473,30 +475,30 @@ class S {
|
|
|
473
475
|
* @returns
|
|
474
476
|
*/
|
|
475
477
|
showJunction(e) {
|
|
476
|
-
const
|
|
477
|
-
for (const
|
|
478
|
-
if (!
|
|
478
|
+
const i = [];
|
|
479
|
+
for (const t of e) {
|
|
480
|
+
if (!t)
|
|
479
481
|
continue;
|
|
480
|
-
this.junctionNames.set(
|
|
481
|
-
const o = new
|
|
482
|
+
this.junctionNames.set(t.id, t.name), t.nodeType = t.type;
|
|
483
|
+
const o = new m({
|
|
482
484
|
geometry: {
|
|
483
485
|
type: "point",
|
|
484
|
-
x:
|
|
485
|
-
y:
|
|
486
|
+
x: t.coordinates[0],
|
|
487
|
+
y: t.coordinates[1]
|
|
486
488
|
},
|
|
487
489
|
attributes: {
|
|
488
|
-
...
|
|
490
|
+
...t,
|
|
489
491
|
selected: !1,
|
|
490
492
|
type: "OpenDriveJunction"
|
|
491
493
|
},
|
|
492
494
|
symbol: {
|
|
493
495
|
type: "picture-marker",
|
|
494
|
-
url:
|
|
496
|
+
url: t.crossId ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png",
|
|
495
497
|
width: 30,
|
|
496
498
|
height: 30
|
|
497
499
|
},
|
|
498
500
|
popupTemplate: {
|
|
499
|
-
title:
|
|
501
|
+
title: t.name,
|
|
500
502
|
content: [
|
|
501
503
|
{
|
|
502
504
|
type: "fields",
|
|
@@ -514,9 +516,9 @@ class S {
|
|
|
514
516
|
]
|
|
515
517
|
}
|
|
516
518
|
});
|
|
517
|
-
|
|
519
|
+
i.push(o);
|
|
518
520
|
}
|
|
519
|
-
this.junctionLayer.addMany(
|
|
521
|
+
this.junctionLayer.addMany(i);
|
|
520
522
|
}
|
|
521
523
|
/**
|
|
522
524
|
* 监听鼠标移动事件,高亮显示鼠标所在路段和路口
|
|
@@ -524,32 +526,32 @@ class S {
|
|
|
524
526
|
monitorMouseMove() {
|
|
525
527
|
const e = k.debounce(async (t) => {
|
|
526
528
|
var l;
|
|
527
|
-
const
|
|
529
|
+
const s = (l = (await this.view.hitTest(t, {
|
|
528
530
|
include: [this.laneLayer, this.junctionLayer]
|
|
529
531
|
})).results) == null ? void 0 : l.filter(
|
|
530
|
-
(
|
|
532
|
+
(r) => r.type === "graphic"
|
|
531
533
|
);
|
|
532
|
-
if (
|
|
534
|
+
if (s.length === 0) {
|
|
533
535
|
this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = "", this.view.closePopup());
|
|
534
536
|
return;
|
|
535
537
|
}
|
|
536
|
-
const
|
|
537
|
-
if (this.hitGraphic =
|
|
538
|
-
const
|
|
538
|
+
const n = s[0];
|
|
539
|
+
if (this.hitGraphic = n.graphic, n.layer.id === "OpenDriveLane") {
|
|
540
|
+
const r = `${this.hitGraphic.getAttribute(
|
|
539
541
|
"roadId"
|
|
540
542
|
)}+${this.hitGraphic.getAttribute("sectionId")}`;
|
|
541
|
-
if (
|
|
542
|
-
(u) => u.getAttribute("id") ===
|
|
543
|
+
if (r === this.currentSectionCode || this.sectionLayer.graphics.findIndex(
|
|
544
|
+
(u) => u.getAttribute("id") === r
|
|
543
545
|
) >= 0)
|
|
544
546
|
return;
|
|
545
|
-
this.currentSectionCode =
|
|
546
|
-
const
|
|
547
|
-
(u) => `${u.attributes.roadId}+${u.attributes.sectionId}` ===
|
|
548
|
-
),
|
|
549
|
-
|
|
550
|
-
),
|
|
551
|
-
this.highlightGraphic = new
|
|
552
|
-
geometry:
|
|
547
|
+
this.currentSectionCode = r;
|
|
548
|
+
const c = this.allLaneGraphics.filter(
|
|
549
|
+
(u) => `${u.attributes.roadId}+${u.attributes.sectionId}` === r
|
|
550
|
+
), g = L.union(
|
|
551
|
+
c.map((u) => u.geometry)
|
|
552
|
+
), h = this.hitGraphic.getAttribute("fromNode"), p = this.hitGraphic.getAttribute("toNode"), d = this.junctionNames.get(h) || h, f = this.junctionNames.get(p) || p;
|
|
553
|
+
this.highlightGraphic = new m({
|
|
554
|
+
geometry: g,
|
|
553
555
|
symbol: {
|
|
554
556
|
type: "simple-fill",
|
|
555
557
|
color: [0, 255, 255, 0.5],
|
|
@@ -561,11 +563,11 @@ class S {
|
|
|
561
563
|
},
|
|
562
564
|
attributes: {
|
|
563
565
|
type: "OpenDriveSection",
|
|
564
|
-
id:
|
|
566
|
+
id: r,
|
|
565
567
|
selected: !1,
|
|
566
|
-
fromNodeName:
|
|
567
|
-
toNodeName:
|
|
568
|
-
laneCount:
|
|
568
|
+
fromNodeName: d,
|
|
569
|
+
toNodeName: f,
|
|
570
|
+
laneCount: c.length
|
|
569
571
|
},
|
|
570
572
|
popupTemplate: {
|
|
571
573
|
title: this.hitGraphic.getAttribute("roadName"),
|
|
@@ -590,16 +592,16 @@ class S {
|
|
|
590
592
|
]
|
|
591
593
|
}
|
|
592
594
|
}), this.highlightLayer.removeAll(), this.highlightLayer.add(this.highlightGraphic);
|
|
593
|
-
const
|
|
595
|
+
const b = this.view.toMap(t);
|
|
594
596
|
this.view.openPopup({
|
|
595
597
|
features: [this.highlightGraphic],
|
|
596
|
-
location:
|
|
598
|
+
location: b
|
|
597
599
|
});
|
|
598
|
-
} else if (
|
|
599
|
-
const
|
|
600
|
-
if (
|
|
600
|
+
} else if (n.layer.id === "OpenDriveJunction") {
|
|
601
|
+
const r = this.hitGraphic.getAttribute("id");
|
|
602
|
+
if (r === this.currentJunctionId)
|
|
601
603
|
return;
|
|
602
|
-
this.currentJunctionId =
|
|
604
|
+
this.currentJunctionId = r, this.view.openPopup({
|
|
603
605
|
features: [this.hitGraphic],
|
|
604
606
|
location: this.hitGraphic.geometry
|
|
605
607
|
});
|
|
@@ -609,67 +611,81 @@ class S {
|
|
|
609
611
|
e(t).catch(() => {
|
|
610
612
|
});
|
|
611
613
|
});
|
|
614
|
+
const i = M.useAppDataStore;
|
|
615
|
+
$(
|
|
616
|
+
() => i.isSketching,
|
|
617
|
+
() => {
|
|
618
|
+
var t;
|
|
619
|
+
i.isSketching ? (t = this.mouseMoveHandler) == null || t.remove() : this.mouseMoveHandler = this.view.on(
|
|
620
|
+
"pointer-move",
|
|
621
|
+
async (o) => {
|
|
622
|
+
e(o).catch(() => {
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
);
|
|
612
628
|
}
|
|
613
629
|
/**
|
|
614
630
|
* 监听鼠标点击事件,获取高亮要素的拓扑信息
|
|
615
631
|
*/
|
|
616
632
|
monitorMouseClick() {
|
|
617
|
-
const e = k.debounce(async (
|
|
618
|
-
var
|
|
619
|
-
const o = (
|
|
633
|
+
const e = k.debounce(async (i) => {
|
|
634
|
+
var r;
|
|
635
|
+
const o = (r = (await this.view.hitTest(i, {
|
|
620
636
|
include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
|
|
621
|
-
})).results) == null ? void 0 :
|
|
622
|
-
(
|
|
637
|
+
})).results) == null ? void 0 : r.filter(
|
|
638
|
+
(a) => a.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, n = s.getAttribute("type"), l = s.getAttribute("id");
|
|
643
|
+
if (n === "OpenDriveJunction")
|
|
628
644
|
if (s.getAttribute("selected") === !1) {
|
|
629
|
-
const
|
|
645
|
+
const a = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, c = await y.get(a, {
|
|
630
646
|
params: {
|
|
631
|
-
id:
|
|
647
|
+
id: l,
|
|
632
648
|
projectName: this.projectName
|
|
633
649
|
}
|
|
634
650
|
});
|
|
635
651
|
c.status === 200 && c.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
|
|
636
652
|
type: "OpenDriveJunction",
|
|
637
|
-
id:
|
|
653
|
+
id: l,
|
|
638
654
|
details: c.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({
|
|
642
658
|
type: "OpenDriveJunction",
|
|
643
|
-
id:
|
|
659
|
+
id: l,
|
|
644
660
|
details: void 0
|
|
645
661
|
}), s.setAttribute("selected", !1);
|
|
646
|
-
const
|
|
647
|
-
s.symbol.url =
|
|
662
|
+
const a = s.getAttribute("crossId");
|
|
663
|
+
s.symbol.url = a ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(s, 30);
|
|
648
664
|
}
|
|
649
|
-
else if (
|
|
665
|
+
else if (n === "OpenDriveSection")
|
|
650
666
|
if (s.getAttribute("selected"))
|
|
651
667
|
this.sectionLayer.remove(s), this.openDriveClickCallback && this.openDriveClickCallback({
|
|
652
668
|
type: "OpenDriveSection",
|
|
653
|
-
id:
|
|
669
|
+
id: l,
|
|
654
670
|
details: void 0
|
|
655
671
|
});
|
|
656
672
|
else {
|
|
657
673
|
this.highlightLayer.remove(s), this.sectionLayer.add(s), s.setAttribute("selected", !0);
|
|
658
|
-
const
|
|
674
|
+
const a = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, c = await y.get(a, {
|
|
659
675
|
params: {
|
|
660
|
-
id:
|
|
676
|
+
id: l,
|
|
661
677
|
projectName: this.projectName
|
|
662
678
|
}
|
|
663
679
|
});
|
|
664
680
|
c.status === 200 && c.data.status === 0 && this.openDriveClickCallback && (s.setAttribute("edgeId", c.data.result.obj_id), this.openDriveClickCallback({
|
|
665
681
|
type: "OpenDriveSection",
|
|
666
|
-
id:
|
|
682
|
+
id: l,
|
|
667
683
|
details: c.data.result
|
|
668
684
|
}));
|
|
669
685
|
}
|
|
670
686
|
});
|
|
671
|
-
this.mouseClickHandler = this.view.on("immediate-click", async (
|
|
672
|
-
e(
|
|
687
|
+
this.mouseClickHandler = this.view.on("immediate-click", async (i) => {
|
|
688
|
+
e(i).catch(() => {
|
|
673
689
|
});
|
|
674
690
|
});
|
|
675
691
|
}
|
|
@@ -678,15 +694,15 @@ class S {
|
|
|
678
694
|
* @param graphic
|
|
679
695
|
* @param targetSize
|
|
680
696
|
*/
|
|
681
|
-
increasePictureMarkerSize(e,
|
|
682
|
-
const
|
|
697
|
+
increasePictureMarkerSize(e, i) {
|
|
698
|
+
const t = setInterval(() => {
|
|
683
699
|
const o = e.symbol, s = o.width;
|
|
684
|
-
s <
|
|
700
|
+
s < i ? e.symbol = {
|
|
685
701
|
type: "picture-marker",
|
|
686
702
|
url: o.url,
|
|
687
703
|
width: s + 1,
|
|
688
704
|
height: s + 1
|
|
689
|
-
} : clearInterval(
|
|
705
|
+
} : clearInterval(t);
|
|
690
706
|
}, 20);
|
|
691
707
|
}
|
|
692
708
|
/**
|
|
@@ -694,47 +710,47 @@ class S {
|
|
|
694
710
|
* @param graphic
|
|
695
711
|
* @param targetSize
|
|
696
712
|
*/
|
|
697
|
-
decreasePictureMarkerSize(e,
|
|
698
|
-
const
|
|
713
|
+
decreasePictureMarkerSize(e, i) {
|
|
714
|
+
const t = setInterval(() => {
|
|
699
715
|
const o = e.symbol, s = o.width;
|
|
700
|
-
s >
|
|
716
|
+
s > i ? e.symbol = {
|
|
701
717
|
type: "picture-marker",
|
|
702
718
|
url: o.url,
|
|
703
719
|
width: s - 1,
|
|
704
720
|
height: s - 1
|
|
705
|
-
} : clearInterval(
|
|
721
|
+
} : clearInterval(t);
|
|
706
722
|
}, 20);
|
|
707
723
|
}
|
|
708
724
|
async getSumoInfo(e) {
|
|
709
725
|
switch (e.type) {
|
|
710
726
|
case "junction": {
|
|
711
|
-
const
|
|
727
|
+
const i = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, t = await y.get(i, {
|
|
712
728
|
params: {
|
|
713
729
|
id: e.id,
|
|
714
730
|
projectName: this.projectName
|
|
715
731
|
}
|
|
716
732
|
});
|
|
717
|
-
return
|
|
733
|
+
return t.status === 200 ? t.data : { status: -1, message: `路口信息查询失败: ${e.id}` };
|
|
718
734
|
}
|
|
719
735
|
case "edge": {
|
|
720
|
-
const
|
|
721
|
-
let
|
|
722
|
-
|
|
736
|
+
const i = e.id.split("#");
|
|
737
|
+
let t = i[0];
|
|
738
|
+
t.startsWith("-") && (t = t.slice(1));
|
|
723
739
|
let o = 0;
|
|
724
|
-
|
|
740
|
+
i.length === 2 && (o = Number(i[1]));
|
|
725
741
|
const s = this.allLaneGraphics.find(
|
|
726
|
-
(
|
|
742
|
+
(n) => n.getAttribute("roadId") === t && n.getAttribute("sectionIndex") === o
|
|
727
743
|
);
|
|
728
744
|
if (s) {
|
|
729
|
-
const
|
|
745
|
+
const n = `${t}+${s.getAttribute(
|
|
730
746
|
"sectionId"
|
|
731
|
-
)}`,
|
|
747
|
+
)}`, l = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, r = await y.get(l, {
|
|
732
748
|
params: {
|
|
733
|
-
id:
|
|
749
|
+
id: n,
|
|
734
750
|
projectName: this.projectName
|
|
735
751
|
}
|
|
736
752
|
});
|
|
737
|
-
return
|
|
753
|
+
return r.status === 200 ? r.data : { status: -1, message: `路段信息查询失败: ${n}` };
|
|
738
754
|
} else
|
|
739
755
|
return { status: -1, message: "未知类型" };
|
|
740
756
|
}
|
|
@@ -746,13 +762,13 @@ class S {
|
|
|
746
762
|
* 清除OpenDrive内容
|
|
747
763
|
*/
|
|
748
764
|
async clearOpenDrive() {
|
|
749
|
-
var
|
|
765
|
+
var i, t;
|
|
750
766
|
let e = await this.laneLayer.queryFeatures();
|
|
751
767
|
e.features.length > 0 && await this.laneLayer.applyEdits({
|
|
752
768
|
deleteFeatures: e.features
|
|
753
769
|
}), e = await this.roadNameLayer.queryFeatures(), e.features.length > 0 && await this.roadNameLayer.applyEdits({
|
|
754
770
|
deleteFeatures: e.features
|
|
755
|
-
}), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), (
|
|
771
|
+
}), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.sectionLayer.removeAll(), this.flashLayer.removeAll(), (i = this.mouseMoveHandler) == null || i.remove(), this.mouseMoveHandler = void 0, (t = this.mouseClickHandler) == null || t.remove(), this.mouseClickHandler = void 0;
|
|
756
772
|
}
|
|
757
773
|
/**
|
|
758
774
|
* 用sumo的id定位车道、基本段、路段
|
|
@@ -760,30 +776,30 @@ class S {
|
|
|
760
776
|
* @returns
|
|
761
777
|
*/
|
|
762
778
|
async findSumo(e) {
|
|
763
|
-
const { type:
|
|
764
|
-
if (
|
|
765
|
-
return await this.findJunction(
|
|
766
|
-
if (
|
|
767
|
-
const s =
|
|
779
|
+
const { type: i, id: t } = e, o = e.flash === void 0 ? !0 : e.flash;
|
|
780
|
+
if (i === "junction")
|
|
781
|
+
return await this.findJunction(t, o);
|
|
782
|
+
if (i === "edge") {
|
|
783
|
+
const s = t.split("+");
|
|
768
784
|
if (s.length > 2)
|
|
769
785
|
return { status: -1, message: "id格式错误" };
|
|
770
|
-
const
|
|
771
|
-
if (
|
|
786
|
+
const n = s.length === 2 ? Number(s[1]) : void 0, l = s[0].split("#");
|
|
787
|
+
if (l.length > 2)
|
|
772
788
|
return { status: -1, message: "id格式错误" };
|
|
773
|
-
const
|
|
774
|
-
return await this.findLane({ roadsectId:
|
|
789
|
+
const r = l[0], a = l.length === 2 ? Number(l[1]) : void 0;
|
|
790
|
+
return await this.findLane({ roadsectId: r, segmentId: a, laneId: n, flash: o });
|
|
775
791
|
} else
|
|
776
792
|
return { status: -1, message: "未知类型" };
|
|
777
793
|
}
|
|
778
|
-
async findJunction(e,
|
|
779
|
-
const
|
|
794
|
+
async findJunction(e, i) {
|
|
795
|
+
const t = this.junctionLayer.graphics.find(
|
|
780
796
|
(o) => o.attributes.id === e
|
|
781
797
|
);
|
|
782
|
-
if (!
|
|
798
|
+
if (!t)
|
|
783
799
|
return { status: -1, message: "未找到。请检查路口编号" };
|
|
784
|
-
if (
|
|
785
|
-
const o = new
|
|
786
|
-
geometry:
|
|
800
|
+
if (i) {
|
|
801
|
+
const o = new m({
|
|
802
|
+
geometry: t.geometry,
|
|
787
803
|
symbol: {
|
|
788
804
|
type: "simple-marker",
|
|
789
805
|
style: "circle",
|
|
@@ -797,7 +813,7 @@ class S {
|
|
|
797
813
|
});
|
|
798
814
|
this.flashGraphic(o);
|
|
799
815
|
}
|
|
800
|
-
return await this.view.goTo(
|
|
816
|
+
return await this.view.goTo(t.geometry, { duration: 1e3 }), { status: 0, message: "ok" };
|
|
801
817
|
}
|
|
802
818
|
/**
|
|
803
819
|
* 用sumo的id定位车道、基本段、路段
|
|
@@ -805,41 +821,41 @@ class S {
|
|
|
805
821
|
* @returns
|
|
806
822
|
*/
|
|
807
823
|
async findLane(e) {
|
|
808
|
-
let { roadsectId:
|
|
809
|
-
|
|
824
|
+
let { roadsectId: i, segmentId: t, laneId: o } = e;
|
|
825
|
+
i.startsWith("-") && (i = i.slice(1));
|
|
810
826
|
let s = this.allLaneGraphics.filter(
|
|
811
|
-
(
|
|
827
|
+
(r) => r.attributes.roadId === i
|
|
812
828
|
);
|
|
813
829
|
if (s.length === 0)
|
|
814
830
|
return { status: -1, message: "未找到。请检查路段编号" };
|
|
815
|
-
if (
|
|
816
|
-
const
|
|
817
|
-
if (s.forEach((
|
|
818
|
-
const c = Number(
|
|
819
|
-
|
|
820
|
-
}),
|
|
831
|
+
if (t !== void 0) {
|
|
832
|
+
const r = [];
|
|
833
|
+
if (s.forEach((a) => {
|
|
834
|
+
const c = Number(a.attributes.sectionId);
|
|
835
|
+
r.indexOf(c) === -1 && r.push(c);
|
|
836
|
+
}), r.sort((a, c) => a - c), t > r.length - 1)
|
|
821
837
|
return { status: -1, message: "未找到。请检查基本段编号" };
|
|
822
|
-
|
|
823
|
-
(
|
|
838
|
+
t = r[t], s = s.filter(
|
|
839
|
+
(a) => Number(a.attributes.sectionId) === t
|
|
824
840
|
);
|
|
825
841
|
}
|
|
826
842
|
if (o !== void 0) {
|
|
827
|
-
const
|
|
828
|
-
if (s.forEach((
|
|
829
|
-
const c = Number(
|
|
830
|
-
|
|
831
|
-
}),
|
|
843
|
+
const r = [];
|
|
844
|
+
if (s.forEach((a) => {
|
|
845
|
+
const c = Number(a.attributes.laneId);
|
|
846
|
+
r.indexOf(c) === -1 && r.push(c);
|
|
847
|
+
}), r.sort((a, c) => a - c), o > r.length - 1)
|
|
832
848
|
return { status: -1, message: "未找到。请检查车道编号" };
|
|
833
|
-
o =
|
|
834
|
-
(
|
|
849
|
+
o = r[o], s = s.filter(
|
|
850
|
+
(a) => Number(a.attributes.laneId) === o
|
|
835
851
|
);
|
|
836
852
|
}
|
|
837
|
-
const
|
|
838
|
-
(
|
|
839
|
-
),
|
|
853
|
+
const n = s.map(
|
|
854
|
+
(r) => r.geometry
|
|
855
|
+
), l = L.union(n);
|
|
840
856
|
if (e.flash) {
|
|
841
|
-
const
|
|
842
|
-
geometry:
|
|
857
|
+
const r = new m({
|
|
858
|
+
geometry: l,
|
|
843
859
|
symbol: {
|
|
844
860
|
type: "simple-fill",
|
|
845
861
|
color: [255, 0, 0, 0.5],
|
|
@@ -850,9 +866,9 @@ class S {
|
|
|
850
866
|
}
|
|
851
867
|
}
|
|
852
868
|
});
|
|
853
|
-
this.flashGraphic(
|
|
869
|
+
this.flashGraphic(r);
|
|
854
870
|
}
|
|
855
|
-
return await this.view.goTo(
|
|
871
|
+
return await this.view.goTo(l, { duration: 1e3 }), { status: 0, message: "ok" };
|
|
856
872
|
}
|
|
857
873
|
/**
|
|
858
874
|
* graphic渐隐渐显闪烁
|
|
@@ -860,9 +876,9 @@ class S {
|
|
|
860
876
|
*/
|
|
861
877
|
flashGraphic(e) {
|
|
862
878
|
this.flashLayer.removeAll(), this.flashLayer.add(e);
|
|
863
|
-
let
|
|
879
|
+
let i = 0, t = !0;
|
|
864
880
|
const o = setInterval(() => {
|
|
865
|
-
|
|
881
|
+
t ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (t = !1, i++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (t = !0)), i >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(o));
|
|
866
882
|
}, 10);
|
|
867
883
|
}
|
|
868
884
|
/**
|
|
@@ -871,20 +887,20 @@ class S {
|
|
|
871
887
|
* @returns
|
|
872
888
|
*/
|
|
873
889
|
unselectSumo(e) {
|
|
874
|
-
if ((!e || e.type === "junction") && this.junctionLayer.graphics.forEach((
|
|
875
|
-
if ((!e || !e.id || e.id === "" || e.id ===
|
|
876
|
-
|
|
877
|
-
const
|
|
878
|
-
|
|
890
|
+
if ((!e || e.type === "junction") && this.junctionLayer.graphics.forEach((i) => {
|
|
891
|
+
if ((!e || !e.id || e.id === "" || e.id === i.getAttribute("id")) && i.getAttribute("selected")) {
|
|
892
|
+
i.setAttribute("selected", !1);
|
|
893
|
+
const t = i.getAttribute("crossId");
|
|
894
|
+
i.symbol.url = t ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(i, 30);
|
|
879
895
|
}
|
|
880
896
|
}), !e || e.type === "edge")
|
|
881
897
|
if (!e || !e.id || e.id === "")
|
|
882
898
|
this.sectionLayer.removeAll();
|
|
883
899
|
else {
|
|
884
|
-
const
|
|
885
|
-
(
|
|
900
|
+
const i = this.sectionLayer.graphics.find(
|
|
901
|
+
(t) => t.getAttribute("edgeId") === e.id
|
|
886
902
|
);
|
|
887
|
-
|
|
903
|
+
i && this.sectionLayer.remove(i);
|
|
888
904
|
}
|
|
889
905
|
return { status: 0, message: "ok" };
|
|
890
906
|
}
|
|
@@ -896,24 +912,24 @@ class S {
|
|
|
896
912
|
selectSumo(e) {
|
|
897
913
|
switch (e.type) {
|
|
898
914
|
case "junction":
|
|
899
|
-
return this.junctionLayer.graphics.forEach((
|
|
900
|
-
if (e.id ===
|
|
901
|
-
return
|
|
915
|
+
return this.junctionLayer.graphics.forEach((i) => {
|
|
916
|
+
if (e.id === i.getAttribute("id"))
|
|
917
|
+
return i.setAttribute("selected", !0), i.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(i, 50), { status: 0, message: "ok" };
|
|
902
918
|
}), { status: -1, message: "未找到路口" };
|
|
903
919
|
case "edge": {
|
|
904
|
-
const
|
|
905
|
-
let
|
|
906
|
-
|
|
920
|
+
const i = e.id.split("#");
|
|
921
|
+
let t = i[0];
|
|
922
|
+
t.startsWith("-") && (t = t.slice(1));
|
|
907
923
|
let o = 0;
|
|
908
|
-
|
|
924
|
+
i.length === 2 && (o = Number(i[1]));
|
|
909
925
|
const s = this.allLaneGraphics.filter(
|
|
910
|
-
(
|
|
926
|
+
(n) => n.getAttribute("roadId") === t && n.getAttribute("sectionIndex") === o
|
|
911
927
|
);
|
|
912
928
|
if (s.length > 0) {
|
|
913
|
-
const
|
|
914
|
-
s.map((
|
|
915
|
-
),
|
|
916
|
-
geometry:
|
|
929
|
+
const n = L.union(
|
|
930
|
+
s.map((r) => r.geometry)
|
|
931
|
+
), l = new m({
|
|
932
|
+
geometry: n,
|
|
917
933
|
symbol: {
|
|
918
934
|
type: "simple-fill",
|
|
919
935
|
color: [0, 255, 255, 0.5],
|
|
@@ -929,7 +945,7 @@ class S {
|
|
|
929
945
|
selected: !0
|
|
930
946
|
}
|
|
931
947
|
});
|
|
932
|
-
return this.sectionLayer.add(
|
|
948
|
+
return this.sectionLayer.add(l), { status: 0, message: "ok" };
|
|
933
949
|
} else
|
|
934
950
|
return { status: -1, message: "未找到路段" };
|
|
935
951
|
}
|
|
@@ -942,5 +958,5 @@ class S {
|
|
|
942
958
|
}
|
|
943
959
|
}
|
|
944
960
|
export {
|
|
945
|
-
|
|
961
|
+
A as default
|
|
946
962
|
};
|