gisviewer-vue3-arcgis 1.0.119 → 1.0.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,9 +66,9 @@ export default class CommonUtils {
66
66
  static getStdVecEntries(std_vec: any, delete_vec?: boolean): any[];
67
67
  static getStdMapEntries(std_map: any): any[];
68
68
  static getStdMapKeys(std_map: any, delete_map?: boolean): any[];
69
- private static geoReference;
70
- private static xOffset;
71
- private static yOffset;
69
+ static geoReference: string;
70
+ static xOffset: number;
71
+ static yOffset: number;
72
72
  static setGeoData(geoReference: string, xOffset: number, yOffset: number): void;
73
73
  /**
74
74
  * OpenDrive坐标转换为WGS84坐标
@@ -76,6 +76,7 @@ export default class CommonUtils {
76
76
  * @returns
77
77
  */
78
78
  static transformLineProjection(line: number[][]): number[][];
79
+ static transformPointProjection(point: number[]): number[];
79
80
  static pointsEqual(point1: number[], point2: number[]): boolean;
80
81
  static getExtensionLine(pt1: number[], pt2: number[], distance: number): turf.Position;
81
82
  }
@@ -1,11 +1,11 @@
1
- import { Point as P, Polyline as f } from "@arcgis/core/geometry";
1
+ import { Point as L, Polyline as f } from "@arcgis/core/geometry";
2
2
  import * as g from "@arcgis/core/geometry/geometryEngineAsync";
3
3
  import * as y from "@arcgis/core/geometry/support/webMercatorUtils";
4
4
  import u from "@turf/bearing";
5
5
  import p from "@turf/destination";
6
6
  import * as a from "@turf/helpers";
7
- import L from "pako";
8
- import O from "proj4";
7
+ import l from "pako";
8
+ import h from "proj4";
9
9
  class i {
10
10
  /**
11
11
  * 得到某个点在一定方向、距离之外的另一个点
@@ -18,7 +18,7 @@ class i {
18
18
  const r = a.point([t.x, t.y]), s = p(r, n, e, {
19
19
  units: "meters"
20
20
  });
21
- return new P({
21
+ return new L({
22
22
  x: s.geometry.coordinates[0],
23
23
  y: s.geometry.coordinates[1]
24
24
  });
@@ -40,12 +40,12 @@ class i {
40
40
  static extendLineInTowDir(t, e) {
41
41
  const n = t.paths[0], r = a.point(n[0]), s = a.point(n[1]), o = u(s, r), c = p(r, e, o, {
42
42
  units: "meters"
43
- }), h = o > 0 ? o - 180 : o + 180, l = p(s, e, h, {
43
+ }), P = o > 0 ? o - 180 : o + 180, O = p(s, e, P, {
44
44
  units: "meters"
45
45
  });
46
46
  return new f({
47
47
  paths: [
48
- [c.geometry.coordinates, l.geometry.coordinates]
48
+ [c.geometry.coordinates, O.geometry.coordinates]
49
49
  ]
50
50
  });
51
51
  }
@@ -149,7 +149,7 @@ class i {
149
149
  e.push(o.charCodeAt(0));
150
150
  }
151
151
  const r = new Uint8Array(e);
152
- return L.inflate(r, { to: "string" });
152
+ return l.inflate(r, { to: "string" });
153
153
  } catch {
154
154
  console.log(`非压缩内容: ${t}`);
155
155
  }
@@ -183,7 +183,7 @@ class i {
183
183
  static transformLineProjection(t) {
184
184
  try {
185
185
  return t.map(
186
- (e) => O(i.geoReference).inverse([
186
+ (e) => h(i.geoReference).inverse([
187
187
  e[0] - i.xOffset,
188
188
  e[1] - i.yOffset
189
189
  ])
@@ -195,6 +195,19 @@ class i {
195
195
  ), t;
196
196
  }
197
197
  }
198
+ static transformPointProjection(t) {
199
+ try {
200
+ return h(i.geoReference).inverse([
201
+ t[0] - i.xOffset,
202
+ t[1] - i.yOffset
203
+ ]);
204
+ } catch {
205
+ return console.error(
206
+ "OpenDrive坐标转换为WGS84坐标失败",
207
+ i.geoReference
208
+ ), t;
209
+ }
210
+ }
198
211
  static pointsEqual(t, e) {
199
212
  return Math.abs(t[0] - e[0]) < Number.EPSILON && Math.abs(t[1] - e[1]) < Number.EPSILON;
200
213
  }
@@ -1,19 +1,19 @@
1
- import M from "@arcgis/core/Basemap";
2
- import T from "@arcgis/core/Map";
3
- import g from "@arcgis/core/config";
4
- import * as P from "@arcgis/core/core/reactiveUtils";
5
- import { Polygon as z, Polyline as W, Point as k } from "@arcgis/core/geometry";
1
+ import b from "@arcgis/core/Basemap";
2
+ import u from "@arcgis/core/config";
3
+ import * as M from "@arcgis/core/core/reactiveUtils";
4
+ import { Polygon as T, Polyline as z, Point as P } from "@arcgis/core/geometry";
6
5
  import * as f from "@arcgis/core/geometry/support/webMercatorUtils";
7
- import x from "@arcgis/core/layers/GeoJSONLayer";
8
- import L from "@arcgis/core/layers/TileLayer";
9
- import R from "@arcgis/core/layers/WebTileLayer";
10
- import S from "@arcgis/core/views/MapView";
6
+ import W from "@arcgis/core/layers/GeoJSONLayer";
7
+ import x from "@arcgis/core/layers/TileLayer";
8
+ import L from "@arcgis/core/layers/WebTileLayer";
9
+ import S from "@arcgis/core/Map";
10
+ import R from "@arcgis/core/views/MapView";
11
11
  import H from "@arcgis/core/views/SceneView";
12
12
  import I from "@turf/destination";
13
13
  import * as O from "@turf/helpers";
14
- import G from "../stores/index.mjs";
15
- function y(m, t) {
16
- return m.startsWith("http://") || m.startsWith("https://") ? m : t + m;
14
+ import C from "../stores/index.mjs";
15
+ function k(h, e) {
16
+ return h && (h.startsWith("http://") || h.startsWith("https://") ? h : e + h);
17
17
  }
18
18
  class Q {
19
19
  constructor() {
@@ -24,18 +24,18 @@ class Q {
24
24
  * @param params 容器
25
25
  * @returns view
26
26
  */
27
- async initialize(t) {
28
- const i = G.useAppDataStore, e = JSON.parse(JSON.stringify(i.mapConfig));
29
- this.mapConfig = e;
30
- const { container: a, markerClickCallback: r, mapClickCallback: d } = t;
31
- g.assetsPath = `${e.assetsRoot}/ArcgisAssets`, g.fontsUrl = `${e.assetsRoot}/fonts`, g.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
32
- const c = new T();
33
- if ((e == null ? void 0 : e.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new S({
34
- map: c,
27
+ async initialize(e) {
28
+ const i = C.useAppDataStore, t = JSON.parse(JSON.stringify(i.mapConfig));
29
+ this.mapConfig = t;
30
+ const { container: a, markerClickCallback: r, mapClickCallback: d } = e;
31
+ u.assetsPath = `${t.assetsRoot}/ArcgisAssets`, u.fontsUrl = `${t.assetsRoot}/fonts`, u.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
32
+ const n = new S();
33
+ if ((t == null ? void 0 : t.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new R({
34
+ map: n,
35
35
  container: a,
36
- ...e.mapOptions
36
+ ...t.mapOptions
37
37
  }) : this.view = new H({
38
- map: c,
38
+ map: n,
39
39
  container: a,
40
40
  environment: {
41
41
  atmosphereEnabled: !0,
@@ -43,9 +43,9 @@ class Q {
43
43
  type: "virtual"
44
44
  }
45
45
  },
46
- ...e == null ? void 0 : e.mapOptions
46
+ ...t == null ? void 0 : t.mapOptions
47
47
  }), this.view.on("click", async (s) => {
48
- var v, b;
48
+ var y, v;
49
49
  if (d) {
50
50
  let o = s.mapPoint;
51
51
  o.spatialReference.isWebMercator && (o = f.webMercatorToGeographic(
@@ -59,14 +59,14 @@ class Q {
59
59
  if (this.view.type === "3d") {
60
60
  const o = this.view.camera;
61
61
  if (this.view.spatialReference.isWebMercator) {
62
- const l = f.webMercatorToGeographic(
62
+ const m = f.webMercatorToGeographic(
63
63
  o.position
64
64
  ), w = {
65
65
  heading: o.heading,
66
66
  tilt: o.tilt,
67
- position: l.toJSON()
67
+ position: m.toJSON()
68
68
  };
69
- console.log(w), (v = navigator.clipboard) == null || v.writeText(JSON.stringify(w));
69
+ console.log(w), (y = navigator.clipboard) == null || y.writeText(JSON.stringify(w));
70
70
  } else
71
71
  console.log(o.toJSON());
72
72
  console.log(this.view.zoom, this.view.scale);
@@ -79,135 +79,136 @@ class Q {
79
79
  zoom: this.view.zoom
80
80
  });
81
81
  }
82
- const h = (b = (await this.view.hitTest(s)).results) == null ? void 0 : b.filter(
82
+ const c = (v = (await this.view.hitTest(s)).results) == null ? void 0 : v.filter(
83
83
  (o) => o.type === "graphic"
84
84
  );
85
- h.length > 0 && h.forEach((o) => {
85
+ c.length > 0 && c.forEach((o) => {
86
86
  var w;
87
- const l = o.graphic;
88
- (w = l.attributes) != null && w.type && r && r(
89
- l.attributes.type,
90
- l.attributes.id,
91
- l.attributes,
87
+ const m = o.graphic;
88
+ (w = m.attributes) != null && w.type && r && r(
89
+ m.attributes.type,
90
+ m.attributes.id,
91
+ m.attributes,
92
92
  s
93
93
  );
94
94
  });
95
- }), e != null && e.baseLayers ? e.baseLayers.forEach((s) => {
95
+ }), t != null && t.baseLayers ? t.baseLayers.forEach((s) => {
96
+ const l = k(s.url, t.assetsRoot);
96
97
  switch (s.type.toLowerCase()) {
97
98
  case "webTile".toLowerCase(): {
98
- const n = y(s.url, e.assetsRoot), h = new R({
99
- urlTemplate: n,
99
+ const c = new L({
100
+ urlTemplate: l,
100
101
  ...s.options
101
102
  });
102
- c.add(h);
103
+ n.add(c);
103
104
  break;
104
105
  }
105
106
  case "tile": {
106
- const n = y(s.url, e.assetsRoot), h = new L({
107
- url: n,
107
+ const c = new x({
108
+ url: l,
108
109
  ...s.options
109
110
  });
110
- c.add(h);
111
+ n.add(c);
111
112
  break;
112
113
  }
113
114
  case "arcgis": {
114
- const n = new M(s.options);
115
- c.basemap = n;
115
+ const c = new b(s.options);
116
+ n.basemap = c;
116
117
  break;
117
118
  }
118
119
  }
119
- }) : c.basemap = new M({
120
+ }) : n.basemap = new b({
120
121
  style: {
121
122
  id: "arcgis/dark-gray",
122
123
  language: "zh-CN"
123
124
  }
124
- }), e != null && e.hdLayers) {
125
- const s = e.hdLayers.map(
126
- (n) => (
125
+ }), t != null && t.hdLayers) {
126
+ const s = t.hdLayers.map(
127
+ (l) => (
127
128
  // 图层文件为GeoJson格式, renderer和symbol使用autocast配置
128
- new x({
129
- url: y(n.url, e.assetsRoot),
130
- ...n.options,
131
- title: n.options.id
129
+ new W({
130
+ url: k(l.url, t.assetsRoot),
131
+ ...l.options,
132
+ title: l.options.id
132
133
  })
133
134
  )
134
135
  );
135
- c.addMany(s);
136
+ n.addMany(s);
136
137
  }
137
138
  this.view.ui.remove("attribution"), this.view.ui.add("compass", "top-left"), await this.view.when();
138
139
  const p = this.mapConfig.camera;
139
- let u;
140
+ let g;
140
141
  if (this.view.type === "2d") {
141
142
  let s = this.view.center;
142
143
  this.view.spatialReference.isWebMercator && (s = f.webMercatorToGeographic(
143
144
  s
144
- )), u = { center: [s.x, s.y], zoom: this.view.zoom };
145
+ )), g = { center: [s.x, s.y], zoom: this.view.zoom };
145
146
  } else {
146
147
  let s = this.view.camera.position;
147
148
  this.view.spatialReference.isWebMercator && (s = f.webMercatorToGeographic(
148
149
  s
149
- )), u = {
150
+ )), g = {
150
151
  position: s,
151
152
  heading: this.view.camera.heading,
152
153
  tilt: this.view.camera.tilt
153
154
  };
154
155
  }
155
- return p ? p.home = u : this.mapConfig.camera = { home: u }, this.view;
156
+ return p ? p.home = g : this.mapConfig.camera = { home: g }, this.view;
156
157
  }
157
- setLayerVisibility(t) {
158
- const { id: i, visible: e } = t, a = this.view.map.findLayerById(i);
159
- return a ? (a.visible = e, { status: 0, message: "ok" }) : { status: -1, message: "未找到图层" };
158
+ setLayerVisibility(e) {
159
+ const { id: i, visible: t } = e, a = this.view.map.findLayerById(i);
160
+ return a ? (a.visible = t, { status: 0, message: "ok" }) : { status: -1, message: "未找到图层" };
160
161
  }
161
162
  /**
162
163
  * 设置地图中心点
163
164
  * @param params
164
165
  * @returns
165
166
  */
166
- async setMapCenter(t) {
167
+ async setMapCenter(e) {
167
168
  var i;
168
169
  if (!this.view)
169
170
  return { status: -1, message: "未初始化" };
170
- if (t.center || t.target) {
171
- switch ((i = t.target) == null ? void 0 : i.type) {
171
+ if (e.center || e.target) {
172
+ switch ((i = e.target) == null ? void 0 : i.type) {
172
173
  case "point":
173
- t.target = new k(t.target);
174
+ e.target = new P(e.target);
174
175
  break;
175
176
  case "polyline":
176
- t.target = new W(t.target);
177
+ e.target = new z(e.target);
177
178
  break;
178
179
  case "polygon":
179
- t.target = new z(t.target);
180
+ e.target = new T(e.target);
180
181
  break;
181
182
  }
182
- await this.view.goTo(t, { duration: (t.duration || 0) * 1e3 });
183
+ await this.view.goTo(e, { duration: (e.duration || 0) * 1e3 });
183
184
  }
184
185
  return { status: 0, message: "成功" };
185
186
  }
186
187
  /**
187
188
  * 在一定的高度,以一定的角度去观察某个坐标
188
189
  * */
189
- async lookAt(t) {
190
+ async lookAt(e) {
190
191
  if (this.view.type === "2d")
191
192
  return;
192
- const i = t.tilt || 0, e = t.heading || 0;
193
+ const i = e.tilt || 0, t = e.heading || 0;
193
194
  if (i === 0)
194
195
  await this.view.goTo(
195
196
  {
196
197
  position: {
197
- x: t.center[0],
198
- y: t.center[1],
199
- z: t.height
198
+ x: e.center[0],
199
+ y: e.center[1],
200
+ z: e.height
200
201
  },
201
- heading: e,
202
+ heading: t,
202
203
  tilt: 0
203
204
  },
204
- { duration: (t.duration || 2) * 1e3 }
205
+ { duration: (e.duration || 2) * 1e3 }
205
206
  );
206
207
  else {
207
- const a = Math.tan(i * Math.PI / 180) * t.height, r = I(
208
- O.point(t.center),
208
+ const a = Math.tan(i * Math.PI / 180) * e.height, r = I(
209
+ O.point(e.center),
209
210
  a,
210
- e + 180,
211
+ t + 180,
211
212
  {
212
213
  units: "meters"
213
214
  }
@@ -217,63 +218,63 @@ class Q {
217
218
  position: {
218
219
  x: r.geometry.coordinates[0],
219
220
  y: r.geometry.coordinates[1],
220
- z: t.height
221
+ z: e.height
221
222
  },
222
- heading: e,
223
+ heading: t,
223
224
  tilt: i
224
225
  },
225
- { duration: (t.duration || 2) * 1e3 }
226
+ { duration: (e.duration || 2) * 1e3 }
226
227
  );
227
228
  }
228
229
  }
229
- async setMapCamera(t) {
230
+ async setMapCamera(e) {
230
231
  if (!this.view)
231
232
  return { status: -1, message: "未初始化" };
232
- const { name: i, duration: e = 0 } = t, { camera: a } = this.mapConfig;
233
+ const { name: i, duration: t = 0 } = e, { camera: a } = this.mapConfig;
233
234
  if (!a)
234
235
  return { status: -1, message: "未配置camera" };
235
236
  const r = a[i];
236
- return r ? (await this.view.goTo(r, { duration: e * 1e3 }), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" };
237
+ return r ? (await this.view.goTo(r, { duration: t * 1e3 }), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" };
237
238
  }
238
239
  /**
239
240
  * 经纬度转像素坐标,在地图移动时回调
240
241
  * */
241
- requestCoordinateTransform(t, i) {
242
- let e = 0;
243
- const r = 1e3 / 30, d = P.watch(
242
+ requestCoordinateTransform(e, i) {
243
+ let t = 0;
244
+ const r = 1e3 / 30, d = M.watch(
244
245
  () => this.view.center,
245
246
  () => {
246
- const c = this.transformPoints(t), p = Date.now();
247
- p - e > r && (i(c), e = p);
247
+ const n = this.transformPoints(e), p = Date.now();
248
+ p - t > r && (i(n), t = p);
248
249
  }
249
250
  );
250
- return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(t) };
251
+ return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(e) };
251
252
  }
252
- transformPoints(t) {
253
- return t.map((i) => {
254
- const e = new k({
253
+ transformPoints(e) {
254
+ return e.map((i) => {
255
+ const t = new P({
255
256
  x: i[0],
256
257
  y: i[1]
257
- }), a = this.view.toScreen(e);
258
+ }), a = this.view.toScreen(t);
258
259
  return [a.x, a.y];
259
260
  });
260
261
  }
261
262
  /**
262
263
  * 停止坐标转换回调
263
264
  * */
264
- cancelCoordinateTransform(t) {
265
- const i = this.watchHandleMap.get(t);
266
- i && (i.remove(), this.watchHandleMap.delete(t));
265
+ cancelCoordinateTransform(e) {
266
+ const i = this.watchHandleMap.get(e);
267
+ i && (i.remove(), this.watchHandleMap.delete(e));
267
268
  }
268
269
  /**
269
270
  * 设置地图zoom范围
270
271
  * */
271
- setMapZoomRange(t) {
272
- const { min: i, max: e } = t;
273
- !i && !e || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = P.watch(
272
+ setMapZoomRange(e) {
273
+ const { min: i, max: t } = e;
274
+ !i && !t || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = M.watch(
274
275
  () => this.view.zoom,
275
276
  (a) => {
276
- i && a <= i && (this.view.zoom = i), e && a >= e && (this.view.zoom = e);
277
+ i && a <= i && (this.view.zoom = i), t && a >= t && (this.view.zoom = t);
277
278
  }
278
279
  ));
279
280
  }
@@ -1,8 +1,7 @@
1
- import View from '@arcgis/core/views/View';
2
1
  import { IFindSumoParams, IResult, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams } from '../../../types';
3
2
  export default class OpenDriveRenderer {
4
3
  private static instance;
5
- static getInstance(view: View): OpenDriveRenderer;
4
+ static getInstance(view: __esri.MapView | __esri.SceneView): OpenDriveRenderer;
6
5
  private readonly view;
7
6
  private laneLayer;
8
7
  private roadNameLayer;
@@ -10,8 +9,12 @@ export default class OpenDriveRenderer {
10
9
  private highlightLayer;
11
10
  private allLaneGraphics;
12
11
  private allRefLineGraphics;
12
+ private mouseMoveHandler;
13
+ private mouseClickHandler;
13
14
  private wasmLoader;
14
- constructor(view: View);
15
+ constructor(view: __esri.MapView | __esri.SceneView);
16
+ private projectName;
17
+ private openDriveServer;
15
18
  showOpenDriveFromFile(params: IShowOpenDriveFromFileParams): Promise<IResult>;
16
19
  /**
17
20
  * 从服务器载入OpenDrive文件解析结果并显示
@@ -21,6 +24,23 @@ export default class OpenDriveRenderer {
21
24
  showOpenDriveFromServer(server: string, projectName: string): Promise<IResult>;
22
25
  private showAllLanes;
23
26
  private showJunction;
27
+ private currentSectionCode;
28
+ private currentJunctionId;
29
+ private hitGraphic;
30
+ private highlightGraphic;
31
+ /**
32
+ * 监听鼠标移动事件,高亮显示鼠标所在路段和路口
33
+ */
34
+ private monitorMouseMove;
35
+ /**
36
+ * 监听鼠标点击事件,获取高亮要素的拓扑信息
37
+ */
38
+ private monitorMouseClick;
39
+ private increasePictureMarkerSize;
40
+ private decreasePictureMarkerSize;
41
+ /**
42
+ * 清除OpenDrive内容
43
+ */
24
44
  clearOpenDrive(): Promise<void>;
25
45
  /**
26
46
  * 用sumo的id定位车道、基本段、路段