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.
- package/es/src/gis-map/utils/common-utils.d.ts +6 -0
- package/es/src/gis-map/utils/common-utils.mjs +56 -43
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +27 -22
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +8 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +251 -125
- package/es/src/gis-map/utils/overlay.mjs +26 -13
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +5 -5
- package/lib/src/gis-map/utils/common-utils.d.ts +6 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +8 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/overlay.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Point as
|
|
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
|
|
7
|
-
import
|
|
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
|
|
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 =
|
|
20
|
+
const r = a.point([t.x, t.y]), i = u(r, n, e, {
|
|
19
21
|
units: "meters"
|
|
20
22
|
});
|
|
21
|
-
return new
|
|
22
|
-
x:
|
|
23
|
-
y:
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
|
76
|
+
let r = await s.getIntersectPointOfLineAndPolygon(
|
|
75
77
|
t,
|
|
76
78
|
e
|
|
77
79
|
);
|
|
78
|
-
if (await
|
|
79
|
-
for (const
|
|
80
|
-
if (r = await
|
|
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
|
-
|
|
84
|
-
), await
|
|
85
|
-
const
|
|
86
|
-
return (await
|
|
87
|
-
|
|
88
|
-
-
|
|
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
|
|
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
|
|
118
|
-
return [
|
|
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
|
|
148
|
-
const
|
|
149
|
-
e.push(
|
|
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
|
|
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
|
|
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
|
|
172
|
-
n.push(r.get(
|
|
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
|
-
|
|
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(
|
|
187
|
-
e[0] -
|
|
188
|
-
e[1] -
|
|
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
|
-
|
|
196
|
+
s.geoReference
|
|
195
197
|
), t;
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
200
|
static transformPointProjection(t) {
|
|
199
201
|
try {
|
|
200
|
-
return y(
|
|
201
|
-
t[0] -
|
|
202
|
-
t[1] -
|
|
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
|
-
|
|
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 =
|
|
216
|
-
return u(
|
|
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
|
-
|
|
236
|
+
s as default
|
|
224
237
|
};
|
|
@@ -1,43 +1,48 @@
|
|
|
1
1
|
import c from "@arcgis/core/Graphic";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
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
|
|
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
|
|
10
|
+
var t, n;
|
|
10
11
|
console.time("初始化停止线图层");
|
|
11
|
-
let e = (
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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:
|
|
23
|
-
|
|
24
|
-
const
|
|
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: "
|
|
27
|
-
|
|
27
|
+
type: "point",
|
|
28
|
+
x: o[0],
|
|
29
|
+
y: o[1],
|
|
30
|
+
spatialReference: this.view.spatialReference
|
|
28
31
|
},
|
|
29
32
|
symbol: {
|
|
30
|
-
type: "simple-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
type: "simple-marker",
|
|
34
|
+
style: "circle",
|
|
35
|
+
color: [0, 0, 255],
|
|
36
|
+
size: 5
|
|
33
37
|
}
|
|
34
38
|
});
|
|
35
|
-
this.stopLineLayer.add(
|
|
39
|
+
this.stopLineLayer.add(s);
|
|
36
40
|
});
|
|
37
41
|
}
|
|
38
42
|
clearSignal() {
|
|
43
|
+
this.stopLineLayer.removeAll();
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
46
|
export {
|
|
42
|
-
|
|
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
|
}
|