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.
@@ -1,14 +1,16 @@
1
- import m from "@arcgis/core/Graphic";
2
- import { Polygon as b } from "@arcgis/core/geometry";
3
- import * as G from "@arcgis/core/geometry/geometryEngineAsync.js";
4
- import L from "@arcgis/core/layers/FeatureLayer";
5
- import v from "@arcgis/core/layers/GraphicsLayer";
6
- import O from "axios";
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 N from "./wasm-loader.mjs";
9
- class I {
9
+ import S from "../common-utils.mjs";
10
+ import F from "./wasm-loader.mjs";
11
+ class N {
10
12
  constructor(e) {
11
- this.wasmLoader = N.getInstance(), this.view = e, this.laneLayer = new L({
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 L({
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 v({ id: "OpenDriveJunction" }), this.highlightLayer = new v({ id: "OpenDriveHighlight" }), this.view.map.addMany([
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.highlightLayer,
273
- this.roadNameLayer
274
+ this.roadNameLayer,
275
+ this.highlightLayer
274
276
  ]);
275
277
  }
276
278
  static getInstance(e) {
277
- return this.instance || (this.instance = new I(e)), this.instance;
279
+ return this.instance || (this.instance = new N(e)), this.instance;
278
280
  }
279
281
  async showOpenDriveFromFile(e) {
280
- var o, c, s;
281
- const i = await this.wasmLoader.load(e.file);
282
- if (i.status !== 0)
283
- return i;
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 { roads: n, junctions: a } = i.result;
286
- return await this.showAllLanes(
287
- n,
288
- ((o = e.options) == null ? void 0 : o.showJunctionLane) || !1,
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
- ), (s = e.options) != null && s.showJunctionPolygon && this.showJunction(a), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
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, i) {
298
- const n = `http://${e}/api/openDrive/analyzeXodr`, a = await O.get(n, {
319
+ async showOpenDriveFromServer(e, o) {
320
+ const i = `http://${e}/api/openDrive/analyzeXodr`, s = await f.get(i, {
299
321
  headers: {
300
- projectName: i
322
+ projectName: o
301
323
  },
302
324
  params: {
303
325
  analyze: !1,
304
326
  compressed: !0
305
327
  }
306
328
  });
307
- if (a.status !== 200)
308
- throw new Error(`OpenDriveRenderer: ${a.statusText}`);
309
- let o = a.data.result.json;
310
- o.startsWith(window.location.protocol) || (o = `${window.location.protocol}//${e}${o}`);
311
- const s = await (await fetch(o)).arrayBuffer(), r = j.inflate(s, { to: "string" }), d = JSON.parse(r);
312
- return await this.showAllLanes(d, !1, !1), { status: 0, message: "ok" };
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, i, n) {
315
- const a = await this.laneLayer.queryFeatures();
316
- return a.features.length > 0 && this.laneLayer.applyEdits({
317
- deleteFeatures: a.features
318
- }), this.roadNameLayer.visible = n, new Promise((o) => {
319
- let c = 0;
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 (!i && r.junction !== "-1")
345
+ if (!o && r.junction !== "-1")
323
346
  continue;
324
- const { id: d, refLine: l } = r;
325
- let t = r.name;
326
- t.includes("(") && (t = t.slice(0, t.indexOf("("))), t = t.replace(/(.)/g, "$1 ");
327
- const h = new m({
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: [l]
353
+ paths: [u]
331
354
  },
332
355
  attributes: {
333
- ObjectID: c++,
334
- roadId: d,
335
- roadName: t
356
+ ObjectID: h++,
357
+ roadId: n,
358
+ roadName: c
336
359
  }
337
360
  });
338
- this.allRefLineGraphics.push(h);
339
- for (const y of r.laneSections) {
340
- const g = Number(y.id);
341
- for (const u of y.lanePaths) {
342
- const p = Number(u.id);
343
- if (p === 0)
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 D = u.type, f = u.innerPath.concat(
346
- u.outerPath.reverse()
368
+ const k = p.type, g = p.innerPath.concat(
369
+ p.outerPath.reverse()
347
370
  );
348
- if (f.length <= 3) {
349
- console.warn(`lane ${p} has less than 3 points`);
371
+ if (g.length <= 3) {
372
+ console.warn(`lane ${y} has less than 3 points`);
350
373
  continue;
351
374
  }
352
- f.push(u.innerPath[0]);
353
- const w = new b({
354
- rings: [f]
375
+ g.push(p.innerPath[0]);
376
+ const v = new C({
377
+ rings: [g]
355
378
  });
356
- if (w) {
357
- const F = new m({
358
- geometry: w,
379
+ if (v) {
380
+ const I = new d({
381
+ geometry: v,
359
382
  attributes: {
360
- ObjectID: c++,
361
- id: `${d}+${g}+${p}`,
362
- roadId: d,
383
+ ObjectID: h++,
384
+ id: `${n}+${b}+${y}`,
385
+ roadId: n,
363
386
  roadName: r.name,
364
- sectionId: g,
365
- laneId: p,
366
- type: D,
387
+ sectionId: b,
388
+ laneId: y,
389
+ type: k,
367
390
  sumoId: ""
368
391
  }
369
392
  });
370
- this.allLaneGraphics.push(F);
393
+ this.allLaneGraphics.push(I), l.push(I);
371
394
  }
372
395
  }
373
396
  }
374
397
  }
375
- this.view.type === "2d" ? this.view.goTo(this.allRefLineGraphics) : this.view.goTo(this.allRefLineGraphics);
376
- const s = setInterval(() => {
377
- if (this.allLaneGraphics.length > 0 || this.allRefLineGraphics.length > 0) {
378
- if (this.allLaneGraphics.length > 0) {
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(s), o();
413
+ clearInterval(a), t();
392
414
  }, 10);
393
415
  });
394
416
  }
395
- async showJunction(e) {
417
+ showJunction(e) {
418
+ const o = [];
396
419
  for (const i of e) {
397
- const n = new b({
398
- rings: [i.outline]
399
- }), a = new m({
400
- geometry: n,
401
- attributes: {
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: "simple-fill",
407
- color: [47, 79, 79, 0.8],
408
- style: "solid",
409
- outline: {
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
- this.junctionLayer.add(a);
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
- const e = await this.laneLayer.queryFeatures();
420
- e.features.length > 0 && this.laneLayer.applyEdits({
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: i } = e, n = e.flash === void 0 ? !0 : e.flash, a = i.split("+");
431
- if (a.length > 2)
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 o = a.length === 2 ? Number(a[1]) : void 0, c = a[0].split("#");
434
- if (c.length > 2)
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 s = c[0];
437
- s.startsWith("-") && (s = s.slice(1));
438
- const r = c.length === 2 ? Number(c[1]) : void 0;
439
- return await this.findLane({ roadsectId: s, segmentId: r, laneId: o, flash: n });
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: i, laneId: n } = e;
448
- const { roadsectId: a } = e, o = this.laneLayer.createQuery();
449
- o.returnGeometry = !0, o.outFields = ["*"], o.where = `roadId = '${a}'`;
450
- const c = await this.laneLayer.queryFeatures(o);
451
- if (c.features.length === 0)
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
- let s = c.features;
454
- if (i !== void 0) {
455
- const l = [];
456
- if (s.forEach((t) => {
457
- const h = Number(t.attributes.sectionId);
458
- l.indexOf(h) === -1 && l.push(h);
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
- i = l[i], s = s.filter(
462
- (t) => Number(t.attributes.sectionId) === i
615
+ o = a[o], t = t.filter(
616
+ (r) => Number(r.attributes.sectionId) === o
463
617
  );
464
618
  }
465
- if (n !== void 0) {
466
- const l = [];
467
- if (s.forEach((t) => {
468
- const h = Number(t.attributes.laneId);
469
- l.indexOf(h) === -1 && l.push(h);
470
- }), l.sort((t, h) => t - h), n > l.length - 1)
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
- n = l[n], s = s.filter(
473
- (t) => Number(t.attributes.laneId) === n
626
+ i = a[i], t = t.filter(
627
+ (r) => Number(r.attributes.laneId) === i
474
628
  );
475
629
  }
476
- const r = s.map(
477
- (l) => l.geometry
478
- ), d = await G.union(r);
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 l = new m({
482
- geometry: d,
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(l);
494
- let t = 0, h = !0;
495
- const y = setInterval(() => {
496
- h ? (this.highlightLayer.opacity -= 0.02, this.highlightLayer.opacity <= 0.1 && (h = !1, t++)) : (this.highlightLayer.opacity += 0.02, this.highlightLayer.opacity >= 1 && (h = !0)), t > 5 && (this.highlightLayer.removeAll(), this.highlightLayer.opacity = 1, clearInterval(y));
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 this.view.type === "2d" ? await this.view.goTo(d, { duration: 1e3 }) : await this.view.goTo(d, { duration: 1e3 }), { status: 0, message: "ok" };
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
- I as default
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;
@@ -35,6 +35,8 @@ export default class Road {
35
35
  * @returns
36
36
  */
37
37
  getLastLaneSection(): LaneSection;
38
+ getLaneSectionIndex(s: number): number;
39
+ getLaneSectionLength(s: number): number;
38
40
  /**
39
41
  * 是否是最后一个路段的里程值
40
42
  * @param s
@@ -1,10 +1,10 @@
1
- import a from "../common-utils.mjs";
2
- import h from "./lane-section.mjs";
3
- class g {
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 = a.getStdVecEntries(e.ref_line, !0);
7
- this.refLine = a.transformLineProjection(t);
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
- a.getStdVecEntries(
16
+ h.getStdVecEntries(
17
17
  e.odr_lanesections,
18
18
  !0
19
19
  ).forEach((i) => {
20
- const o = new h(i, this);
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
- g as default
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
  }