gisviewer-vue3-arcgis 1.0.122 → 1.0.124

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.
Files changed (27) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +5 -0
  2. package/es/src/gis-map/gis-map.vue.mjs +103 -97
  3. package/es/src/gis-map/index.d.ts +4 -0
  4. package/es/src/gis-map/style/index.css +1 -1
  5. package/es/src/gis-map/utils/custom-layer/custom-wmts-layer.d.ts +6 -0
  6. package/es/src/gis-map/utils/custom-layer/custom-wmts-layer.mjs +21 -0
  7. package/es/src/gis-map/utils/map-initializer.mjs +43 -33
  8. package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +1 -0
  9. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +128 -116
  10. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +20 -0
  11. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +34 -0
  12. package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +15 -0
  13. package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +171 -0
  14. package/lib/src/gis-map/gis-map.vue.d.ts +5 -0
  15. package/lib/src/gis-map/gis-map.vue.js +1 -1
  16. package/lib/src/gis-map/index.d.ts +4 -0
  17. package/lib/src/gis-map/style/index.css +1 -1
  18. package/lib/src/gis-map/utils/custom-layer/custom-wmts-layer.d.ts +6 -0
  19. package/lib/src/gis-map/utils/custom-layer/custom-wmts-layer.js +1 -0
  20. package/lib/src/gis-map/utils/map-initializer.js +1 -1
  21. package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +1 -0
  22. package/lib/src/gis-map/utils/open-drive-renderer/index.js +4 -2
  23. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +20 -0
  24. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -0
  25. package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +15 -0
  26. package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -0
  27. package/package.json +3 -1
@@ -3,14 +3,19 @@ import * as D from "@arcgis/core/core/promiseUtils";
3
3
  import { Polygon as N } from "@arcgis/core/geometry";
4
4
  import * as k from "@arcgis/core/geometry/geometryEngineAsync";
5
5
  import C from "@arcgis/core/layers/FeatureLayer";
6
- import m from "@arcgis/core/layers/GraphicsLayer";
7
- import f from "axios";
6
+ import f from "@arcgis/core/layers/GraphicsLayer";
7
+ import g from "axios";
8
+ import F from "md5";
8
9
  import G from "pako";
9
10
  import j from "../common-utils.mjs";
