gisviewer-vue3-arcgis 1.0.249 → 1.0.251

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.
@@ -80,7 +80,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
80
80
  handleShowPlateNumber: () => void;
81
81
  setMapCenter: (params: ISetMapCenterParams) => Promise<import("../types").IResult>;
82
82
  setMapCamera: (params: ISetMapCameraParams) => Promise<import("../types").IResult>;
83
- setMapZoom: (zoom: number) => import("../types").IResult;
83
+ setMapZoom: (params: {
84
+ zoom: number;
85
+ }) => import("../types").IResult;
84
86
  lookAt: (params: ILookAtParams) => Promise<void>;
85
87
  setLayerVisibility: (params: ILayerVisibleParams) => import("../types").IResult;
86
88
  requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
@@ -65,7 +65,9 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
65
65
  handleShowPlateNumber: () => void;
66
66
  setMapCenter: (params: import("../types").ISetMapCenterParams) => Promise<import("../types").IResult>;
67
67
  setMapCamera: (params: import("../types").ISetMapCameraParams) => Promise<import("../types").IResult>;
68
- setMapZoom: (zoom: number) => import("../types").IResult;
68
+ setMapZoom: (params: {
69
+ zoom: number;
70
+ }) => import("../types").IResult;
69
71
  lookAt: (params: import("../types").ILookAtParams) => Promise<void>;
70
72
  setLayerVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult;
71
73
  requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
@@ -1,15 +1,15 @@
1
1
  import * as y from "@arcgis/core/core/reactiveUtils.js";
