gisviewer-vue3-arcgis 1.0.160 → 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/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/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
|
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
1
|
+
import g from "@arcgis/core/Graphic";
|
|
2
|
+
import * as C from "@arcgis/core/core/promiseUtils";
|
|
3
|
+
import * as $ from "@arcgis/core/core/reactiveUtils.js";
|
|
3
4
|
import { Polygon as N } from "@arcgis/core/geometry";
|
|
4
5
|
import * as L from "@arcgis/core/geometry/geometryEngine";
|
|
5
6
|
import k from "@arcgis/core/layers/FeatureLayer";
|
|
6
7
|
import I from "@arcgis/core/layers/GraphicsLayer";
|
|
7
|
-
import * as
|
|
8
|
-
import { lineSliceAlong as
|
|
8
|
+
import * as D from "@turf/helpers";
|
|
9
|
+
import { lineSliceAlong as G } from "@turf/line-slice-along";
|
|
9
10
|
import b from "axios";
|
|
10
|
-
import { XMLParser as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { watch as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
class
|
|
11
|
+
import { XMLParser as F } from "fast-xml-parser";
|
|
12
|
+
import P from "md5";
|
|
13
|
+
import x from "pako";
|
|
14
|
+
import { watch as E } from "vue";
|
|
15
|
+
import R from "../../stores/index.mjs";
|
|
16
|
+
import J from "../common-utils.mjs";
|
|
17
|
+
class M {
|
|
17
18
|
constructor(e) {
|
|
18
|
-
this.junctionNames = /* @__PURE__ */ new Map(), this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.selectedSectionIds = [], this.currentJunctionId = "", this.view = e, this.laneLayer = new k({
|
|
19
|
+
this.junctionNames = /* @__PURE__ */ new Map(), this.junctionScale = 5e3, this.projectName = "", this.openDriveServer = "", this.currentSectionCode = "", this.selectedSectionIds = [], this.currentJunctionId = "", this.view = e, this.laneLayer = new k({
|
|
19
20
|
id: "OpenDriveLane",
|
|
20
21
|
fields: [
|
|
21
22
|
{
|
|
@@ -290,9 +291,9 @@ class x {
|
|
|
290
291
|
]
|
|
291
292
|
}), this.junctionLayer = new I({ id: "OpenDriveJunction" }), this.sectionLayer = new I({ id: "OpenDriveSection" }), this.highlightLayer = new I({ id: "OpenDriveHighlight" }), this.flashLayer = new I({ id: "OpenDriveFlash" }), this.drawLayer = new I({ id: "Draw" }), this.splitLaneLayer = new I({ id: "SplitLane" }), this.borderLayer = new I({ id: "OpenDriveBorder" }), this.view.map.addMany([
|
|
292
293
|
this.laneLayer,
|
|
293
|
-
this.junctionLayer,
|
|
294
294
|
this.sectionLayer,
|
|
295
295
|
this.roadNameLayer,
|
|
296
|
+
this.junctionLayer,
|
|
296
297
|
this.highlightLayer,
|
|
297
298
|
this.flashLayer,
|
|
298
299
|
this.drawLayer,
|
|
@@ -301,16 +302,16 @@ class x {
|
|
|
301
302
|
]);
|
|
302
303
|
}
|
|
303
304
|
static getInstance(e) {
|
|
304
|
-
return this.instance || (this.instance = new
|
|
305
|
+
return this.instance || (this.instance = new M(e)), this.instance;
|
|
305
306
|
}
|
|
306
307
|
async makeMd5FromFile(e) {
|
|
307
308
|
var t;
|
|
308
309
|
try {
|
|
309
|
-
const r = await (await fetch(e)).text(), n = (t = new
|
|
310
|
+
const r = await (await fetch(e)).text(), n = (t = new F({
|
|
310
311
|
ignoreAttributes: !1,
|
|
311
312
|
allowBooleanAttributes: !0
|
|
312
313
|
}).parse(r).OpenDRIVE.userData) == null ? void 0 : t.border;
|
|
313
|
-
return { status: 0, message: "ok", result: { md5:
|
|
314
|
+
return { status: 0, message: "ok", result: { md5: P(r), border: n } };
|
|
314
315
|
} catch (i) {
|
|
315
316
|
return { status: -1, message: i.message };
|
|
316
317
|
}
|
|
@@ -321,8 +322,23 @@ class x {
|
|
|
321
322
|
* @returns
|
|
322
323
|
*/
|
|
323
324
|
async showOpenDriveFromFile(e) {
|
|
324
|
-
var f,
|
|
325
|
-
this.openDriveClickCallback = e.selectedCallback,
|
|
325
|
+
var f, y;
|
|
326
|
+
this.openDriveClickCallback = e.selectedCallback, $.watch(
|
|
327
|
+
() => this.view.scale,
|
|
328
|
+
(p, h) => {
|
|
329
|
+
p > this.junctionScale && h <= this.junctionScale ? (console.log(p, h), this.junctionLayer.graphics.forEach((m) => {
|
|
330
|
+
m.symbol = this.getCrossGraphicSymbol(
|
|
331
|
+
m.attributes,
|
|
332
|
+
"marker"
|
|
333
|
+
);
|
|
334
|
+
})) : p <= this.junctionScale && h > this.junctionScale && (console.log(p, h), this.junctionLayer.graphics.forEach((m) => {
|
|
335
|
+
m.symbol = this.getCrossGraphicSymbol(
|
|
336
|
+
m.attributes,
|
|
337
|
+
"picture"
|
|
338
|
+
);
|
|
339
|
+
}));
|
|
340
|
+
}
|
|
341
|
+
), console.time("md5用时");
|
|
326
342
|
const t = await this.makeMd5FromFile(e.file);
|
|
327
343
|
if (t.status !== 0)
|
|
328
344
|
return t;
|
|
@@ -340,34 +356,34 @@ class x {
|
|
|
340
356
|
}
|
|
341
357
|
}
|
|
342
358
|
);
|
|
343
|
-
} catch (
|
|
344
|
-
return { status: -1, message:
|
|
359
|
+
} catch (p) {
|
|
360
|
+
return { status: -1, message: p.message };
|
|
345
361
|
}
|
|
346
362
|
if (r.status !== 200)
|
|
347
363
|
return { status: -1, message: r.statusText };
|
|
348
364
|
console.time("渲染用时");
|
|
349
365
|
const s = r.data.result.geoSetting;
|
|
350
|
-
|
|
366
|
+
J.setGeoData(
|
|
351
367
|
s.geoReference,
|
|
352
368
|
s.offsetX,
|
|
353
369
|
s.offsetY
|
|
354
370
|
);
|
|
355
371
|
let c = r.data.result.json;
|
|
356
372
|
c.startsWith(window.location.protocol) || (c = `${window.location.protocol}//${e.server}${c}`);
|
|
357
|
-
const a = await (await fetch(c)).arrayBuffer(), o =
|
|
373
|
+
const a = await (await fetch(c)).arrayBuffer(), o = x.inflate(a, { to: "string" }), l = JSON.parse(o);
|
|
358
374
|
await this.showAllLanes(
|
|
359
375
|
l,
|
|
360
376
|
((f = e.options) == null ? void 0 : f.showJunctionLane) || !1,
|
|
361
|
-
((
|
|
377
|
+
((y = e.options) == null ? void 0 : y.showRoadName) || !0
|
|
362
378
|
);
|
|
363
379
|
const d = r.data.result.junctions;
|
|
364
380
|
this.showJunction(d), e.options && e.options.centerMap !== !1 && await this.view.goTo(this.allLaneGraphics), this.mouseMoveHandler || this.monitorMouseMove(), this.mouseClickHandler || this.monitorMouseClick();
|
|
365
|
-
const
|
|
366
|
-
return
|
|
367
|
-
() =>
|
|
381
|
+
const u = R.useAppDataStore;
|
|
382
|
+
return E(
|
|
383
|
+
() => u.isSketching,
|
|
368
384
|
() => {
|
|
369
|
-
var
|
|
370
|
-
|
|
385
|
+
var p, h;
|
|
386
|
+
u.isSketching ? ((p = this.mouseMoveHandler) == null || p.remove(), this.mouseMoveHandler = void 0, (h = this.mouseClickHandler) == null || h.remove(), this.mouseClickHandler = void 0) : (this.monitorMouseMove(), this.monitorMouseClick());
|
|
371
387
|
}
|
|
372
388
|
), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
|
|
373
389
|
}
|
|
@@ -390,7 +406,7 @@ class x {
|
|
|
390
406
|
throw new Error(`OpenDriveRenderer: ${r.statusText}`);
|
|
391
407
|
let s = r.data.result.json;
|
|
392
408
|
s.startsWith(window.location.protocol) || (s = `${window.location.protocol}//${e}${s}`);
|
|
393
|
-
const n = await (await fetch(s)).arrayBuffer(), a =
|
|
409
|
+
const n = await (await fetch(s)).arrayBuffer(), a = x.inflate(n, { to: "string" }), o = JSON.parse(a);
|
|
394
410
|
return await this.showAllLanes(o, !1, !1), { status: 0, message: "ok" };
|
|
395
411
|
}
|
|
396
412
|
/**
|
|
@@ -412,9 +428,9 @@ class x {
|
|
|
412
428
|
if (!t && o.junction !== "-1")
|
|
413
429
|
continue;
|
|
414
430
|
const { id: l, refLine: d } = o;
|
|
415
|
-
let
|
|
416
|
-
|
|
417
|
-
const f = new
|
|
431
|
+
let u = o.name;
|
|
432
|
+
u.includes("(") && (u = u.slice(0, u.indexOf("("))), u = u.replace(/(.)/g, "$1 ");
|
|
433
|
+
const f = new g({
|
|
418
434
|
geometry: {
|
|
419
435
|
type: "polyline",
|
|
420
436
|
paths: [d]
|
|
@@ -422,48 +438,48 @@ class x {
|
|
|
422
438
|
attributes: {
|
|
423
439
|
ObjectID: c++,
|
|
424
440
|
roadId: l,
|
|
425
|
-
roadName:
|
|
441
|
+
roadName: u
|
|
426
442
|
}
|
|
427
443
|
});
|
|
428
|
-
this.allRefLineGraphics.push(f), o.laneSections.sort((
|
|
429
|
-
for (let
|
|
430
|
-
const
|
|
431
|
-
for (const
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
444
|
+
this.allRefLineGraphics.push(f), o.laneSections.sort((y, p) => Number(y.id) - Number(p.id));
|
|
445
|
+
for (let y = 0; y < o.laneSections.length; y++) {
|
|
446
|
+
const p = o.laneSections[y], h = Number(p.id);
|
|
447
|
+
for (const m of p.lanePaths) {
|
|
448
|
+
const v = Number(m.id);
|
|
449
|
+
if (v === 0)
|
|
434
450
|
continue;
|
|
435
|
-
const
|
|
436
|
-
|
|
451
|
+
const w = m.type, O = [...m.outerPath], S = m.innerPath.concat(
|
|
452
|
+
O.reverse()
|
|
437
453
|
);
|
|
438
454
|
if (S.length <= 3) {
|
|
439
|
-
console.warn(`lane ${
|
|
455
|
+
console.warn(`lane ${v} has less than 3 points`);
|
|
440
456
|
continue;
|
|
441
457
|
}
|
|
442
|
-
S.push(
|
|
458
|
+
S.push(m.innerPath[0]);
|
|
443
459
|
const A = new N({
|
|
444
460
|
rings: [S]
|
|
445
461
|
});
|
|
446
462
|
if (A) {
|
|
447
|
-
const
|
|
463
|
+
const j = new g({
|
|
448
464
|
geometry: A,
|
|
449
465
|
attributes: {
|
|
450
466
|
ObjectID: c++,
|
|
451
|
-
id: `${l}+${
|
|
467
|
+
id: `${l}+${h}+${v}`,
|
|
452
468
|
fromNode: o.fromNode,
|
|
453
469
|
toNode: o.toNode,
|
|
454
470
|
roadId: String(l),
|
|
455
471
|
roadName: o.name,
|
|
456
|
-
sectionId: String(
|
|
457
|
-
sectionIndex:
|
|
458
|
-
laneId:
|
|
459
|
-
type:
|
|
472
|
+
sectionId: String(h),
|
|
473
|
+
sectionIndex: y,
|
|
474
|
+
laneId: v,
|
|
475
|
+
type: w,
|
|
460
476
|
sumoId: "",
|
|
461
477
|
// 记录左右边线的起始点,用于按长度高亮车道的一部分
|
|
462
|
-
leftLine:
|
|
463
|
-
rightLine:
|
|
478
|
+
leftLine: m.innerPath,
|
|
479
|
+
rightLine: m.outerPath
|
|
464
480
|
}
|
|
465
481
|
});
|
|
466
|
-
this.allLaneGraphics.push(
|
|
482
|
+
this.allLaneGraphics.push(j), n.push(j);
|
|
467
483
|
}
|
|
468
484
|
}
|
|
469
485
|
}
|
|
@@ -498,7 +514,7 @@ class x {
|
|
|
498
514
|
if (!i)
|
|
499
515
|
continue;
|
|
500
516
|
this.junctionNames.set(i.id, i.name), i.nodeType = i.type;
|
|
501
|
-
const r = new
|
|
517
|
+
const r = new g({
|
|
502
518
|
geometry: {
|
|
503
519
|
type: "point",
|
|
504
520
|
x: i.coordinates[0],
|
|
@@ -509,31 +525,34 @@ class x {
|
|
|
509
525
|
selected: !1,
|
|
510
526
|
type: "OpenDriveJunction"
|
|
511
527
|
},
|
|
512
|
-
symbol:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
528
|
+
symbol: this.getCrossGraphicSymbol(i, "marker")
|
|
529
|
+
// symbol: {
|
|
530
|
+
// type: 'picture-marker',
|
|
531
|
+
// url: junctionTableData.crossId
|
|
532
|
+
// ? '/GisViewerAssets/Images/xhj_1.png'
|
|
533
|
+
// : '/GisViewerAssets/Images/xhj_2.png',
|
|
534
|
+
// width: '18px',
|
|
535
|
+
// height: '28px',
|
|
536
|
+
// yoffset: '9px'
|
|
537
|
+
// } as any,
|
|
538
|
+
// popupTemplate: {
|
|
539
|
+
// title: junctionTableData.name,
|
|
540
|
+
// content: [
|
|
541
|
+
// {
|
|
542
|
+
// type: 'fields',
|
|
543
|
+
// fieldInfos: [
|
|
544
|
+
// {
|
|
545
|
+
// fieldName: 'id',
|
|
546
|
+
// label: '路口编号'
|
|
547
|
+
// },
|
|
548
|
+
// {
|
|
549
|
+
// fieldName: 'crossId',
|
|
550
|
+
// label: '信号机编号'
|
|
551
|
+
// }
|
|
552
|
+
// ]
|
|
553
|
+
// }
|
|
554
|
+
// ]
|
|
555
|
+
// }
|
|
537
556
|
});
|
|
538
557
|
t.push(r);
|
|
539
558
|
}
|
|
@@ -543,7 +562,7 @@ class x {
|
|
|
543
562
|
* 监听鼠标移动事件,高亮显示鼠标所在路段和路口
|
|
544
563
|
*/
|
|
545
564
|
monitorMouseMove() {
|
|
546
|
-
const e =
|
|
565
|
+
const e = C.debounce(async (t) => {
|
|
547
566
|
var c;
|
|
548
567
|
const r = (c = (await this.view.hitTest(t, {
|
|
549
568
|
include: [this.laneLayer, this.junctionLayer]
|
|
@@ -560,15 +579,15 @@ class x {
|
|
|
560
579
|
"roadId"
|
|
561
580
|
)}+${this.hitGraphic.getAttribute("sectionId")}`;
|
|
562
581
|
if (this.currentSectionCode === n || this.selectedSectionIds.includes(n) || this.sectionLayer.graphics.findIndex(
|
|
563
|
-
(
|
|
582
|
+
(h) => h.getAttribute("id") === n
|
|
564
583
|
) >= 0)
|
|
565
584
|
return;
|
|
566
585
|
this.currentSectionCode = n;
|
|
567
586
|
const o = this.allLaneGraphics.filter(
|
|
568
|
-
(
|
|
587
|
+
(h) => `${h.attributes.roadId}+${h.attributes.sectionId}` === n
|
|
569
588
|
), l = L.union(
|
|
570
|
-
o.map((
|
|
571
|
-
), d = this.hitGraphic.getAttribute("fromNode"),
|
|
589
|
+
o.map((h) => h.geometry)
|
|
590
|
+
), d = this.hitGraphic.getAttribute("fromNode"), u = this.hitGraphic.getAttribute("toNode"), f = this.junctionNames.get(d) || d, y = this.junctionNames.get(u) || u, p = new g({
|
|
572
591
|
geometry: l,
|
|
573
592
|
symbol: {
|
|
574
593
|
type: "simple-fill",
|
|
@@ -584,7 +603,7 @@ class x {
|
|
|
584
603
|
id: n,
|
|
585
604
|
selected: !1,
|
|
586
605
|
fromNodeName: f,
|
|
587
|
-
toNodeName:
|
|
606
|
+
toNodeName: y,
|
|
588
607
|
laneCount: o.length
|
|
589
608
|
},
|
|
590
609
|
popupTemplate: {
|
|
@@ -610,20 +629,12 @@ class x {
|
|
|
610
629
|
]
|
|
611
630
|
}
|
|
612
631
|
});
|
|
613
|
-
this.highlightLayer.removeAll(), this.highlightLayer.add(
|
|
614
|
-
const g = this.view.toMap(t);
|
|
615
|
-
this.view.openPopup({
|
|
616
|
-
features: [m],
|
|
617
|
-
location: g
|
|
618
|
-
});
|
|
632
|
+
this.highlightLayer.removeAll(), this.highlightLayer.add(p);
|
|
619
633
|
} else if (s.layer.id === "OpenDriveJunction") {
|
|
620
634
|
const n = this.hitGraphic.getAttribute("id");
|
|
621
635
|
if (n === this.currentJunctionId)
|
|
622
636
|
return;
|
|
623
|
-
this.currentJunctionId = n
|
|
624
|
-
features: [this.hitGraphic],
|
|
625
|
-
location: this.hitGraphic.geometry
|
|
626
|
-
});
|
|
637
|
+
this.currentJunctionId = n;
|
|
627
638
|
}
|
|
628
639
|
});
|
|
629
640
|
this.mouseMoveHandler = this.view.on("pointer-move", async (t) => {
|
|
@@ -635,7 +646,7 @@ class x {
|
|
|
635
646
|
* 监听鼠标点击事件,获取高亮要素的拓扑信息
|
|
636
647
|
*/
|
|
637
648
|
monitorMouseClick() {
|
|
638
|
-
const e =
|
|
649
|
+
const e = C.debounce(async (t) => {
|
|
639
650
|
var a;
|
|
640
651
|
const r = (a = (await this.view.hitTest(t, {
|
|
641
652
|
include: [this.highlightLayer, this.junctionLayer, this.sectionLayer]
|
|
@@ -657,16 +668,21 @@ class x {
|
|
|
657
668
|
type: "OpenDriveJunction",
|
|
658
669
|
id: n,
|
|
659
670
|
details: l.data.result
|
|
660
|
-
}), s.setAttribute("selected", !0), s.symbol
|
|
661
|
-
|
|
671
|
+
}), s.setAttribute("selected", !0), s.symbol = {
|
|
672
|
+
type: "picture-marker",
|
|
673
|
+
url: "/GisViewerAssets/Images/point_red.png",
|
|
674
|
+
width: "20px",
|
|
675
|
+
height: "20px"
|
|
676
|
+
}, this.increasePictureMarkerSize(s, 50));
|
|
677
|
+
} else
|
|
662
678
|
this.openDriveClickCallback && this.openDriveClickCallback({
|
|
663
679
|
type: "OpenDriveJunction",
|
|
664
680
|
id: n,
|
|
665
681
|
details: void 0
|
|
666
|
-
}), s.setAttribute("selected", !1)
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
682
|
+
}), s.setAttribute("selected", !1), s.symbol = this.getCrossGraphicSymbol(
|
|
683
|
+
s.attributes,
|
|
684
|
+
this.view.scale < this.junctionScale ? "picture" : "marker"
|
|
685
|
+
);
|
|
670
686
|
else if (c === "OpenDriveSection")
|
|
671
687
|
if (s.layer.id === "OpenDriveHighlight") {
|
|
672
688
|
this.highlightLayer.remove(s), this.sectionLayer.add(s), s.setAttribute("selected", !0), this.selectedSectionIds.push(n);
|
|
@@ -807,15 +823,15 @@ class x {
|
|
|
807
823
|
if (!i)
|
|
808
824
|
return { status: -1, message: "未找到。请检查路口编号" };
|
|
809
825
|
if (t) {
|
|
810
|
-
const r = new
|
|
826
|
+
const r = new g({
|
|
811
827
|
geometry: i.geometry,
|
|
812
828
|
symbol: {
|
|
813
829
|
type: "simple-marker",
|
|
814
830
|
style: "circle",
|
|
815
831
|
size: 30,
|
|
816
|
-
color: [0,
|
|
832
|
+
color: [0, 255, 255, 0.8],
|
|
817
833
|
outline: {
|
|
818
|
-
color:
|
|
834
|
+
color: [0, 255, 255],
|
|
819
835
|
width: 1
|
|
820
836
|
}
|
|
821
837
|
}
|
|
@@ -863,7 +879,7 @@ class x {
|
|
|
863
879
|
(a) => a.geometry
|
|
864
880
|
), n = L.union(c);
|
|
865
881
|
if (e.flash) {
|
|
866
|
-
const a = new
|
|
882
|
+
const a = new g({
|
|
867
883
|
geometry: n,
|
|
868
884
|
symbol: {
|
|
869
885
|
type: "simple-fill",
|
|
@@ -896,11 +912,10 @@ class x {
|
|
|
896
912
|
*/
|
|
897
913
|
unselectSumo(e) {
|
|
898
914
|
if ((!e || e.type === "junction") && this.junctionLayer.graphics.forEach((t) => {
|
|
899
|
-
|
|
900
|
-
t.
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
}
|
|
915
|
+
(!e || !e.id || e.id === "" || e.id === t.getAttribute("id")) && t.getAttribute("selected") && (t.setAttribute("selected", !1), t.symbol = this.getCrossGraphicSymbol(
|
|
916
|
+
t.attributes,
|
|
917
|
+
this.view.scale < this.junctionScale ? "picture" : "marker"
|
|
918
|
+
));
|
|
904
919
|
}), !e || e.type === "edge") {
|
|
905
920
|
let t;
|
|
906
921
|
!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) => {
|
|
@@ -943,7 +958,7 @@ class x {
|
|
|
943
958
|
let o = c.get(a);
|
|
944
959
|
o ? o.push(n.geometry) : (o = [n.geometry], c.set(a, o));
|
|
945
960
|
}), c.forEach((n, a) => {
|
|
946
|
-
const o = L.union(n), l = new
|
|
961
|
+
const o = L.union(n), l = new g({
|
|
947
962
|
geometry: o,
|
|
948
963
|
symbol: {
|
|
949
964
|
type: "simple-fill",
|
|
@@ -984,7 +999,7 @@ class x {
|
|
|
984
999
|
type: "edge",
|
|
985
1000
|
id: d
|
|
986
1001
|
});
|
|
987
|
-
const
|
|
1002
|
+
const u = `http://${this.openDriveServer}/api/sumo/getSumoEdge`, f = await b.get(u, {
|
|
988
1003
|
params: {
|
|
989
1004
|
id: `${o}+${a.getAttribute("sectionId")}`,
|
|
990
1005
|
projectName: this.projectName
|
|
@@ -1027,25 +1042,25 @@ class x {
|
|
|
1027
1042
|
const r = Number(i[1]), s = i[0].split("#"), c = s.length === 2 ? Number(s[1]) : 0;
|
|
1028
1043
|
let n = s[0];
|
|
1029
1044
|
n.startsWith("-") && (n = n.slice(1));
|
|
1030
|
-
const a = this.allLaneGraphics.filter((
|
|
1045
|
+
const a = this.allLaneGraphics.filter((w) => w.getAttribute("roadId") === n && w.getAttribute("sectionIndex") === c);
|
|
1031
1046
|
if (a.length === 0)
|
|
1032
1047
|
return { status: -1, message: "未找到路段" };
|
|
1033
1048
|
const o = a.length - r, l = a.find(
|
|
1034
|
-
(
|
|
1049
|
+
(w) => Math.abs(w.getAttribute("laneId")) === o
|
|
1035
1050
|
);
|
|
1036
1051
|
if (!l)
|
|
1037
1052
|
return { status: -1, message: "未找到车道" };
|
|
1038
|
-
const d = e.start || 0,
|
|
1053
|
+
const d = e.start || 0, u = e.end || 100, f = D.lineString(l.getAttribute("leftLine")), y = G(f, d, u, {
|
|
1039
1054
|
units: "meters"
|
|
1040
|
-
}),
|
|
1055
|
+
}), p = D.lineString(l.getAttribute("rightLine")), h = G(p, d, u, {
|
|
1041
1056
|
units: "meters"
|
|
1042
|
-
}),
|
|
1043
|
-
|
|
1057
|
+
}), m = y.geometry.coordinates.concat(
|
|
1058
|
+
h.geometry.coordinates.reverse()
|
|
1044
1059
|
);
|
|
1045
|
-
|
|
1046
|
-
const
|
|
1060
|
+
m.push(m[m.length - 1]);
|
|
1061
|
+
const v = new g({
|
|
1047
1062
|
geometry: new N({
|
|
1048
|
-
rings: [
|
|
1063
|
+
rings: [m]
|
|
1049
1064
|
}),
|
|
1050
1065
|
attributes: {
|
|
1051
1066
|
ObjectID: l.getAttribute("ObjectID"),
|
|
@@ -1059,8 +1074,8 @@ class x {
|
|
|
1059
1074
|
laneId: l.getAttribute("laneId"),
|
|
1060
1075
|
type: l.getAttribute("type"),
|
|
1061
1076
|
sumoId: l.getAttribute("sumoId"),
|
|
1062
|
-
leftLine:
|
|
1063
|
-
rightLine:
|
|
1077
|
+
leftLine: y.geometry.coordinates,
|
|
1078
|
+
rightLine: h.geometry.coordinates
|
|
1064
1079
|
},
|
|
1065
1080
|
symbol: {
|
|
1066
1081
|
type: "simple-fill",
|
|
@@ -1070,12 +1085,123 @@ class x {
|
|
|
1070
1085
|
}
|
|
1071
1086
|
}
|
|
1072
1087
|
});
|
|
1073
|
-
return this.splitLaneLayer.add(
|
|
1088
|
+
return this.splitLaneLayer.add(v), this.view.goTo(v), { status: 0, message: "ok", result: e };
|
|
1074
1089
|
}
|
|
1075
1090
|
clearSplitLane() {
|
|
1076
1091
|
this.splitLaneLayer.removeAll();
|
|
1077
1092
|
}
|
|
1093
|
+
/**
|
|
1094
|
+
* 生成路口点符号。在不同比例尺下,使用不同的符号
|
|
1095
|
+
* @param attributes
|
|
1096
|
+
* @param symbolType
|
|
1097
|
+
* @returns
|
|
1098
|
+
*/
|
|
1099
|
+
getCrossGraphicSymbol(e, t) {
|
|
1100
|
+
const i = e.crossId !== "" && e.crossId !== void 0 && e.crossId !== null;
|
|
1101
|
+
if (t === "marker")
|
|
1102
|
+
return {
|
|
1103
|
+
type: "picture-marker",
|
|
1104
|
+
url: `/GisViewerAssets/Images/xhj_${i ? 4 : 2}.png`,
|
|
1105
|
+
width: "18px",
|
|
1106
|
+
height: "28px",
|
|
1107
|
+
yOffset: "12px"
|
|
1108
|
+
};
|
|
1109
|
+
if (t === "picture")
|
|
1110
|
+
return i ? {
|
|
1111
|
+
type: "cim",
|
|
1112
|
+
data: {
|
|
1113
|
+
type: "CIMSymbolReference",
|
|
1114
|
+
primitiveOverrides: [
|
|
1115
|
+
{
|
|
1116
|
+
// 将textGraphic的TextString替换为graphic.attributes.name
|
|
1117
|
+
type: "CIMPrimitiveOverride",
|
|
1118
|
+
primitiveName: "textGraphic",
|
|
1119
|
+
propertyName: "TextString",
|
|
1120
|
+
valueExpressionInfo: {
|
|
1121
|
+
type: "CIMExpressionInfo",
|
|
1122
|
+
title: "Custom",
|
|
1123
|
+
expression: 'Replace($feature.name, "与", "/") + " " + $feature.crossId',
|
|
1124
|
+
returnType: "Default"
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
symbol: {
|
|
1129
|
+
type: "CIMPointSymbol",
|
|
1130
|
+
symbolLayers: [
|
|
1131
|
+
// 路口名称
|
|
1132
|
+
{
|
|
1133
|
+
type: "CIMVectorMarker",
|
|
1134
|
+
size: 32,
|
|
1135
|
+
colorLocked: !0,
|
|
1136
|
+
anchorPointUnits: "Relative",
|
|
1137
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
1138
|
+
markerGraphics: [
|
|
1139
|
+
{
|
|
1140
|
+
type: "CIMMarkerGraphic",
|
|
1141
|
+
primitiveName: "textGraphic",
|
|
1142
|
+
geometry: { x: 0, y: 0 },
|
|
1143
|
+
symbol: {
|
|
1144
|
+
type: "CIMTextSymbol",
|
|
1145
|
+
height: 12,
|
|
1146
|
+
horizontalAlignment: "Center",
|
|
1147
|
+
offsetX: 0,
|
|
1148
|
+
offsetY: i ? 50 : 40,
|
|
1149
|
+
haloSize: 2,
|
|
1150
|
+
haloSymbol: {
|
|
1151
|
+
type: "CIMPolygonSymbol",
|
|
1152
|
+
symbolLayers: [
|
|
1153
|
+
{
|
|
1154
|
+
type: "CIMSolidFill",
|
|
1155
|
+
enable: !0,
|
|
1156
|
+
color: [255, 255, 255, 255]
|
|
1157
|
+
}
|
|
1158
|
+
]
|
|
1159
|
+
},
|
|
1160
|
+
symbol: {
|
|
1161
|
+
type: "CIMPolygonSymbol",
|
|
1162
|
+
symbolLayers: [
|
|
1163
|
+
{
|
|
1164
|
+
type: "CIMSolidFill",
|
|
1165
|
+
enable: !0,
|
|
1166
|
+
color: [0, 0, 0, 255]
|
|
1167
|
+
}
|
|
1168
|
+
]
|
|
1169
|
+
},
|
|
1170
|
+
verticalAlignment: "Center"
|
|
1171
|
+
},
|
|
1172
|
+
textString: ""
|
|
1173
|
+
}
|
|
1174
|
+
],
|
|
1175
|
+
scaleSymbolsProportionally: !0,
|
|
1176
|
+
respectFrame: !0
|
|
1177
|
+
},
|
|
1178
|
+
// 路口图标
|
|
1179
|
+
{
|
|
1180
|
+
type: "CIMPictureMarker",
|
|
1181
|
+
enable: !0,
|
|
1182
|
+
anchorPoint: {
|
|
1183
|
+
x: 0,
|
|
1184
|
+
y: 0
|
|
1185
|
+
},
|
|
1186
|
+
anchorPointUnits: "Relative",
|
|
1187
|
+
size: 45,
|
|
1188
|
+
rotateClockwise: !0,
|
|
1189
|
+
textureFilter: "Picture",
|
|
1190
|
+
url: "/GisViewerAssets/Images/xhj_4.png",
|
|
1191
|
+
offsetY: i ? 22 : 15
|
|
1192
|
+
}
|
|
1193
|
+
]
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
} : {
|
|
1197
|
+
type: "picture-marker",
|
|
1198
|
+
url: "/GisViewerAssets/Images/xhj_2.png",
|
|
1199
|
+
width: "27px",
|
|
1200
|
+
height: "42px",
|
|
1201
|
+
yOffset: "22px"
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1078
1204
|
}
|
|
1079
1205
|
export {
|
|
1080
|
-
|
|
1206
|
+
M as default
|
|
1081
1207
|
};
|
|
@@ -2,9 +2,9 @@ import * as u from "@arcgis/core/core/reactiveUtils.js";
|
|
|
2
2
|
import y from "@arcgis/core/Graphic";
|
|
3
3
|
import h from "@arcgis/core/layers/GraphicsLayer";
|
|
4
4
|
import p from "@turf/buffer";
|
|
5
|
-
import
|
|
5
|
+
import d from "@turf/convex";
|
|
6
6
|
import * as o from "@turf/helpers";
|
|
7
|
-
import
|
|
7
|
+
import f from "concaveman";
|
|
8
8
|
import b from "./district-controller.mjs";
|
|
9
9
|
class x {
|
|
10
10
|
constructor(e) {
|
|
@@ -38,7 +38,7 @@ class x {
|
|
|
38
38
|
return this.watchHandle = u.watch(
|
|
39
39
|
() => this.view.scale,
|
|
40
40
|
(t, r) => {
|
|
41
|
-
|
|
41
|
+
t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((s) => {
|
|
42
42
|
s.symbol = this.getCrossGraphicSymbol(
|
|
43
43
|
s.attributes,
|
|
44
44
|
"marker"
|
|
@@ -139,9 +139,9 @@ class x {
|
|
|
139
139
|
const n = o.featureCollection(
|
|
140
140
|
r.map((g) => o.point(g))
|
|
141
141
|
);
|
|
142
|
-
i =
|
|
142
|
+
i = d(n);
|
|
143
143
|
} else {
|
|
144
|
-
const n =
|
|
144
|
+
const n = f(r, 0.5);
|
|
145
145
|
n.length >= 4 && (i = o.polygon([n]));
|
|
146
146
|
}
|
|
147
147
|
i || (i = o.lineString(r));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),p=require("@turf/bearing"),g=require("@turf/destination"),b=require("@turf/helpers"),S=require("@turf/length"),A=require("@turf/line-slice-along"),M=require("pako"),P=require("proj4");function y(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const l=y(L),h=y(w),c=y(b);class i{static destinationWithPoint(e,t,n){const r=c.point([e.x,e.y]),s=g(r,n,t,{units:"meters"});return new f.Point({x:s.geometry.coordinates[0],y:s.geometry.coordinates[1]})}static angleOfLine(e){const t=e.paths[0],n=c.point(t[0]),r=c.point(t[t.length-1]);return p(n,r)}static extendLineInTowDir(e,t){const n=e.paths[0],r=c.point(n[0]),s=c.point(n[1]),o=p(s,r),u=g(r,t,o,{units:"meters"}),d=o>0?o-180:o+180,O=g(s,t,d,{units:"meters"});return new f.Polyline({paths:[[u.geometry.coordinates,O.geometry.coordinates]]})}static async getIntersectPointOfTwoLines(e,t){const n=await l.intersectLinesToPoints(e,t);if(n.length)return n[0]}static async getIntersectPointsOfStopLineAndLane(e,t,n){let r=await i.getIntersectPointOfLineAndPolygon(e,t);if(await i.pointDistance(r)<3&&n){for(const s of n)if(r=await i.getIntersectPointOfLineAndPolygon(e,t,s),await i.pointDistance(r)>2.5){const o=new f.Polyline({paths:[r]});return(await i.getOffsetLine(o,-s)).paths[0]}}else return r;return[]}static async pointDistance(e){if(e.length<2)return 0;const t=new f.Polyline({paths:[e]});return await l.geodesicLength(t,"meters")}static async getIntersectPointOfLineAndPolygon(e,t,n=0){n!==0&&(e=await i.getOffsetLine(e,n));const r=await l.intersect(e,t);if(r instanceof f.Polyline){const s=r.paths[0],o=s[0],u=s[s.length-1];return[o,u]}return[]}static async getOffsetLine(e,t){const n=h.geographicToWebMercator(e),r=await l.offset(n,t,"meters");return h.webMercatorToGeographic(r,!1)}static unzip(e){try{const t=[],n=e.split("");for(let s=0;s<n.length;s++){const o=n[s];t.push(o.charCodeAt(0))}const r=new Uint8Array(t);return M.inflate(r,{to:"string"})}catch{console.log(`非压缩内容: ${e}`)}}static getStdVecEntries(e,t=!1){const n=new Array(e.size());for(let r=0;r<e.size();r++)n[r]=e.get(r);return t&&e.delete(),n}static getStdMapEntries(e){const t=[];for(const n of i.getStdMapKeys(e))t.push([n,e.get(n)]);return t}static getStdMapKeys(e,t=!1){const n=[],r=e.keys();for(let s=0;s<r.size();s++)n.push(r.get(s));return r.delete(),t&&e.delete(),n}static setGeoData(e,t,n){i.geoReference=e,i.xOffset=t,i.yOffset=n}static transformLineProjection(e){try{return e.map(t=>P(i.geoReference).inverse([t[0]-i.xOffset,t[1]-i.yOffset]))}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",i.geoReference),e}}static transformPointProjection(e){try{return P(i.geoReference).inverse([e[0]-i.xOffset,e[1]-i.yOffset])}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",i.geoReference),e}}static pointsEqual(e,t){return Math.abs(e[0]-t[0])<Number.EPSILON&&Math.abs(e[1]-t[1])<Number.EPSILON}static getExtensionLine(e,t,n){const r=c.point(e),s=c.point(t),o=p(r,s);return g(s,n,o,{units:"meters"}).geometry.coordinates}static isCoordinateValid(e){return typeof e.latitude=="string"&&(e.latitude=Number(e.latitude)),typeof e.longitude=="string"&&(e.longitude=Number(e.longitude)),e.latitude!==null&&e.longitude!==null&&!isNaN(e.latitude)&&!isNaN(e.longitude)&&e.latitude!==0&&e.longitude!==0}static getCenterPointInLine(e){const t=c.lineString(e),n=S(t,{units:"meters"});return A(t,0,n/2,{units:"meters"}).geometry.coordinates[1]}}exports.default=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/GraphicsLayer"),h=require("../common-utils.js"),y=require("./signal-holo-flow.js");class L extends y.default{constructor(e){super(e),this.stopLineLayer=new d,this.stopLineMap=new Map,this.view.map.add(this.stopLineLayer)}async initializeLayer(){var o,n;console.time("初始化停止线图层");let e=(n=(o=this.mapConfig.holoFlow)==null?void 0:o.signal)==null?void 0:n.stopLineLayer;if(!e)return;e=this.mapConfig.assetsRoot+"/"+e,(await(await fetch(e)).json()).features.forEach(t=>{const{roadId:s,nodeId:r}=t.properties,{coordinates:l}=t.geometry,c=this.stopLineMap.get(r);c?c.set(s,l):this.stopLineMap.set(r,new Map([[s,l]]))}),console.timeEnd("初始化停止线图层")}async handleSignalData(e){const{crossId:a}=e,i=this.stopLineMap.get(a);i&&i.forEach((o,n)=>{const t=h.default.getCenterPointInLine(o);console.log("centerPoint",t);const s=new p({geometry:{type:"point",x:t[0],y:t[1],spatialReference:this.view.spatialReference},symbol:{type:"simple-marker",style:"circle",color:[0,0,255],size:5}});this.stopLineLayer.add(s)})}clearSignal(){this.stopLineLayer.removeAll()}}exports.default=L;
|
|
@@ -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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/Graphic"),P=require("@arcgis/core/core/promiseUtils"),N=require("@arcgis/core/geometry"),q=require("@arcgis/core/geometry/geometryEngine"),C=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),J=require("@turf/helpers"),O=require("@turf/line-slice-along"),b=require("axios"),E=require("fast-xml-parser"),R=require("md5"),x=require("pako"),T=require("vue"),H=require("../../stores/index.js"),_=require("../common-utils.js");function D(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=D(P),S=D(q),$=D(J);class j{constructor(e){this.junctionNames=new Map,this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.selectedSectionIds=[],this.currentJunctionId="",this.view=e,this.laneLayer=new C({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 C({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new v({id:"OpenDriveJunction"}),this.sectionLayer=new v({id:"OpenDriveSection"}),this.highlightLayer=new v({id:"OpenDriveHighlight"}),this.flashLayer=new v({id:"OpenDriveFlash"}),this.drawLayer=new v({id:"Draw"}),this.splitLaneLayer=new v({id:"SplitLane"}),this.borderLayer=new v({id:"OpenDriveBorder"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer,this.drawLayer,this.splitLaneLayer,this.borderLayer])}static getInstance(e){return this.instance||(this.instance=new j(e)),this.instance}async makeMd5FromFile(e){var t;try{const r=await(await fetch(e)).text(),n=(t=new E.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(r).OpenDRIVE.userData)==null?void 0:t.border;return{status:0,message:"ok",result:{md5:R(r),border:n}}}catch(i){return{status:-1,message:i.message}}}async showOpenDriveFromFile(e){var g,p;this.openDriveClickCallback=e.selectedCallback,console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;this.projectName=t.result.md5,console.timeEnd("md5用时"),console.log(t.result.border),this.openDriveServer=e.server;const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let r;try{r=await b.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(m){return{status:-1,message:m.message}}if(r.status!==200)return{status:-1,message:r.statusText};console.time("渲染用时");const s=r.data.result.geoSetting;_.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let c=r.data.result.json;c.startsWith(window.location.protocol)||(c=`${window.location.protocol}//${e.server}${c}`);const a=await(await fetch(c)).arrayBuffer(),o=x.inflate(a,{to:"string"}),l=JSON.parse(o);await this.showAllLanes(l,((g=e.options)==null?void 0:g.showJunctionLane)||!1,((p=e.options)==null?void 0:p.showRoadName)||!0);const d=r.data.result.junctions;this.showJunction(d),e.options&&e.options.centerMap!==!1&&await this.view.goTo(this.allLaneGraphics),this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick();const h=H.default.useAppDataStore;return T.watch(()=>h.isSketching,()=>{var m,f;h.isSketching?((m=this.mouseMoveHandler)==null||m.remove(),this.mouseMoveHandler=void 0,(f=this.mouseClickHandler)==null||f.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`,r=await b.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(r.status!==200)throw new Error(`OpenDriveRenderer: ${r.statusText}`);let s=r.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const n=await(await fetch(s)).arrayBuffer(),a=x.inflate(n,{to:"string"}),o=JSON.parse(a);return await this.showAllLanes(o,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){const r=await this.laneLayer.queryFeatures();return r.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:r.features}),this.roadNameLayer.visible=i,new Promise(s=>{let c=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const o of e){if(!t&&o.junction!=="-1")continue;const{id:l,refLine:d}=o;let h=o.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const g=new y({geometry:{type:"polyline",paths:[d]},attributes:{ObjectID:c++,roadId:l,roadName:h}});this.allRefLineGraphics.push(g),o.laneSections.sort((p,m)=>Number(p.id)-Number(m.id));for(let p=0;p<o.laneSections.length;p++){const m=o.laneSections[p],f=Number(m.id);for(const u of m.lanePaths){const w=Number(u.id);if(w===0)continue;const I=u.type,F=[...u.outerPath],A=u.innerPath.concat(F.reverse());if(A.length<=3){console.warn(`lane ${w} has less than 3 points`);continue}A.push(u.innerPath[0]);const k=new N.Polygon({rings:[A]});if(k){const G=new y({geometry:k,attributes:{ObjectID:c++,id:`${l}+${f}+${w}`,fromNode:o.fromNode,toNode:o.toNode,roadId:String(l),roadName:o.name,sectionId:String(f),sectionIndex:p,laneId:w,type:I,sumoId:"",leftLine:u.innerPath,rightLine:u.outerPath}});this.allLaneGraphics.push(G),n.push(G)}}}}const a=setInterval(()=>{if(n.length>0||this.allRefLineGraphics.length>0){if(n.length>0){const o=n.splice(0,100);this.laneLayer.applyEdits({addFeatures:o})}if(this.allRefLineGraphics.length>0){const o=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:o})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];for(const i of e){if(!i)continue;this.junctionNames.set(i.id,i.name),i.nodeType=i.type;const r=new y({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/xhj_1.png":"/GisViewerAssets/Images/xhj_2.png",width:"18px",height:"28px",yoffset:"9px"},popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"路口编号"},{fieldName:"crossId",label:"信号机编号"}]}]}});t.push(r)}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=M.debounce(async t=>{var c;const r=(c=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:c.filter(n=>n.type==="graphic");if(r.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId=""),this.view.closePopup();return}const s=r[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 o=this.allLaneGraphics.filter(u=>`${u.attributes.roadId}+${u.attributes.sectionId}`===n),l=S.union(o.map(u=>u.geometry)),d=this.hitGraphic.getAttribute("fromNode"),h=this.hitGraphic.getAttribute("toNode"),g=this.junctionNames.get(d)||d,p=this.junctionNames.get(h)||h,m=new y({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:g,toNodeName:p,laneCount:o.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(m);const f=this.view.toMap(t);this.view.openPopup({features:[m],location:f})}else if(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n,this.view.openPopup({features:[this.hitGraphic],location:this.hitGraphic.geometry})}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=M.debounce(async t=>{var a;const r=(a=(await this.view.hitTest(t,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(o=>o.type==="graphic");if(r.length===0)return;const s=r[0].graphic,c=s.getAttribute("type"),n=s.getAttribute("id");if(c==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const o=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,l=await b.get(o,{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.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(s,50))}else{this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:void 0}),s.setAttribute("selected",!1);const o=s.getAttribute("crossId");s.symbol.url=o?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(s,30)}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 o=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,l=await b.get(o,{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(o=>o!==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 r=e.symbol,s=r.width;s<t?e.symbol={type:"picture-marker",url:r.url,width:s+1,height:s+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,t){const i=setInterval(()=>{const r=e.symbol,s=r.width;s>t?e.symbol={type:"picture-marker",url:r.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 r=0;t.length===2&&(r=Number(t[1]));const s=this.allLaneGraphics.find(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===r);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:"未知类型"}}}async clearOpenDrive(){var t,i;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0}async findSumo(e){const{type:t,id:i}=e,r=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(i,r);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],o=n.length===2?Number(n[1]):void 0;return await this.findLane({roadsectId:a,segmentId:o,laneId:c,flash:r})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const i=this.junctionLayer.graphics.find(r=>r.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(t){const r=new y({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[0,0,255,.6],outline:{color:"blue",width:1}}});this.flashGraphic(r)}return await this.view.goTo(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:i,laneId:r}=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(o=>{const l=Number(o.attributes.sectionId);a.indexOf(l)===-1&&a.push(l)}),a.sort((o,l)=>o-l),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(o=>Number(o.attributes.sectionId)===i)}if(r!==void 0){const a=[];if(s.forEach(o=>{const l=Number(o.attributes.laneId);a.indexOf(l)===-1&&a.push(l)}),a.sort((o,l)=>o-l),r>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};r=a[r],s=s.filter(o=>Number(o.attributes.laneId)===r)}const c=s.map(a=>a.geometry),n=S.union(c);if(e.flash){const a=new y({geometry:n,symbol:{type:"simple-fill",color:[0,0,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 r=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(r))},10)}unselectSumo(e){if((!e||e.type==="junction")&&this.junctionLayer.graphics.forEach(t=>{if((!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")){t.setAttribute("selected",!1);const i=t.getAttribute("crossId");t.symbol.url=i?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(t,30)}}),!e||e.type==="edge"){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 r=i.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(s=>s!==r)}),this.sectionLayer.removeMany(t))}return{status:0,message:"ok"}}selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(t=>{if(e.id===t.getAttribute("id"))return t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const t=e.id.split("#");let i=String(t[0]);i.startsWith("-")&&(i=i.slice(1));let r=0;t.length===2&&(r=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")===r)),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 o=c.get(a);o?o.push(n.geometry):(o=[n.geometry],c.set(a,o))}),c.forEach((n,a)=>{const o=S.union(n),l=new y({geometry:o,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)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const t=new N.Polygon({rings:[e]}),i=await this.laneLayer.queryFeatures({geometry:t,outFields:["*"]}),r=[],s=[];for(const a of i.features){const o=a.getAttribute("roadId"),l=a.getAttribute("sectionIndex"),d=`${o}#${l}`;if(r.indexOf(d)===-1){r.push(d),this.selectSumo({type:"edge",id:d});const h=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,g=await b.get(h,{params:{id:`${o}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});g.status===200&&g.data.status===0&&s.push(g.data.result)}}const c=this.junctionLayer.graphics.filter(a=>{const o=a.geometry;return S.contains(t,o)}),n=[];for(const a of c){const o=a.getAttribute("id");this.selectSumo({type:"junction",id:o});const l=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await b.get(l,{params:{id:o,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 r=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 o=a.length-r,l=a.find(I=>Math.abs(I.getAttribute("laneId"))===o);if(!l)return{status:-1,message:"未找到车道"};const d=e.start||0,h=e.end||100,g=$.lineString(l.getAttribute("leftLine")),p=O.lineSliceAlong(g,d,h,{units:"meters"}),m=$.lineString(l.getAttribute("rightLine")),f=O.lineSliceAlong(m,d,h,{units:"meters"}),u=p.geometry.coordinates.concat(f.geometry.coordinates.reverse());u.push(u[u.length-1]);const w=new y({geometry:new N.Polygon({rings:[u]}),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:p.geometry.coordinates,rightLine:f.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(w),this.view.goTo(w),{status:0,message:"ok",result:e}}clearSplitLane(){this.splitLaneLayer.removeAll()}}exports.default=j;
|
|
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"),E=require("@arcgis/core/core/reactiveUtils.js"),A=require("@arcgis/core/geometry"),q=require("@arcgis/core/geometry/geometryEngine"),G=require("@arcgis/core/layers/FeatureLayer"),I=require("@arcgis/core/layers/GraphicsLayer"),R=require("@turf/helpers"),x=require("@turf/line-slice-along"),b=require("axios"),J=require("fast-xml-parser"),T=require("md5"),O=require("pako"),H=require("vue"),_=require("../../stores/index.js"),z=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(E),S=N(q),P=N(R);class C{constructor(e){this.junctionNames=new Map,this.junctionScale=5e3,this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.selectedSectionIds=[],this.currentJunctionId="",this.view=e,this.laneLayer=new G({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"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 G({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new I({id:"OpenDriveJunction"}),this.sectionLayer=new I({id:"OpenDriveSection"}),this.highlightLayer=new I({id:"OpenDriveHighlight"}),this.flashLayer=new I({id:"OpenDriveFlash"}),this.drawLayer=new I({id:"Draw"}),this.splitLaneLayer=new I({id:"SplitLane"}),this.borderLayer=new I({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 C(e)),this.instance}async makeMd5FromFile(e){var t;try{const r=await(await fetch(e)).text(),n=(t=new J.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(r).OpenDRIVE.userData)==null?void 0:t.border;return{status:0,message:"ok",result:{md5:T(r),border:n}}}catch(i){return{status:-1,message:i.message}}}async showOpenDriveFromFile(e){var g,y;this.openDriveClickCallback=e.selectedCallback,U.watch(()=>this.view.scale,(p,d)=>{p>this.junctionScale&&d<=this.junctionScale?(console.log(p,d),this.junctionLayer.graphics.forEach(m=>{m.symbol=this.getCrossGraphicSymbol(m.attributes,"marker")})):p<=this.junctionScale&&d>this.junctionScale&&(console.log(p,d),this.junctionLayer.graphics.forEach(m=>{m.symbol=this.getCrossGraphicSymbol(m.attributes,"picture")}))}),console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;this.projectName=t.result.md5,console.timeEnd("md5用时"),console.log(t.result.border),this.openDriveServer=e.server;const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let r;try{r=await b.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(p){return{status:-1,message:p.message}}if(r.status!==200)return{status:-1,message:r.statusText};console.time("渲染用时");const s=r.data.result.geoSetting;z.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let c=r.data.result.json;c.startsWith(window.location.protocol)||(c=`${window.location.protocol}//${e.server}${c}`);const a=await(await fetch(c)).arrayBuffer(),o=O.inflate(a,{to:"string"}),l=JSON.parse(o);await this.showAllLanes(l,((g=e.options)==null?void 0:g.showJunctionLane)||!1,((y=e.options)==null?void 0:y.showRoadName)||!0);const u=r.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 h=_.default.useAppDataStore;return H.watch(()=>h.isSketching,()=>{var p,d;h.isSketching?((p=this.mouseMoveHandler)==null||p.remove(),this.mouseMoveHandler=void 0,(d=this.mouseClickHandler)==null||d.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`,r=await b.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(r.status!==200)throw new Error(`OpenDriveRenderer: ${r.statusText}`);let s=r.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"}),o=JSON.parse(a);return await this.showAllLanes(o,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){const r=await this.laneLayer.queryFeatures();return r.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:r.features}),this.roadNameLayer.visible=i,new Promise(s=>{let c=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const o of e){if(!t&&o.junction!=="-1")continue;const{id:l,refLine:u}=o;let h=o.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const g=new f({geometry:{type:"polyline",paths:[u]},attributes:{ObjectID:c++,roadId:l,roadName:h}});this.allRefLineGraphics.push(g),o.laneSections.sort((y,p)=>Number(y.id)-Number(p.id));for(let y=0;y<o.laneSections.length;y++){const p=o.laneSections[y],d=Number(p.id);for(const m of p.lanePaths){const v=Number(m.id);if(v===0)continue;const w=m.type,$=[...m.outerPath],j=m.innerPath.concat($.reverse());if(j.length<=3){console.warn(`lane ${v} has less than 3 points`);continue}j.push(m.innerPath[0]);const D=new A.Polygon({rings:[j]});if(D){const k=new f({geometry:D,attributes:{ObjectID:c++,id:`${l}+${d}+${v}`,fromNode:o.fromNode,toNode:o.toNode,roadId:String(l),roadName:o.name,sectionId:String(d),sectionIndex:y,laneId:v,type:w,sumoId:"",leftLine:m.innerPath,rightLine:m.outerPath}});this.allLaneGraphics.push(k),n.push(k)}}}}const a=setInterval(()=>{if(n.length>0||this.allRefLineGraphics.length>0){if(n.length>0){const o=n.splice(0,100);this.laneLayer.applyEdits({addFeatures:o})}if(this.allRefLineGraphics.length>0){const o=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:o})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];for(const i of e){if(!i)continue;this.junctionNames.set(i.id,i.name),i.nodeType=i.type;const r=new f({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(i,"marker")});t.push(r)}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=M.debounce(async t=>{var c;const r=(c=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:c.filter(n=>n.type==="graphic");if(r.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId=""),this.view.closePopup();return}const s=r[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(d=>d.getAttribute("id")===n)>=0)return;this.currentSectionCode=n;const o=this.allLaneGraphics.filter(d=>`${d.attributes.roadId}+${d.attributes.sectionId}`===n),l=S.union(o.map(d=>d.geometry)),u=this.hitGraphic.getAttribute("fromNode"),h=this.hitGraphic.getAttribute("toNode"),g=this.junctionNames.get(u)||u,y=this.junctionNames.get(h)||h,p=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:g,toNodeName:y,laneCount:o.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(p)}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 r=(a=(await this.view.hitTest(t,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(o=>o.type==="graphic");if(r.length===0)return;const s=r[0].graphic,c=s.getAttribute("type"),n=s.getAttribute("id");if(c==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const o=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,l=await b.get(o,{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 o=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,l=await b.get(o,{params:{id:n,projectName:this.projectName}});if(l.status===200&&l.data.status===0&&this.openDriveClickCallback){const u=l.data.result.obj_id;s.setAttribute("edgeId",u),this.openDriveClickCallback({type:"OpenDriveSection",id:u,details:l.data.result})}}else this.sectionLayer.remove(s),this.selectedSectionIds=this.selectedSectionIds.filter(o=>o!==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 r=e.symbol,s=r.width;s<t?e.symbol={type:"picture-marker",url:r.url,width:s+1,height:s+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,t){const i=setInterval(()=>{const r=e.symbol,s=r.width;s>t?e.symbol={type:"picture-marker",url:r.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 r=0;t.length===2&&(r=Number(t[1]));const s=this.allLaneGraphics.find(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===r);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:"未知类型"}}}async clearOpenDrive(){var t,i;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0}async findSumo(e){const{type:t,id:i}=e,r=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(i,r);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],o=n.length===2?Number(n[1]):void 0;return await this.findLane({roadsectId:a,segmentId:o,laneId:c,flash:r})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const i=this.junctionLayer.graphics.find(r=>r.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(t){const r=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(r)}return await this.view.goTo(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:i,laneId:r}=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(o=>{const l=Number(o.attributes.sectionId);a.indexOf(l)===-1&&a.push(l)}),a.sort((o,l)=>o-l),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(o=>Number(o.attributes.sectionId)===i)}if(r!==void 0){const a=[];if(s.forEach(o=>{const l=Number(o.attributes.laneId);a.indexOf(l)===-1&&a.push(l)}),a.sort((o,l)=>o-l),r>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};r=a[r],s=s.filter(o=>Number(o.attributes.laneId)===r)}const c=s.map(a=>a.geometry),n=S.union(c);if(e.flash){const a=new f({geometry:n,symbol:{type:"simple-fill",color:[0,0,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 r=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(r))},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 r=i.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(s=>s!==r)}),this.sectionLayer.removeMany(t))}return{status:0,message:"ok"}}selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(t=>{if(e.id===t.getAttribute("id"))return t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const t=e.id.split("#");let i=String(t[0]);i.startsWith("-")&&(i=i.slice(1));let r=0;t.length===2&&(r=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")===r)),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 o=c.get(a);o?o.push(n.geometry):(o=[n.geometry],c.set(a,o))}),c.forEach((n,a)=>{const o=S.union(n),l=new f({geometry:o,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)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const t=new A.Polygon({rings:[e]}),i=await this.laneLayer.queryFeatures({geometry:t,outFields:["*"]}),r=[],s=[];for(const a of i.features){const o=a.getAttribute("roadId"),l=a.getAttribute("sectionIndex"),u=`${o}#${l}`;if(r.indexOf(u)===-1){r.push(u),this.selectSumo({type:"edge",id:u});const h=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,g=await b.get(h,{params:{id:`${o}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});g.status===200&&g.data.status===0&&s.push(g.data.result)}}const c=this.junctionLayer.graphics.filter(a=>{const o=a.geometry;return S.contains(t,o)}),n=[];for(const a of c){const o=a.getAttribute("id");this.selectSumo({type:"junction",id:o});const l=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,u=await b.get(l,{params:{id:o,projectName:this.projectName}});u.status===200&&u.data.status===0&&n.push(u.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 r=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(w=>w.getAttribute("roadId")===n&&w.getAttribute("sectionIndex")===c);if(a.length===0)return{status:-1,message:"未找到路段"};const o=a.length-r,l=a.find(w=>Math.abs(w.getAttribute("laneId"))===o);if(!l)return{status:-1,message:"未找到车道"};const u=e.start||0,h=e.end||100,g=P.lineString(l.getAttribute("leftLine")),y=x.lineSliceAlong(g,u,h,{units:"meters"}),p=P.lineString(l.getAttribute("rightLine")),d=x.lineSliceAlong(p,u,h,{units:"meters"}),m=y.geometry.coordinates.concat(d.geometry.coordinates.reverse());m.push(m[m.length-1]);const v=new f({geometry:new A.Polygon({rings:[m]}),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:y.geometry.coordinates,rightLine:d.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:e}}clearSplitLane(){this.splitLaneLayer.removeAll()}getCrossGraphicSymbol(e,t){const i=e.crossId!==""&&e.crossId!==void 0&&e.crossId!==null;if(t==="marker")return{type:"picture-marker",url:`/GisViewerAssets/Images/xhj_${i?4:2}.png`,width:"18px",height:"28px",yOffset:"12px"};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?50:40,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:45,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/xhj_4.png",offsetY:i?22:15}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/xhj_2.png",width:"27px",height:"42px",yOffset:"22px"}}}exports.default=C;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils.js"),u=require("@arcgis/core/Graphic"),h=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/buffer"),b=require("@turf/convex"),L=require("@turf/helpers"),C=require("concaveman"),v=require("./district-controller.js");function g(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const w=g(d),l=g(L);class
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils.js"),u=require("@arcgis/core/Graphic"),h=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/buffer"),b=require("@turf/convex"),L=require("@turf/helpers"),C=require("concaveman"),v=require("./district-controller.js");function g(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const w=g(d),l=g(L);class S{constructor(e){this.crossScale=5e3,this.view=e,this.districtControllerLayer=new h({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new h({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new h({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new h({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const r=new v.default(t);this.drawArea(r,!0)}return this.watchHandle=w.watch(()=>this.view.scale,(t,r)=>{t>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.watchHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}showPopup(e){const t=e.geometry.type==="point"?e.geometry:e.geometry.centroid;this.view.openPopup({features:[e],location:t})}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id).toArray().map(i=>i.clone()),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray().map(i=>i.clone());if(t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t);else if(r.length>0){const i=r[0].geometry.centroid;await this.view.goTo({target:i,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>=2){let i=null;if(r.length===2)i=l.lineString(r);else{if(t){const c=l.featureCollection(r.map(p=>l.point(p)));i=b(c)}else{const c=C(r,.5);c.length>=4&&(i=l.polygon([c]))}i||(i=l.lineString(r))}const n=f(i.geometry,t?200:30,{units:"meters"});let o;t?o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:o=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const m={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},y=new u({geometry:{type:"polygon",rings:n.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.2],outline:{color:e.areaColor,width:3,style:t?"solid":"long-dash"}},attributes:m,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:o}]}});t?this.districtControllerLayer.add(y):this.subDistrictControllerLayer.add(y)}for(const i of e.subDistricts)this.drawArea(i,!1);const s=[];e.crosses.forEach(i=>{const n={type:"cross",id:i.id,name:i.name,color:e.areaColor,signalId:i.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:i.isKey},o=new u({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossGraphicSymbol(n,"marker"),attributes:n,popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(o)}),this.crossLayer.addMany(s)}getCrossGraphicSymbol(e,t){const{isKey:r,color:s}=e;if(t==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,size:8,outline:{color:"white",width:1}};if(t==="picture")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: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:r?50:40,haloSize:1,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:r?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${r?4:1}.png`,offsetY:r?22:15}]}}}}}exports.default=S;
|