10
- import F from "./wasm-loader.mjs";
11
+ import A from "./wasm-loader.mjs";
11
12
  class S {
12
13
  constructor(t) {
13
- this.wasmLoader = F.getInstance(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.currentJunctionId = "", this.view = t, this.laneLayer = new C({
14
+ this.wasmLoader = A.getInstance(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.currentJunctionId = "", this.view = t, this.view.popup.visibleElements = {
15
+ closeButton: !1,
16
+ collapseButton: !1,
17
+ actionBar: !1
18
+ }, this.laneLayer = new C({
14
19
  id: "OpenDriveLane",
15
20
  fields: [
16
21
  {
@@ -268,7 +273,7 @@ class S {
268
273
  }
269
274
  }
270
275
  ]
271
- }), this.junctionLayer = new m({ id: "OpenDriveJunction" }), this.sectionLayer = new m({ id: "OpenDriveSection" }), this.highlightLayer = new m({ id: "OpenDriveHighlight" }), this.flashLayer = new m({ id: "OpenDriveFlash" }), this.view.map.addMany([
276
+ }), this.junctionLayer = new f({ id: "OpenDriveJunction" }), this.sectionLayer = new f({ id: "OpenDriveSection" }), this.highlightLayer = new f({ id: "OpenDriveHighlight" }), this.flashLayer = new f({ id: "OpenDriveFlash" }), this.view.map.addMany([
272
277
  this.laneLayer,
273
278
  this.junctionLayer,
274
279
  this.sectionLayer,
@@ -280,21 +285,31 @@ class S {
280
285
  static getInstance(t) {
281
286
  return this.instance || (this.instance = new S(t)), this.instance;
282
287
  }
288
+ async makeMd5FromFile(t) {
289
+ const i = await (await fetch(t)).text();
290
+ return F(i);
291
+ }
283
292
  async showOpenDriveFromFile(t) {
284
293
  var h, d;
285
- this.openDriveClickCallback = t.selectedCallback, this.projectName = Date.now().toString(), this.openDriveServer = t.server;
286
- const o = `http://${this.openDriveServer}/api/openDrive/uploadXodr`, i = await f.post(
287
- o,
288
- {},
289
- {
290
- params: {
291
- url: t.file,
292
- projectName: this.projectName
294
+ this.openDriveClickCallback = t.selectedCallback, this.projectName = await this.makeMd5FromFile(t.file), this.openDriveServer = t.server, await this.makeMd5FromFile(t.file);
295
+ const a = `http://${this.openDriveServer}/api/openDrive/uploadXodr`;
296
+ let i;
297
+ try {
298
+ i = await g.post(
299
+ a,
300
+ {},
301
+ {
302
+ params: {
303
+ url: t.file,
304
+ projectName: this.projectName
305
+ }
293
306
  }
294
- }
295
- );
307
+ );
308
+ } catch (u) {
309
+ return { status: -1, message: u.message };
310
+ }
296
311
  if (i.status !== 200)
297
- throw new Error(`OpenDriveRenderer: ${i.statusText}`);
312
+ return { status: -1, message: i.statusText };
298
313
  console.time("渲染用时");
299
314
  const s = i.data.result.geoSetting;
300
315
  j.setGeoData(
@@ -304,16 +319,16 @@ class S {
304
319
  );
305
320
  let e = i.data.result.json;
306
321
  e.startsWith(window.location.protocol) || (e = `${window.location.protocol}//${t.server}${e}`);
307
- const r = await (await fetch(e)).arrayBuffer(), n = G.inflate(r, { to: "string" }), a = JSON.parse(n);
322
+ const r = await (await fetch(e)).arrayBuffer(), n = G.inflate(r, { to: "string" }), o = JSON.parse(n);
308
323
  await this.showAllLanes(
309
- a,
324
+ o,
310
325
  ((h = t.options) == null ? void 0 : h.showJunctionLane) || !1,
311
326
  ((d = t.options) == null ? void 0 : d.showRoadName) || !0
312
327
  );
313
328
  const l = i.data.result.junctions;
314
329
  if (this.showJunction(l), t.options && t.options.centerMap !== !1) {
315
- const g = j.transformPointProjection([0, 0]);
316
- await this.view.goTo(g);
330
+ const u = j.transformPointProjection([0, 0]);
331
+ await this.view.goTo(u);
317
332
  }
318
333
  return this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick(), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
319
334
  }
@@ -322,10 +337,10 @@ class S {
322
337
  * @param server
323
338
  * @param projectName
324
339
  */
325
- async showOpenDriveFromServer(t, o) {
326
- const i = `http://${t}/api/openDrive/analyzeXodr`, s = await f.get(i, {
340
+ async showOpenDriveFromServer(t, a) {
341
+ const i = `http://${t}/api/openDrive/analyzeXodr`, s = await g.get(i, {
327
342
  headers: {
328
- projectName: o
343
+ projectName: a
329
344
  },
330
345
  params: {
331
346
  analyze: !1,
@@ -336,10 +351,10 @@ class S {
336
351
  throw new Error(`OpenDriveRenderer: ${s.statusText}`);
337
352
  let e = s.data.result.json;
338
353
  e.startsWith(window.location.protocol) || (e = `${window.location.protocol}//${t}${e}`);
339
- const r = await (await fetch(e)).arrayBuffer(), n = G.inflate(r, { to: "string" }), a = JSON.parse(n);
340
- return await this.showAllLanes(a, !1, !1), { status: 0, message: "ok" };
354
+ const r = await (await fetch(e)).arrayBuffer(), n = G.inflate(r, { to: "string" }), o = JSON.parse(n);
355
+ return await this.showAllLanes(o, !1, !1), { status: 0, message: "ok" };
341
356
  }
342
- async showAllLanes(t, o, i) {
357
+ async showAllLanes(t, a, i) {
343
358
  const s = await this.laneLayer.queryFeatures();
344
359
  return s.features.length > 0 && this.laneLayer.applyEdits({
345
360
  deleteFeatures: s.features
@@ -347,13 +362,13 @@ class S {
347
362
  let c = 0;
348
363
  this.allLaneGraphics = [], this.allRefLineGraphics = [];
349
364
  const r = [];
350
- for (const a of t) {
351
- if (!o && a.junction !== "-1")
365
+ for (const o of t) {
366
+ if (!a && o.junction !== "-1")
352
367
  continue;
353
- const { id: l, refLine: h } = a;
354
- let d = a.name;
368
+ const { id: l, refLine: h } = o;
369
+ let d = o.name;
355
370
  d.includes("(") && (d = d.slice(0, d.indexOf("("))), d = d.replace(/(.)/g, "$1 ");
356
- const g = new p({
371
+ const u = new p({
357
372
  geometry: {
358
373
  type: "polyline",
359
374
  paths: [h]
@@ -364,39 +379,39 @@ class S {
364
379
  roadName: d
365
380
  }
366
381
  });
367
- this.allRefLineGraphics.push(g);
368
- for (const v of a.laneSections) {
382
+ this.allRefLineGraphics.push(u);
383
+ for (const v of o.laneSections) {
369
384
  const b = Number(v.id);
370
- for (const u of v.lanePaths) {
371
- const y = Number(u.id);
372
- if (y === 0)
385
+ for (const y of v.lanePaths) {
386
+ const m = Number(y.id);
387
+ if (m === 0)
373
388
  continue;
374
- const O = u.type, w = u.innerPath.concat(
375
- u.outerPath.reverse()
389
+ const O = y.type, w = y.innerPath.concat(
390
+ y.outerPath.reverse()
376
391
  );
377
392
  if (w.length <= 3) {
378
- console.warn(`lane ${y} has less than 3 points`);
393
+ console.warn(`lane ${m} has less than 3 points`);
379
394
  continue;
380
395
  }
381
- w.push(u.innerPath[0]);
382
- const L = new N({
396
+ w.push(y.innerPath[0]);
397
+ const I = new N({
383
398
  rings: [w]
384
399
  });
385
- if (L) {
386
- const I = new p({
387
- geometry: L,
400
+ if (I) {
401
+ const L = new p({
402
+ geometry: I,
388
403
  attributes: {
389
404
  ObjectID: c++,
390
- id: `${l}+${b}+${y}`,
405
+ id: `${l}+${b}+${m}`,
391
406
  roadId: l,
392
- roadName: a.name,
407
+ roadName: o.name,
393
408
  sectionId: b,
394
- laneId: y,
409
+ laneId: m,
395
410
  type: O,
396
411
  sumoId: ""
397
412
  }
398
413
  });
399
- this.allLaneGraphics.push(I), r.push(I);
414
+ this.allLaneGraphics.push(L), r.push(L);
400
415
  }
401
416
  }
402
417
  }
@@ -404,15 +419,15 @@ class S {
404
419
  const n = setInterval(() => {
405
420
  if (r.length > 0 || this.allRefLineGraphics.length > 0) {
406
421
  if (r.length > 0) {
407
- const a = r.splice(0, 100);
422
+ const o = r.splice(0, 100);
408
423
  this.laneLayer.applyEdits({
409
- addFeatures: a
424
+ addFeatures: o
410
425
  });
411
426
  }
412
427
  if (this.allRefLineGraphics.length > 0) {
413
- const a = this.allRefLineGraphics.splice(0, 10);
428
+ const o = this.allRefLineGraphics.splice(0, 10);
414
429
  this.roadNameLayer.applyEdits({
415
- addFeatures: a
430
+ addFeatures: o
416
431
  });
417
432
  }
418
433
  } else
@@ -421,7 +436,7 @@ class S {
421
436
  });
422
437
  }
423
438
  showJunction(t) {
424
- const o = [];
439
+ const a = [];
425
440
  for (const i of t) {
426
441
  i.nodeType = i.type;
427
442
  const s = new p({
@@ -437,28 +452,28 @@ class S {
437
452
  },
438
453
  symbol: {
439
454
  type: "picture-marker",
440
- url: i.crossId ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/normal-cross.png",
455
+ url: i.crossId ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png",
441
456
  width: 30,
442
457
  height: 30
443
458
  }
444
459
  });
445
- o.push(s);
460
+ a.push(s);
446
461
  }
447
- this.junctionLayer.addMany(o);
462
+ this.junctionLayer.addMany(a);
448
463
  }
449
464
  /**
450
465
  * 监听鼠标移动事件,高亮显示鼠标所在路段和路口
451
466
  */
452
467
  monitorMouseMove() {
453
- const t = D.debounce(async (o) => {
468
+ const t = D.debounce(async (a) => {
454
469
  var c;
455
- const s = (c = (await this.view.hitTest(o, {
470
+ const s = (c = (await this.view.hitTest(a, {
456
471
  include: [this.laneLayer, this.junctionLayer]
457
472
  })).results) == null ? void 0 : c.filter(
458
473
  (r) => r.type === "graphic"
459
474
  );
460
475
  if (s.length === 0) {
461
- this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll());
476
+ this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = "", this.view.closePopup());
462
477
  return;
463
478
  }
464
479
  const e = s[0];
@@ -469,20 +484,20 @@ class S {
469
484
  ) >= 0)
470
485
  return;
471
486
  this.currentSectionCode = r;
472
- const a = this.allLaneGraphics.filter(
487
+ const o = this.allLaneGraphics.filter(
473
488
  (h) => `${h.attributes.roadId}+${h.attributes.sectionId}` === r
474
489
  ), l = await k.union(
475
- a.map((h) => h.geometry)
490
+ o.map((h) => h.geometry)
476
491
  );
477
492
  this.highlightGraphic = new p({
478
493
  geometry: l,
479
494
  symbol: {
480
495
  type: "simple-fill",
481
- color: [255, 0, 0, 0.5],
496
+ color: [0, 255, 255, 0.5],
482
497
  style: "solid",
483
498
  outline: {
484
- color: "red",
485
- width: 2
499
+ color: [0, 255, 255],
500
+ width: 1
486
501
  }
487
502
  },
488
503
  attributes: {
@@ -492,29 +507,23 @@ class S {
492
507
  }
493
508
  }), this.highlightLayer.removeAll(), this.highlightLayer.add(this.highlightGraphic);
494
509
  } else if (e.layer.id === "OpenDriveJunction") {
495
- const r = this.hitGraphic.attributes.id;
510
+ const r = this.hitGraphic.getAttribute("id");
496
511
  if (r === this.currentJunctionId)
497
512
  return;
498
513
  this.currentJunctionId = r;
499
- const n = new p({
500
- geometry: this.hitGraphic.geometry,
501
- symbol: {
502
- type: "text",
503
- color: "black",
504
- backgroundColor: "gray",
505
- text: `${this.hitGraphic.attributes.name}
506
- ${this.hitGraphic.attributes.id}`,
507
- font: {
508
- size: 10
509
- },
510
- yoffset: 40
511
- }
514
+ const n = this.hitGraphic.getAttribute("name"), o = this.hitGraphic.getAttribute("crossId");
515
+ this.view.popup.open({
516
+ title: n,
517
+ content: `<table>
518
+ <tr><td>路口编号</td><td>${r}</td></tr>
519
+ <tr><td>信号机编号</td><td>${o || "无信控"}</td></tr>
520
+ </table>`,
521
+ location: this.hitGraphic.geometry
512
522
  });
513
- this.highlightLayer.removeAll(), this.highlightLayer.add(n);
514
523
  }
515
524
  });
516
- this.mouseMoveHandler = this.view.on("pointer-move", async (o) => {
517
- t(o).catch(() => {
525
+ this.mouseMoveHandler = this.view.on("pointer-move", async (a) => {
526
+ t(a).catch(() => {
518
527
  });
519
528
  });
520
529
  }
@@ -522,19 +531,19 @@ ${this.hitGraphic.attributes.id}`,
522
531
  * 监听鼠标点击事件,获取高亮要素的拓扑信息
523
532
  */
524
533
  monitorMouseClick() {
525
- const t = D.debounce(async (o) => {
534
+ const t = D.debounce(async (a) => {
526
535
  var n;
527
- const s = (n = (await this.view.hitTest(o, {
536
+ const s = (n = (await this.view.hitTest(a, {
528
537
  include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
529
538
  })).results) == null ? void 0 : n.filter(
530
- (a) => a.type === "graphic"
539
+ (o) => o.type === "graphic"
531
540
  );
532
541
  if (s.length === 0)
533
542
  return;
534
543
  const e = s[0].graphic, c = e.getAttribute("type"), r = e.getAttribute("id");
535
544
  if (c === "OpenDriveJunction")
536
545
  if (e.getAttribute("selected") === !1) {
537
- const a = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, l = await f.get(a, {
546
+ const o = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, l = await g.get(o, {
538
547
  params: {
539
548
  id: r,
540
549
  projectName: this.projectName
@@ -545,12 +554,15 @@ ${this.hitGraphic.attributes.id}`,
545
554
  id: r,
546
555
  details: l.data.result
547
556
  }), e.setAttribute("selected", !0), e.symbol.url = "/GisViewerAssets/Images/point_red.png", this.increasePictureMarkerSize(e, 50));
548
- } else
557
+ } else {
549
558
  this.openDriveClickCallback && this.openDriveClickCallback({
550
559
  type: "OpenDriveJunction",
551
560
  id: r,
552
561
  details: void 0
553
- }), e.setAttribute("selected", !1), e.symbol.url = "/GisViewerAssets/Images/point_green.png", this.decreasePictureMarkerSize(e, 30);
562
+ }), e.setAttribute("selected", !1);
563
+ const o = e.getAttribute("crossId");
564
+ e.symbol.url = o ? "/GisViewerAssets/Images/point_green.png" : "/GisViewerAssets/Images/point_yellow.png", this.decreasePictureMarkerSize(e, 30);
565
+ }
554
566
  else if (c === "OpenDriveSection")
555
567
  if (e.getAttribute("selected"))
556
568
  this.sectionLayer.remove(e), this.openDriveClickCallback && this.openDriveClickCallback({
@@ -560,7 +572,7 @@ ${this.hitGraphic.attributes.id}`,
560
572
  });
561
573
  else {
562
574
  this.highlightLayer.remove(e), this.sectionLayer.add(e), e.setAttribute("selected", !0);
563
- const a = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, l = await f.get(a, {
575
+ const o = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, l = await g.get(o, {
564
576
  params: {
565
577
  id: r,
566
578
  projectName: this.projectName
@@ -573,15 +585,15 @@ ${this.hitGraphic.attributes.id}`,
573
585
  });
574
586
  }
575
587
  });
576
- this.mouseClickHandler = this.view.on("immediate-click", async (o) => {
577
- t(o).catch(() => {
588
+ this.mouseClickHandler = this.view.on("immediate-click", async (a) => {
589
+ t(a).catch(() => {
578
590
  });
579
591
  });
580
592
  }
581
- increasePictureMarkerSize(t, o) {
593
+ increasePictureMarkerSize(t, a) {
582
594
  const i = setInterval(() => {
583
595
  const s = t.symbol, e = s.width;
584
- e < o ? t.symbol = {
596
+ e < a ? t.symbol = {
585
597
  type: "picture-marker",
586
598
  url: s.url,
587
599
  width: e + 1,
@@ -589,10 +601,10 @@ ${this.hitGraphic.attributes.id}`,
589
601
  } : clearInterval(i);
590
602
  }, 20);
591
603
  }
592
- decreasePictureMarkerSize(t, o) {
604
+ decreasePictureMarkerSize(t, a) {
593
605
  const i = setInterval(() => {
594
606
  const s = t.symbol, e = s.width;
595
- e > o ? t.symbol = {
607
+ e > a ? t.symbol = {
596
608
  type: "picture-marker",
597
609
  url: s.url,
598
610
  width: e - 1,
@@ -604,13 +616,13 @@ ${this.hitGraphic.attributes.id}`,
604
616
  * 清除OpenDrive内容
605
617
  */
606
618
  async clearOpenDrive() {
607
- var o, i;
619
+ var a, i;
608
620
  let t = await this.laneLayer.queryFeatures();
609
621
  t.features.length > 0 && await this.laneLayer.applyEdits({
610
622
  deleteFeatures: t.features
611
623
  }), t = await this.roadNameLayer.queryFeatures(), t.features.length > 0 && await this.roadNameLayer.applyEdits({
612
624
  deleteFeatures: t.features
613
- }), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.wasmLoader.clear(), (o = this.mouseMoveHandler) == null || o.remove(), (i = this.mouseClickHandler) == null || i.remove();
625
+ }), this.highlightLayer.removeAll(), this.junctionLayer.removeAll(), this.wasmLoader.clear(), (a = this.mouseMoveHandler) == null || a.remove(), (i = this.mouseClickHandler) == null || i.remove();
614
626
  }
615
627
  /**
616
628
  * 用sumo的id定位车道、基本段、路段
@@ -618,28 +630,28 @@ ${this.hitGraphic.attributes.id}`,
618
630
  * @returns
619
631
  */
620
632
  async findSumo(t) {
621
- const { type: o, id: i } = t, s = t.flash === void 0 ? !0 : t.flash;
622
- if (o === "junction")
633
+ const { type: a, id: i } = t, s = t.flash === void 0 ? !0 : t.flash;
634
+ if (a === "junction")
623
635
  return await this.findJunction(i, s);
624
- if (o === "edge") {
636
+ if (a === "edge") {
625
637
  const e = i.split("+");
626
638
  if (e.length > 2)
627
639
  return { status: -1, message: "id格式错误" };
628
640
  const c = e.length === 2 ? Number(e[1]) : void 0, r = e[0].split("#");
629
641
  if (r.length > 2)
630
642
  return { status: -1, message: "id格式错误" };
631
- const n = r[0], a = r.length === 2 ? Number(r[1]) : void 0;
632
- return await this.findLane({ roadsectId: n, segmentId: a, laneId: c, flash: s });
643
+ const n = r[0], o = r.length === 2 ? Number(r[1]) : void 0;
644
+ return await this.findLane({ roadsectId: n, segmentId: o, laneId: c, flash: s });
633
645
  } else
634
646
  return { status: -1, message: "未知类型" };
635
647
  }
636
- async findJunction(t, o) {
648
+ async findJunction(t, a) {
637
649
  const i = this.junctionLayer.graphics.find(
638
650
  (s) => s.attributes.id === t
639
651
  );
640
652
  if (!i)
641
653
  return { status: -1, message: "未找到。请检查路口编号" };
642
- if (o) {
654
+ if (a) {
643
655
  const s = new p({
644
656
  geometry: i.geometry,
645
657
  symbol: {
@@ -663,33 +675,33 @@ ${this.hitGraphic.attributes.id}`,
663
675
  * @returns
664
676
  */
665
677
  async findLane(t) {
666
- let { roadsectId: o, segmentId: i, laneId: s } = t;
667
- o.startsWith("-") && (o = o.slice(1));
678
+ let { roadsectId: a, segmentId: i, laneId: s } = t;
679
+ a.startsWith("-") && (a = a.slice(1));
668
680
  let e = this.allLaneGraphics.filter(
669
- (n) => n.attributes.roadId === o
681
+ (n) => n.attributes.roadId === a
670
682
  );
671
683
  if (e.length === 0)
672
684
  return { status: -1, message: "未找到。请检查路段编号" };
673
685
  if (i !== void 0) {
674
686
  const n = [];
675
- if (e.forEach((a) => {
676
- const l = Number(a.attributes.sectionId);
687
+ if (e.forEach((o) => {
688
+ const l = Number(o.attributes.sectionId);
677
689
  n.indexOf(l) === -1 && n.push(l);
678
- }), n.sort((a, l) => a - l), i > n.length - 1)
690
+ }), n.sort((o, l) => o - l), i > n.length - 1)
679
691
  return { status: -1, message: "未找到。请检查基本段编号" };
680
692
  i = n[i], e = e.filter(
681
- (a) => Number(a.attributes.sectionId) === i
693
+ (o) => Number(o.attributes.sectionId) === i
682
694
  );
683
695
  }
684
696
  if (s !== void 0) {
685
697
  const n = [];
686
- if (e.forEach((a) => {
687
- const l = Number(a.attributes.laneId);
698
+ if (e.forEach((o) => {
699
+ const l = Number(o.attributes.laneId);
688
700
  n.indexOf(l) === -1 && n.push(l);
689
- }), n.sort((a, l) => a - l), s > n.length - 1)
701
+ }), n.sort((o, l) => o - l), s > n.length - 1)
690
702
  return { status: -1, message: "未找到。请检查车道编号" };
691
703
  s = n[s], e = e.filter(
692
- (a) => Number(a.attributes.laneId) === s
704
+ (o) => Number(o.attributes.laneId) === s
693
705
  );
694
706
  }
695
707
  const c = e.map(
@@ -714,9 +726,9 @@ ${this.hitGraphic.attributes.id}`,
714
726
  }
715
727
  flashGraphic(t) {
716
728
  this.flashLayer.removeAll(), this.flashLayer.add(t);
717
- let o = 0, i = !0;
729
+ let a = 0, i = !0;
718
730
  const s = setInterval(() => {
719
- i ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (i = !1, o++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (i = !0)), o >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(s));
731
+ i ? (this.flashLayer.opacity -= 0.02, this.flashLayer.opacity <= 0.1 && (i = !1, a++)) : (this.flashLayer.opacity += 0.02, this.flashLayer.opacity >= 1 && (i = !0)), a >= 5 && (this.flashLayer.removeAll(), this.flashLayer.opacity = 1, clearInterval(s));
720
732
  }, 10);
721
733
  }
722
734
  async splitLane(t) {
@@ -0,0 +1,20 @@
1
+ interface ICross {
2
+ id: string;
3
+ name: string;
4
+ parentId: string;
5
+ latitude: number;
6
+ longitude: number;
7
+ }
8
+ export default class DistrictController {
9
+ id: string;
10
+ name: string;
11
+ parentId: string;
12
+ crosses: ICross[];
13
+ subDistricts: DistrictController[];
14
+ areaColor: number[];
15
+ crossCount: number;
16
+ subDistrictCount: number;
17
+ constructor(params: any);
18
+ getAllCrossCoordinates(): number[][];
19
+ }
20
+ export {};
@@ -0,0 +1,34 @@
1
+ class i {
2
+ constructor(t) {
3
+ this.crosses = [], this.subDistricts = [], this.areaColor = [
4
+ Math.floor(Math.random() * 255),
5
+ Math.floor(Math.random() * 255),
6
+ Math.floor(Math.random() * 255)
7
+ ], this.crossCount = 0, this.subDistrictCount = 0, this.id = t.id, this.name = t.name, this.parentId = t.parentId;
8
+ for (const s of t.children)
9
+ if (s.children) {
10
+ const o = new i(s);
11
+ o.areaColor = this.areaColor, this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
12
+ } else {
13
+ const o = {
14
+ id: s.id,
15
+ name: s.name,
16
+ parentId: s.parentId,
17
+ latitude: s.latitude,
18
+ longitude: s.longitude
19
+ };
20
+ this.crosses.push(o), this.crossCount++;
21
+ }
22
+ }
23
+ getAllCrossCoordinates() {
24
+ const t = [];
25
+ for (const s of this.crosses)
26
+ t.push([s.longitude, s.latitude]);
27
+ for (const s of this.subDistricts)
28
+ t.push(...s.getAllCrossCoordinates());
29
+ return t;
30
+ }
31
+ }
32
+ export {
33
+ i as default
34
+ };
@@ -0,0 +1,15 @@
1
+ import { IResult } from '../../../types';
2
+ export default class SignalControlAreaController {
3
+ private view;
4
+ private districtControllerLayer;
5
+ private subDistrictControllerLayer;
6
+ private crossLayer;
7
+ private eventHandle?;
8
+ constructor(view: __esri.MapView | __esri.SceneView);
9
+ showSignalControlArea(params: any): IResult;
10
+ clearSignalControlArea(): IResult;
11
+ locateSignalControlArea(params: {
12
+ id: string;
13
+ }): IResult;
14
+ private drawArea;
15
+ }