2
- import { Polyline as m } from "@arcgis/core/geometry";
3
- import c from "@arcgis/core/Graphic";
4
- import n from "@arcgis/core/layers/GraphicsLayer";
5
- import b from "axios";
2
+ import { Polyline as b } from "@arcgis/core/geometry";
3
+ import n from "@arcgis/core/Graphic";
4
+ import h from "@arcgis/core/layers/GraphicsLayer";
5
+ import m from "axios";
6
6
  class w {
7
7
  constructor(e) {
8
- this.selectedNodeIds = [], this.nodeScale = 5e3, this.hasGpu = !1, this.hasGpu = localStorage.getItem("gpu") !== "Unknown", this.view = e, this.roadsectLayer = new n({
8
+ this.selectedNodeIds = [], this.nodeScale = 5e3, this.hasGpu = !1, this.hasGpu = localStorage.getItem("gpu") !== "Unknown", this.view = e, this.roadsectLayer = new h({
9
9
  id: "roadsectLayer"
10
- }), this.view.map.add(this.roadsectLayer), this.allNodesLayer = new n({
10
+ }), this.view.map.add(this.roadsectLayer), this.allNodesLayer = new h({
11
11
  id: "allNodesLayer"
12
- }), this.view.map.add(this.allNodesLayer), this.bandLayer = new n({
12
+ }), this.view.map.add(this.allNodesLayer), this.bandLayer = new h({
13
13
  id: "bandLayer"
14
14
  }), this.view.map.add(this.bandLayer);
15
15
  }
@@ -18,8 +18,8 @@ class w {
18
18
  * @param params
19
19
  */
20
20
  addGreenWaveBand(e) {
21
- this.addNodeCallback = e.addCrossCallback, this.removeNodeCallback = e.removeCrossCallback, e.removeAllCrossCallback && (this.removeAllNodeCallback = e.removeAllCrossCallback), this.selectedNodeIds = [], this.openDriveServer = e.odrServer, this.showAllNodes(e.crossesInArea), this.viewClickWatcher || (this.viewClickWatcher = this.view.on("click", (o) => {
22
- this.handleViewClick(o);
21
+ this.addNodeCallback = e.addCrossCallback, this.removeNodeCallback = e.removeCrossCallback, e.removeAllCrossCallback && (this.removeAllNodeCallback = e.removeAllCrossCallback), this.selectedNodeIds = [], this.openDriveServer = e.odrServer, this.showAllNodes(e.crossesInArea), this.viewClickWatcher || (this.viewClickWatcher = this.view.on("click", (i) => {
22
+ this.handleViewClick(i);
23
23
  }));
24
24
  }
25
25
  stopAddGreenWaveBand() {
@@ -27,38 +27,46 @@ class w {
27
27
  (e = this.viewClickWatcher) == null || e.remove(), this.viewClickWatcher = void 0, this.allNodesLayer.removeAll(), this.selectedNodeIds = [], this.roadsectLayer.removeAll(), this.bandLayer.removeAll();
28
28
  }
29
29
  async showGreenWaveBand(e) {
30
- this.scaleWatcher || (this.scaleWatcher = y.watch(
30
+ this.bandLayer.graphics.forEach((t) => {
31
+ t.getAttribute("bandId") === e.bandId && this.bandLayer.remove(t);
32
+ }), this.roadsectLayer.graphics.forEach((t) => {
33
+ t.getAttribute("bandId") === e.bandId && this.roadsectLayer.remove(t);
34
+ }), this.scaleWatcher || (this.scaleWatcher = y.watch(
31
35
  () => this.view.scale,
32
- (s, i) => {
33
- s > this.nodeScale && i <= this.nodeScale ? this.bandLayer.graphics.forEach((l) => {
34
- l.geometry.type === "point" && (l.symbol = this.getShowNodeSymbol("marker"));
35
- }) : s <= this.nodeScale && i > this.nodeScale && this.bandLayer.graphics.forEach((l) => {
36
- l.geometry.type === "point" && (l.symbol = this.getShowNodeSymbol("picture"));
36
+ (t, r) => {
37
+ t > this.nodeScale && r <= this.nodeScale ? this.bandLayer.graphics.forEach((a) => {
38
+ a.geometry.type === "point" && (a.symbol = this.getShowNodeSymbol("marker"));
39
+ }) : t <= this.nodeScale && r > this.nodeScale && this.bandLayer.graphics.forEach((a) => {
40
+ a.geometry.type === "point" && (a.symbol = this.getShowNodeSymbol("picture"));
37
41
  });
38
42
  }
39
43
  ));
40
- const o = new m({
44
+ const i = new b({
41
45
  paths: [e.coordinates]
42
- }), a = new c({
43
- geometry: o,
44
- symbol: this.getLineSymbol(!0),
46
+ }), s = new n({
47
+ geometry: i,
48
+ symbol: this.getLineSymbol(!0, e),
45
49
  attributes: {
46
50
  bandId: e.bandId,
47
51
  type: "greenWaveBand",
48
52
  id: e.bandId
49
53
  }
50
54
  });
51
- this.roadsectLayer.add(a), await this.view.goTo(a), e.nodeList.forEach((s) => {
52
- const i = new c({
55
+ this.roadsectLayer.add(s), await this.view.goTo(s), e.nodeList && e.nodeList.forEach((t) => {
56
+ const r = new n({
53
57
  geometry: {
54
58
  type: "point",
55
- x: s.longitude,
56
- y: s.latitude
59
+ x: t.longitude,
60
+ y: t.latitude
57
61
  },
58
62
  symbol: this.getShowNodeSymbol("picture"),
59
- attributes: s
63
+ attributes: {
64
+ ...t,
65
+ bandId: e.bandId,
66
+ type: "greenWaveBandNode"
67
+ }
60
68
  });
61
- this.bandLayer.add(i);
69
+ this.bandLayer.add(r);
62
70
  });
63
71
  }
64
72
  /**
@@ -66,20 +74,20 @@ class w {
66
74
  * @param nodeAttributes
67
75
  */
68
76
  showAllNodes(e) {
69
- const o = [];
70
- e.forEach((a) => {
71
- o.push(
72
- new c({
77
+ const i = [];
78
+ e.forEach((s) => {
79
+ i.push(
80
+ new n({
73
81
  geometry: {
74
82
  type: "point",
75
- x: a.longitude,
76
- y: a.latitude
83
+ x: s.longitude,
84
+ y: s.latitude
77
85
  },
78
86
  symbol: this.getEditableNodeSymbol(!1),
79
- attributes: { ...a, selected: !1 }
87
+ attributes: { ...s, selected: !1 }
80
88
  })
81
89
  );
82
- }), this.allNodesLayer.addMany(o);
90
+ }), this.allNodesLayer.addMany(i);
83
91
  }
84
92
  /**
85
93
  * 点击待选/已选路口
@@ -87,51 +95,51 @@ class w {
87
95
  * @returns
88
96
  */
89
97
  async handleViewClick(e) {
90
- var l;
91
- const a = (l = (await this.view.hitTest(e, {
98
+ var a;
99
+ const s = (a = (await this.view.hitTest(e, {
92
100
  include: [this.allNodesLayer]
93
- })).results) == null ? void 0 : l.filter(
101
+ })).results) == null ? void 0 : a.filter(
94
102
  (d) => d.type === "graphic"
95
103
  );
96
- if (a.length === 0)
104
+ if (s.length === 0)
97
105
  return;
98
- const s = a[0].graphic, i = s.getAttribute("id");
99
- if (this.selectedNodeIds.includes(i)) {
100
- const d = this.selectedNodeIds.indexOf(i) + 1;
106
+ const t = s[0].graphic, r = t.getAttribute("id");
107
+ if (this.selectedNodeIds.includes(r)) {
108
+ const d = this.selectedNodeIds.indexOf(r) + 1;
101
109
  if (d === 1)
102
- this.removeAllNodeCallback && this.removeAllNodeCallback(), this.selectedNodeIds = [], this.allNodesLayer.graphics.forEach((t) => {
103
- t.setAttribute("selected", !1), t.symbol = this.getEditableNodeSymbol(!1), t.visible = !0;
110
+ this.removeAllNodeCallback && this.removeAllNodeCallback(), this.selectedNodeIds = [], this.allNodesLayer.graphics.forEach((o) => {
111
+ o.setAttribute("selected", !1), o.symbol = this.getEditableNodeSymbol(!1), o.visible = !0;
104
112
  }), this.roadsectLayer.removeAll();
105
113
  else {
106
- for (let t = d; t < this.selectedNodeIds.length; t++) {
114
+ for (let o = d; o < this.selectedNodeIds.length; o++) {
107
115
  this.removeNodeCallback && this.removeNodeCallback({
108
- id: this.selectedNodeIds[t]
116
+ id: this.selectedNodeIds[o]
109
117
  });
110
- for (let r = 0; r < this.roadsectLayer.graphics.length; r++) {
111
- const h = this.roadsectLayer.graphics.getItemAt(r);
112
- (h.getAttribute("id") === this.selectedNodeIds[t] || !h.getAttribute("selected")) && (this.roadsectLayer.remove(h), r--);
118
+ for (let l = 0; l < this.roadsectLayer.graphics.length; l++) {
119
+ const c = this.roadsectLayer.graphics.getItemAt(l);
120
+ (c.getAttribute("id") === this.selectedNodeIds[o] || !c.getAttribute("selected")) && (this.roadsectLayer.remove(c), l--);
113
121
  }
114
122
  }
115
- this.selectedNodeIds = this.selectedNodeIds.slice(0, d), this.allNodesLayer.graphics.forEach((t) => {
116
- const r = this.selectedNodeIds.includes(
117
- t.getAttribute("id")
123
+ this.selectedNodeIds = this.selectedNodeIds.slice(0, d), this.allNodesLayer.graphics.forEach((o) => {
124
+ const l = this.selectedNodeIds.includes(
125
+ o.getAttribute("id")
118
126
  );
119
- t.setAttribute("selected", r), t.symbol = this.getEditableNodeSymbol(r), t.visible = r;
120
- }), await this.showDownstreamNodes(i);
127
+ o.setAttribute("selected", l), o.symbol = this.getEditableNodeSymbol(l), o.visible = l;
128
+ }), await this.showDownstreamNodes(r);
121
129
  }
122
130
  } else {
123
- s.setAttribute("selected", !0), s.symbol = this.getEditableNodeSymbol(!0), this.selectedNodeIds.push(i), this.allNodesLayer.graphics.forEach((t) => {
124
- t.visible = t.getAttribute("selected");
131
+ t.setAttribute("selected", !0), t.symbol = this.getEditableNodeSymbol(!0), this.selectedNodeIds.push(r), this.allNodesLayer.graphics.forEach((o) => {
132
+ o.visible = o.getAttribute("selected");
125
133
  });
126
134
  let d = [];
127
- for (let t = 0; t < this.roadsectLayer.graphics.length; t++) {
128
- const r = this.roadsectLayer.graphics.getItemAt(t);
129
- r.getAttribute("id") === i ? (r.symbol = this.getLineSymbol(!0), r.setAttribute("selected", !0), d = r.geometry.paths[0]) : r.getAttribute("selected") || (this.roadsectLayer.remove(r), t--);
135
+ for (let o = 0; o < this.roadsectLayer.graphics.length; o++) {
136
+ const l = this.roadsectLayer.graphics.getItemAt(o);
137
+ l.getAttribute("id") === r ? (l.symbol = this.getLineSymbol(!0), l.setAttribute("selected", !0), d = l.geometry.paths[0]) : l.getAttribute("selected") || (this.roadsectLayer.remove(l), o--);
130
138
  }
131
139
  this.addNodeCallback && this.addNodeCallback({
132
- ...s.attributes,
140
+ ...t.attributes,
133
141
  roadsect: d
134
- }), await this.showDownstreamNodes(i);
142
+ }), await this.showDownstreamNodes(r);
135
143
  }
136
144
  }
137
145
  /**
@@ -140,99 +148,103 @@ class w {
140
148
  */
141
149
  async showDownstreamNodes(e) {
142
150
  this.view.container.style.cursor = "progress";
143
- const o = await b.get(
151
+ const i = await m.get(
144
152
  `http://${this.openDriveServer}/api/computable/getDownstreamNodes`,
145
153
  { params: { nodeId: e } }
146
154
  );
147
- if (o.status !== 200 || o.data.status !== 0) {
155
+ if (i.status !== 200 || i.data.status !== 0) {
148
156
  this.view.container.style.cursor = "default";
149
157
  return;
150
158
  }
151
- o.data.result.forEach((s) => {
152
- this.allNodesLayer.graphics.forEach((i) => {
153
- if (i.getAttribute("nodeId") === s.id && i.getAttribute("selected") === !1 && (i.visible = !0, s.coordinates)) {
154
- const l = new c({
159
+ i.data.result.forEach((t) => {
160
+ this.allNodesLayer.graphics.forEach((r) => {
161
+ if (r.getAttribute("nodeId") === t.id && r.getAttribute("selected") === !1 && (r.visible = !0, t.coordinates)) {
162
+ const a = new n({
155
163
  geometry: {
156
164
  type: "polyline",
157
- paths: [s.coordinates]
165
+ paths: [t.coordinates]
158
166
  },
159
167
  symbol: this.getLineSymbol(!1),
160
- attributes: { ...s, selected: !1 }
168
+ attributes: { ...t, selected: !1 }
161
169
  });
162
- this.roadsectLayer.add(l);
170
+ this.roadsectLayer.add(a);
163
171
  }
164
172
  });
165
173
  }), this.view.container.style.cursor = "default";
166
174
  }
167
- getLineSymbol(e) {
168
- return e ? {
169
- type: "cim",
170
- data: {
171
- type: "CIMSymbolReference",
172
- symbol: {
173
- type: "CIMLineSymbol",
174
- symbolLayers: [
175
- {
176
- type: "CIMVectorMarker",
177
- enable: !0,
178
- size: 4,
179
- markerPlacement: {
180
- type: "CIMMarkerPlacementAlongLineSameSize",
181
- endings: "WithMarkers",
182
- placementTemplate: [40],
183
- angleToLine: !0
184
- },
185
- frame: {
186
- xmin: -5,
187
- ymin: -5,
188
- xmax: 5,
189
- ymax: 5
190
- },
191
- markerGraphics: [
192
- {
193
- type: "CIMMarkerGraphic",
194
- geometry: {
195
- paths: [
196
- [
197
- [4, -4],
198
- [12, 0],
199
- [4, 4]
200
- ],
201
- [
202
- [-4, 4],
203
- [-12, 0],
204
- [-4, -4]
175
+ getLineSymbol(e, i) {
176
+ if (e) {
177
+ const s = (i == null ? void 0 : i.lineWidth) || 4, t = (i == null ? void 0 : i.lineColor) || [55, 125, 34, 255], r = (i == null ? void 0 : i.arrowColor) || [255, 255, 255, 255];
178
+ return Array.isArray(t) && t.length === 3 && t.push(255), Array.isArray(r) && r.length === 3 && r.push(255), {
179
+ type: "cim",
180
+ data: {
181
+ type: "CIMSymbolReference",
182
+ symbol: {
183
+ type: "CIMLineSymbol",
184
+ symbolLayers: [
185
+ {
186
+ type: "CIMVectorMarker",
187
+ enable: !0,
188
+ size: 4,
189
+ markerPlacement: {
190
+ type: "CIMMarkerPlacementAlongLineSameSize",
191
+ endings: "WithMarkers",
192
+ placementTemplate: [40],
193
+ angleToLine: !0
194
+ },
195
+ frame: {
196
+ xmin: -5,
197
+ ymin: -5,
198
+ xmax: 5,
199
+ ymax: 5
200
+ },
201
+ markerGraphics: [
202
+ {
203
+ type: "CIMMarkerGraphic",
204
+ geometry: {
205
+ paths: [
206
+ [
207
+ [s, -s],
208
+ [3 * s, 0],
209
+ [s, s]
210
+ ],
211
+ [
212
+ [-s, s],
213
+ [-3 * s, 0],
214
+ [-s, -s]
215
+ ]
205
216
  ]
206
- ]
207
- },
208
- symbol: {
209
- type: "CIMLineSymbol",
210
- symbolLayers: [
211
- {
212
- type: "CIMSolidStroke",
213
- enable: !0,
214
- width: 1.5,
215
- color: [255, 255, 255, 255]
216
- }
217
- ]
217
+ },
218
+ symbol: {
219
+ type: "CIMLineSymbol",
220
+ symbolLayers: [
221
+ {
222
+ type: "CIMSolidStroke",
223
+ enable: !0,
224
+ width: 1.5,
225
+ color: r
226
+ }
227
+ ]
228
+ }
218
229
  }
219
- }
220
- ]
221
- },
222
- {
223
- type: "CIMSolidStroke",
224
- enable: !0,
225
- width: 4,
226
- color: [55, 125, 34, 255]
227
- }
228
- ]
230
+ ]
231
+ },
232
+ {
233
+ type: "CIMSolidStroke",
234
+ enable: !0,
235
+ width: s,
236
+ color: t
237
+ }
238
+ ]
239
+ }
229
240
  }
230
- }
231
- } : {
232
- type: "simple-line",
233
- color: "gray",
234
- width: 2
235
- };
241
+ };
242
+ } else
243
+ return {
244
+ type: "simple-line",
245
+ color: "gray",
246
+ width: 2
247
+ };
236
248
  }
237
249
  getShowNodeSymbol(e) {
238
250
  return e === "marker" ? {
@@ -23,7 +23,9 @@ export default class MapInitializer {
23
23
  * @returns
24
24
  */
25
25
  setMapCenter(params: ISetMapCenterParams): Promise<IResult>;
26
- setMapZoom(zoom: number): IResult;
26
+ setMapZoom(params: {
27
+ zoom: number;
28
+ }): IResult;
27
29
  /**
28
30
  * 在一定的高度,以一定的角度去观察某个坐标
29
31
  * */
@@ -1,9 +1,9 @@
1
1
  import M from "@arcgis/core/Basemap";
2
2
  import d from "@arcgis/core/config";
3
3
  import * as k from "@arcgis/core/core/reactiveUtils";
4
- import { Multipoint as P, Polygon as C, Polyline as W, Point as T } from "@arcgis/core/geometry";
4
+ import { Multipoint as P, Polygon as C, Polyline as z, Point as T } from "@arcgis/core/geometry";
5
5
  import * as u from "@arcgis/core/geometry/support/webMercatorUtils";
6
- import z from "@arcgis/core/layers/FeatureLayer";
6
+ import W from "@arcgis/core/layers/FeatureLayer";
7
7
  import x from "@arcgis/core/layers/GeoJSONLayer";
8
8
  import I from "@arcgis/core/layers/GroupLayer";
9
9
  import G from "@arcgis/core/layers/IntegratedMesh3DTilesLayer";
@@ -168,7 +168,7 @@ class ae {
168
168
  break;
169
169
  }
170
170
  case "feature": {
171
- c = new z({ url: n, ...t.options });
171
+ c = new W({ url: n, ...t.options });
172
172
  break;
173
173
  }
174
174
  case "3dtiles": {
@@ -258,7 +258,7 @@ class ae {
258
258
  e.target = new T(e.target);
259
259
  break;
260
260
  case "polyline":
261
- e.target = new W(e.target);
261
+ e.target = new z(e.target);
262
262
  break;
263
263
  case "polygon":
264
264
  e.target = new C(e.target);
@@ -272,7 +272,7 @@ class ae {
272
272
  return { status: 0, message: "成功" };
273
273
  }
274
274
  setMapZoom(e) {
275
- return this.view ? (this.view.zoom = e, { status: 0, message: "成功" }) : { status: -1, message: "未初始化" };
275
+ return this.view ? (this.view.zoom = e.zoom, { status: 0, message: "成功" }) : { status: -1, message: "未初始化" };
276
276
  }
277
277
  /**
278
278
  * 在一定的高度,以一定的角度去观察某个坐标
@@ -308,11 +308,11 @@ class O {
308
308
  var t;
309
309
  try {
310
310
  const o = await (await fetch(e)).text();
311
- let r = (t = new F({
311
+ let n = (t = new F({
312
312
  ignoreAttributes: !1,
313
313
  allowBooleanAttributes: !0
314
314
  }).parse(o).OpenDRIVE.userData) == null ? void 0 : t.border;
315
- return r ? r = JSON.parse(r) : r = [], { status: 0, message: "ok", result: { md5: J(o), border: r } };
315
+ return n ? n = JSON.parse(n) : n = [], { status: 0, message: "ok", result: { md5: J(o), border: n } };
316
316
  } catch (s) {
317
317
  return { status: -1, message: s.message };
318
318
  }
@@ -359,7 +359,7 @@ class O {
359
359
  );
360
360
  let c = o.data.result.json;
361
361
  c.startsWith(window.location.protocol) || (c = `${window.location.protocol}//${e.server}${c}`);
362
- const a = await (await fetch(c)).arrayBuffer(), n = G.inflate(a, { to: "string" }), l = JSON.parse(n);
362
+ const a = await (await fetch(c)).arrayBuffer(), r = G.inflate(a, { to: "string" }), l = JSON.parse(r);
363
363
  if (await this.showAllLanes(
364
364
  l,
365
365
  ((y = e.options) == null ? void 0 : y.showJunctionLane) || !1,
@@ -397,8 +397,8 @@ class O {
397
397
  throw new Error(`OpenDriveRenderer: ${o.statusText}`);
398
398
  let i = o.data.result.json;
399
399
  i.startsWith(window.location.protocol) || (i = `${window.location.protocol}//${e}${i}`);
400
- const r = await (await fetch(i)).arrayBuffer(), a = G.inflate(r, { to: "string" }), n = JSON.parse(a);
401
- return await this.showAllLanes(n, !1, !1), { status: 0, message: "ok" };
400
+ const n = await (await fetch(i)).arrayBuffer(), a = G.inflate(n, { to: "string" }), r = JSON.parse(a);
401
+ return console.log(r), await this.showAllLanes(r, !1, !1), { status: 0, message: "ok" };
402
402
  }
403
403
  /**
404
404
  * 显示所有车道
@@ -408,18 +408,19 @@ class O {
408
408
  * @returns
409
409
  */
410
410
  async showAllLanes(e, t, s) {
411
+ console.log(e);
411
412
  const o = await this.laneLayer.queryFeatures();
412
413
  return o.features.length > 0 && this.laneLayer.applyEdits({
413
414
  deleteFeatures: o.features
414
415
  }), this.roadNameLayer.visible = s, new Promise((i) => {
415
416
  let c = 0;
416
417
  this.allLaneGraphics = [], this.allRefLineGraphics = [];
417
- const r = [];
418
- for (const n of e) {
419
- if (!t && n.junction !== "-1")
418
+ const n = [];
419
+ for (const r of e) {
420
+ if (!t && r.junction !== "-1")
420
421
  continue;
421
- const { id: l, refLine: h } = n;
422
- let p = n.name;
422
+ const { id: l, refLine: h } = r;
423
+ let p = r.name;
423
424
  p.includes("(") && (p = p.slice(0, p.indexOf("("))), p = p.replace(/(.)/g, "$1 ");
424
425
  const y = new g({
425
426
  geometry: {
@@ -432,9 +433,9 @@ class O {
432
433
  roadName: p
433
434
  }
434
435
  });
435
- this.allRefLineGraphics.push(y), n.laneSections.sort((m, f) => Number(m.id) - Number(f.id));
436
- for (let m = 0; m < n.laneSections.length; m++) {
437
- const f = n.laneSections[m], d = Number(f.id);
436
+ this.allRefLineGraphics.push(y), r.laneSections.sort((m, f) => Number(m.id) - Number(f.id));
437
+ for (let m = 0; m < r.laneSections.length; m++) {
438
+ const f = r.laneSections[m], d = Number(f.id);
438
439
  for (const u of f.lanePaths) {
439
440
  const v = Number(u.id);
440
441
  if (v === 0)
@@ -456,10 +457,10 @@ class O {
456
457
  attributes: {
457
458
  ObjectID: c++,
458
459
  id: `${l}+${d}+${v}`,
459
- fromNode: n.fromNode,
460
- toNode: n.toNode,
460
+ fromNode: r.fromNode,
461
+ toNode: r.toNode,
461
462
  roadId: String(l),
462
- roadName: n.name,
463
+ roadName: r.name,
463
464
  sectionId: String(d),
464
465
  sectionIndex: m,
465
466
  laneId: v,
@@ -470,23 +471,23 @@ class O {
470
471
  rightLine: u.outerPath
471
472
  }
472
473
  });
473
- this.allLaneGraphics.push(j), r.push(j);
474
+ this.allLaneGraphics.push(j), n.push(j);
474
475
  }
475
476
  }
476
477
  }
477
478
  }
478
479
  const a = setInterval(() => {
479
- if (r.length > 0 || this.allRefLineGraphics.length > 0) {
480
- if (r.length > 0) {
481
- const n = r.splice(0, 100);
480
+ if (n.length > 0 || this.allRefLineGraphics.length > 0) {
481
+ if (n.length > 0) {
482
+ const r = n.splice(0, 100);
482
483
  this.laneLayer.applyEdits({
483
- addFeatures: n
484
+ addFeatures: r
484
485
  });
485
486
  }
486
487
  if (this.allRefLineGraphics.length > 0) {
487
- const n = this.allRefLineGraphics.splice(0, 10);
488
+ const r = this.allRefLineGraphics.splice(0, 10);
488
489
  this.roadNameLayer.applyEdits({
489
- addFeatures: n
490
+ addFeatures: r
490
491
  });
491
492
  }
492
493
  } else
@@ -513,7 +514,7 @@ class O {
513
514
  });
514
515
  let c = !0;
515
516
  if (s && (c = L.contains(s, i)), c) {
516
- const r = new g({
517
+ const n = new g({
517
518
  geometry: i,
518
519
  attributes: {
519
520
  ...o,
@@ -522,7 +523,7 @@ class O {
522
523
  },
523
524
  symbol: this.getCrossGraphicSymbol(o, "marker")
524
525
  });
525
- t.push(r);
526
+ t.push(n);
526
527
  }
527
528
  }
528
529
  this.junctionLayer.addMany(t);
@@ -536,7 +537,7 @@ class O {
536
537
  const o = (c = (await this.view.hitTest(t, {
537
538
  include: [this.laneLayer, this.junctionLayer]
538
539
  })).results) == null ? void 0 : c.filter(
539
- (r) => r.type === "graphic"
540
+ (n) => n.type === "graphic"
540
541
  );
541
542
  if (o.length === 0) {
542
543
  this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = ""), this.view.closePopup();
@@ -544,18 +545,18 @@ class O {
544
545
  }
545
546
  const i = o[0];
546
547
  if (this.hitGraphic = i.graphic, i.layer.id === "OpenDriveLane") {
547
- const r = `${this.hitGraphic.getAttribute(
548
+ const n = `${this.hitGraphic.getAttribute(
548
549
  "roadId"
549
550
  )}+${this.hitGraphic.getAttribute("sectionId")}`;
550
- if (this.currentSectionCode === r || this.selectedSectionIds.includes(r) || this.sectionLayer.graphics.findIndex(
551
- (d) => d.getAttribute("id") === r
551
+ if (this.currentSectionCode === n || this.selectedSectionIds.includes(n) || this.sectionLayer.graphics.findIndex(
552
+ (d) => d.getAttribute("id") === n
552
553
  ) >= 0)
553
554
  return;
554
- this.currentSectionCode = r;
555
- const n = this.allLaneGraphics.filter(
556
- (d) => `${d.attributes.roadId}+${d.attributes.sectionId}` === r
555
+ this.currentSectionCode = n;
556
+ const r = this.allLaneGraphics.filter(
557
+ (d) => `${d.attributes.roadId}+${d.attributes.sectionId}` === n
557
558
  ), l = L.union(
558
- n.map((d) => d.geometry)
559
+ r.map((d) => d.geometry)
559
560
  ), h = this.hitGraphic.getAttribute("fromNode"), p = this.hitGraphic.getAttribute("toNode"), y = this.junctionNames.get(h) || h, m = this.junctionNames.get(p) || p, f = new g({
560
561
  geometry: l,
561
562
  symbol: {
@@ -569,11 +570,11 @@ class O {
569
570
  },
570
571
  attributes: {
571
572
  type: "OpenDriveSection",
572
- id: r,
573
+ id: n,
573
574
  selected: !1,
574
575
  fromNodeName: y,
575
576
  toNodeName: m,
576
- laneCount: n.length
577
+ laneCount: r.length
577
578
  },
578
579
  popupTemplate: {
579
580
  title: this.hitGraphic.getAttribute("roadName"),
@@ -600,10 +601,10 @@ class O {
600
601
  });
601
602
  this.highlightLayer.removeAll(), this.highlightLayer.add(f);
602
603
  } else if (i.layer.id === "OpenDriveJunction") {
603
- const r = this.hitGraphic.getAttribute("id");
604
- if (r === this.currentJunctionId)
604
+ const n = this.hitGraphic.getAttribute("id");
605
+ if (n === this.currentJunctionId)
605
606
  return;
606
- this.currentJunctionId = r;
607
+ this.currentJunctionId = n;
607
608
  }
608
609
  });
609
610
  this.mouseMoveHandler = this.view.on("pointer-move", async (t) => {
@@ -620,22 +621,22 @@ class O {
620
621
  const o = (a = (await this.view.hitTest(t, {
621
622
  include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
622
623
  })).results) == null ? void 0 : a.filter(
623
- (n) => n.type === "graphic"
624
+ (r) => r.type === "graphic"
624
625
  );
625
626
  if (o.length === 0)
626
627
  return;
627
- const i = o[0].graphic, c = i.getAttribute("type"), r = i.getAttribute("id");
628
+ const i = o[0].graphic, c = i.getAttribute("type"), n = i.getAttribute("id");
628
629
  if (c === "OpenDriveJunction")
629
630
  if (i.getAttribute("selected") === !1) {
630
- const n = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, l = await b.get(n, {
631
+ const r = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, l = await b.get(r, {
631
632
  params: {
632
- id: r,
633
+ id: n,
633
634
  projectName: this.projectName
634
635
  }
635
636
  });
636
637
  l.status === 200 && l.data.status === 0 && (this.openDriveClickCallback && this.openDriveClickCallback({
637
638
  type: "OpenDriveJunction",
638
- id: r,
639
+ id: n,
639
640
  details: l.data.result
640
641
  }), i.setAttribute("selected", !0), i.symbol = {
641
642
  type: "picture-marker",
@@ -646,7 +647,7 @@ class O {
646
647
  } else
647
648
  this.openDriveClickCallback && this.openDriveClickCallback({
648
649
  type: "OpenDriveJunction",
649
- id: r,
650
+ id: n,
650
651
  details: void 0
651
652
  }), i.setAttribute("selected", !1), i.symbol = this.getCrossGraphicSymbol(
652
653
  i.attributes,
@@ -654,10 +655,10 @@ class O {
654
655
  );
655
656
  else if (c === "OpenDriveSection")
656
657
  if (i.layer.id === "OpenDriveHighlight") {
657
- this.highlightLayer.remove(i), this.sectionLayer.add(i), i.setAttribute("selected", !0), this.selectedSectionIds.push(r);
658
- const n = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, l = await b.get(n, {
658
+ this.highlightLayer.remove(i), this.sectionLayer.add(i), i.setAttribute("selected", !0), this.selectedSectionIds.push(n);
659
+ const r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, l = await b.get(r, {
659
660
  params: {
660
- id: r,
661
+ id: n,
661
662
  projectName: this.projectName
662
663
  }
663
664
  });
@@ -671,7 +672,7 @@ class O {
671
672
  }
672
673
  } else
673
674
  this.sectionLayer.remove(i), this.selectedSectionIds = this.selectedSectionIds.filter(
674
- (n) => n !== r
675
+ (r) => r !== n
675
676
  ), this.openDriveClickCallback && this.openDriveClickCallback({
676
677
  type: "OpenDriveSection",
677
678
  id: i.getAttribute("edgeId"),
@@ -738,7 +739,7 @@ class O {
738
739
  if (i) {
739
740
  const c = `${s}+${i.getAttribute(
740
741
  "sectionId"
741
- )}`, r = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, a = await b.get(r, {
742
+ )}`, n = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, a = await b.get(n, {
742
743
  params: {
743
744
  id: c,
744
745
  projectName: this.projectName
@@ -780,11 +781,11 @@ class O {
780
781
  const i = s.split("_");
781
782
  if (i.length > 2)
782
783
  return { status: -1, message: "id格式错误" };
783
- const c = i.length === 2 ? Number(i[1]) : void 0, r = i[0].split("#");
784
- if (r.length > 2)
784
+ const c = i.length === 2 ? Number(i[1]) : void 0, n = i[0].split("#");
785
+ if (n.length > 2)
785
786
  return { status: -1, message: "id格式错误" };
786
- const a = r[0], n = r.length === 2 ? Number(r[1]) : void 0;
787
- return await this.findLane({ roadsectId: a, segmentId: n, laneId: c, flash: o });
787
+ const a = n[0], r = n.length === 2 ? Number(n[1]) : void 0;
788
+ return await this.findLane({ roadsectId: a, segmentId: r, laneId: c, flash: o });
788
789
  } else
789
790
  return { status: -1, message: "未知类型" };
790
791
  }
@@ -827,32 +828,32 @@ class O {
827
828
  return { status: -1, message: "未找到。请检查路段编号" };
828
829
  if (s !== void 0) {
829
830
  const a = [];
830
- if (i.forEach((n) => {
831
- const l = Number(n.attributes.sectionId);
831
+ if (i.forEach((r) => {
832
+ const l = Number(r.attributes.sectionId);
832
833
  a.indexOf(l) === -1 && a.push(l);
833
- }), a.sort((n, l) => n - l), s > a.length - 1)
834
+ }), a.sort((r, l) => r - l), s > a.length - 1)
834
835
  return { status: -1, message: "未找到。请检查基本段编号" };
835
836
  s = a[s], i = i.filter(
836
- (n) => Number(n.attributes.sectionId) === s
837
+ (r) => Number(r.attributes.sectionId) === s
837
838
  );
838
839
  }
839
840
  if (o !== void 0) {
840
841
  const a = [];
841
- if (i.forEach((n) => {
842
- const l = Number(n.attributes.laneId);
842
+ if (i.forEach((r) => {
843
+ const l = Number(r.attributes.laneId);
843
844
  a.indexOf(l) === -1 && a.push(l);
844
- }), a.sort((n, l) => n - l), o > a.length - 1)
845
+ }), a.sort((r, l) => r - l), o > a.length - 1)
845
846
  return { status: -1, message: "未找到。请检查车道编号" };
846
847
  o = a[o], i = i.filter(
847
- (n) => Number(n.attributes.laneId) === o
848
+ (r) => Number(r.attributes.laneId) === o
848
849
  );
849
850
  }
850
851
  const c = i.map(
851
852
  (a) => a.geometry
852
- ), r = L.union(c);
853
+ ), n = L.union(c);
853
854
  if (e.flash) {
854
855
  const a = new g({
855
- geometry: r,
856
+ geometry: n,
856
857
  symbol: {
857
858
  type: "simple-fill",
858
859
  color: [0, 255, 255, 0.6],
@@ -864,7 +865,7 @@ class O {
864
865
  });
865
866
  this.flashGraphic(a);
866
867
  }
867
- return await this.view.goTo(r, { duration: 1e3 }), { status: 0, message: "ok" };
868
+ return await this.view.goTo(n, { duration: 1e3 }), { status: 0, message: "ok" };
868
869
  }
869
870
  /**
870
871
  * graphic渐隐渐显闪烁
@@ -924,14 +925,14 @@ class O {
924
925
  (c) => c.getAttribute("roadId") === s && c.getAttribute("sectionIndex") === o
925
926
  )), i.length > 0) {
926
927
  const c = /* @__PURE__ */ new Map();
927
- return i.forEach((r) => {
928
- const a = r.getAttribute("roadId") + "+" + r.getAttribute("sectionId");
928
+ return i.forEach((n) => {
929
+ const a = n.getAttribute("roadId") + "+" + n.getAttribute("sectionId");
929
930
  this.selectedSectionIds.includes(a) || this.selectedSectionIds.push(a);
930
- let n = c.get(a);
931
- n ? n.push(r.geometry) : (n = [r.geometry], c.set(a, n));
932
- }), c.forEach(async (r, a) => {
933
- const n = L.union(r), l = new g({
934
- geometry: n,
931
+ let r = c.get(a);
932
+ r ? r.push(n.geometry) : (r = [n.geometry], c.set(a, r));
933
+ }), c.forEach(async (n, a) => {
934
+ const r = L.union(n), l = new g({
935
+ geometry: r,
935
936
  symbol: {
936
937
  type: "simple-fill",
937
938
  color: [0, 255, 255, 0.5],
@@ -965,7 +966,7 @@ class O {
965
966
  outFields: ["*"]
966
967
  }), o = [], i = [];
967
968
  for (const a of s.features) {
968
- const n = a.getAttribute("roadId"), l = a.getAttribute("sectionIndex"), h = `${n}#${l}`;
969
+ const r = a.getAttribute("roadId"), l = a.getAttribute("sectionIndex"), h = `${r}#${l}`;
969
970
  if (o.indexOf(h) === -1) {
970
971
  o.push(h), this.selectSumo({
971
972
  type: "edge",
@@ -973,7 +974,7 @@ class O {
973
974
  });
974
975
  const p = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, y = await b.get(p, {
975
976
  params: {
976
- id: `${n}+${a.getAttribute("sectionId")}`,
977
+ id: `${r}+${a.getAttribute("sectionId")}`,
977
978
  projectName: this.projectName
978
979
  }
979
980
  });
@@ -981,28 +982,28 @@ class O {
981
982
  }
982
983
  }
983
984
  const c = this.junctionLayer.graphics.filter((a) => {
984
- const n = a.geometry;
985
- return L.contains(t, n);
986
- }), r = [];
985
+ const r = a.geometry;
986
+ return L.contains(t, r);
987
+ }), n = [];
987
988
  for (const a of c) {
988
- const n = a.getAttribute("id");
989
+ const r = a.getAttribute("id");
989
990
  this.selectSumo({
990
991
  type: "junction",
991
- id: n
992
+ id: r
992
993
  });
993
994
  const l = `http://${this.openDriveServer}/api/sumo/getSumoJunction`, h = await b.get(l, {
994
995
  params: {
995
- id: n,
996
+ id: r,
996
997
  projectName: this.projectName
997
998
  }
998
999
  });
999
- h.status === 200 && h.data.status === 0 && r.push(h.data.result);
1000
+ h.status === 200 && h.data.status === 0 && n.push(h.data.result);
1000
1001
  }
1001
1002
  return {
1002
1003
  status: 0,
1003
1004
  message: "ok",
1004
1005
  result: {
1005
- junctions: r,
1006
+ junctions: n,
1006
1007
  edges: i
1007
1008
  }
1008
1009
  };
@@ -1012,13 +1013,13 @@ class O {
1012
1013
  if (s.length !== 2)
1013
1014
  return { status: -1, message: "车道编号格式错误" };
1014
1015
  const o = Number(s[1]), i = s[0].split("#"), c = i.length === 2 ? Number(i[1]) : 0;
1015
- let r = i[0];
1016
- r.startsWith("-") && (r = r.slice(1));
1017
- const a = this.allLaneGraphics.filter((I) => I.getAttribute("roadId") === r && I.getAttribute("sectionIndex") === c);
1016
+ let n = i[0];
1017
+ n.startsWith("-") && (n = n.slice(1));
1018
+ const a = this.allLaneGraphics.filter((I) => I.getAttribute("roadId") === n && I.getAttribute("sectionIndex") === c);
1018
1019
  if (a.length === 0)
1019
1020
  return { status: -1, message: "未找到路段" };
1020
- const n = a.length - o, l = a.find(
1021
- (I) => Math.abs(I.getAttribute("laneId")) === n
1021
+ const r = a.length - o, l = a.find(
1022
+ (I) => Math.abs(I.getAttribute("laneId")) === r
1022
1023
  );
1023
1024
  if (!l)
1024
1025
  return { status: -1, message: "未找到车道" };
@@ -307,7 +307,10 @@ export interface IEditSignalControlAreaParams {
307
307
  export interface IShowGreenWaveBandParams {
308
308
  bandId: string;
309
309
  coordinates: number[][];
310
- nodeList: INode[];
310
+ nodeList?: INode[];
311
+ lineColor?: string | number[];
312
+ lineWidth?: number;
313
+ arrowColor?: string | number[];
311
314
  }
312
315
  export interface IRoadLine {
313
316
  id: string;
@@ -80,7 +80,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
80
80
  handleShowPlateNumber: () => void;
81
81
  setMapCenter: (params: ISetMapCenterParams) => Promise<import("../types").IResult>;
82
82
  setMapCamera: (params: ISetMapCameraParams) => Promise<import("../types").IResult>;
83
- setMapZoom: (zoom: number) => import("../types").IResult;
83
+ setMapZoom: (params: {
84
+ zoom: number;
85
+ }) => import("../types").IResult;
84
86
  lookAt: (params: ILookAtParams) => Promise<void>;
85
87
  setLayerVisibility: (params: ILayerVisibleParams) => import("../types").IResult;
86
88
  requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
@@ -65,7 +65,9 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
65
65
  handleShowPlateNumber: () => void;
66
66
  setMapCenter: (params: import("../types").ISetMapCenterParams) => Promise<import("../types").IResult>;
67
67
  setMapCamera: (params: import("../types").ISetMapCameraParams) => Promise<import("../types").IResult>;
68
- setMapZoom: (zoom: number) => import("../types").IResult;
68
+ setMapZoom: (params: {
69
+ zoom: number;
70
+ }) => import("../types").IResult;
69
71
  lookAt: (params: import("../types").ILookAtParams) => Promise<void>;
70
72
  setLayerVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult;
71
73
  requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/core/reactiveUtils.js"),b=require("@arcgis/core/geometry"),n=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),u=require("axios");function p(c){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const s in c)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(c,s);Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>c[s]})}}return e.default=c,Object.freeze(e)}const g=p(m);class f{constructor(e){this.selectedNodeIds=[],this.nodeScale=5e3,this.hasGpu=!1,this.hasGpu=localStorage.getItem("gpu")!=="Unknown",this.view=e,this.roadsectLayer=new y({id:"roadsectLayer"}),this.view.map.add(this.roadsectLayer),this.allNodesLayer=new y({id:"allNodesLayer"}),this.view.map.add(this.allNodesLayer),this.bandLayer=new y({id:"bandLayer"}),this.view.map.add(this.bandLayer)}addGreenWaveBand(e){this.addNodeCallback=e.addCrossCallback,this.removeNodeCallback=e.removeCrossCallback,e.removeAllCrossCallback&&(this.removeAllNodeCallback=e.removeAllCrossCallback),this.selectedNodeIds=[],this.openDriveServer=e.odrServer,this.showAllNodes(e.crossesInArea),this.viewClickWatcher||(this.viewClickWatcher=this.view.on("click",s=>{this.handleViewClick(s)}))}stopAddGreenWaveBand(){var e;(e=this.viewClickWatcher)==null||e.remove(),this.viewClickWatcher=void 0,this.allNodesLayer.removeAll(),this.selectedNodeIds=[],this.roadsectLayer.removeAll(),this.bandLayer.removeAll()}async showGreenWaveBand(e){this.scaleWatcher||(this.scaleWatcher=g.watch(()=>this.view.scale,(i,r)=>{i>this.nodeScale&&r<=this.nodeScale?this.bandLayer.graphics.forEach(l=>{l.geometry.type==="point"&&(l.symbol=this.getShowNodeSymbol("marker"))}):i<=this.nodeScale&&r>this.nodeScale&&this.bandLayer.graphics.forEach(l=>{l.geometry.type==="point"&&(l.symbol=this.getShowNodeSymbol("picture"))})}));const s=new b.Polyline({paths:[e.coordinates]}),a=new n({geometry:s,symbol:this.getLineSymbol(!0),attributes:{bandId:e.bandId,type:"greenWaveBand",id:e.bandId}});this.roadsectLayer.add(a),await this.view.goTo(a),e.nodeList.forEach(i=>{const r=new n({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getShowNodeSymbol("picture"),attributes:i});this.bandLayer.add(r)})}showAllNodes(e){const s=[];e.forEach(a=>{s.push(new n({geometry:{type:"point",x:a.longitude,y:a.latitude},symbol:this.getEditableNodeSymbol(!1),attributes:{...a,selected:!1}}))}),this.allNodesLayer.addMany(s)}async handleViewClick(e){var l;const a=(l=(await this.view.hitTest(e,{include:[this.allNodesLayer]})).results)==null?void 0:l.filter(d=>d.type==="graphic");if(a.length===0)return;const i=a[0].graphic,r=i.getAttribute("id");if(this.selectedNodeIds.includes(r)){const d=this.selectedNodeIds.indexOf(r)+1;if(d===1)this.removeAllNodeCallback&&this.removeAllNodeCallback(),this.selectedNodeIds=[],this.allNodesLayer.graphics.forEach(t=>{t.setAttribute("selected",!1),t.symbol=this.getEditableNodeSymbol(!1),t.visible=!0}),this.roadsectLayer.removeAll();else{for(let t=d;t<this.selectedNodeIds.length;t++){this.removeNodeCallback&&this.removeNodeCallback({id:this.selectedNodeIds[t]});for(let o=0;o<this.roadsectLayer.graphics.length;o++){const h=this.roadsectLayer.graphics.getItemAt(o);(h.getAttribute("id")===this.selectedNodeIds[t]||!h.getAttribute("selected"))&&(this.roadsectLayer.remove(h),o--)}}this.selectedNodeIds=this.selectedNodeIds.slice(0,d),this.allNodesLayer.graphics.forEach(t=>{const o=this.selectedNodeIds.includes(t.getAttribute("id"));t.setAttribute("selected",o),t.symbol=this.getEditableNodeSymbol(o),t.visible=o}),await this.showDownstreamNodes(r)}}else{i.setAttribute("selected",!0),i.symbol=this.getEditableNodeSymbol(!0),this.selectedNodeIds.push(r),this.allNodesLayer.graphics.forEach(t=>{t.visible=t.getAttribute("selected")});let d=[];for(let t=0;t<this.roadsectLayer.graphics.length;t++){const o=this.roadsectLayer.graphics.getItemAt(t);o.getAttribute("id")===r?(o.symbol=this.getLineSymbol(!0),o.setAttribute("selected",!0),d=o.geometry.paths[0]):o.getAttribute("selected")||(this.roadsectLayer.remove(o),t--)}this.addNodeCallback&&this.addNodeCallback({...i.attributes,roadsect:d}),await this.showDownstreamNodes(r)}}async showDownstreamNodes(e){this.view.container.style.cursor="progress";const s=await u.get(`http://${this.openDriveServer}/api/computable/getDownstreamNodes`,{params:{nodeId:e}});if(s.status!==200||s.data.status!==0){this.view.container.style.cursor="default";return}s.data.result.forEach(i=>{this.allNodesLayer.graphics.forEach(r=>{if(r.getAttribute("nodeId")===i.id&&r.getAttribute("selected")===!1&&(r.visible=!0,i.coordinates)){const l=new n({geometry:{type:"polyline",paths:[i.coordinates]},symbol:this.getLineSymbol(!1),attributes:{...i,selected:!1}});this.roadsectLayer.add(l)}})}),this.view.container.style.cursor="default"}getLineSymbol(e){return e?{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:4,markerPlacement:{type:"CIMMarkerPlacementAlongLineSameSize",endings:"WithMarkers",placementTemplate:[40],angleToLine:!0},frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[4,-4],[12,0],[4,4]],[[-4,4],[-12,0],[-4,-4]]]},symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,width:1.5,color:[255,255,255,255]}]}}]},{type:"CIMSolidStroke",enable:!0,width:4,color:[55,125,34,255]}]}}}:{type:"simple-line",color:"gray",width:2}}getShowNodeSymbol(e){return e==="marker"?{type:"simple-marker",style:"circle",color:[61,139,249],size:8,outline:{color:"white",width:1}}:this.getEditableNodeSymbol(!0)}getEditableNodeSymbol(e){return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:30,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:2,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:25,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}}}exports.default=f;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),m=require("@arcgis/core/geometry"),c=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),u=require("axios");function g(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const s in n)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}return e.default=n,Object.freeze(e)}const p=g(b);class f{constructor(e){this.selectedNodeIds=[],this.nodeScale=5e3,this.hasGpu=!1,this.hasGpu=localStorage.getItem("gpu")!=="Unknown",this.view=e,this.roadsectLayer=new y({id:"roadsectLayer"}),this.view.map.add(this.roadsectLayer),this.allNodesLayer=new y({id:"allNodesLayer"}),this.view.map.add(this.allNodesLayer),this.bandLayer=new y({id:"bandLayer"}),this.view.map.add(this.bandLayer)}addGreenWaveBand(e){this.addNodeCallback=e.addCrossCallback,this.removeNodeCallback=e.removeCrossCallback,e.removeAllCrossCallback&&(this.removeAllNodeCallback=e.removeAllCrossCallback),this.selectedNodeIds=[],this.openDriveServer=e.odrServer,this.showAllNodes(e.crossesInArea),this.viewClickWatcher||(this.viewClickWatcher=this.view.on("click",s=>{this.handleViewClick(s)}))}stopAddGreenWaveBand(){var e;(e=this.viewClickWatcher)==null||e.remove(),this.viewClickWatcher=void 0,this.allNodesLayer.removeAll(),this.selectedNodeIds=[],this.roadsectLayer.removeAll(),this.bandLayer.removeAll()}async showGreenWaveBand(e){this.bandLayer.graphics.forEach(t=>{t.getAttribute("bandId")===e.bandId&&this.bandLayer.remove(t)}),this.roadsectLayer.graphics.forEach(t=>{t.getAttribute("bandId")===e.bandId&&this.roadsectLayer.remove(t)}),this.scaleWatcher||(this.scaleWatcher=p.watch(()=>this.view.scale,(t,o)=>{t>this.nodeScale&&o<=this.nodeScale?this.bandLayer.graphics.forEach(a=>{a.geometry.type==="point"&&(a.symbol=this.getShowNodeSymbol("marker"))}):t<=this.nodeScale&&o>this.nodeScale&&this.bandLayer.graphics.forEach(a=>{a.geometry.type==="point"&&(a.symbol=this.getShowNodeSymbol("picture"))})}));const s=new m.Polyline({paths:[e.coordinates]}),i=new c({geometry:s,symbol:this.getLineSymbol(!0,e),attributes:{bandId:e.bandId,type:"greenWaveBand",id:e.bandId}});this.roadsectLayer.add(i),await this.view.goTo(i),e.nodeList&&e.nodeList.forEach(t=>{const o=new c({geometry:{type:"point",x:t.longitude,y:t.latitude},symbol:this.getShowNodeSymbol("picture"),attributes:{...t,bandId:e.bandId,type:"greenWaveBandNode"}});this.bandLayer.add(o)})}showAllNodes(e){const s=[];e.forEach(i=>{s.push(new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getEditableNodeSymbol(!1),attributes:{...i,selected:!1}}))}),this.allNodesLayer.addMany(s)}async handleViewClick(e){var a;const i=(a=(await this.view.hitTest(e,{include:[this.allNodesLayer]})).results)==null?void 0:a.filter(d=>d.type==="graphic");if(i.length===0)return;const t=i[0].graphic,o=t.getAttribute("id");if(this.selectedNodeIds.includes(o)){const d=this.selectedNodeIds.indexOf(o)+1;if(d===1)this.removeAllNodeCallback&&this.removeAllNodeCallback(),this.selectedNodeIds=[],this.allNodesLayer.graphics.forEach(r=>{r.setAttribute("selected",!1),r.symbol=this.getEditableNodeSymbol(!1),r.visible=!0}),this.roadsectLayer.removeAll();else{for(let r=d;r<this.selectedNodeIds.length;r++){this.removeNodeCallback&&this.removeNodeCallback({id:this.selectedNodeIds[r]});for(let l=0;l<this.roadsectLayer.graphics.length;l++){const h=this.roadsectLayer.graphics.getItemAt(l);(h.getAttribute("id")===this.selectedNodeIds[r]||!h.getAttribute("selected"))&&(this.roadsectLayer.remove(h),l--)}}this.selectedNodeIds=this.selectedNodeIds.slice(0,d),this.allNodesLayer.graphics.forEach(r=>{const l=this.selectedNodeIds.includes(r.getAttribute("id"));r.setAttribute("selected",l),r.symbol=this.getEditableNodeSymbol(l),r.visible=l}),await this.showDownstreamNodes(o)}}else{t.setAttribute("selected",!0),t.symbol=this.getEditableNodeSymbol(!0),this.selectedNodeIds.push(o),this.allNodesLayer.graphics.forEach(r=>{r.visible=r.getAttribute("selected")});let d=[];for(let r=0;r<this.roadsectLayer.graphics.length;r++){const l=this.roadsectLayer.graphics.getItemAt(r);l.getAttribute("id")===o?(l.symbol=this.getLineSymbol(!0),l.setAttribute("selected",!0),d=l.geometry.paths[0]):l.getAttribute("selected")||(this.roadsectLayer.remove(l),r--)}this.addNodeCallback&&this.addNodeCallback({...t.attributes,roadsect:d}),await this.showDownstreamNodes(o)}}async showDownstreamNodes(e){this.view.container.style.cursor="progress";const s=await u.get(`http://${this.openDriveServer}/api/computable/getDownstreamNodes`,{params:{nodeId:e}});if(s.status!==200||s.data.status!==0){this.view.container.style.cursor="default";return}s.data.result.forEach(t=>{this.allNodesLayer.graphics.forEach(o=>{if(o.getAttribute("nodeId")===t.id&&o.getAttribute("selected")===!1&&(o.visible=!0,t.coordinates)){const a=new c({geometry:{type:"polyline",paths:[t.coordinates]},symbol:this.getLineSymbol(!1),attributes:{...t,selected:!1}});this.roadsectLayer.add(a)}})}),this.view.container.style.cursor="default"}getLineSymbol(e,s){if(e){const i=(s==null?void 0:s.lineWidth)||4,t=(s==null?void 0:s.lineColor)||[55,125,34,255],o=(s==null?void 0:s.arrowColor)||[255,255,255,255];return Array.isArray(t)&&t.length===3&&t.push(255),Array.isArray(o)&&o.length===3&&o.push(255),{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:4,markerPlacement:{type:"CIMMarkerPlacementAlongLineSameSize",endings:"WithMarkers",placementTemplate:[40],angleToLine:!0},frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[i,-i],[3*i,0],[i,i]],[[-i,i],[-3*i,0],[-i,-i]]]},symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,width:1.5,color:o}]}}]},{type:"CIMSolidStroke",enable:!0,width:i,color:t}]}}}}else return{type:"simple-line",color:"gray",width:2}}getShowNodeSymbol(e){return e==="marker"?{type:"simple-marker",style:"circle",color:[61,139,249],size:8,outline:{color:"white",width:1}}:this.getEditableNodeSymbol(!0)}getEditableNodeSymbol(e){return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:30,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:2,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:25,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}}}exports.default=f;
@@ -23,7 +23,9 @@ export default class MapInitializer {
23
23
  * @returns
24
24
  */
25
25
  setMapCenter(params: ISetMapCenterParams): Promise<IResult>;
26
- setMapZoom(zoom: number): IResult;
26
+ setMapZoom(params: {
27
+ zoom: number;
28
+ }): IResult;
27
29
  /**
28
30
  * 在一定的高度,以一定的角度去观察某个坐标
29
31
  * */
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("@arcgis/core/Basemap"),v=require("@arcgis/core/config"),C=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),z=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/FeatureLayer"),O=require("@arcgis/core/layers/GeoJSONLayer"),S=require("@arcgis/core/layers/GroupLayer"),x=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),I=require("@arcgis/core/layers/MapImageLayer"),G=require("@arcgis/core/layers/TileLayer"),H=require("@arcgis/core/layers/WebTileLayer"),R=require("@arcgis/core/layers/WMSLayer"),_=require("@arcgis/core/Map"),B=require("@arcgis/core/views/MapView"),U=require("@arcgis/core/views/SceneView"),j=require("@turf/destination"),N=require("@turf/helpers"),E=require("./custom-layer/custom-wmts-layer.js");function y(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const i in u)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(u,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>u[i]})}}return e.default=u,Object.freeze(e)}const L=y(C),d=y(z),A=y(N);class J{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}async initialize(e){var f,M,k,P;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:a}=e;v.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,v.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,v.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const r=new _;((f=this.mapConfig)==null?void 0:f.mapOptions.mode.toLowerCase())==="2d"?(this.view=new B({map:r,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new U({map:r,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(M=this.mapConfig)==null?void 0:M.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var l,m;if(a){let o=t.mapPoint;o.spatialReference.isWebMercator&&(o=d.webMercatorToGeographic(o)),a([o.x,o.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const o=this.view.camera;if(this.view.spatialReference.isWebMercator){const h=d.webMercatorToGeographic(o.position),p={heading:o.heading,tilt:o.tilt,position:h.toJSON()};console.log(p),(l=navigator.clipboard)==null||l.writeText(JSON.stringify(p))}else console.log(o.toJSON());console.log(this.view.zoom,this.view.scale)}else{let o=this.view.center;this.view.spatialReference.isWebMercator&&(o=d.webMercatorToGeographic(o)),console.log({center:o.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(m=(await this.view.hitTest(t)).results)==null?void 0:m.filter(o=>o.type==="graphic");c.length>0&&c.forEach(o=>{var p;const h=o.graphic;(p=h.attributes)!=null&&p.type&&s&&s(h.attributes.type,h.attributes.id,h.attributes,t)})});{let t=0,n=!1;this.view.on("pointer-move",async c=>{var m;const l=performance.now();if(!(n||l-t<100)){t=l,n=!0;try{const h=(m=(await this.view.hitTest(c)).results)==null?void 0:m.some(q=>q.type==="graphic"),p=this.view.container;p&&(p.style.cursor=h?"pointer":"default")}finally{n=!1}}})}if(this.view.on("pointer-leave",()=>{const t=this.view.container;t&&(t.style.cursor="default")}),(k=this.mapConfig)!=null&&k.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const n=this.processUrl(t.url);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new H({urlTemplate:n,...t.options});break}case"tile":{c=new G({url:n,...t.options});break}case"customwmts".toLowerCase():{c=new E.default({urlTemplate:n,...t.options});break}case"mapimage".toLowerCase():{c=new I({url:n,...t.options});break}case"arcgis":{const l=new T(t.options);r.basemap=l;break}case"feature":{c=new W({url:n,...t.options});break}case"3dtiles":{c=new x({url:n,...t.options});break}case"wms":{c=new R({url:n,...t.options});break}default:console.warn(`不支持的图层类型: ${t.type}`);break}if(c)if(t.group){let l=r.findLayerById(t.group);l&&l.type==="group"?l.add(c):(l=new S({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c],visible:t.groupVisible!==!1}),r.add(l))}else r.add(c)}):r.basemap=new T({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(P=this.mapConfig)!=null&&P.hdLayers){const t=this.mapConfig.hdLayers.map(n=>new O({url:this.processUrl(n.url),...n.options,title:n.options.id}));r.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const b=this.mapConfig.camera;let w;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=d.webMercatorToGeographic(t)),w={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=d.webMercatorToGeographic(t)),w={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return b?b.home=w:this.mapConfig.camera={home:w},this.view}setLayerVisibility(e){const{id:i,visible:s}=e,a=this.view.map.findLayerById(i);return a?(a.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new g.Point(e.target);break;case"polyline":e.target=new g.Polyline(e.target);break;case"polygon":e.target=new g.Polygon(e.target);break;case"multipoint":e.target=new g.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}setMapZoom(e){return this.view?(this.view.zoom=e,{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const a=Math.tan(i*Math.PI/180)*e.height,r=j(A.point(e.center),a,s+180,{units:"meters"});await this.view.goTo({position:{x:r.geometry.coordinates[0],y:r.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:a}=this.mapConfig;if(!a)return{status:-1,message:"未配置camera"};const r=a[i];return r?(await this.view.goTo(r,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const r=1e3/30,b=L.watch(()=>this.view.center,()=>{const w=this.transformPoints(e),f=Date.now();f-s>r&&(i(w),s=f)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,b),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new g.Point({x:i[0],y:i[1]}),a=this.view.toScreen(s);return[a.x,a.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=L.watch(()=>this.view.zoom,a=>{i&&a<=i&&(this.view.zoom=i),s&&a>=s&&(this.view.zoom=s)}))}}exports.default=J;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("@arcgis/core/Basemap"),v=require("@arcgis/core/config"),z=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/FeatureLayer"),O=require("@arcgis/core/layers/GeoJSONLayer"),S=require("@arcgis/core/layers/GroupLayer"),x=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),I=require("@arcgis/core/layers/MapImageLayer"),G=require("@arcgis/core/layers/TileLayer"),H=require("@arcgis/core/layers/WebTileLayer"),R=require("@arcgis/core/layers/WMSLayer"),_=require("@arcgis/core/Map"),B=require("@arcgis/core/views/MapView"),U=require("@arcgis/core/views/SceneView"),j=require("@turf/destination"),N=require("@turf/helpers"),E=require("./custom-layer/custom-wmts-layer.js");function y(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const i in u)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(u,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>u[i]})}}return e.default=u,Object.freeze(e)}const L=y(z),d=y(C),A=y(N);class J{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}async initialize(e){var m,M,k,P;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:a}=e;v.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,v.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,v.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const r=new _;((m=this.mapConfig)==null?void 0:m.mapOptions.mode.toLowerCase())==="2d"?(this.view=new B({map:r,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new U({map:r,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(M=this.mapConfig)==null?void 0:M.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var l,f;if(a){let o=t.mapPoint;o.spatialReference.isWebMercator&&(o=d.webMercatorToGeographic(o)),a([o.x,o.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const o=this.view.camera;if(this.view.spatialReference.isWebMercator){const h=d.webMercatorToGeographic(o.position),p={heading:o.heading,tilt:o.tilt,position:h.toJSON()};console.log(p),(l=navigator.clipboard)==null||l.writeText(JSON.stringify(p))}else console.log(o.toJSON());console.log(this.view.zoom,this.view.scale)}else{let o=this.view.center;this.view.spatialReference.isWebMercator&&(o=d.webMercatorToGeographic(o)),console.log({center:o.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(f=(await this.view.hitTest(t)).results)==null?void 0:f.filter(o=>o.type==="graphic");c.length>0&&c.forEach(o=>{var p;const h=o.graphic;(p=h.attributes)!=null&&p.type&&s&&s(h.attributes.type,h.attributes.id,h.attributes,t)})});{let t=0,n=!1;this.view.on("pointer-move",async c=>{var f;const l=performance.now();if(!(n||l-t<100)){t=l,n=!0;try{const h=(f=(await this.view.hitTest(c)).results)==null?void 0:f.some(q=>q.type==="graphic"),p=this.view.container;p&&(p.style.cursor=h?"pointer":"default")}finally{n=!1}}})}if(this.view.on("pointer-leave",()=>{const t=this.view.container;t&&(t.style.cursor="default")}),(k=this.mapConfig)!=null&&k.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const n=this.processUrl(t.url);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new H({urlTemplate:n,...t.options});break}case"tile":{c=new G({url:n,...t.options});break}case"customwmts".toLowerCase():{c=new E.default({urlTemplate:n,...t.options});break}case"mapimage".toLowerCase():{c=new I({url:n,...t.options});break}case"arcgis":{const l=new T(t.options);r.basemap=l;break}case"feature":{c=new W({url:n,...t.options});break}case"3dtiles":{c=new x({url:n,...t.options});break}case"wms":{c=new R({url:n,...t.options});break}default:console.warn(`不支持的图层类型: ${t.type}`);break}if(c)if(t.group){let l=r.findLayerById(t.group);l&&l.type==="group"?l.add(c):(l=new S({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c],visible:t.groupVisible!==!1}),r.add(l))}else r.add(c)}):r.basemap=new T({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(P=this.mapConfig)!=null&&P.hdLayers){const t=this.mapConfig.hdLayers.map(n=>new O({url:this.processUrl(n.url),...n.options,title:n.options.id}));r.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const b=this.mapConfig.camera;let w;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=d.webMercatorToGeographic(t)),w={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=d.webMercatorToGeographic(t)),w={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return b?b.home=w:this.mapConfig.camera={home:w},this.view}setLayerVisibility(e){const{id:i,visible:s}=e,a=this.view.map.findLayerById(i);return a?(a.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new g.Point(e.target);break;case"polyline":e.target=new g.Polyline(e.target);break;case"polygon":e.target=new g.Polygon(e.target);break;case"multipoint":e.target=new g.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}setMapZoom(e){return this.view?(this.view.zoom=e.zoom,{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const a=Math.tan(i*Math.PI/180)*e.height,r=j(A.point(e.center),a,s+180,{units:"meters"});await this.view.goTo({position:{x:r.geometry.coordinates[0],y:r.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:a}=this.mapConfig;if(!a)return{status:-1,message:"未配置camera"};const r=a[i];return r?(await this.view.goTo(r,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const r=1e3/30,b=L.watch(()=>this.view.center,()=>{const w=this.transformPoints(e),m=Date.now();m-s>r&&(i(w),s=m)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,b),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new g.Point({x:i[0],y:i[1]}),a=this.view.toScreen(s);return[a.x,a.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=L.watch(()=>this.view.zoom,a=>{i&&a<=i&&(this.view.zoom=i),s&&a>=s&&(this.view.zoom=s)}))}}exports.default=J;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/Graphic"),F=require("@arcgis/core/core/promiseUtils"),J=require("@arcgis/core/core/reactiveUtils.js"),S=require("@arcgis/core/geometry"),q=require("@arcgis/core/geometry/geometryEngine"),x=require("@arcgis/core/layers/FeatureLayer"),w=require("@arcgis/core/layers/GraphicsLayer"),E=require("@turf/helpers"),G=require("@turf/line-slice-along"),b=require("axios"),R=require("fast-xml-parser"),T=require("md5"),O=require("pako"),_=require("vue"),z=require("../../stores/index.js"),H=require("../common-utils.js");function N(L){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(L){for(const t in L)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(L,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>L[t]})}}return e.default=L,Object.freeze(e)}const M=N(F),U=N(J),A=N(q),P=N(E);class D{constructor(e){this.junctionNames=new Map,this.junctionScale=5e3,this.xodrBorder=[],this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.selectedSectionIds=[],this.currentJunctionId="",this.view=e,this.laneLayer=new x({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:"sectionIndex",alias:"路段序号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"},{name:"fromNode",alias:"起点路口",type:"string"},{name:"toNode",alias:"终点路口",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 x({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 w({id:"OpenDriveJunction"}),this.sectionLayer=new w({id:"OpenDriveSection"}),this.highlightLayer=new w({id:"OpenDriveHighlight"}),this.flashLayer=new w({id:"OpenDriveFlash"}),this.drawLayer=new w({id:"Draw"}),this.splitLaneLayer=new w({id:"SplitLane"}),this.borderLayer=new w({id:"OpenDriveBorder"}),this.view.map.addMany([this.laneLayer,this.sectionLayer,this.roadNameLayer,this.junctionLayer,this.highlightLayer,this.flashLayer,this.drawLayer,this.splitLaneLayer,this.borderLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){var t;try{const o=await(await fetch(e)).text();let r=(t=new R.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(o).OpenDRIVE.userData)==null?void 0:t.border;return r?r=JSON.parse(r):r=[],{status:0,message:"ok",result:{md5:T(o),border:r}}}catch(i){return{status:-1,message:i.message}}}async showOpenDriveFromFile(e){var y,m,g;this.openDriveClickCallback=e.selectedCallback,this.scaleWatch=U.watch(()=>this.view.scale,(u,h)=>{u>this.junctionScale&&h<=this.junctionScale?this.updateAllJunctionSymbol("marker"):u<=this.junctionScale&&h>this.junctionScale&&this.updateAllJunctionSymbol("picture")});let t=e.file.split("/").pop()||"";t=t.split(".").slice(0,-1).join("."),console.log(`OpenDriveRenderer: 显示OpenDrive文件 ${t}`),this.openDriveServer=e.server;const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await b.post(i,{},{params:{url:e.file,projectName:t}})}catch(u){return{status:-1,message:u.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;H.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let c=o.data.result.json;c.startsWith(window.location.protocol)||(c=`${window.location.protocol}//${e.server}${c}`);const a=await(await fetch(c)).arrayBuffer(),n=O.inflate(a,{to:"string"}),l=JSON.parse(n);if(await this.showAllLanes(l,((y=e.options)==null?void 0:y.showJunctionLane)||!1,((m=e.options)==null?void 0:m.showRoadName)||!0),((g=e.options)==null?void 0:g.showJunctionPoint)!==!1){const u=o.data.result.junctions;this.showJunction(u)}e.options&&e.options.centerMap!==!1&&await this.view.goTo(this.allLaneGraphics),this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick();const p=z.default.useAppDataStore;return _.watch(()=>p.isSketching,()=>{var u,h;p.isSketching?((u=this.mouseMoveHandler)==null||u.remove(),this.mouseMoveHandler=void 0,(h=this.mouseClickHandler)==null||h.remove(),this.mouseClickHandler=void 0):(this.monitorMouseMove(),this.monitorMouseClick())}),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await b.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 r=await(await fetch(s)).arrayBuffer(),a=O.inflate(r,{to:"string"}),n=JSON.parse(a);return await this.showAllLanes(n,!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 c=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const r=[];for(const n of e){if(!t&&n.junction!=="-1")continue;const{id:l,refLine:d}=n;let p=n.name;p.includes("(")&&(p=p.slice(0,p.indexOf("("))),p=p.replace(/(.)/g,"$1 ");const y=new f({geometry:{type:"polyline",paths:[d]},attributes:{ObjectID:c++,roadId:l,roadName:p}});this.allRefLineGraphics.push(y),n.laneSections.sort((m,g)=>Number(m.id)-Number(g.id));for(let m=0;m<n.laneSections.length;m++){const g=n.laneSections[m],u=Number(g.id);for(const h of g.lanePaths){const v=Number(h.id);if(v===0)continue;const I=h.type,$=[...h.outerPath],j=h.innerPath.concat($.reverse());if(j.length<=3){console.warn(`lane ${v} has less than 3 points`);continue}j.push(h.innerPath[0]);const k=new S.Polygon({rings:[j]});if(k){const C=new f({geometry:k,attributes:{ObjectID:c++,id:`${l}+${u}+${v}`,fromNode:n.fromNode,toNode:n.toNode,roadId:String(l),roadName:n.name,sectionId:String(u),sectionIndex:m,laneId:v,type:I,sumoId:"",leftLine:h.innerPath,rightLine:h.outerPath}});this.allLaneGraphics.push(C),r.push(C)}}}}const a=setInterval(()=>{if(r.length>0||this.allRefLineGraphics.length>0){if(r.length>0){const n=r.splice(0,100);this.laneLayer.applyEdits({addFeatures:n})}if(this.allRefLineGraphics.length>0){const n=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:n})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];let i;this.xodrBorder.length>0&&(i=new S.Polygon({rings:[this.xodrBorder]}));for(const o of e)if(o&&(this.junctionNames.set(o.id,o.name),o.nodeType=o.type,o.crossId)){const s=new S.Point({x:o.coordinates[0],y:o.coordinates[1]});let c=!0;if(i&&(c=A.contains(i,s)),c){const r=new f({geometry:s,attributes:{...o,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(o,"marker")});t.push(r)}}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=M.debounce(async t=>{var c;const o=(c=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:c.filter(r=>r.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",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 r=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`;if(this.currentSectionCode===r||this.selectedSectionIds.includes(r)||this.sectionLayer.graphics.findIndex(u=>u.getAttribute("id")===r)>=0)return;this.currentSectionCode=r;const n=this.allLaneGraphics.filter(u=>`${u.attributes.roadId}+${u.attributes.sectionId}`===r),l=A.union(n.map(u=>u.geometry)),d=this.hitGraphic.getAttribute("fromNode"),p=this.hitGraphic.getAttribute("toNode"),y=this.junctionNames.get(d)||d,m=this.junctionNames.get(p)||p,g=new f({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:r,selected:!1,fromNodeName:y,toNodeName:m,laneCount:n.length},popupTemplate:{title:this.hitGraphic.getAttribute("roadName"),content:[{type:"fields",fieldInfos:[{fieldName:"fromNodeName",label:"起点路口"},{fieldName:"toNodeName",label:"终点路口"},{fieldName:"laneCount",label:"车道数量"}]}]}});this.highlightLayer.removeAll(),this.highlightLayer.add(g)}else if(s.layer.id==="OpenDriveJunction"){const r=this.hitGraphic.getAttribute("id");if(r===this.currentJunctionId)return;this.currentJunctionId=r}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=M.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(n=>n.type==="graphic");if(o.length===0)return;const s=o[0].graphic,c=s.getAttribute("type"),r=s.getAttribute("id");if(c==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const n=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,l=await b.get(n,{params:{id:r,projectName:this.projectName}});l.status===200&&l.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:l.data.result}),s.setAttribute("selected",!0),s.symbol={type:"picture-marker",url:"/GisViewerAssets/Images/point_red.png",width:"20px",height:"20px"},this.increasePictureMarkerSize(s,50))}else this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:void 0}),s.setAttribute("selected",!1),s.symbol=this.getCrossGraphicSymbol(s.attributes,this.view.scale<this.junctionScale?"picture":"marker");else if(c==="OpenDriveSection")if(s.layer.id==="OpenDriveHighlight"){this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0),this.selectedSectionIds.push(r);const n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,l=await b.get(n,{params:{id:r,projectName:this.projectName}});if(l.status===200&&l.data.status===0&&this.openDriveClickCallback){const d=l.data.result.obj_id;s.setAttribute("edgeId",d),this.openDriveClickCallback({type:"OpenDriveSection",id:d,details:l.data.result})}}else this.sectionLayer.remove(s),this.selectedSectionIds=this.selectedSectionIds.filter(n=>n!==r),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:s.getAttribute("edgeId"),details:void 0})});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 b.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(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===o);if(s){const c=`${i}+${s.getAttribute("sectionId")}`,r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await b.get(r,{params:{id:c,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${c}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}setOpendriveVisibility(e){this.laneLayer.visible=e}async clearOpenDrive(){var t,i,o;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(),this.borderLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0,(o=this.scaleWatch)==null||o.remove(),this.scaleWatch=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 c=s.length===2?Number(s[1]):void 0,r=s[0].split("#");if(r.length>2)return{status:-1,message:"id格式错误"};const a=r[0],n=r.length===2?Number(r[1]):void 0;return await this.findLane({roadsectId:a,segmentId:n,laneId:c,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 f({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[0,255,255,.8],outline:{color:[0,255,255],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(n=>{const l=Number(n.attributes.sectionId);a.indexOf(l)===-1&&a.push(l)}),a.sort((n,l)=>n-l),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(n=>Number(n.attributes.sectionId)===i)}if(o!==void 0){const a=[];if(s.forEach(n=>{const l=Number(n.attributes.laneId);a.indexOf(l)===-1&&a.push(l)}),a.sort((n,l)=>n-l),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(n=>Number(n.attributes.laneId)===o)}const c=s.map(a=>a.geometry),r=A.union(c);if(e.flash){const a=new f({geometry:r,symbol:{type:"simple-fill",color:[0,255,255,.6],style:"solid",outline:{width:0}}});this.flashGraphic(a)}return await this.view.goTo(r,{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=>{(!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")&&(t.setAttribute("selected",!1),t.symbol=this.getCrossGraphicSymbol(t.attributes,this.view.scale<this.junctionScale?"picture":"marker"))}),!e||e.type==="edge"){let t;!e||!e.id||e.id===""?t=this.sectionLayer.graphics.toArray():t=this.sectionLayer.graphics.filter(i=>i.getAttribute("edgeId")===e.id).toArray(),t.length>0&&(t.forEach(i=>{const o=i.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(s=>s!==o)}),this.sectionLayer.removeMany(t))}return{status:0,message:"ok"}}async 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=String(t[0]);i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));let s=[];if(t.length===1?s=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===i):t.length===2&&(s=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===o)),s.length>0){const c=new Map;return s.forEach(r=>{const a=r.getAttribute("roadId")+"+"+r.getAttribute("sectionId");this.selectedSectionIds.includes(a)||this.selectedSectionIds.push(a);let n=c.get(a);n?n.push(r.geometry):(n=[r.geometry],c.set(a,n))}),c.forEach(async(r,a)=>{const n=A.union(r),l=new f({geometry:n,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:a,edgeId:e.id,selected:!0}});this.sectionLayer.add(l),await this.view.goTo(l)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const t=new S.Polygon({rings:[e]}),i=await this.laneLayer.queryFeatures({geometry:t,outFields:["*"]}),o=[],s=[];for(const a of i.features){const n=a.getAttribute("roadId"),l=a.getAttribute("sectionIndex"),d=`${n}#${l}`;if(o.indexOf(d)===-1){o.push(d),this.selectSumo({type:"edge",id:d});const p=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,y=await b.get(p,{params:{id:`${n}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});y.status===200&&y.data.status===0&&s.push(y.data.result)}}const c=this.junctionLayer.graphics.filter(a=>{const n=a.geometry;return A.contains(t,n)}),r=[];for(const a of c){const n=a.getAttribute("id");this.selectSumo({type:"junction",id:n});const l=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await b.get(l,{params:{id:n,projectName:this.projectName}});d.status===200&&d.data.status===0&&r.push(d.data.result)}return{status:0,message:"ok",result:{junctions:r,edges:s}}}async splitLane(e){const i=e.id.split("_");if(i.length!==2)return{status:-1,message:"车道编号格式错误"};const o=Number(i[1]),s=i[0].split("#"),c=s.length===2?Number(s[1]):0;let r=s[0];r.startsWith("-")&&(r=r.slice(1));const a=this.allLaneGraphics.filter(I=>I.getAttribute("roadId")===r&&I.getAttribute("sectionIndex")===c);if(a.length===0)return{status:-1,message:"未找到路段"};const n=a.length-o,l=a.find(I=>Math.abs(I.getAttribute("laneId"))===n);if(!l)return{status:-1,message:"未找到车道"};const d=e.start||0,p=e.end||100,y=P.lineString(l.getAttribute("leftLine")),m=G.lineSliceAlong(y,d,p,{units:"meters"}),g=P.lineString(l.getAttribute("rightLine")),u=G.lineSliceAlong(g,d,p,{units:"meters"}),h=m.geometry.coordinates.concat(u.geometry.coordinates.reverse());h.push(h[h.length-1]);const v=new f({geometry:new S.Polygon({rings:[h]}),attributes:{ObjectID:l.getAttribute("ObjectID"),id:l.getAttribute("id"),fromNode:l.getAttribute("fromNode"),toNode:l.getAttribute("toNode"),roadId:l.getAttribute("roadId"),roadName:l.getAttribute("roadName"),sectionId:l.getAttribute("sectionId"),sectionIndex:l.getAttribute("sectionIndex"),laneId:l.getAttribute("laneId"),type:l.getAttribute("type"),sumoId:l.getAttribute("sumoId"),leftLine:m.geometry.coordinates,rightLine:u.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(v),this.view.goTo(v),{status:0,message:"ok",result:{coordinates:h}}}clearSplitLane(){this.splitLaneLayer.removeAll()}updateAllJunctionSymbol(e){const t=this.junctionLayer.graphics.clone();this.junctionLayer.removeAll(),t.forEach(i=>{i.getAttribute("selected")||(i.symbol=this.getCrossGraphicSymbol(i.attributes,e))}),this.junctionLayer.addMany(t.toArray())}getCrossGraphicSymbol(e,t){const i=e.crossId!==""&&e.crossId!==void 0&&e.crossId!==null;if(t==="marker")return{type:"picture-marker",url:`/GisViewerAssets/Images/cross/${i?"gis_xhj_blue":"gis_lkcz_xz"}.png`,width:"32px",height:"32px"};if(t==="picture")return i?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.crossId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:i?25:15,haloSize:2,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:32,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz_xz.png",width:"32px",height:"32px"}}}exports.default=D;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/Graphic"),F=require("@arcgis/core/core/promiseUtils"),J=require("@arcgis/core/core/reactiveUtils.js"),S=require("@arcgis/core/geometry"),q=require("@arcgis/core/geometry/geometryEngine"),x=require("@arcgis/core/layers/FeatureLayer"),w=require("@arcgis/core/layers/GraphicsLayer"),E=require("@turf/helpers"),G=require("@turf/line-slice-along"),b=require("axios"),R=require("fast-xml-parser"),T=require("md5"),O=require("pako"),_=require("vue"),z=require("../../stores/index.js"),H=require("../common-utils.js");function N(L){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(L){for(const t in L)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(L,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>L[t]})}}return e.default=L,Object.freeze(e)}const M=N(F),U=N(J),A=N(q),P=N(E);class D{constructor(e){this.junctionNames=new Map,this.junctionScale=5e3,this.xodrBorder=[],this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.selectedSectionIds=[],this.currentJunctionId="",this.view=e,this.laneLayer=new x({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:"sectionIndex",alias:"路段序号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"},{name:"fromNode",alias:"起点路口",type:"string"},{name:"toNode",alias:"终点路口",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 x({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 w({id:"OpenDriveJunction"}),this.sectionLayer=new w({id:"OpenDriveSection"}),this.highlightLayer=new w({id:"OpenDriveHighlight"}),this.flashLayer=new w({id:"OpenDriveFlash"}),this.drawLayer=new w({id:"Draw"}),this.splitLaneLayer=new w({id:"SplitLane"}),this.borderLayer=new w({id:"OpenDriveBorder"}),this.view.map.addMany([this.laneLayer,this.sectionLayer,this.roadNameLayer,this.junctionLayer,this.highlightLayer,this.flashLayer,this.drawLayer,this.splitLaneLayer,this.borderLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){var t;try{const o=await(await fetch(e)).text();let n=(t=new R.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(o).OpenDRIVE.userData)==null?void 0:t.border;return n?n=JSON.parse(n):n=[],{status:0,message:"ok",result:{md5:T(o),border:n}}}catch(i){return{status:-1,message:i.message}}}async showOpenDriveFromFile(e){var y,m,g;this.openDriveClickCallback=e.selectedCallback,this.scaleWatch=U.watch(()=>this.view.scale,(u,h)=>{u>this.junctionScale&&h<=this.junctionScale?this.updateAllJunctionSymbol("marker"):u<=this.junctionScale&&h>this.junctionScale&&this.updateAllJunctionSymbol("picture")});let t=e.file.split("/").pop()||"";t=t.split(".").slice(0,-1).join("."),console.log(`OpenDriveRenderer: 显示OpenDrive文件 ${t}`),this.openDriveServer=e.server;const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await b.post(i,{},{params:{url:e.file,projectName:t}})}catch(u){return{status:-1,message:u.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;H.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let c=o.data.result.json;c.startsWith(window.location.protocol)||(c=`${window.location.protocol}//${e.server}${c}`);const a=await(await fetch(c)).arrayBuffer(),r=O.inflate(a,{to:"string"}),l=JSON.parse(r);if(await this.showAllLanes(l,((y=e.options)==null?void 0:y.showJunctionLane)||!1,((m=e.options)==null?void 0:m.showRoadName)||!0),((g=e.options)==null?void 0:g.showJunctionPoint)!==!1){const u=o.data.result.junctions;this.showJunction(u)}e.options&&e.options.centerMap!==!1&&await this.view.goTo(this.allLaneGraphics),this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick();const p=z.default.useAppDataStore;return _.watch(()=>p.isSketching,()=>{var u,h;p.isSketching?((u=this.mouseMoveHandler)==null||u.remove(),this.mouseMoveHandler=void 0,(h=this.mouseClickHandler)==null||h.remove(),this.mouseClickHandler=void 0):(this.monitorMouseMove(),this.monitorMouseClick())}),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await b.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=O.inflate(n,{to:"string"}),r=JSON.parse(a);return console.log(r),await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){console.log(e);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 c=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:l,refLine:d}=r;let p=r.name;p.includes("(")&&(p=p.slice(0,p.indexOf("("))),p=p.replace(/(.)/g,"$1 ");const y=new f({geometry:{type:"polyline",paths:[d]},attributes:{ObjectID:c++,roadId:l,roadName:p}});this.allRefLineGraphics.push(y),r.laneSections.sort((m,g)=>Number(m.id)-Number(g.id));for(let m=0;m<r.laneSections.length;m++){const g=r.laneSections[m],u=Number(g.id);for(const h of g.lanePaths){const v=Number(h.id);if(v===0)continue;const I=h.type,$=[...h.outerPath],j=h.innerPath.concat($.reverse());if(j.length<=3){console.warn(`lane ${v} has less than 3 points`);continue}j.push(h.innerPath[0]);const k=new S.Polygon({rings:[j]});if(k){const C=new f({geometry:k,attributes:{ObjectID:c++,id:`${l}+${u}+${v}`,fromNode:r.fromNode,toNode:r.toNode,roadId:String(l),roadName:r.name,sectionId:String(u),sectionIndex:m,laneId:v,type:I,sumoId:"",leftLine:h.innerPath,rightLine:h.outerPath}});this.allLaneGraphics.push(C),n.push(C)}}}}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=[];let i;this.xodrBorder.length>0&&(i=new S.Polygon({rings:[this.xodrBorder]}));for(const o of e)if(o&&(this.junctionNames.set(o.id,o.name),o.nodeType=o.type,o.crossId)){const s=new S.Point({x:o.coordinates[0],y:o.coordinates[1]});let c=!0;if(i&&(c=A.contains(i,s)),c){const n=new f({geometry:s,attributes:{...o,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(o,"marker")});t.push(n)}}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=M.debounce(async t=>{var c;const o=(c=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:c.filter(n=>n.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",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.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`;if(this.currentSectionCode===n||this.selectedSectionIds.includes(n)||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),l=A.union(r.map(u=>u.geometry)),d=this.hitGraphic.getAttribute("fromNode"),p=this.hitGraphic.getAttribute("toNode"),y=this.junctionNames.get(d)||d,m=this.junctionNames.get(p)||p,g=new f({geometry:l,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,fromNodeName:y,toNodeName:m,laneCount:r.length},popupTemplate:{title:this.hitGraphic.getAttribute("roadName"),content:[{type:"fields",fieldInfos:[{fieldName:"fromNodeName",label:"起点路口"},{fieldName:"toNodeName",label:"终点路口"},{fieldName:"laneCount",label:"车道数量"}]}]}});this.highlightLayer.removeAll(),this.highlightLayer.add(g)}else if(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=M.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,c=s.getAttribute("type"),n=s.getAttribute("id");if(c==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const r=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,l=await b.get(r,{params:{id:n,projectName:this.projectName}});l.status===200&&l.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:l.data.result}),s.setAttribute("selected",!0),s.symbol={type:"picture-marker",url:"/GisViewerAssets/Images/point_red.png",width:"20px",height:"20px"},this.increasePictureMarkerSize(s,50))}else this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:void 0}),s.setAttribute("selected",!1),s.symbol=this.getCrossGraphicSymbol(s.attributes,this.view.scale<this.junctionScale?"picture":"marker");else if(c==="OpenDriveSection")if(s.layer.id==="OpenDriveHighlight"){this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0),this.selectedSectionIds.push(n);const r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,l=await b.get(r,{params:{id:n,projectName:this.projectName}});if(l.status===200&&l.data.status===0&&this.openDriveClickCallback){const d=l.data.result.obj_id;s.setAttribute("edgeId",d),this.openDriveClickCallback({type:"OpenDriveSection",id:d,details:l.data.result})}}else this.sectionLayer.remove(s),this.selectedSectionIds=this.selectedSectionIds.filter(r=>r!==n),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:s.getAttribute("edgeId"),details:void 0})});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 b.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(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===o);if(s){const c=`${i}+${s.getAttribute("sectionId")}`,n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await b.get(n,{params:{id:c,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${c}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}setOpendriveVisibility(e){this.laneLayer.visible=e}async clearOpenDrive(){var t,i,o;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(),this.borderLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0,(o=this.scaleWatch)==null||o.remove(),this.scaleWatch=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 c=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:c,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 f({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[0,255,255,.8],outline:{color:[0,255,255],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 l=Number(r.attributes.sectionId);a.indexOf(l)===-1&&a.push(l)}),a.sort((r,l)=>r-l),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 l=Number(r.attributes.laneId);a.indexOf(l)===-1&&a.push(l)}),a.sort((r,l)=>r-l),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(r=>Number(r.attributes.laneId)===o)}const c=s.map(a=>a.geometry),n=A.union(c);if(e.flash){const a=new f({geometry:n,symbol:{type:"simple-fill",color:[0,255,255,.6],style:"solid",outline:{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=>{(!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")&&(t.setAttribute("selected",!1),t.symbol=this.getCrossGraphicSymbol(t.attributes,this.view.scale<this.junctionScale?"picture":"marker"))}),!e||e.type==="edge"){let t;!e||!e.id||e.id===""?t=this.sectionLayer.graphics.toArray():t=this.sectionLayer.graphics.filter(i=>i.getAttribute("edgeId")===e.id).toArray(),t.length>0&&(t.forEach(i=>{const o=i.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(s=>s!==o)}),this.sectionLayer.removeMany(t))}return{status:0,message:"ok"}}async 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=String(t[0]);i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));let s=[];if(t.length===1?s=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===i):t.length===2&&(s=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===o)),s.length>0){const c=new Map;return s.forEach(n=>{const a=n.getAttribute("roadId")+"+"+n.getAttribute("sectionId");this.selectedSectionIds.includes(a)||this.selectedSectionIds.push(a);let r=c.get(a);r?r.push(n.geometry):(r=[n.geometry],c.set(a,r))}),c.forEach(async(n,a)=>{const r=A.union(n),l=new f({geometry:r,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:a,edgeId:e.id,selected:!0}});this.sectionLayer.add(l),await this.view.goTo(l)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const t=new S.Polygon({rings:[e]}),i=await this.laneLayer.queryFeatures({geometry:t,outFields:["*"]}),o=[],s=[];for(const a of i.features){const r=a.getAttribute("roadId"),l=a.getAttribute("sectionIndex"),d=`${r}#${l}`;if(o.indexOf(d)===-1){o.push(d),this.selectSumo({type:"edge",id:d});const p=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,y=await b.get(p,{params:{id:`${r}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});y.status===200&&y.data.status===0&&s.push(y.data.result)}}const c=this.junctionLayer.graphics.filter(a=>{const r=a.geometry;return A.contains(t,r)}),n=[];for(const a of c){const r=a.getAttribute("id");this.selectSumo({type:"junction",id:r});const l=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await b.get(l,{params:{id:r,projectName:this.projectName}});d.status===200&&d.data.status===0&&n.push(d.data.result)}return{status:0,message:"ok",result:{junctions:n,edges:s}}}async splitLane(e){const i=e.id.split("_");if(i.length!==2)return{status:-1,message:"车道编号格式错误"};const o=Number(i[1]),s=i[0].split("#"),c=s.length===2?Number(s[1]):0;let n=s[0];n.startsWith("-")&&(n=n.slice(1));const a=this.allLaneGraphics.filter(I=>I.getAttribute("roadId")===n&&I.getAttribute("sectionIndex")===c);if(a.length===0)return{status:-1,message:"未找到路段"};const r=a.length-o,l=a.find(I=>Math.abs(I.getAttribute("laneId"))===r);if(!l)return{status:-1,message:"未找到车道"};const d=e.start||0,p=e.end||100,y=P.lineString(l.getAttribute("leftLine")),m=G.lineSliceAlong(y,d,p,{units:"meters"}),g=P.lineString(l.getAttribute("rightLine")),u=G.lineSliceAlong(g,d,p,{units:"meters"}),h=m.geometry.coordinates.concat(u.geometry.coordinates.reverse());h.push(h[h.length-1]);const v=new f({geometry:new S.Polygon({rings:[h]}),attributes:{ObjectID:l.getAttribute("ObjectID"),id:l.getAttribute("id"),fromNode:l.getAttribute("fromNode"),toNode:l.getAttribute("toNode"),roadId:l.getAttribute("roadId"),roadName:l.getAttribute("roadName"),sectionId:l.getAttribute("sectionId"),sectionIndex:l.getAttribute("sectionIndex"),laneId:l.getAttribute("laneId"),type:l.getAttribute("type"),sumoId:l.getAttribute("sumoId"),leftLine:m.geometry.coordinates,rightLine:u.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(v),this.view.goTo(v),{status:0,message:"ok",result:{coordinates:h}}}clearSplitLane(){this.splitLaneLayer.removeAll()}updateAllJunctionSymbol(e){const t=this.junctionLayer.graphics.clone();this.junctionLayer.removeAll(),t.forEach(i=>{i.getAttribute("selected")||(i.symbol=this.getCrossGraphicSymbol(i.attributes,e))}),this.junctionLayer.addMany(t.toArray())}getCrossGraphicSymbol(e,t){const i=e.crossId!==""&&e.crossId!==void 0&&e.crossId!==null;if(t==="marker")return{type:"picture-marker",url:`/GisViewerAssets/Images/cross/${i?"gis_xhj_blue":"gis_lkcz_xz"}.png`,width:"32px",height:"32px"};if(t==="picture")return i?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.crossId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:i?25:15,haloSize:2,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:32,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz_xz.png",width:"32px",height:"32px"}}}exports.default=D;
@@ -307,7 +307,10 @@ export interface IEditSignalControlAreaParams {
307
307
  export interface IShowGreenWaveBandParams {
308
308
  bandId: string;
309
309
  coordinates: number[][];
310
- nodeList: INode[];
310
+ nodeList?: INode[];
311
+ lineColor?: string | number[];
312
+ lineWidth?: number;
313
+ arrowColor?: string | number[];
311
314
  }
312
315
  export interface IRoadLine {
313
316
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.249",
3
+ "version": "1.0.251",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [