gisviewer-vue3-arcgis 1.0.129 → 1.0.131

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.
@@ -79,7 +79,13 @@ declare const _sfc_main: import("vue").DefineComponent<{
79
79
  splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
80
80
  showSignalControlArea: (params: any) => import("../types").IResult;
81
81
  clearSignalControlArea: () => void;
82
- locateSignalControlArea: (params: any) => import("../types").IResult;
82
+ locateSignalControlArea: (params: {
83
+ id: string;
84
+ }) => Promise<import("../types").IResult>;
85
+ highlightSignalControlArea: (params: {
86
+ id: string;
87
+ }) => Promise<import("../types").IResult>;
88
+ resetHighlightSignalControlArea: () => import("../types").IResult;
83
89
  props: any;
84
90
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
85
91
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -1,91 +1,93 @@
1
- import { defineComponent as Ce, ref as h, onMounted as he, getCurrentInstance as Oe, computed as Se, openBlock as ke, createElementBlock as De, createElementVNode as p, withDirectives as Te, vShow as Ie } from "vue";
2
- import O, { registerStore as Le } from "./stores/index.mjs";
1
+ import { defineComponent as Ce, ref as S, onMounted as Oe, getCurrentInstance as ke, onUnmounted as Te, computed as Ae, openBlock as De, createElementBlock as Ie, createElementVNode as p, withDirectives as Le, vShow as be } from "vue";
2
+ import C, { registerStore as _e } from "./stores/index.mjs";
3
3
  import "./style/index.css";
4
- import Ae from "./utils/holo-flow/index.mjs";
5
- import be from "./utils/map-initializer.mjs";
6
- import S from "./utils/open-drive-renderer/index.mjs";
7
- import _e from "./utils/overlay.mjs";
8
- import xe from "./utils/queue-length.mjs";
4
+ import He from "./utils/holo-flow/index.mjs";
5
+ import xe from "./utils/map-initializer.mjs";
6
+ import O from "./utils/open-drive-renderer/index.mjs";
7
+ import Me from "./utils/overlay.mjs";
8
+ import Ve from "./utils/queue-length.mjs";
9
9
  import k from "./utils/road-config-tool/index.mjs";
10
- import Me from "./utils/signal-control-area-controller/index.mjs";
11
- import Fe from "./utils/traffic-flow.mjs";
12
- const Ve = { class: "gis-viewer" }, Be = { style: { position: "absolute", bottom: "10px", left: "10px" } }, $e = /* @__PURE__ */ Ce({
10
+ import Be from "./utils/signal-control-area-controller/index.mjs";
11
+ import ze from "./utils/traffic-flow.mjs";
12
+ const Ne = { class: "gis-viewer" }, Qe = { style: { position: "absolute", bottom: "10px", left: "10px" } }, Je = /* @__PURE__ */ Ce({
13
13
  __name: "gis-map",
14
14
  props: {
15
15
  config: {},
16
16
  assetsRoot: {}
17
17
  },
18
18
  emits: ["mapLoaded", "markerClick", "mapClick"],
19
- setup(D, { expose: T, emit: I }) {
20
- const g = h(null);
21
- let s, i, a, o, r, n, m, t, c;
22
- const f = h(!1);
23
- he(async () => {
24
- if (Le(), !g.value)
19
+ setup(T, { expose: A, emit: D }) {
20
+ const g = S(null);
21
+ let i, c, s, n, a, r, u, t, o;
22
+ const f = S(!1);
23
+ Oe(async () => {
24
+ if (_e(), !g.value)
25
25
  return;
26
- document.addEventListener("keydown", (u) => {
27
- u.ctrlKey && u.key === "i" && (f.value = !f.value);
26
+ document.addEventListener("keydown", (m) => {
27
+ m.ctrlKey && m.key === "i" && (f.value = !f.value);
28
28
  });
29
- const e = Oe(), { $gisviewerAssetsRoot: l } = e.appContext.config.globalProperties, C = await (await fetch(y.config)).json();
30
- C.assetsRoot = y.assetsRoot || l;
31
- const de = O.useAppDataStore;
32
- de.mapConfig = C, i = new be(), s = await i.initialize({
29
+ const e = ke(), { $gisviewerAssetsRoot: l } = e.appContext.config.globalProperties, h = await (await fetch(y.config)).json();
30
+ h.assetsRoot = y.assetsRoot || l;
31
+ const he = C.useAppDataStore;
32
+ he.mapConfig = h, c = new xe(), i = await c.initialize({
33
33
  container: g.value,
34
- markerClickCallback: (u, v, d, ye) => {
35
- w("markerClick", u, v, d, ye);
34
+ markerClickCallback: (m, d, v, Se) => {
35
+ w("markerClick", m, d, v, Se);
36
36
  },
37
- mapClickCallback: (u, v, d) => {
38
- w("mapClick", u, v, d);
37
+ mapClickCallback: (m, d, v) => {
38
+ w("mapClick", m, d, v);
39
39
  }
40
- }), r = new Ae(s), await r.init(), w("mapLoaded");
40
+ }), a = new He(i), await a.init(), w("mapLoaded");
41
+ }), Te(() => {
42
+ o == null || o.clearSignalControlArea(), t == null || t.clearOpenDrive(), a == null || a.clearHoloTrace(), a == null || a.clearHoloSignal(), n == null || n.disconnectTrafficFlow();
41
43
  });
42
- const L = Se(() => s), A = () => {
43
- const e = O.useAppDataStore;
44
+ const I = Ae(() => i), L = () => {
45
+ const e = C.useAppDataStore;
44
46
  e.saveTrackLog = !0;
45
47
  }, b = () => {
46
- r.downloadTrackLog();
47
- }, _ = async (e) => await i.setMapCenter(e), x = async (e) => await i.setMapCamera(e), M = async (e) => await i.lookAt(e), F = (e) => i.setLayerVisibility(e), V = (e, l) => i.requestCoordinateTransform(e, l), B = (e) => {
48
- i.cancelCoordinateTransform(e);
49
- }, H = (e) => {
50
- i.setMapZoomRange(e);
51
- }, z = (e) => (a || (a = new k(s)), a.showLaneNumber(e)), N = () => {
52
- a == null || a.clearLaneNumber();
53
- }, Q = async (e) => (a || (a = new k(s)), await a.initializeSearch(e)), j = async () => a == null ? void 0 : a.calCrossIndicatorArea(), P = async () => {
54
- }, R = async (e, l) => {
55
- o || (o = new Fe(s)), o.connectTrafficFlow(e, l);
56
- }, E = () => {
57
- o == null || o.disconnectTrafficFlow();
48
+ a.downloadTrackLog();
49
+ }, _ = async (e) => await c.setMapCenter(e), H = async (e) => await c.setMapCamera(e), x = async (e) => await c.lookAt(e), M = (e) => c.setLayerVisibility(e), V = (e, l) => c.requestCoordinateTransform(e, l), B = (e) => {
50
+ c.cancelCoordinateTransform(e);
51
+ }, z = (e) => {
52
+ c.setMapZoomRange(e);
53
+ }, N = (e) => (s || (s = new k(i)), s.showLaneNumber(e)), Q = () => {
54
+ s == null || s.clearLaneNumber();
55
+ }, j = async (e) => (s || (s = new k(i)), await s.initializeSearch(e)), P = async () => s == null ? void 0 : s.calCrossIndicatorArea(), E = async () => {
56
+ }, F = async (e, l) => {
57
+ n || (n = new ze(i)), n.connectTrafficFlow(e, l);
58
+ }, R = () => {
59
+ n == null || n.disconnectTrafficFlow();
58
60
  }, Z = (e) => {
59
- r.handleVehicleTraceData(e);
61
+ a.handleVehicleTraceData(e);
60
62
  }, q = () => {
61
- r.clearHoloTrace();
63
+ a.clearHoloTrace();
62
64
  }, K = (e) => {
63
- r.setInterpolate(e);
64
- }, $ = async (e) => {
65
- await r.handleSignalData(e);
66
- }, G = () => {
67
- r.clearHoloSignal();
65
+ a.setInterpolate(e);
66
+ }, U = async (e) => {
67
+ await a.handleSignalData(e);
68
+ }, $ = () => {
69
+ a.clearHoloSignal();
70
+ }, G = (e) => {
71
+ n == null || n.toggleTrafficInfo(e), a.toggleTrafficInfo(e);
68
72
  }, J = (e) => {
69
- o == null || o.toggleTrafficInfo(e), r.toggleTrafficInfo(e);
70
- }, U = (e) => {
71
- r.togglePause(e);
73
+ a.togglePause(e);
72
74
  }, W = (e) => {
73
- o == null || o.toggleTrafficObject(e), r.toggleTrafficObject(e);
75
+ n == null || n.toggleTrafficObject(e), a.toggleTrafficObject(e);
74
76
  }, X = (e) => {
75
- r.updatePanelContent(e);
76
- }, Y = async (e) => (n || (n = new _e(s)), n.addOverlays(e)), ee = (e) => n == null ? void 0 : n.removeOverlaysByType(e), te = (e) => n == null ? void 0 : n.removeOverlaysById(e), ne = () => n == null ? void 0 : n.removeAllOverlays(), ae = () => {
77
- n == null || n.showAllOverlays();
78
- }, oe = (e) => {
79
- m || (m = new xe(s)), m.updateQueueLength(e);
80
- }, re = () => {
81
- m == null || m.removeQueueLength();
82
- }, se = async (e, l) => (t || (t = new S(s)), await t.showOpenDriveFromServer(e, l)), ie = async (e) => (t || (t = new S(s)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), ce = async () => await (t == null ? void 0 : t.clearOpenDrive()), le = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
77
+ a.updatePanelContent(e);
78
+ }, Y = async (e) => (r || (r = new Me(i)), r.addOverlays(e)), ee = (e) => r == null ? void 0 : r.removeOverlaysByType(e), te = (e) => r == null ? void 0 : r.removeOverlaysById(e), ae = () => r == null ? void 0 : r.removeAllOverlays(), ne = () => {
79
+ r == null || r.showAllOverlays();
80
+ }, re = (e) => {
81
+ u || (u = new Ve(i)), u.updateQueueLength(e);
82
+ }, oe = () => {
83
+ u == null || u.removeQueueLength();
84
+ }, se = async (e, l) => (t || (t = new O(i)), await t.showOpenDriveFromServer(e, l)), ie = async (e) => (t || (t = new O(i)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), ce = async () => await (t == null ? void 0 : t.clearOpenDrive()), le = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
83
85
  status: -1,
84
86
  message: "未加载OpenDrive地图"
85
- }, me = async (e) => t ? t.selectSumo(e) : {
87
+ }, ue = async (e) => t ? t.selectSumo(e) : {
86
88
  status: -1,
87
89
  message: "未加载OpenDrive地图"
88
- }, ue = async (e) => t ? t.unselectSumo(e) : {
90
+ }, me = async (e) => t ? t.unselectSumo(e) : {
89
91
  status: -1,
90
92
  message: "未加载OpenDrive地图"
91
93
  }, pe = async (e) => t ? await t.getSumoInfo(e) : {
@@ -94,71 +96,73 @@ const Ve = { class: "gis-viewer" }, Be = { style: { position: "absolute", bottom
94
96
  }, ge = async (e) => t ? await (t == null ? void 0 : t.splitLane(e)) : {
95
97
  status: -1,
96
98
  message: "未加载OpenDrive地图"
97
- }, fe = (e) => (c || (c = new Me(s)), c.showSignalControlArea(e)), we = () => {
98
- c == null || c.clearSignalControlArea();
99
- }, ve = (e) => c ? c.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, y = D, w = I;
100
- return T({
101
- mapViewer: L,
102
- setLayerVisibility: F,
99
+ }, fe = (e) => (o || (o = new Be(i)), o.showSignalControlArea(e)), we = () => {
100
+ o == null || o.clearSignalControlArea();
101
+ }, de = async (e) => o ? await o.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, ve = async (e) => o ? await o.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, ye = () => o ? o.resetHighlight() : { status: -1, message: "未加载信号控制区" }, y = T, w = D;
102
+ return A({
103
+ mapViewer: I,
104
+ setLayerVisibility: M,
103
105
  setMapCenter: _,
104
- lookAt: M,
105
- setMapCamera: x,
106
- setMapZoomRange: H,
106
+ lookAt: x,
107
+ setMapCamera: H,
108
+ setMapZoomRange: z,
107
109
  requestCoordinateTransform: V,
108
110
  cancelCoordinateTransform: B,
109
111
  addOverlays: Y,
110
- showAllOverlays: ae,
112
+ showAllOverlays: ne,
111
113
  removeOverlaysByType: ee,
112
114
  removeOverlaysById: te,
113
- removeAllOverlays: ne,
114
- showLaneNumber: z,
115
- clearLaneNumber: N,
116
- initializeAreaTool: Q,
117
- calCrossIndicatorArea: j,
118
- calRoadIndicatorArea: P,
119
- connectCarFlow: R,
120
- disconnectCarFlow: E,
115
+ removeAllOverlays: ae,
116
+ showLaneNumber: N,
117
+ clearLaneNumber: Q,
118
+ initializeAreaTool: j,
119
+ calCrossIndicatorArea: P,
120
+ calRoadIndicatorArea: E,
121
+ connectCarFlow: F,
122
+ disconnectCarFlow: R,
121
123
  handleHoloVehicleTraceData: Z,
122
124
  clearHoloTrace: q,
123
- handleHoloSignalData: $,
124
- clearHoloSignal: G,
125
+ handleHoloSignalData: U,
126
+ clearHoloSignal: $,
125
127
  setInterpolate: K,
126
- toggleTrafficInfo: J,
128
+ toggleTrafficInfo: G,
127
129
  toggleTrafficObject: W,
128
130
  toggleVehicleInfo: X,
129
- togglePause: U,
130
- updateQueueLength: oe,
131
- removeQueueLength: re,
131
+ togglePause: J,
132
+ updateQueueLength: re,
133
+ removeQueueLength: oe,
132
134
  showOpenDriveFromServer: se,
133
135
  showOpenDriveFromFile: ie,
134
136
  clearOpenDrive: ce,
135
137
  findSumoInOpenDrive: le,
136
- selectSumoInOpenDrive: me,
137
- unselectSumoInOpenDrive: ue,
138
+ selectSumoInOpenDrive: ue,
139
+ unselectSumoInOpenDrive: me,
138
140
  getSumoInfo: pe,
139
141
  splitOpenDriveLane: ge,
140
142
  showSignalControlArea: fe,
141
143
  clearSignalControlArea: we,
142
- locateSignalControlArea: ve
143
- }), (e, l) => (ke(), De("div", Ve, [
144
+ locateSignalControlArea: de,
145
+ highlightSignalControlArea: ve,
146
+ resetHighlightSignalControlArea: ye
147
+ }), (e, l) => (De(), Ie("div", Ne, [
144
148
  p("div", {
145
149
  class: "gis-viewer-main",
146
150
  ref_key: "mapContainer",
147
151
  ref: g
148
152
  }, [
149
- Te(p("div", Be, [
153
+ Le(p("div", Qe, [
150
154
  p("button", {
151
155
  style: { "margin-right": "10px" },
152
- onClick: A
156
+ onClick: L
153
157
  }, " 开始记录 "),
154
158
  p("button", { onClick: b }, "下载日志")
155
159
  ], 512), [
156
- [Ie, f.value]
160
+ [be, f.value]
157
161
  ])
158
162
  ], 512)
159
163
  ]));
160
164
  }
161
165
  });
162
166
  export {
163
- $e as default
167
+ Je as default
164
168
  };
@@ -68,7 +68,13 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
68
68
  splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
69
69
  showSignalControlArea: (params: any) => import("../types").IResult;
70
70
  clearSignalControlArea: () => void;
71
- locateSignalControlArea: (params: any) => import("../types").IResult;
71
+ locateSignalControlArea: (params: {
72
+ id: string;
73
+ }) => Promise<import("../types").IResult>;
74
+ highlightSignalControlArea: (params: {
75
+ id: string;
76
+ }) => Promise<import("../types").IResult>;
77
+ resetHighlightSignalControlArea: () => import("../types").IResult;
72
78
  props: any;
73
79
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
74
80
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -58,7 +58,8 @@ class n {
58
58
  this.signalHoloFlow || (this.signalHoloFlow = new a(this.view)), await this.signalHoloFlow.initializeLayer(), await this.signalHoloFlow.handleSignalData(e);
59
59
  }
60
60
  clearHoloSignal() {
61
- this.signalHoloFlow.clearSignal();
61
+ var e;
62
+ (e = this.signalHoloFlow) == null || e.clearSignal();
62
63
  }
63
64
  setInterpolate(e) {
64
65
  this.traceHoloFlow.setInterpolate(e);
@@ -3,7 +3,7 @@ import * as j from "@arcgis/core/core/promiseUtils";
3
3
  import { Polygon as O } from "@arcgis/core/geometry";
4
4
  import * as I from "@arcgis/core/geometry/geometryEngine";
5
5
  import G from "@arcgis/core/layers/FeatureLayer";
6
- import w from "@arcgis/core/layers/GraphicsLayer";
6
+ import b from "@arcgis/core/layers/GraphicsLayer";
7
7
  import m from "axios";
8
8
  import F from "md5";
9
9
  import S from "pako";
@@ -273,7 +273,7 @@ class C {
273
273
  }
274
274
  }
275
275
  ]
276
- }), 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.view.map.addMany([
276
+ }), this.junctionLayer = new b({ id: "OpenDriveJunction" }), this.sectionLayer = new b({ id: "OpenDriveSection" }), this.highlightLayer = new b({ id: "OpenDriveHighlight" }), this.flashLayer = new b({ id: "OpenDriveFlash" }), this.view.map.addMany([
277
277
  this.laneLayer,
278
278
  this.junctionLayer,
279
279
  this.sectionLayer,
@@ -403,14 +403,14 @@ class C {
403
403
  for (let u = 0; u < r.laneSections.length; u++) {
404
404
  const g = r.laneSections[u], L = Number(g.id);
405
405
  for (const y of g.lanePaths) {
406
- const b = Number(y.id);
407
- if (b === 0)
406
+ const w = Number(y.id);
407
+ if (w === 0)
408
408
  continue;
409
409
  const N = y.type, v = y.innerPath.concat(
410
410
  y.outerPath.reverse()
411
411
  );
412
412
  if (v.length <= 3) {
413
- console.warn(`lane ${b} has less than 3 points`);
413
+ console.warn(`lane ${w} has less than 3 points`);
414
414
  continue;
415
415
  }
416
416
  v.push(y.innerPath[0]);
@@ -422,12 +422,12 @@ class C {
422
422
  geometry: D,
423
423
  attributes: {
424
424
  ObjectID: l++,
425
- id: `${c}+${L}+${b}`,
425
+ id: `${c}+${L}+${w}`,
426
426
  roadId: c,
427
427
  roadName: r.name,
428
428
  sectionId: L,
429
429
  sectionIndex: u,
430
- laneId: b,
430
+ laneId: w,
431
431
  type: N,
432
432
  sumoId: ""
433
433
  }
@@ -822,14 +822,12 @@ class C {
822
822
  }
823
823
  }), !e || e.type === "edge")
824
824
  if (!e || !e.id || e.id === "")
825
- this.sectionLayer.graphics.forEach((t) => {
826
- t.visible = !1, t.setAttribute("selected", !1);
827
- });
825
+ this.sectionLayer.removeAll();
828
826
  else {
829
827
  const t = this.sectionLayer.graphics.find(
830
828
  (s) => s.getAttribute("edgeId") === e.id
831
829
  );
832
- t && (t.visible = !1, t.setAttribute("selected", !1));
830
+ t && this.sectionLayer.remove(t);
833
831
  }
834
832
  return { status: 0, message: "ok" };
835
833
  }
@@ -9,6 +9,7 @@ export default class DistrictController {
9
9
  id: string;
10
10
  name: string;
11
11
  parentId: string;
12
+ parentName: string;
12
13
  crosses: ICross[];
13
14
  subDistricts: DistrictController[];
14
15
  areaColor: number[];
@@ -1,6 +1,6 @@
1
1
  class r {
2
2
  constructor(t) {
3
- this.crosses = [], this.subDistricts = [], this.areaColor = [
3
+ this.parentName = "", this.crosses = [], this.subDistricts = [], this.areaColor = [
4
4
  Math.floor(Math.random() * 255),
5
5
  Math.floor(Math.random() * 255),
6
6
  Math.floor(Math.random() * 255)
@@ -8,7 +8,7 @@ class r {
8
8
  for (const s of t.children)
9
9
  if (s.children) {
10
10
  const o = new r(s);
11
- o.areaColor = this.areaColor, this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
11
+ o.parentName = this.name, o.areaColor = this.areaColor, this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
12
12
  } else {
13
13
  const o = {
14
14
  id: s.id,
@@ -4,13 +4,24 @@ export default class SignalControlAreaController {
4
4
  private districtControllerLayer;
5
5
  private subDistrictControllerLayer;
6
6
  private crossLayer;
7
+ private highlightLayer;
7
8
  private eventHandle?;
8
9
  constructor(view: __esri.MapView | __esri.SceneView);
9
10
  showSignalControlArea(params: any): IResult;
10
11
  clearSignalControlArea(): IResult;
11
12
  locateSignalControlArea(params: {
12
13
  id: string;
13
- }): IResult;
14
+ }): Promise<IResult>;
15
+ highlightSignalControlArea(params: {
16
+ id: string;
17
+ }): Promise<IResult>;
18
+ resetHighlight(): IResult;
19
+ /**
20
+ * 在区控\子区\路口图层中查找对应的graphic
21
+ * @param id
22
+ * @returns
23
+ */
24
+ private findAreaGraphic;
14
25
  /**
15
26
  * 绘制区控与子区
16
27
  * @param districtController
@@ -1,61 +1,86 @@
1
- import n from "@arcgis/core/Graphic";
2
- import s from "@arcgis/core/layers/GraphicsLayer";
3
- import p from "@turf/buffer";
4
- import f from "@turf/convex";
1
+ import h from "@arcgis/core/Graphic";
2
+ import a from "@arcgis/core/layers/GraphicsLayer";
3
+ import y from "@turf/buffer";
4
+ import g from "@turf/convex";
5
5
  import * as c from "@turf/helpers";
6
- import y from "./district-controller.mjs";
7
- class v {
6
+ import m from "./district-controller.mjs";
7
+ class C {
8
8
  constructor(e) {
9
9
  this.view = e, this.view.popup.visibleElements = {
10
10
  closeButton: !0,
11
11
  collapseButton: !1,
12
- actionBar: !1
13
- }, this.districtControllerLayer = new s({
12
+ actionBar: !0
13
+ }, this.districtControllerLayer = new a({
14
14
  id: "districtControllerLayer",
15
15
  maxScale: 144447,
16
16
  minScale: 1155582
17
- }), this.subDistrictControllerLayer = new s({
17
+ }), this.subDistrictControllerLayer = new a({
18
18
  id: "subDistrictControllerLayer",
19
19
  maxScale: 0,
20
20
  minScale: 144447
21
- }), this.crossLayer = new s({
21
+ }), this.crossLayer = new a({
22
22
  id: "crossLayer",
23
23
  maxScale: 0,
24
- minScale: 18056
24
+ minScale: 36112
25
+ }), this.highlightLayer = new a({
26
+ id: "highlightLayer"
25
27
  }), this.view.map.addMany([
26
- this.crossLayer,
27
28
  this.districtControllerLayer,
28
- this.subDistrictControllerLayer
29
+ this.subDistrictControllerLayer,
30
+ this.crossLayer,
31
+ this.highlightLayer
29
32
  ]);
30
33
  }
31
34
  showSignalControlArea(e) {
35
+ this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0;
32
36
  for (const t of e) {
33
- const r = new y(t);
37
+ const r = new m(t);
34
38
  this.drawArea(r, !0);
35
39
  }
36
40
  return { status: 0, message: "ok" };
37
41
  }
38
42
  clearSignalControlArea() {
39
43
  var e;
40
- return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), (e = this.eventHandle) == null || e.remove(), this.view.closePopup(), { status: 0, message: "ok" };
44
+ return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), (e = this.eventHandle) == null || e.remove(), this.view.closePopup(), { status: 0, message: "ok" };
41
45
  }
42
- locateSignalControlArea(e) {
43
- let t = this.districtControllerLayer.graphics.find(
44
- (r) => r.attributes.id === e.id
45
- );
46
- if (t || (t = this.subDistrictControllerLayer.graphics.find(
47
- (r) => r.attributes.id === e.id
48
- )), t || (t = this.crossLayer.graphics.find(
49
- (r) => r.attributes.id === e.id
50
- )), t) {
51
- this.view.goTo(t.geometry);
46
+ async locateSignalControlArea(e) {
47
+ const t = this.findAreaGraphic(e.id);
48
+ if (t) {
49
+ await this.view.goTo(t.geometry);
52
50
  const r = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
53
51
  return this.view.popup.open({
54
52
  features: [t],
55
53
  location: r
56
54
  }), { status: 0, message: "ok" };
57
- }
58
- return { status: 1, message: "未找到" };
55
+ } else
56
+ return { status: 1, message: "未找到" };
57
+ }
58
+ async highlightSignalControlArea(e) {
59
+ this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1;
60
+ const t = this.districtControllerLayer.graphics.filter((i) => i.getAttribute("id") === e.id).toArray(), r = this.subDistrictControllerLayer.graphics.filter(
61
+ (i) => i.getAttribute("id") === e.id || i.getAttribute("parentId") === e.id
62
+ ).toArray(), s = this.crossLayer.graphics.filter(
63
+ (i) => i.getAttribute("id") === e.id || i.getAttribute("districtId") === e.id || i.getAttribute("subDistrictId") === e.id
64
+ ).toArray();
65
+ return t.length > 0 && this.highlightLayer.addMany(t), r.length > 0 && this.highlightLayer.addMany(r), s.length > 0 && this.highlightLayer.addMany(s), this.highlightLayer.graphics.length === 0 ? { status: 1, message: "未找到" } : (await this.view.goTo(
66
+ t.length > 0 ? t : r.length > 0 ? r : s
67
+ ), { status: 0, message: "ok" });
68
+ }
69
+ resetHighlight() {
70
+ return this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0, this.crossLayer.visible = !0, { status: 0, message: "ok" };
71
+ }
72
+ /**
73
+ * 在区控\子区\路口图层中查找对应的graphic
74
+ * @param id
75
+ * @returns
76
+ */
77
+ findAreaGraphic(e) {
78
+ let t = this.districtControllerLayer.graphics.find(
79
+ (r) => r.attributes.id === e
80
+ );
81
+ return t || (t = this.subDistrictControllerLayer.graphics.find(
82
+ (r) => r.attributes.id === e
83
+ )), t || (t = this.crossLayer.graphics.find((r) => r.attributes.id === e)), t;
59
84
  }
60
85
  /**
61
86
  * 绘制区控与子区
@@ -66,21 +91,21 @@ class v {
66
91
  drawArea(e, t) {
67
92
  const r = e.getAllCrossCoordinates();
68
93
  if (r.length > 2) {
69
- const o = c.featureCollection(
94
+ const i = c.featureCollection(
70
95
  r.map((u) => c.point(u))
71
- ), i = f(o);
72
- if (!i)
96
+ ), l = g(i);
97
+ if (!l)
73
98
  return;
74
- const d = p(
75
- i.geometry,
99
+ const d = y(
100
+ l.geometry,
76
101
  // 区控面积更大,需要更大的缓冲半径
77
- t ? 200 : 20,
102
+ t ? 200 : 30,
78
103
  {
79
104
  units: "meters"
80
105
  }
81
106
  );
82
- let a;
83
- t ? a = [
107
+ let o;
108
+ t ? o = [
84
109
  {
85
110
  fieldName: "id",
86
111
  label: "区控编号"
@@ -93,11 +118,15 @@ class v {
93
118
  fieldName: "subDistrictCount",
94
119
  label: "子区数量"
95
120
  }
96
- ] : a = [
121
+ ] : o = [
97
122
  {
98
123
  fieldName: "parentId",
99
124
  label: "区控编号"
100
125
  },
126
+ {
127
+ fieldName: "parentName",
128
+ label: "区控名称"
129
+ },
101
130
  {
102
131
  fieldName: "id",
103
132
  label: "子区编号"
@@ -107,17 +136,18 @@ class v {
107
136
  label: "路口数量"
108
137
  }
109
138
  ];
110
- const l = new n({
139
+ const n = new h({
111
140
  geometry: {
112
141
  type: "polygon",
113
142
  rings: d.geometry.coordinates
114
143
  },
115
144
  symbol: {
116
145
  type: "simple-fill",
117
- color: [...e.areaColor, 0.5],
146
+ color: [...e.areaColor, t ? 0.6 : 0.8],
118
147
  outline: {
119
148
  color: e.areaColor,
120
- width: 1
149
+ width: 2,
150
+ style: t ? "solid" : "long-dash"
121
151
  }
122
152
  },
123
153
  attributes: {
@@ -125,6 +155,7 @@ class v {
125
155
  id: e.id,
126
156
  name: e.name,
127
157
  parentId: e.parentId,
158
+ parentName: e.parentName,
128
159
  crossCount: e.crossCount,
129
160
  subDistrictCount: e.subDistrictCount
130
161
  },
@@ -133,35 +164,39 @@ class v {
133
164
  content: [
134
165
  {
135
166
  type: "fields",
136
- fieldInfos: a
167
+ fieldInfos: o
137
168
  }
138
169
  ]
139
170
  }
140
171
  });
141
- t ? this.districtControllerLayer.add(l) : this.subDistrictControllerLayer.add(l);
172
+ t ? this.districtControllerLayer.add(n) : this.subDistrictControllerLayer.add(n);
142
173
  }
143
- for (const o of e.subDistricts)
144
- this.drawArea(o, !1);
145
- const m = e.crosses.map((o) => new n({
174
+ for (const i of e.subDistricts)
175
+ this.drawArea(i, !1);
176
+ const s = e.crosses.map((i) => new h({
146
177
  geometry: {
147
178
  type: "point",
148
- x: o.longitude,
149
- y: o.latitude
179
+ x: i.longitude,
180
+ y: i.latitude
150
181
  },
151
182
  symbol: {
152
183
  type: "simple-marker",
153
184
  color: e.areaColor,
154
- size: 8
185
+ size: 8,
186
+ outline: {
187
+ color: "white",
188
+ width: 1
189
+ }
155
190
  },
156
191
  attributes: {
157
192
  type: "cross",
158
- id: o.id,
159
- name: o.name,
193
+ id: i.id,
194
+ name: i.name,
160
195
  districtId: t ? e.id : e.parentId,
161
196
  subDistrictId: t ? "" : e.id
162
197
  },
163
198
  popupTemplate: {
164
- title: o.name,
199
+ title: i.name,
165
200
  content: [
166
201
  {
167
202
  type: "fields",
@@ -183,9 +218,9 @@ class v {
183
218
  ]
184
219
  }
185
220
  }));
186
- this.crossLayer.addMany(m);
221
+ this.crossLayer.addMany(s);
187
222
  }
188
223
  }
189
224
  export {
190
- v as default
225
+ C as default
191
226
  };
@@ -79,7 +79,13 @@ declare const _sfc_main: import("vue").DefineComponent<{
79
79
  splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
80
80
  showSignalControlArea: (params: any) => import("../types").IResult;
81
81
  clearSignalControlArea: () => void;
82
- locateSignalControlArea: (params: any) => import("../types").IResult;
82
+ locateSignalControlArea: (params: {
83
+ id: string;
84
+ }) => Promise<import("../types").IResult>;
85
+ highlightSignalControlArea: (params: {
86
+ id: string;
87
+ }) => Promise<import("../types").IResult>;
88
+ resetHighlightSignalControlArea: () => import("../types").IResult;
83
89
  props: any;
84
90
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
85
91
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),y=require("./stores/index.js");require("./style/index.css");const ye=require("./utils/holo-flow/index.js"),he=require("./utils/map-initializer.js"),O=require("./utils/open-drive-renderer/index.js"),Ce=require("./utils/overlay.js"),Oe=require("./utils/queue-length.js"),S=require("./utils/road-config-tool/index.js"),Se=require("./utils/signal-control-area-controller/index.js"),ke=require("./utils/traffic-flow.js"),De={class:"gis-viewer"},Te={style:{position:"absolute",bottom:"10px",left:"10px"}},Le=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:D,emit:T}){const d=a.ref(null);let c,i,r,o,s,n,m,t,l;const f=a.ref(!1);a.onMounted(async()=>{if(y.registerStore(),!d.value)return;document.addEventListener("keydown",p=>{p.ctrlKey&&p.key==="i"&&(f.value=!f.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,C=await(await fetch(h.config)).json();C.assetsRoot=h.assetsRoot||u;const we=y.default.useAppDataStore;we.mapConfig=C,i=new he.default,c=await i.initialize({container:d.value,markerClickCallback:(p,w,v,ve)=>{g("markerClick",p,w,v,ve)},mapClickCallback:(p,w,v)=>{g("mapClick",p,w,v)}}),s=new ye.default(c),await s.init(),g("mapLoaded")});const L=a.computed(()=>c),I=()=>{const e=y.default.useAppDataStore;e.saveTrackLog=!0},b=()=>{s.downloadTrackLog()},A=async e=>await i.setMapCenter(e),q=async e=>await i.setMapCamera(e),_=async e=>await i.lookAt(e),x=e=>i.setLayerVisibility(e),V=(e,u)=>i.requestCoordinateTransform(e,u),M=e=>{i.cancelCoordinateTransform(e)},N=e=>{i.setMapZoomRange(e)},F=e=>(r||(r=new S.default(c)),r.showLaneNumber(e)),B=()=>{r==null||r.clearLaneNumber()},E=async e=>(r||(r=new S.default(c)),await r.initializeSearch(e)),H=async()=>r==null?void 0:r.calCrossIndicatorArea(),j=async()=>{},z=async(e,u)=>{o||(o=new ke.default(c)),o.connectTrafficFlow(e,u)},P=()=>{o==null||o.disconnectTrafficFlow()},Q=e=>{s.handleVehicleTraceData(e)},R=()=>{s.clearHoloTrace()},Z=e=>{s.setInterpolate(e)},K=async e=>{await s.handleSignalData(e)},G=()=>{s.clearHoloSignal()},J=e=>{o==null||o.toggleTrafficInfo(e),s.toggleTrafficInfo(e)},U=e=>{s.togglePause(e)},W=e=>{o==null||o.toggleTrafficObject(e),s.toggleTrafficObject(e)},X=e=>{s.updatePanelContent(e)},Y=async e=>(n||(n=new Ce.default(c)),n.addOverlays(e)),$=e=>n==null?void 0:n.removeOverlaysByType(e),ee=e=>n==null?void 0:n.removeOverlaysById(e),te=()=>n==null?void 0:n.removeAllOverlays(),ne=()=>{n==null||n.showAllOverlays()},ae=e=>{m||(m=new Oe.default(c)),m.updateQueueLength(e)},re=()=>{m==null||m.removeQueueLength()},oe=async(e,u)=>(t||(t=new O.default(c)),await t.showOpenDriveFromServer(e,u)),se=async e=>(t||(t=new O.default(c)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ce=async()=>await(t==null?void 0:t.clearOpenDrive()),ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},le=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ue=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},me=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},pe=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},de=e=>(l||(l=new Se.default(c)),l.showSignalControlArea(e)),fe=()=>{l==null||l.clearSignalControlArea()},ge=e=>l?l.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},h=k,g=T;return D({mapViewer:L,setLayerVisibility:x,setMapCenter:A,lookAt:_,setMapCamera:q,setMapZoomRange:N,requestCoordinateTransform:V,cancelCoordinateTransform:M,addOverlays:Y,showAllOverlays:ne,removeOverlaysByType:$,removeOverlaysById:ee,removeAllOverlays:te,showLaneNumber:F,clearLaneNumber:B,initializeAreaTool:E,calCrossIndicatorArea:H,calRoadIndicatorArea:j,connectCarFlow:z,disconnectCarFlow:P,handleHoloVehicleTraceData:Q,clearHoloTrace:R,handleHoloSignalData:K,clearHoloSignal:G,setInterpolate:Z,toggleTrafficInfo:J,toggleTrafficObject:W,toggleVehicleInfo:X,togglePause:U,updateQueueLength:ae,removeQueueLength:re,showOpenDriveFromServer:oe,showOpenDriveFromFile:se,clearOpenDrive:ce,findSumoInOpenDrive:ie,selectSumoInOpenDrive:le,unselectSumoInOpenDrive:ue,getSumoInfo:me,splitOpenDriveLane:pe,showSignalControlArea:de,clearSignalControlArea:fe,locateSignalControlArea:ge}),(e,u)=>(a.openBlock(),a.createElementBlock("div",De,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:d},[a.withDirectives(a.createElementVNode("div",Te,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:I}," 开始记录 "),a.createElementVNode("button",{onClick:b},"下载日志")],512),[[a.vShow,f.value]])],512)]))}});exports.default=Le;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),y=require("./stores/index.js");require("./style/index.css");const Se=require("./utils/holo-flow/index.js"),Ce=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),Oe=require("./utils/overlay.js"),ke=require("./utils/queue-length.js"),O=require("./utils/road-config-tool/index.js"),Te=require("./utils/signal-control-area-controller/index.js"),Ae=require("./utils/traffic-flow.js"),De={class:"gis-viewer"},Le={style:{position:"absolute",bottom:"10px",left:"10px"}},Ie=o.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:A}){const d=o.ref(null);let i,l,c,n,a,r,g,t,s;const p=o.ref(!1);o.onMounted(async()=>{if(y.registerStore(),!d.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(p.value=!p.value)});const e=o.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,S=await(await fetch(h.config)).json();S.assetsRoot=h.assetsRoot||u;const ye=y.default.useAppDataStore;ye.mapConfig=S,l=new Ce.default,i=await l.initialize({container:d.value,markerClickCallback:(m,w,v,he)=>{f("markerClick",m,w,v,he)},mapClickCallback:(m,w,v)=>{f("mapClick",m,w,v)}}),a=new Se.default(i),await a.init(),f("mapLoaded")}),o.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),a==null||a.clearHoloTrace(),a==null||a.clearHoloSignal(),n==null||n.disconnectTrafficFlow()});const D=o.computed(()=>i),L=()=>{const e=y.default.useAppDataStore;e.saveTrackLog=!0},I=()=>{a.downloadTrackLog()},b=async e=>await l.setMapCenter(e),q=async e=>await l.setMapCamera(e),_=async e=>await l.lookAt(e),x=e=>l.setLayerVisibility(e),H=(e,u)=>l.requestCoordinateTransform(e,u),V=e=>{l.cancelCoordinateTransform(e)},M=e=>{l.setMapZoomRange(e)},N=e=>(c||(c=new O.default(i)),c.showLaneNumber(e)),B=()=>{c==null||c.clearLaneNumber()},E=async e=>(c||(c=new O.default(i)),await c.initializeSearch(e)),j=async()=>c==null?void 0:c.calCrossIndicatorArea(),z=async()=>{},P=async(e,u)=>{n||(n=new Ae.default(i)),n.connectTrafficFlow(e,u)},Q=()=>{n==null||n.disconnectTrafficFlow()},F=e=>{a.handleVehicleTraceData(e)},Z=()=>{a.clearHoloTrace()},K=e=>{a.setInterpolate(e)},U=async e=>{await a.handleSignalData(e)},G=()=>{a.clearHoloSignal()},J=e=>{n==null||n.toggleTrafficInfo(e),a.toggleTrafficInfo(e)},R=e=>{a.togglePause(e)},W=e=>{n==null||n.toggleTrafficObject(e),a.toggleTrafficObject(e)},X=e=>{a.updatePanelContent(e)},Y=async e=>(r||(r=new Oe.default(i)),r.addOverlays(e)),$=e=>r==null?void 0:r.removeOverlaysByType(e),ee=e=>r==null?void 0:r.removeOverlaysById(e),te=()=>r==null?void 0:r.removeAllOverlays(),ae=()=>{r==null||r.showAllOverlays()},ne=e=>{g||(g=new ke.default(i)),g.updateQueueLength(e)},re=()=>{g==null||g.removeQueueLength()},se=async(e,u)=>(t||(t=new C.default(i)),await t.showOpenDriveFromServer(e,u)),oe=async e=>(t||(t=new C.default(i)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ce=async()=>await(t==null?void 0:t.clearOpenDrive()),ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},le=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ue=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ge=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},me=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},de=e=>(s||(s=new Te.default(i)),s.showSignalControlArea(e)),pe=()=>{s==null||s.clearSignalControlArea()},fe=async e=>s?await s.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},we=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},ve=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},h=k,f=A;return T({mapViewer:D,setLayerVisibility:x,setMapCenter:b,lookAt:_,setMapCamera:q,setMapZoomRange:M,requestCoordinateTransform:H,cancelCoordinateTransform:V,addOverlays:Y,showAllOverlays:ae,removeOverlaysByType:$,removeOverlaysById:ee,removeAllOverlays:te,showLaneNumber:N,clearLaneNumber:B,initializeAreaTool:E,calCrossIndicatorArea:j,calRoadIndicatorArea:z,connectCarFlow:P,disconnectCarFlow:Q,handleHoloVehicleTraceData:F,clearHoloTrace:Z,handleHoloSignalData:U,clearHoloSignal:G,setInterpolate:K,toggleTrafficInfo:J,toggleTrafficObject:W,toggleVehicleInfo:X,togglePause:R,updateQueueLength:ne,removeQueueLength:re,showOpenDriveFromServer:se,showOpenDriveFromFile:oe,clearOpenDrive:ce,findSumoInOpenDrive:ie,selectSumoInOpenDrive:le,unselectSumoInOpenDrive:ue,getSumoInfo:ge,splitOpenDriveLane:me,showSignalControlArea:de,clearSignalControlArea:pe,locateSignalControlArea:fe,highlightSignalControlArea:we,resetHighlightSignalControlArea:ve}),(e,u)=>(o.openBlock(),o.createElementBlock("div",De,[o.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:d},[o.withDirectives(o.createElementVNode("div",Le,[o.createElementVNode("button",{style:{"margin-right":"10px"},onClick:L}," 开始记录 "),o.createElementVNode("button",{onClick:I},"下载日志")],512),[[o.vShow,p.value]])],512)]))}});exports.default=Ie;
@@ -68,7 +68,13 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
68
68
  splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
69
69
  showSignalControlArea: (params: any) => import("../types").IResult;
70
70
  clearSignalControlArea: () => void;
71
- locateSignalControlArea: (params: any) => import("../types").IResult;
71
+ locateSignalControlArea: (params: {
72
+ id: string;
73
+ }) => Promise<import("../types").IResult>;
74
+ highlightSignalControlArea: (params: {
75
+ id: string;
76
+ }) => Promise<import("../types").IResult>;
77
+ resetHighlightSignalControlArea: () => import("../types").IResult;
72
78
  props: any;
73
79
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
74
80
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../types/index.js"),a=require("./signal-holo-flow.js"),o=require("./trace-holo-flow.js");class i{constructor(e){this.view=e}async init(){this.traceHoloFlow=new o.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let l=t.EVehiclePlateState.None;switch(e){case"none":l=t.EVehiclePlateState.None;break;case"plateNumber":l=t.EVehiclePlateState.PlateNumber;break;case"vehicleId":l=t.EVehiclePlateState.Id;break;case"mix":l=t.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(l)}async handleSignalData(e){this.signalHoloFlow||(this.signalHoloFlow=new a.default(this.view)),await this.signalHoloFlow.initializeLayer(),await this.signalHoloFlow.handleSignalData(e)}clearHoloSignal(){this.signalHoloFlow.clearSignal()}setInterpolate(e){this.traceHoloFlow.setInterpolate(e)}downloadTrackLog(){this.traceHoloFlow.downloadLog()}}exports.default=i;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../types/index.js"),a=require("./signal-holo-flow.js"),o=require("./trace-holo-flow.js");class i{constructor(e){this.view=e}async init(){this.traceHoloFlow=new o.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let l=t.EVehiclePlateState.None;switch(e){case"none":l=t.EVehiclePlateState.None;break;case"plateNumber":l=t.EVehiclePlateState.PlateNumber;break;case"vehicleId":l=t.EVehiclePlateState.Id;break;case"mix":l=t.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(l)}async handleSignalData(e){this.signalHoloFlow||(this.signalHoloFlow=new a.default(this.view)),await this.signalHoloFlow.initializeLayer(),await this.signalHoloFlow.handleSignalData(e)}clearHoloSignal(){var e;(e=this.signalHoloFlow)==null||e.clearSignal()}setInterpolate(e){this.traceHoloFlow.setInterpolate(e)}downloadTrackLog(){this.traceHoloFlow.downloadLog()}}exports.default=i;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),$=require("@arcgis/core/core/promiseUtils"),M=require("@arcgis/core/geometry"),J=require("@arcgis/core/geometry/geometryEngine"),G=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),y=require("axios"),P=require("md5"),A=require("pako"),C=require("../common-utils.js"),x=require("./wasm-loader.js");function O(f){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const t in f)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(f,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>f[t]})}}return e.default=f,Object.freeze(e)}const N=O($),L=O(J);class D{constructor(e){this.wasmLoader=x.default.getInstance(),this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.laneLayer=new G({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new G({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new v({id:"OpenDriveJunction"}),this.sectionLayer=new v({id:"OpenDriveSection"}),this.highlightLayer=new v({id:"OpenDriveHighlight"}),this.flashLayer=new v({id:"OpenDriveFlash"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){try{const i=await(await fetch(e)).text();return{status:0,message:"ok",result:P(i)}}catch(t){return{status:-1,message:t.message}}}async showOpenDriveFromFile(e){var h,g;this.openDriveClickCallback=e.selectedCallback,console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;this.projectName=t.result,console.timeEnd("md5用时"),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await y.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(d){return{status:-1,message:d.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;C.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const a=await(await fetch(l)).arrayBuffer(),r=A.inflate(a,{to:"string"}),c=JSON.parse(r);await this.showAllLanes(c,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((g=e.options)==null?void 0:g.showRoadName)||!0);const u=o.data.result.junctions;if(this.showJunction(u),e.options&&e.options.centerMap!==!1){const d=C.default.transformPointProjection([0,0]);await this.view.goTo(d)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await y.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let s=o.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const n=await(await fetch(s)).arrayBuffer(),a=A.inflate(n,{to:"string"}),r=JSON.parse(a);return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=i,new Promise(s=>{let l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:c,refLine:u}=r;let h=r.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const g=new p({geometry:{type:"polyline",paths:[u]},attributes:{ObjectID:l++,roadId:c,roadName:h}});this.allRefLineGraphics.push(g),r.laneSections.sort((d,b)=>Number(d.id)-Number(b.id));for(let d=0;d<r.laneSections.length;d++){const b=r.laneSections[d],k=Number(b.id);for(const m of b.lanePaths){const w=Number(m.id);if(w===0)continue;const F=m.type,I=m.innerPath.concat(m.outerPath.reverse());if(I.length<=3){console.warn(`lane ${w} has less than 3 points`);continue}I.push(m.innerPath[0]);const j=new M.Polygon({rings:[I]});if(j){const S=new p({geometry:j,attributes:{ObjectID:l++,id:`${c}+${k}+${w}`,roadId:c,roadName:r.name,sectionId:k,sectionIndex:d,laneId:w,type:F,sumoId:""}});this.allLaneGraphics.push(S),n.push(S)}}}}const a=setInterval(()=>{if(n.length>0||this.allRefLineGraphics.length>0){if(n.length>0){const r=n.splice(0,100);this.laneLayer.applyEdits({addFeatures:r})}if(this.allRefLineGraphics.length>0){const r=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:r})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];for(const i of e){i.nodeType=i.type;const o=new p({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30}});t.push(o)}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=N.debounce(async t=>{var l;const o=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(n=>n.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId="",this.view.closePopup());return}const s=o[0];if(this.hitGraphic=s.graphic,s.layer.id==="OpenDriveLane"){const n=`${this.hitGraphic.attributes.roadId}+${this.hitGraphic.attributes.sectionId}`;if(n===this.currentSectionCode||this.sectionLayer.graphics.findIndex(u=>u.getAttribute("id")===n)>=0)return;this.currentSectionCode=n;const r=this.allLaneGraphics.filter(u=>`${u.attributes.roadId}+${u.attributes.sectionId}`===n),c=L.union(r.map(u=>u.geometry));this.highlightGraphic=new p({geometry:c,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:n,selected:!1}}),this.highlightLayer.removeAll(),this.highlightLayer.add(this.highlightGraphic)}else if(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n;const a=this.hitGraphic.getAttribute("name"),r=this.hitGraphic.getAttribute("crossId");this.view.popup.open({title:a,content:`<table>
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),$=require("@arcgis/core/core/promiseUtils"),M=require("@arcgis/core/geometry"),J=require("@arcgis/core/geometry/geometryEngine"),G=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),y=require("axios"),P=require("md5"),A=require("pako"),C=require("../common-utils.js"),x=require("./wasm-loader.js");function O(m){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const t in m)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(m,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>m[t]})}}return e.default=m,Object.freeze(e)}const N=O($),L=O(J);class D{constructor(e){this.wasmLoader=x.default.getInstance(),this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.laneLayer=new G({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new G({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new v({id:"OpenDriveJunction"}),this.sectionLayer=new v({id:"OpenDriveSection"}),this.highlightLayer=new v({id:"OpenDriveHighlight"}),this.flashLayer=new v({id:"OpenDriveFlash"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){try{const i=await(await fetch(e)).text();return{status:0,message:"ok",result:P(i)}}catch(t){return{status:-1,message:t.message}}}async showOpenDriveFromFile(e){var h,g;this.openDriveClickCallback=e.selectedCallback,console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;this.projectName=t.result,console.timeEnd("md5用时"),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await y.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(d){return{status:-1,message:d.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;C.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const a=await(await fetch(l)).arrayBuffer(),r=A.inflate(a,{to:"string"}),c=JSON.parse(r);await this.showAllLanes(c,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((g=e.options)==null?void 0:g.showRoadName)||!0);const u=o.data.result.junctions;if(this.showJunction(u),e.options&&e.options.centerMap!==!1){const d=C.default.transformPointProjection([0,0]);await this.view.goTo(d)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await y.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let s=o.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const n=await(await fetch(s)).arrayBuffer(),a=A.inflate(n,{to:"string"}),r=JSON.parse(a);return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=i,new Promise(s=>{let l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:c,refLine:u}=r;let h=r.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const g=new p({geometry:{type:"polyline",paths:[u]},attributes:{ObjectID:l++,roadId:c,roadName:h}});this.allRefLineGraphics.push(g),r.laneSections.sort((d,b)=>Number(d.id)-Number(b.id));for(let d=0;d<r.laneSections.length;d++){const b=r.laneSections[d],k=Number(b.id);for(const f of b.lanePaths){const w=Number(f.id);if(w===0)continue;const F=f.type,I=f.innerPath.concat(f.outerPath.reverse());if(I.length<=3){console.warn(`lane ${w} has less than 3 points`);continue}I.push(f.innerPath[0]);const j=new M.Polygon({rings:[I]});if(j){const S=new p({geometry:j,attributes:{ObjectID:l++,id:`${c}+${k}+${w}`,roadId:c,roadName:r.name,sectionId:k,sectionIndex:d,laneId:w,type:F,sumoId:""}});this.allLaneGraphics.push(S),n.push(S)}}}}const a=setInterval(()=>{if(n.length>0||this.allRefLineGraphics.length>0){if(n.length>0){const r=n.splice(0,100);this.laneLayer.applyEdits({addFeatures:r})}if(this.allRefLineGraphics.length>0){const r=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:r})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];for(const i of e){i.nodeType=i.type;const o=new p({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30}});t.push(o)}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=N.debounce(async t=>{var l;const o=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(n=>n.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId="",this.view.closePopup());return}const s=o[0];if(this.hitGraphic=s.graphic,s.layer.id==="OpenDriveLane"){const n=`${this.hitGraphic.attributes.roadId}+${this.hitGraphic.attributes.sectionId}`;if(n===this.currentSectionCode||this.sectionLayer.graphics.findIndex(u=>u.getAttribute("id")===n)>=0)return;this.currentSectionCode=n;const r=this.allLaneGraphics.filter(u=>`${u.attributes.roadId}+${u.attributes.sectionId}`===n),c=L.union(r.map(u=>u.geometry));this.highlightGraphic=new p({geometry:c,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:n,selected:!1}}),this.highlightLayer.removeAll(),this.highlightLayer.add(this.highlightGraphic)}else if(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n;const a=this.hitGraphic.getAttribute("name"),r=this.hitGraphic.getAttribute("crossId");this.view.popup.open({title:a,content:`<table>
2
2
  <tr><td>路口编号</td><td>${n}</td></tr>
3
3
  <tr><td>信号机编号</td><td>${r||"无信控"}</td></tr>
4
- </table>`,location:this.hitGraphic.geometry})}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=N.debounce(async t=>{var a;const o=(a=(await this.view.hitTest(t,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(r=>r.type==="graphic");if(o.length===0)return;const s=o[0].graphic,l=s.getAttribute("type"),n=s.getAttribute("id");if(l==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const r=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,c=await y.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:c.data.result}),s.setAttribute("selected",!0),s.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(s,50))}else{this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:void 0}),s.setAttribute("selected",!1);const r=s.getAttribute("crossId");s.symbol.url=r?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(s,30)}else if(l==="OpenDriveSection")if(s.getAttribute("selected"))this.sectionLayer.remove(s),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:void 0});else{this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0);const r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,c=await y.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&this.openDriveClickCallback&&(s.setAttribute("edgeId",c.data.result.obj_id),this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:c.data.result}))}});this.mouseClickHandler=this.view.on("immediate-click",async t=>{e(t).catch(()=>{})})}increasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s<t?e.symbol={type:"picture-marker",url:o.url,width:s+1,height:s+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s>t?e.symbol={type:"picture-marker",url:o.url,width:s-1,height:s-1}:clearInterval(i)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const t=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,i=await y.get(t,{params:{id:e.id,projectName:this.projectName}});return i.status===200?i.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.find(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s){const l=`${i}+${s.getAttribute("sectionId")}`,n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await y.get(n,{params:{id:l,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${l}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}async clearOpenDrive(){var t,i;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0}async findSumo(e){const{type:t,id:i}=e,o=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(i,o);if(t==="edge"){const s=i.split("+");if(s.length>2)return{status:-1,message:"id格式错误"};const l=s.length===2?Number(s[1]):void 0,n=s[0].split("#");if(n.length>2)return{status:-1,message:"id格式错误"};const a=n[0],r=n.length===2?Number(n[1]):void 0;return await this.findLane({roadsectId:a,segmentId:r,laneId:l,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const i=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(t){const o=new p({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[255,0,0,.6],outline:{color:"red",width:1}}});this.flashGraphic(o)}return await this.view.goTo(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:i,laneId:o}=e;t.startsWith("-")&&(t=t.slice(1));let s=this.allLaneGraphics.filter(a=>a.attributes.roadId===t);if(s.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(i!==void 0){const a=[];if(s.forEach(r=>{const c=Number(r.attributes.sectionId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(r=>Number(r.attributes.sectionId)===i)}if(o!==void 0){const a=[];if(s.forEach(r=>{const c=Number(r.attributes.laneId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(r=>Number(r.attributes.laneId)===o)}const l=s.map(a=>a.geometry),n=L.union(l);if(e.flash){const a=new p({geometry:n,symbol:{type:"simple-fill",color:[255,0,0,.5],style:"solid",outline:{color:"red",width:0}}});this.flashGraphic(a)}return await this.view.goTo(n,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let t=0,i=!0;const o=setInterval(()=>{i?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(i=!1,t++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(i=!0)),t>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if((!e||e.type==="junction")&&this.junctionLayer.graphics.forEach(t=>{if((!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")){t.setAttribute("selected",!1);const i=t.getAttribute("crossId");t.symbol.url=i?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(t,30)}}),!e||e.type==="edge")if(!e||!e.id||e.id==="")this.sectionLayer.graphics.forEach(t=>{t.visible=!1,t.setAttribute("selected",!1)});else{const t=this.sectionLayer.graphics.find(i=>i.getAttribute("edgeId")===e.id);t&&(t.visible=!1,t.setAttribute("selected",!1))}return{status:0,message:"ok"}}selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(t=>{if(e.id===t.getAttribute("id"))return t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s.length>0){const l=L.union(s.map(a=>a.geometry)),n=new p({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",edgeId:e.id,selected:!0}});return this.sectionLayer.add(n),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async splitLane(e){return{status:0,message:"ok",result:e}}}exports.default=D;
4
+ </table>`,location:this.hitGraphic.geometry})}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=N.debounce(async t=>{var a;const o=(a=(await this.view.hitTest(t,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(r=>r.type==="graphic");if(o.length===0)return;const s=o[0].graphic,l=s.getAttribute("type"),n=s.getAttribute("id");if(l==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const r=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,c=await y.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:c.data.result}),s.setAttribute("selected",!0),s.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(s,50))}else{this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:void 0}),s.setAttribute("selected",!1);const r=s.getAttribute("crossId");s.symbol.url=r?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(s,30)}else if(l==="OpenDriveSection")if(s.getAttribute("selected"))this.sectionLayer.remove(s),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:void 0});else{this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0);const r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,c=await y.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&this.openDriveClickCallback&&(s.setAttribute("edgeId",c.data.result.obj_id),this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:c.data.result}))}});this.mouseClickHandler=this.view.on("immediate-click",async t=>{e(t).catch(()=>{})})}increasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s<t?e.symbol={type:"picture-marker",url:o.url,width:s+1,height:s+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s>t?e.symbol={type:"picture-marker",url:o.url,width:s-1,height:s-1}:clearInterval(i)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const t=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,i=await y.get(t,{params:{id:e.id,projectName:this.projectName}});return i.status===200?i.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.find(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s){const l=`${i}+${s.getAttribute("sectionId")}`,n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await y.get(n,{params:{id:l,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${l}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}async clearOpenDrive(){var t,i;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0}async findSumo(e){const{type:t,id:i}=e,o=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(i,o);if(t==="edge"){const s=i.split("+");if(s.length>2)return{status:-1,message:"id格式错误"};const l=s.length===2?Number(s[1]):void 0,n=s[0].split("#");if(n.length>2)return{status:-1,message:"id格式错误"};const a=n[0],r=n.length===2?Number(n[1]):void 0;return await this.findLane({roadsectId:a,segmentId:r,laneId:l,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const i=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(t){const o=new p({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[255,0,0,.6],outline:{color:"red",width:1}}});this.flashGraphic(o)}return await this.view.goTo(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:i,laneId:o}=e;t.startsWith("-")&&(t=t.slice(1));let s=this.allLaneGraphics.filter(a=>a.attributes.roadId===t);if(s.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(i!==void 0){const a=[];if(s.forEach(r=>{const c=Number(r.attributes.sectionId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(r=>Number(r.attributes.sectionId)===i)}if(o!==void 0){const a=[];if(s.forEach(r=>{const c=Number(r.attributes.laneId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(r=>Number(r.attributes.laneId)===o)}const l=s.map(a=>a.geometry),n=L.union(l);if(e.flash){const a=new p({geometry:n,symbol:{type:"simple-fill",color:[255,0,0,.5],style:"solid",outline:{color:"red",width:0}}});this.flashGraphic(a)}return await this.view.goTo(n,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let t=0,i=!0;const o=setInterval(()=>{i?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(i=!1,t++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(i=!0)),t>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if((!e||e.type==="junction")&&this.junctionLayer.graphics.forEach(t=>{if((!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")){t.setAttribute("selected",!1);const i=t.getAttribute("crossId");t.symbol.url=i?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(t,30)}}),!e||e.type==="edge")if(!e||!e.id||e.id==="")this.sectionLayer.removeAll();else{const t=this.sectionLayer.graphics.find(i=>i.getAttribute("edgeId")===e.id);t&&this.sectionLayer.remove(t)}return{status:0,message:"ok"}}selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(t=>{if(e.id===t.getAttribute("id"))return t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s.length>0){const l=L.union(s.map(a=>a.geometry)),n=new p({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",edgeId:e.id,selected:!0}});return this.sectionLayer.add(n),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async splitLane(e){return{status:0,message:"ok",result:e}}}exports.default=D;
@@ -9,6 +9,7 @@ export default class DistrictController {
9
9
  id: string;
10
10
  name: string;
11
11
  parentId: string;
12
+ parentName: string;
12
13
  crosses: ICross[];
13
14
  subDistricts: DistrictController[];
14
15
  areaColor: number[];
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class r{constructor(s){this.crosses=[],this.subDistricts=[],this.areaColor=[Math.floor(Math.random()*255),Math.floor(Math.random()*255),Math.floor(Math.random()*255)],this.crossCount=0,this.subDistrictCount=0,this.id=s.id,this.name=s.name,this.parentId=s.parentId;for(const t of s.children)if(t.children){const o=new r(t);o.areaColor=this.areaColor,this.subDistricts.push(o),this.subDistrictCount++,this.crossCount+=o.crossCount}else{const o={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude)};this.crosses.push(o),this.crossCount++}}getAllCrossCoordinates(){const s=[];for(const t of this.crosses)s.push([t.longitude,t.latitude]);for(const t of this.subDistricts)s.push(...t.getAllCrossCoordinates());return s}}exports.default=r;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class e{constructor(s){this.parentName="",this.crosses=[],this.subDistricts=[],this.areaColor=[Math.floor(Math.random()*255),Math.floor(Math.random()*255),Math.floor(Math.random()*255)],this.crossCount=0,this.subDistrictCount=0,this.id=s.id,this.name=s.name,this.parentId=s.parentId;for(const t of s.children)if(t.children){const o=new e(t);o.parentName=this.name,o.areaColor=this.areaColor,this.subDistricts.push(o),this.subDistrictCount++,this.crossCount+=o.crossCount}else{const o={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude)};this.crosses.push(o),this.crossCount++}}getAllCrossCoordinates(){const s=[];for(const t of this.crosses)s.push([t.longitude,t.latitude]);for(const t of this.subDistricts)s.push(...t.getAllCrossCoordinates());return s}}exports.default=e;
@@ -4,13 +4,24 @@ export default class SignalControlAreaController {
4
4
  private districtControllerLayer;
5
5
  private subDistrictControllerLayer;
6
6
  private crossLayer;
7
+ private highlightLayer;
7
8
  private eventHandle?;
8
9
  constructor(view: __esri.MapView | __esri.SceneView);
9
10
  showSignalControlArea(params: any): IResult;
10
11
  clearSignalControlArea(): IResult;
11
12
  locateSignalControlArea(params: {
12
13
  id: string;
13
- }): IResult;
14
+ }): Promise<IResult>;
15
+ highlightSignalControlArea(params: {
16
+ id: string;
17
+ }): Promise<IResult>;
18
+ resetHighlight(): IResult;
19
+ /**
20
+ * 在区控\子区\路口图层中查找对应的graphic
21
+ * @param id
22
+ * @returns
23
+ */
24
+ private findAreaGraphic;
14
25
  /**
15
26
  * 绘制区控与子区
16
27
  * @param districtController
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),i=require("@arcgis/core/layers/GraphicsLayer"),m=require("@turf/buffer"),y=require("@turf/convex"),b=require("@turf/helpers"),g=require("./district-controller.js");function h(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=h(b);class C{constructor(e){this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1},this.districtControllerLayer=new i({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new i({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new i({id:"crossLayer",maxScale:0,minScale:18056}),this.view.map.addMany([this.crossLayer,this.districtControllerLayer,this.subDistrictControllerLayer])}showSignalControlArea(e){for(const t of e){const r=new g.default(t);this.drawArea(r,!0)}return{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),(e=this.eventHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}locateSignalControlArea(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e.id);if(t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e.id)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e.id)),t){this.view.goTo(t.geometry);const r=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.popup.open({features:[t],location:r}),{status:0,message:"ok"}}return{status:1,message:"未找到"}}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>2){const o=u.featureCollection(r.map(f=>u.point(f))),l=y(o);if(!l)return;const p=m(l.geometry,t?200:20,{units:"meters"});let a;t?a=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:a=[{fieldName:"parentId",label:"区控编号"},{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const n=new c({geometry:{type:"polygon",rings:p.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.5],outline:{color:e.areaColor,width:1}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:a}]}});t?this.districtControllerLayer.add(n):this.subDistrictControllerLayer.add(n)}for(const o of e.subDistricts)this.drawArea(o,!1);const d=e.crosses.map(o=>new c({geometry:{type:"point",x:o.longitude,y:o.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8},attributes:{type:"cross",id:o.id,name:o.name,districtId:t?e.id:e.parentId,subDistrictId:t?"":e.id},popupTemplate:{title:o.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtId",label:"区控编号"},{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"id",label:"路口编号"}]}]}}));this.crossLayer.addMany(d)}}exports.default=C;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),y=require("@turf/buffer"),f=require("@turf/convex"),p=require("@turf/helpers"),b=require("./district-controller.js");function m(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=m(p);class L{constructor(e){this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0},this.districtControllerLayer=new l({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new l({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new l({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new l({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const r=new b.default(t);this.drawArea(r,!0)}return{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.eventHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);if(t){await this.view.goTo(t.geometry);const r=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.popup.open({features:[t],location:r}),{status:0,message:"ok"}}else return{status:1,message:"未找到"}}async highlightSignalControlArea(e){this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id).toArray(),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray(),a=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray();return t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),a.length>0&&this.highlightLayer.addMany(a),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(await this.view.goTo(t.length>0?t:r.length>0?r:a),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>2){const i=u.featureCollection(r.map(g=>u.point(g))),n=f(i);if(!n)return;const d=y(n.geometry,t?200:30,{units:"meters"});let o;t?o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:o=[{fieldName:"parentId",label:"区控编号"},{fieldName:"parentName",label:"区控名称"},{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const h=new c({geometry:{type:"polygon",rings:d.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:o}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const i of e.subDistricts)this.drawArea(i,!1);const a=e.crosses.map(i=>new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8,outline:{color:"white",width:1}},attributes:{type:"cross",id:i.id,name:i.name,districtId:t?e.id:e.parentId,subDistrictId:t?"":e.id},popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtId",label:"区控编号"},{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"id",label:"路口编号"}]}]}}));this.crossLayer.addMany(a)}}exports.default=L;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.129",
3
+ "version": "1.0.131",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [