gisviewer-vue3-arcgis 1.0.159 → 1.0.161

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.
@@ -83,4 +83,10 @@ export default class CommonUtils {
83
83
  latitude: number | string;
84
84
  longitude: number | string;
85
85
  }): boolean;
86
+ /**
87
+ * 获取折线中点
88
+ * @param line
89
+ * @returns
90
+ */
91
+ static getCenterPointInLine(line: number[][]): number[];
86
92
  }
@@ -1,12 +1,14 @@
1
- import { Point as O, 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 l from "@arcgis/core/geometry/support/webMercatorUtils";
4
4
  import p from "@turf/bearing";
5
5
  import u from "@turf/destination";
6
- import * as o from "@turf/helpers";
7
- import L from "pako";
6
+ import * as a from "@turf/helpers";
7
+ import O from "@turf/length";
8
+ import d from "@turf/line-slice-along";
9
+ import w from "pako";
8
10
  import y from "proj4";
9
- class i {
11
+ class s {
10
12
  /**
11
13
  * 得到某个点在一定方向、距离之外的另一个点
12
14
  * @param point
@@ -15,12 +17,12 @@ class i {
15
17
  * @returns
16
18
  */
17
19
  static destinationWithPoint(t, e, n) {
18
- const r = o.point([t.x, t.y]), s = u(r, n, e, {
20
+ const r = a.point([t.x, t.y]), i = u(r, n, e, {
19
21
  units: "meters"
20
22
  });
21
- return new O({
22
- x: s.geometry.coordinates[0],
23
- y: s.geometry.coordinates[1]
23
+ return new L({
24
+ x: i.geometry.coordinates[0],
25
+ y: i.geometry.coordinates[1]
24
26
  });
25
27
  }
26
28
  /**
@@ -29,7 +31,7 @@ class i {
29
31
  * @returns
30
32
  */
31
33
  static angleOfLine(t) {
32
- const e = t.paths[0], n = o.point(e[0]), r = o.point(e[e.length - 1]);
34
+ const e = t.paths[0], n = a.point(e[0]), r = a.point(e[e.length - 1]);
33
35
  return p(n, r);
34
36
  }
35
37
  /**
@@ -38,9 +40,9 @@ class i {
38
40
  * @param distance
39
41
  */
40
42
  static extendLineInTowDir(t, e) {
41
- const n = t.paths[0], r = o.point(n[0]), s = o.point(n[1]), a = p(s, r), c = u(r, e, a, {
43
+ const n = t.paths[0], r = a.point(n[0]), i = a.point(n[1]), o = p(i, r), c = u(r, e, o, {
42
44
  units: "meters"
43
- }), h = a > 0 ? a - 180 : a + 180, P = u(s, e, h, {
45
+ }), h = o > 0 ? o - 180 : o + 180, P = u(i, e, h, {
44
46
  units: "meters"
45
47
  });
46
48
  return new f({
@@ -71,21 +73,21 @@ class i {
71
73
  * @returns
72
74
  */
73
75
  static async getIntersectPointsOfStopLineAndLane(t, e, n) {
74
- let r = await i.getIntersectPointOfLineAndPolygon(
76
+ let r = await s.getIntersectPointOfLineAndPolygon(
75
77
  t,
76
78
  e
77
79
  );
78
- if (await i.pointDistance(r) < 3 && n) {
79
- for (const s of n)
80
- if (r = await i.getIntersectPointOfLineAndPolygon(
80
+ if (await s.pointDistance(r) < 3 && n) {
81
+ for (const i of n)
82
+ if (r = await s.getIntersectPointOfLineAndPolygon(
81
83
  t,
82
84
  e,
83
- s
84
- ), await i.pointDistance(r) > 2.5) {
85
- const a = new f({ paths: [r] });
86
- return (await i.getOffsetLine(
87
- a,
88
- -s
85
+ i
86
+ ), await s.pointDistance(r) > 2.5) {
87
+ const o = new f({ paths: [r] });
88
+ return (await s.getOffsetLine(
89
+ o,
90
+ -i
89
91
  )).paths[0];
90
92
  }
91
93
  } else
@@ -111,11 +113,11 @@ class i {
111
113
  * @returns 线面交线的头尾端点
112
114
  */
113
115
  static async getIntersectPointOfLineAndPolygon(t, e, n = 0) {
114
- n !== 0 && (t = await i.getOffsetLine(t, n));
116
+ n !== 0 && (t = await s.getOffsetLine(t, n));
115
117
  const r = await g.intersect(t, e);
116
118
  if (r instanceof f) {
117
- const s = r.paths[0], a = s[0], c = s[s.length - 1];
118
- return [a, c];
119
+ const i = r.paths[0], o = i[0], c = i[i.length - 1];
120
+ return [o, c];
119
121
  }
120
122
  return [];
121
123
  }
@@ -144,12 +146,12 @@ class i {
144
146
  static unzip(t) {
145
147
  try {
146
148
  const e = [], n = t.split("");
147
- for (let s = 0; s < n.length; s++) {
148
- const a = n[s];
149
- e.push(a.charCodeAt(0));
149
+ for (let i = 0; i < n.length; i++) {
150
+ const o = n[i];
151
+ e.push(o.charCodeAt(0));
150
152
  }
151
153
  const r = new Uint8Array(e);
152
- return L.inflate(r, { to: "string" });
154
+ return w.inflate(r, { to: "string" });
153
155
  } catch {
154
156
  console.log(`非压缩内容: ${t}`);
155
157
  }
@@ -162,18 +164,18 @@ class i {
162
164
  }
163
165
  static getStdMapEntries(t) {
164
166
  const e = [];
165
- for (const n of i.getStdMapKeys(t))
167
+ for (const n of s.getStdMapKeys(t))
166
168
  e.push([n, t.get(n)]);
167
169
  return e;
168
170
  }
169
171
  static getStdMapKeys(t, e = !1) {
170
172
  const n = [], r = t.keys();
171
- for (let s = 0; s < r.size(); s++)
172
- n.push(r.get(s));
173
+ for (let i = 0; i < r.size(); i++)
174
+ n.push(r.get(i));
173
175
  return r.delete(), e && t.delete(), n;
174
176
  }
175
177
  static setGeoData(t, e, n) {
176
- i.geoReference = t, i.xOffset = e, i.yOffset = n;
178
+ s.geoReference = t, s.xOffset = e, s.yOffset = n;
177
179
  }
178
180
  /**
179
181
  * OpenDrive坐标转换为WGS84坐标
@@ -183,28 +185,28 @@ class i {
183
185
  static transformLineProjection(t) {
184
186
  try {
185
187
  return t.map(
186
- (e) => y(i.geoReference).inverse([
187
- e[0] - i.xOffset,
188
- e[1] - i.yOffset
188
+ (e) => y(s.geoReference).inverse([
189
+ e[0] - s.xOffset,
190
+ e[1] - s.yOffset
189
191
  ])
190
192
  );
191
193
  } catch {
192
194
  return console.error(
193
195
  "OpenDrive坐标转换为WGS84坐标失败",
194
- i.geoReference
196
+ s.geoReference
195
197
  ), t;
196
198
  }
197
199
  }
198
200
  static transformPointProjection(t) {
199
201
  try {
200
- return y(i.geoReference).inverse([
201
- t[0] - i.xOffset,
202
- t[1] - i.yOffset
202
+ return y(s.geoReference).inverse([
203
+ t[0] - s.xOffset,
204
+ t[1] - s.yOffset
203
205
  ]);
204
206
  } catch {
205
207
  return console.error(
206
208
  "OpenDrive坐标转换为WGS84坐标失败",
207
- i.geoReference
209
+ s.geoReference
208
210
  ), t;
209
211
  }
210
212
  }
@@ -212,13 +214,24 @@ class i {
212
214
  return Math.abs(t[0] - e[0]) < Number.EPSILON && Math.abs(t[1] - e[1]) < Number.EPSILON;
213
215
  }
214
216
  static getExtensionLine(t, e, n) {
215
- const r = o.point(t), s = o.point(e), a = p(r, s);
216
- return u(s, n, a, { units: "meters" }).geometry.coordinates;
217
+ const r = a.point(t), i = a.point(e), o = p(r, i);
218
+ return u(i, n, o, { units: "meters" }).geometry.coordinates;
217
219
  }
218
220
  static isCoordinateValid(t) {
219
221
  return typeof t.latitude == "string" && (t.latitude = Number(t.latitude)), typeof t.longitude == "string" && (t.longitude = Number(t.longitude)), t.latitude !== null && t.longitude !== null && !isNaN(t.latitude) && !isNaN(t.longitude) && t.latitude !== 0 && t.longitude !== 0;
220
222
  }
223
+ /**
224
+ * 获取折线中点
225
+ * @param line
226
+ * @returns
227
+ */
228
+ static getCenterPointInLine(t) {
229
+ const e = a.lineString(t), n = O(e, { units: "meters" });
230
+ return d(e, 0, n / 2, {
231
+ units: "meters"
232
+ }).geometry.coordinates[1];
233
+ }
221
234
  }
222
235
  export {
223
- i as default
236
+ s as default
224
237
  };
@@ -1,43 +1,48 @@
1
1
  import c from "@arcgis/core/Graphic";
2
- import h from "@arcgis/core/layers/GraphicsLayer";
3
- import d from "./signal-holo-flow.mjs";
4
- class f extends d {
2
+ import m from "@arcgis/core/layers/GraphicsLayer";
3
+ import h from "../common-utils.mjs";
4
+ import y from "./signal-holo-flow.mjs";
5
+ class M extends y {
5
6
  constructor(e) {
6
- super(e), this.stopLineLayer = new h(), this.stopLineMap = /* @__PURE__ */ new Map(), this.view.map.add(this.stopLineLayer);
7
+ super(e), this.stopLineLayer = new m(), this.stopLineMap = /* @__PURE__ */ new Map(), this.view.map.add(this.stopLineLayer);
7
8
  }
8
9
  async initializeLayer() {
9
- var s, a;
10
+ var t, n;
10
11
  console.time("初始化停止线图层");
11
- let e = (a = (s = this.mapConfig.holoFlow) == null ? void 0 : s.signal) == null ? void 0 : a.stopLineLayer;
12
+ let e = (n = (t = this.mapConfig.holoFlow) == null ? void 0 : t.signal) == null ? void 0 : n.stopLineLayer;
12
13
  if (!e)
13
14
  return;
14
- e = this.mapConfig.assetsRoot + "/" + e;
15
- const o = await (await fetch(e)).json();
16
- console.log(o.features.length), o.features.forEach((t) => {
17
- const { roadId: n, nodeId: r } = t.properties, { coordinates: p } = t.geometry, l = this.stopLineMap.get(r);
18
- l ? l.set(n, p) : this.stopLineMap.set(r, /* @__PURE__ */ new Map([[n, p]]));
19
- }), console.timeEnd("初始化停止线图层"), console.log(this.stopLineMap.size);
15
+ e = this.mapConfig.assetsRoot + "/" + e, (await (await fetch(e)).json()).features.forEach((o) => {
16
+ const { roadId: s, nodeId: r } = o.properties, { coordinates: p } = o.geometry, l = this.stopLineMap.get(r);
17
+ l ? l.set(s, p) : this.stopLineMap.set(r, /* @__PURE__ */ new Map([[s, p]]));
18
+ }), console.timeEnd("初始化停止线图层");
20
19
  }
21
20
  async handleSignalData(e) {
22
- const { crossId: i } = e, o = this.stopLineMap.get(i);
23
- o && o.forEach((s, a) => {
24
- const t = new c({
21
+ const { crossId: a } = e, i = this.stopLineMap.get(a);
22
+ i && i.forEach((t, n) => {
23
+ const o = h.getCenterPointInLine(t);
24
+ console.log("centerPoint", o);
25
+ const s = new c({
25
26
  geometry: {
26
- type: "polyline",
27
- paths: [s]
27
+ type: "point",
28
+ x: o[0],
29
+ y: o[1],
30
+ spatialReference: this.view.spatialReference
28
31
  },
29
32
  symbol: {
30
- type: "simple-line",
31
- color: [255, 0, 0],
32
- width: 4
33
+ type: "simple-marker",
34
+ style: "circle",
35
+ color: [0, 0, 255],
36
+ size: 5
33
37
  }
34
38
  });
35
- this.stopLineLayer.add(t);
39
+ this.stopLineLayer.add(s);
36
40
  });
37
41
  }
38
42
  clearSignal() {
43
+ this.stopLineLayer.removeAll();
39
44
  }
40
45
  }
41
46
  export {
42
- f as default
47
+ M as default
43
48
  };
@@ -17,6 +17,7 @@ export default class OpenDriveRenderer {
17
17
  private mouseMoveHandler;
18
18
  private mouseClickHandler;
19
19
  private junctionNames;
20
+ private readonly junctionScale;
20
21
  constructor(view: __esri.MapView | __esri.SceneView);
21
22
  private projectName;
22
23
  private openDriveServer;
@@ -110,4 +111,11 @@ export default class OpenDriveRenderer {
110
111
  geometrySearch(coordinate: number[][]): Promise<IResult>;
111
112
  splitLane(params: ISplitOpenDriveLaneParams): Promise<IResult>;
112
113
  clearSplitLane(): void;
114
+ /**
115
+ * 生成路口点符号。在不同比例尺下,使用不同的符号
116
+ * @param attributes
117
+ * @param symbolType
118
+ * @returns
119
+ */
120
+ private getCrossGraphicSymbol;
113
121
  }