gisviewer-vue3-arcgis 1.0.119 → 1.0.121

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,141 @@ 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(
285
+ o,
286
+ {},
287
+ {
288
+ params: {
289
+ url: e.file,
290
+ projectName: this.projectName
291
+ }
292
+ }
293
+ );
294
+ if (i.status !== 200)
295
+ throw new Error(`OpenDriveRenderer: ${i.statusText}`);
284
296
  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,
297
+ const s = i.data.result.geoSetting;
298
+ S.setGeoData(
299
+ s.geoReference,
300
+ s.offsetX,
301
+ s.offsetY
302
+ );
303
+ let t = i.data.result.json;
304
+ t.startsWith(window.location.protocol) || (t = `${window.location.protocol}//${e.server}${t}`);
305
+ const l = await (await fetch(t)).arrayBuffer(), a = j.inflate(l, { to: "string" }), r = JSON.parse(a);
306
+ await this.showAllLanes(
307
+ r,
308
+ ((u = e.options) == null ? void 0 : u.showJunctionLane) || !1,
289
309
  ((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" };
310
+ );
311
+ const n = i.data.result.junctions;
312
+ if (this.showJunction(n), e.options && e.options.centerMap !== !1) {
313
+ const m = S.transformPointProjection([0, 0]);
314
+ await this.view.goTo(m);
315
+ }
316
+ return this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick(), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
291
317
  }
292
318
  /**
293
319
  * 从服务器载入OpenDrive文件解析结果并显示
294
320
  * @param server
295
321
  * @param projectName
296
322
  */
297
- async showOpenDriveFromServer(e, i) {
298
- const n = `http://${e}/api/openDrive/analyzeXodr`, a = await O.get(n, {
323
+ async showOpenDriveFromServer(e, o) {
324
+ const i = `http://${e}/api/openDrive/analyzeXodr`, s = await f.get(i, {
299
325
  headers: {
300
- projectName: i
326
+ projectName: o
301
327
  },
302
328
  params: {
303
329
  analyze: !1,
304
330
  compressed: !0
305
331
  }
306
332
  });
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" };
333
+ if (s.status !== 200)
334
+ throw new Error(`OpenDriveRenderer: ${s.statusText}`);
335
+ let t = s.data.result.json;
336
+ t.startsWith(window.location.protocol) || (t = `${window.location.protocol}//${e}${t}`);
337
+ const l = await (await fetch(t)).arrayBuffer(), a = j.inflate(l, { to: "string" }), r = JSON.parse(a);
338
+ return await this.showAllLanes(r, !1, !1), { status: 0, message: "ok" };
313
339
  }
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;
340
+ async showAllLanes(e, o, i) {
341
+ const s = await this.laneLayer.queryFeatures();
342
+ return s.features.length > 0 && this.laneLayer.applyEdits({
343
+ deleteFeatures: s.features
344
+ }), this.roadNameLayer.visible = i, new Promise((t) => {
345
+ let h = 0;
320
346
  this.allLaneGraphics = [], this.allRefLineGraphics = [];
347
+ const l = [];
321
348
  for (const r of e) {
322
- if (!i && r.junction !== "-1")
349
+ if (!o && r.junction !== "-1")
323
350
  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({
351
+ const { id: n, refLine: u } = r;
352
+ let c = r.name;
353
+ c.includes("(") && (c = c.slice(0, c.indexOf("("))), c = c.replace(/(.)/g, "$1 ");
354
+ const m = new d({
328
355
  geometry: {
329
356
  type: "polyline",
330
- paths: [l]
357
+ paths: [u]
331
358
  },
332
359
  attributes: {
333
- ObjectID: c++,
334
- roadId: d,
335
- roadName: t
360
+ ObjectID: h++,
361
+ roadId: n,
362
+ roadName: c
336
363
  }
337
364
  });
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)
365
+ this.allRefLineGraphics.push(m);
366
+ for (const w of r.laneSections) {
367
+ const b = Number(w.id);
368
+ for (const p of w.lanePaths) {
369
+ const y = Number(p.id);
370
+ if (y === 0)
344
371
  continue;
345
- const D = u.type, f = u.innerPath.concat(
346
- u.outerPath.reverse()
372
+ const k = p.type, g = p.innerPath.concat(
373
+ p.outerPath.reverse()
347
374
  );
348
- if (f.length <= 3) {
349
- console.warn(`lane ${p} has less than 3 points`);
375
+ if (g.length <= 3) {
376
+ console.warn(`lane ${y} has less than 3 points`);
350
377
  continue;
351
378
  }
352
- f.push(u.innerPath[0]);
353
- const w = new b({
354
- rings: [f]
379
+ g.push(p.innerPath[0]);
380
+ const v = new C({
381
+ rings: [g]
355
382
  });
356
- if (w) {
357
- const F = new m({
358
- geometry: w,
383
+ if (v) {
384
+ const I = new d({
385
+ geometry: v,
359
386
  attributes: {
360
- ObjectID: c++,
361
- id: `${d}+${g}+${p}`,
362
- roadId: d,
387
+ ObjectID: h++,
388
+ id: `${n}+${b}+${y}`,
389
+ roadId: n,
363
390
  roadName: r.name,
364
- sectionId: g,
365
- laneId: p,
366
- type: D,
391
+ sectionId: b,
392
+ laneId: y,
393
+ type: k,
367
394
  sumoId: ""
368
395
  }
369
396
  });
370
- this.allLaneGraphics.push(F);
397
+ this.allLaneGraphics.push(I), l.push(I);
371
398
  }
372
399
  }
373
400
  }
374
401
  }
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);
402
+ const a = setInterval(() => {
403
+ if (l.length > 0 || this.allRefLineGraphics.length > 0) {
404
+ if (l.length > 0) {
405
+ const r = l.splice(0, 100);
380
406
  this.laneLayer.applyEdits({
381
407
  addFeatures: r
382
408
  });
@@ -388,38 +414,170 @@ class I {
388
414
  });
389
415
  }
390
416
  } else
391
- clearInterval(s), o();
417
+ clearInterval(a), t();
392
418
  }, 10);
393
419
  });
394
420
  }
395
- async showJunction(e) {
421
+ showJunction(e) {
422
+ const o = [];
396
423
  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
424
+ const s = new d({
425
+ geometry: {
426
+ type: "point",
427
+ x: i.coordinates[0],
428
+ y: i.coordinates[1]
404
429
  },
430
+ attributes: { ...i, selected: !1 },
405
431
  symbol: {
406
- type: "simple-fill",
407
- color: [47, 79, 79, 0.8],
408
- style: "solid",
409
- outline: {
410
- color: "white",
411
- width: 1
412
- }
432
+ type: "picture-marker",
433
+ url: i.crossId ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/normal-cross.png",
434
+ width: 30,
435
+ height: 30
413
436
  }
414
437
  });
415
- this.junctionLayer.add(a);
438
+ o.push(s);
416
439
  }
440
+ this.junctionLayer.addMany(o);
441
+ }
442
+ /**
443
+ * 监听鼠标移动事件,高亮显示鼠标所在路段和路口
444
+ */
445
+ monitorMouseMove() {
446
+ const e = O.debounce(async (o) => {
447
+ var h;
448
+ const s = (h = (await this.view.hitTest(o, {
449
+ include: [this.laneLayer, this.junctionLayer]
450
+ })).results) == null ? void 0 : h.filter(
451
+ (l) => l.type === "graphic"
452
+ );
453
+ if (s.length === 0) {
454
+ this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll());
455
+ return;
456
+ }
457
+ const t = s[0];
458
+ if (this.hitGraphic = t.graphic, t.layer.id === "OpenDriveLane") {
459
+ const l = `${this.hitGraphic.attributes.roadId}+${this.hitGraphic.attributes.sectionId}`;
460
+ if (l === this.currentSectionCode)
461
+ return;
462
+ this.currentSectionCode = l;
463
+ const a = this.allLaneGraphics.filter(
464
+ (n) => `${n.attributes.roadId}+${n.attributes.sectionId}` === l
465
+ ), r = await L.union(
466
+ a.map((n) => n.geometry)
467
+ );
468
+ this.highlightGraphic = new d({
469
+ geometry: r,
470
+ symbol: {
471
+ type: "simple-fill",
472
+ color: [255, 0, 0, 0.5],
473
+ style: "solid",
474
+ outline: {
475
+ color: "red",
476
+ width: 2
477
+ }
478
+ },
479
+ attributes: {
480
+ type: "OpenDriveSection",
481
+ id: l,
482
+ detail: ""
483
+ }
484
+ }), this.highlightLayer.removeAll(), this.highlightLayer.add(this.highlightGraphic);
485
+ } else if (t.layer.id === "OpenDriveJunction") {
486
+ const l = this.hitGraphic.attributes.id;
487
+ if (l === this.currentJunctionId)
488
+ return;
489
+ this.currentJunctionId = l, this.highlightGraphic = new d({
490
+ geometry: this.hitGraphic.geometry,
491
+ symbol: {
492
+ type: "simple-marker",
493
+ style: "circle",
494
+ size: 40,
495
+ color: [0, 0, 0, 0],
496
+ outline: {
497
+ color: [0, 0, 0, 0]
498
+ }
499
+ },
500
+ attributes: {
501
+ type: "OpenDriveJunction",
502
+ id: l
503
+ }
504
+ });
505
+ const a = new d({
506
+ geometry: this.hitGraphic.geometry,
507
+ symbol: {
508
+ type: "text",
509
+ color: "black",
510
+ backgroundColor: "gray",
511
+ text: `${this.hitGraphic.attributes.name}
512
+ ${this.hitGraphic.attributes.id}`,
513
+ font: {
514
+ size: 10
515
+ },
516
+ yoffset: 40
517
+ }
518
+ });
519
+ this.highlightLayer.removeAll(), this.highlightLayer.addMany([this.highlightGraphic, a]);
520
+ }
521
+ });
522
+ this.mouseMoveHandler = this.view.on("pointer-move", async (o) => {
523
+ e(o).catch(() => {
524
+ });
525
+ });
526
+ }
527
+ /**
528
+ * 监听鼠标点击事件,获取高亮要素的拓扑信息
529
+ */
530
+ monitorMouseClick() {
531
+ this.mouseClickHandler = this.view.on("immediate-click", async () => {
532
+ var e, o;
533
+ if (this.hitGraphic && !this.currentSectionCode) {
534
+ if (this.currentJunctionId)
535
+ if (this.hitGraphic.getAttribute("selected") === !1) {
536
+ const i = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, s = await f.get(i, {
537
+ params: {
538
+ id: this.currentJunctionId,
539
+ projectName: this.projectName
540
+ }
541
+ });
542
+ 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));
543
+ } else
544
+ (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);
545
+ }
546
+ });
417
547
  }
548
+ increasePictureMarkerSize(e, o) {
549
+ const i = setInterval(() => {
550
+ const s = e.symbol, t = s.width;
551
+ t < o ? e.symbol = {
552
+ type: "picture-marker",
553
+ url: s.url,
554
+ width: t + 1,
555
+ height: t + 1
556
+ } : clearInterval(i);
557
+ }, 20);
558
+ }
559
+ decreasePictureMarkerSize(e, o) {
560
+ const i = setInterval(() => {
561
+ const s = e.symbol, t = s.width;
562
+ t > o ? e.symbol = {
563
+ type: "picture-marker",
564
+ url: s.url,
565
+ width: t - 1,
566
+ height: t - 1
567
+ } : clearInterval(i);
568
+ }, 20);
569
+ }
570
+ /**
571
+ * 清除OpenDrive内容
572
+ */
418
573
  async clearOpenDrive() {
419
- const e = await this.laneLayer.queryFeatures();
420
- e.features.length > 0 && this.laneLayer.applyEdits({
574
+ var o, i;
575
+ let e = await this.laneLayer.queryFeatures();
576
+ e.features.length > 0 && await this.laneLayer.applyEdits({
577
+ deleteFeatures: e.features
578
+ }), e = await this.roadNameLayer.queryFeatures(), e.features.length > 0 && await this.roadNameLayer.applyEdits({
421
579
  deleteFeatures: e.features
422
- }), this.wasmLoader.clear();
580
+ }), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.wasmLoader.clear(), (o = this.mouseMoveHandler) == null || o.remove(), (i = this.mouseClickHandler) == null || i.remove();
423
581
  }
424
582
  /**
425
583
  * 用sumo的id定位车道、基本段、路段
@@ -427,16 +585,16 @@ class I {
427
585
  * @returns
428
586
  */
429
587
  async findSumo(e) {
430
- const { id: i } = e, n = e.flash === void 0 ? !0 : e.flash, a = i.split("+");
431
- if (a.length > 2)
588
+ const { id: o } = e, i = e.flash === void 0 ? !0 : e.flash, s = o.split("+");
589
+ if (s.length > 2)
432
590
  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)
591
+ const t = s.length === 2 ? Number(s[1]) : void 0, h = s[0].split("#");
592
+ if (h.length > 2)
435
593
  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 });
594
+ let l = h[0];
595
+ l.startsWith("-") && (l = l.slice(1));
596
+ const a = h.length === 2 ? Number(h[1]) : void 0;
597
+ return await this.findLane({ roadsectId: l, segmentId: a, laneId: t, flash: i });
440
598
  }
441
599
  /**
442
600
  * 用sumo的id定位车道、基本段、路段
@@ -444,42 +602,42 @@ class I {
444
602
  * @returns
445
603
  */
446
604
  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)
605
+ let { segmentId: o, laneId: i } = e;
606
+ const { roadsectId: s } = e;
607
+ let t = this.allLaneGraphics.filter(
608
+ (a) => a.attributes.roadId === s
609
+ );
610
+ if (t.length === 0)
452
611
  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)
612
+ if (o !== void 0) {
613
+ const a = [];
614
+ if (t.forEach((r) => {
615
+ const n = Number(r.attributes.sectionId);
616
+ a.indexOf(n) === -1 && a.push(n);
617
+ }), a.sort((r, n) => r - n), o > a.length - 1)
460
618
  return { status: -1, message: "未找到。请检查基本段编号" };
461
- i = l[i], s = s.filter(
462
- (t) => Number(t.attributes.sectionId) === i
619
+ o = a[o], t = t.filter(
620
+ (r) => Number(r.attributes.sectionId) === o
463
621
  );
464
622
  }
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)
623
+ if (i !== void 0) {
624
+ const a = [];
625
+ if (t.forEach((r) => {
626
+ const n = Number(r.attributes.laneId);
627
+ a.indexOf(n) === -1 && a.push(n);
628
+ }), a.sort((r, n) => r - n), i > a.length - 1)
471
629
  return { status: -1, message: "未找到。请检查车道编号" };
472
- n = l[n], s = s.filter(
473
- (t) => Number(t.attributes.laneId) === n
630
+ i = a[i], t = t.filter(
631
+ (r) => Number(r.attributes.laneId) === i
474
632
  );
475
633
  }
476
- const r = s.map(
477
- (l) => l.geometry
478
- ), d = await G.union(r);
634
+ const h = t.map(
635
+ (a) => a.geometry
636
+ ), l = await L.union(h);
479
637
  if (e.flash) {
480
638
  this.highlightLayer.removeAll();
481
- const l = new m({
482
- geometry: d,
639
+ const a = new d({
640
+ geometry: l,
483
641
  symbol: {
484
642
  type: "simple-fill",
485
643
  color: [255, 0, 0, 0.5],
@@ -490,18 +648,18 @@ class I {
490
648
  }
491
649
  }
492
650
  });
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));
651
+ this.highlightLayer.add(a);
652
+ let r = 0, n = !0;
653
+ const u = setInterval(() => {
654
+ 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
655
  }, 20);
498
656
  }
499
- return this.view.type === "2d" ? await this.view.goTo(d, { duration: 1e3 }) : await this.view.goTo(d, { duration: 1e3 }), { status: 0, message: "ok" };
657
+ return await this.view.goTo(l, { duration: 1e3 }), { status: 0, message: "ok" };
500
658
  }
501
659
  async splitLane(e) {
502
660
  return { status: 0, message: "ok", result: e };
503
661
  }
504
662
  }
505
663
  export {
506
- I as default
664
+ N as default
507
665
  };
@@ -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
  }