gisviewer-vue3-arcgis 1.0.270 → 1.0.273
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.mjs +31 -31
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +84 -84
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +105 -99
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Point as
|
|
1
|
+
import { Point as d, Polyline as l } from "@arcgis/core/geometry";
|
|
2
2
|
import * as u from "@arcgis/core/geometry/geometryEngineAsync";
|
|
3
3
|
import * as y from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
4
4
|
import h from "@turf/bearing";
|
|
5
5
|
import p from "@turf/destination";
|
|
6
6
|
import * as f from "@turf/helpers";
|
|
7
|
-
import
|
|
7
|
+
import L from "@turf/length";
|
|
8
8
|
import O from "@turf/line-slice-along";
|
|
9
9
|
import w from "pako";
|
|
10
10
|
import P from "proj4";
|
|
11
|
-
class
|
|
11
|
+
class o {
|
|
12
12
|
/**
|
|
13
13
|
* 得到某个点在一定方向、距离之外的另一个点
|
|
14
14
|
* @param point
|
|
@@ -20,7 +20,7 @@ class s {
|
|
|
20
20
|
const r = f.point([t.x, t.y]), i = p(r, n, e, {
|
|
21
21
|
units: "meters"
|
|
22
22
|
});
|
|
23
|
-
return new
|
|
23
|
+
return new d({
|
|
24
24
|
x: i.geometry.coordinates[0],
|
|
25
25
|
y: i.geometry.coordinates[1]
|
|
26
26
|
});
|
|
@@ -42,12 +42,12 @@ class s {
|
|
|
42
42
|
static extendLineInTowDir(t, e) {
|
|
43
43
|
const n = t.paths[0], r = f.point(n[0]), i = f.point(n[1]), a = h(i, r), c = p(r, e, a, {
|
|
44
44
|
units: "meters"
|
|
45
|
-
}), g = a > 0 ? a - 180 : a + 180,
|
|
45
|
+
}), g = a > 0 ? a - 180 : a + 180, s = p(i, e, g, {
|
|
46
46
|
units: "meters"
|
|
47
47
|
});
|
|
48
48
|
return new l({
|
|
49
49
|
paths: [
|
|
50
|
-
[c.geometry.coordinates,
|
|
50
|
+
[c.geometry.coordinates, s.geometry.coordinates]
|
|
51
51
|
]
|
|
52
52
|
});
|
|
53
53
|
}
|
|
@@ -73,19 +73,19 @@ class s {
|
|
|
73
73
|
* @returns
|
|
74
74
|
*/
|
|
75
75
|
static async getIntersectPointsOfStopLineAndLane(t, e, n) {
|
|
76
|
-
let r = await
|
|
76
|
+
let r = await o.getIntersectPointOfLineAndPolygon(
|
|
77
77
|
t,
|
|
78
78
|
e
|
|
79
79
|
);
|
|
80
|
-
if (await
|
|
80
|
+
if (await o.pointDistance(r) < 3 && n) {
|
|
81
81
|
for (const i of n)
|
|
82
|
-
if (r = await
|
|
82
|
+
if (r = await o.getIntersectPointOfLineAndPolygon(
|
|
83
83
|
t,
|
|
84
84
|
e,
|
|
85
85
|
i
|
|
86
|
-
), await
|
|
86
|
+
), await o.pointDistance(r) > 2.5) {
|
|
87
87
|
const a = new l({ paths: [r] });
|
|
88
|
-
return (await
|
|
88
|
+
return (await o.getOffsetLine(
|
|
89
89
|
a,
|
|
90
90
|
-i
|
|
91
91
|
)).paths[0];
|
|
@@ -113,7 +113,7 @@ class s {
|
|
|
113
113
|
* @returns 线面交线的头尾端点
|
|
114
114
|
*/
|
|
115
115
|
static async getIntersectPointOfLineAndPolygon(t, e, n = 0) {
|
|
116
|
-
n !== 0 && (t = await
|
|
116
|
+
n !== 0 && (t = await o.getOffsetLine(t, n));
|
|
117
117
|
const r = await u.intersect(t, e);
|
|
118
118
|
if (r instanceof l) {
|
|
119
119
|
const i = r.paths[0], a = i[0], c = i[i.length - 1];
|
|
@@ -164,7 +164,7 @@ class s {
|
|
|
164
164
|
}
|
|
165
165
|
static getStdMapEntries(t) {
|
|
166
166
|
const e = [];
|
|
167
|
-
for (const n of
|
|
167
|
+
for (const n of o.getStdMapKeys(t))
|
|
168
168
|
e.push([n, t.get(n)]);
|
|
169
169
|
return e;
|
|
170
170
|
}
|
|
@@ -175,7 +175,7 @@ class s {
|
|
|
175
175
|
return r.delete(), e && t.delete(), n;
|
|
176
176
|
}
|
|
177
177
|
static setGeoData(t, e, n) {
|
|
178
|
-
|
|
178
|
+
o.geoReference = t, o.xOffset = e, o.yOffset = n;
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* OpenDrive坐标转换为WGS84坐标
|
|
@@ -185,28 +185,28 @@ class s {
|
|
|
185
185
|
static transformLineProjection(t) {
|
|
186
186
|
try {
|
|
187
187
|
return t.map(
|
|
188
|
-
(e) => P(
|
|
189
|
-
e[0] -
|
|
190
|
-
e[1] -
|
|
188
|
+
(e) => P(o.geoReference).inverse([
|
|
189
|
+
e[0] - o.xOffset,
|
|
190
|
+
e[1] - o.yOffset
|
|
191
191
|
])
|
|
192
192
|
);
|
|
193
193
|
} catch {
|
|
194
194
|
return console.error(
|
|
195
195
|
"OpenDrive坐标转换为WGS84坐标失败",
|
|
196
|
-
|
|
196
|
+
o.geoReference
|
|
197
197
|
), t;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
static transformPointProjection(t) {
|
|
201
201
|
try {
|
|
202
|
-
return P(
|
|
203
|
-
t[0] -
|
|
204
|
-
t[1] -
|
|
202
|
+
return P(o.geoReference).inverse([
|
|
203
|
+
t[0] - o.xOffset,
|
|
204
|
+
t[1] - o.yOffset
|
|
205
205
|
]);
|
|
206
206
|
} catch {
|
|
207
207
|
return console.error(
|
|
208
208
|
"OpenDrive坐标转换为WGS84坐标失败",
|
|
209
|
-
|
|
209
|
+
o.geoReference
|
|
210
210
|
), t;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
@@ -226,7 +226,7 @@ class s {
|
|
|
226
226
|
* @returns
|
|
227
227
|
*/
|
|
228
228
|
static getCenterPointInLine(t) {
|
|
229
|
-
const e = f.lineString(t), n =
|
|
229
|
+
const e = f.lineString(t), n = L(e, { units: "meters" }) / 2, r = O(e, 0, n, {
|
|
230
230
|
units: "meters"
|
|
231
231
|
});
|
|
232
232
|
return r.geometry.coordinates[r.geometry.coordinates.length - 1];
|
|
@@ -236,12 +236,12 @@ class s {
|
|
|
236
236
|
const i = localStorage.getItem("gpu") !== "Unknown";
|
|
237
237
|
if (!n) {
|
|
238
238
|
if (e.length > 0) {
|
|
239
|
-
const g = e.map((
|
|
239
|
+
const g = e.map((s) => s.geometry).filter((s) => s);
|
|
240
240
|
if (g.length > 0) {
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
let s = (a = await u.union(g)) == null ? void 0 : a.extent;
|
|
242
|
+
s && (s = s.expand(1.3), i ? await t.goTo(s.center, {
|
|
243
243
|
duration: 1e3
|
|
244
|
-
}) : t.center =
|
|
244
|
+
}) : t.center = s.center);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
return;
|
|
@@ -251,14 +251,14 @@ class s {
|
|
|
251
251
|
duration: 1e3
|
|
252
252
|
});
|
|
253
253
|
else if (e.length > 0) {
|
|
254
|
-
const g = e.map((
|
|
254
|
+
const g = e.map((s) => s.geometry).filter((s) => s);
|
|
255
255
|
if (g.length > 0) {
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
let s = (c = await u.union(g)) == null ? void 0 : c.extent;
|
|
257
|
+
s && (s = s.expand(1.3), t.extent = s);
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
export {
|
|
263
|
-
|
|
263
|
+
o as default
|
|
264
264
|
};
|
|
@@ -2,21 +2,21 @@ import { Point as u } from "@arcgis/core/geometry";
|
|
|
2
2
|
import y from "@arcgis/core/Graphic";
|
|
3
3
|
import p from "@arcgis/core/layers/GraphicsLayer";
|
|
4
4
|
class C {
|
|
5
|
-
constructor(
|
|
6
|
-
this.iconSymbolScale = 1e4, this.largeMarkerScale = 4e4, this.oldScale = 0, this.showName = "detail", this.showStyle = "scatter", this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusteredLocations = [], this.locations = [], this.view =
|
|
5
|
+
constructor(t) {
|
|
6
|
+
this.iconSymbolScale = 1e4, this.largeMarkerScale = 4e4, this.oldScale = 0, this.showName = "detail", this.showStyle = "scatter", this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusteredLocations = [], this.locations = [], this.view = t, this.crossLayer = new p({
|
|
7
7
|
id: "signal-control-cross-layer",
|
|
8
8
|
title: "信控路口图层"
|
|
9
9
|
}), this.view.map.add(this.crossLayer);
|
|
10
10
|
}
|
|
11
|
-
didCrossScaleThreshold(
|
|
12
|
-
return
|
|
11
|
+
didCrossScaleThreshold(t, s, i) {
|
|
12
|
+
return t < i && s >= i || t >= i && s < i;
|
|
13
13
|
}
|
|
14
14
|
locationToScreen() {
|
|
15
|
-
this.clusteredLocations = [], this.locations.forEach((
|
|
15
|
+
this.clusteredLocations = [], this.locations.forEach((t) => {
|
|
16
16
|
const s = this.view.toScreen(
|
|
17
|
-
new u({ x:
|
|
17
|
+
new u({ x: t.x, y: t.y })
|
|
18
18
|
);
|
|
19
|
-
s.x > 0 && s.y > 0 && (
|
|
19
|
+
s.x > 0 && s.y > 0 && (t.properties.screenX = s.x, t.properties.screenY = s.y, t.visited = !1, t.clusterId = void 0, this.clusteredLocations.push(t));
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -24,55 +24,55 @@ class C {
|
|
|
24
24
|
* @param params
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
|
-
showSignalCross(
|
|
28
|
-
if (this.crossLayer.removeAll(), this.showName =
|
|
27
|
+
showSignalCross(t) {
|
|
28
|
+
if (this.crossLayer.removeAll(), this.showName = t.showName || "detail", this.showStyle = t.style || "scatter", this.oldScale = this.view.scale, this.scaleWatchHandle || (this.scaleWatchHandle = this.view.watch("stationary", () => {
|
|
29
29
|
if (this.showStyle === "scatter") {
|
|
30
|
-
const s = this.view.scale,
|
|
30
|
+
const s = this.view.scale, i = this.didCrossScaleThreshold(
|
|
31
31
|
this.oldScale,
|
|
32
32
|
s,
|
|
33
33
|
this.iconSymbolScale
|
|
34
|
-
),
|
|
34
|
+
), e = this.didCrossScaleThreshold(
|
|
35
35
|
this.oldScale,
|
|
36
36
|
s,
|
|
37
37
|
this.largeMarkerScale
|
|
38
38
|
);
|
|
39
|
-
(
|
|
39
|
+
(i || e) && this.updateScatterSymbol(), this.oldScale = s;
|
|
40
40
|
} else {
|
|
41
41
|
this.locationToScreen();
|
|
42
42
|
const s = this.doPixelCluster(this.clusterRadius);
|
|
43
43
|
this.showClusterResult(s);
|
|
44
44
|
}
|
|
45
45
|
})), this.showStyle === "scatter") {
|
|
46
|
-
const s =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
const s = [], i = [];
|
|
47
|
+
t.points.forEach((e) => {
|
|
48
|
+
const r = this.getCrossSymbol(e), o = this.getBrandLabel(e.brand), a = this.getOnlineLabel(e.isOnline), l = this.getMalfunctionLabel(
|
|
49
|
+
e.isMalfunction
|
|
50
|
+
), n = new y({
|
|
51
51
|
geometry: {
|
|
52
52
|
type: "point",
|
|
53
|
-
longitude:
|
|
54
|
-
latitude:
|
|
53
|
+
longitude: e.x,
|
|
54
|
+
latitude: e.y
|
|
55
55
|
},
|
|
56
|
-
symbol:
|
|
56
|
+
symbol: r,
|
|
57
57
|
attributes: {
|
|
58
58
|
type: "signal-cross",
|
|
59
|
-
id:
|
|
60
|
-
brandLabel:
|
|
61
|
-
isOnlineLabel:
|
|
62
|
-
isMalfunctionLabel:
|
|
63
|
-
...
|
|
59
|
+
id: e.crossId,
|
|
60
|
+
brandLabel: o,
|
|
61
|
+
isOnlineLabel: a,
|
|
62
|
+
isMalfunctionLabel: l,
|
|
63
|
+
...e
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
|
|
67
|
-
this.crossLayer.addMany(s);
|
|
66
|
+
e.isMalfunction === !0 || e.isOnline === !1 ? i.push(n) : s.push(n);
|
|
67
|
+
}), this.crossLayer.addMany(s), this.crossLayer.addMany(i);
|
|
68
68
|
} else {
|
|
69
|
-
this.locations =
|
|
70
|
-
id:
|
|
71
|
-
x:
|
|
72
|
-
y:
|
|
69
|
+
this.locations = t.points.map((i) => ({
|
|
70
|
+
id: i.crossId,
|
|
71
|
+
x: i.x,
|
|
72
|
+
y: i.y,
|
|
73
73
|
visited: !1,
|
|
74
74
|
clusterId: void 0,
|
|
75
|
-
properties:
|
|
75
|
+
properties: i
|
|
76
76
|
})), this.locationToScreen();
|
|
77
77
|
const s = this.doPixelCluster(this.clusterRadius);
|
|
78
78
|
this.showClusterResult(s);
|
|
@@ -80,22 +80,22 @@ class C {
|
|
|
80
80
|
return { status: 0, message: "ok" };
|
|
81
81
|
}
|
|
82
82
|
clearSignalCross() {
|
|
83
|
-
var
|
|
84
|
-
this.crossLayer.removeAll(), (
|
|
83
|
+
var t;
|
|
84
|
+
this.crossLayer.removeAll(), (t = this.scaleWatchHandle) == null || t.remove(), this.scaleWatchHandle = null;
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* 更改路口显示名称内容
|
|
88
88
|
* @param showName
|
|
89
89
|
*/
|
|
90
|
-
changeShowName(
|
|
91
|
-
this.showName =
|
|
90
|
+
changeShowName(t) {
|
|
91
|
+
this.showName = t, this.showStyle === "scatter" && this.updateScatterSymbol();
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* 更新散点符号
|
|
95
95
|
*/
|
|
96
96
|
updateScatterSymbol() {
|
|
97
|
-
this.crossLayer.graphics.forEach((
|
|
98
|
-
|
|
97
|
+
this.crossLayer.graphics.forEach((t) => {
|
|
98
|
+
t.symbol = this.getCrossSymbol(t.attributes);
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
@@ -105,17 +105,17 @@ class C {
|
|
|
105
105
|
* @param minPoints
|
|
106
106
|
* @returns
|
|
107
107
|
*/
|
|
108
|
-
doPixelCluster(
|
|
108
|
+
doPixelCluster(t) {
|
|
109
109
|
let s = 0;
|
|
110
|
-
for (let
|
|
111
|
-
const
|
|
112
|
-
if (
|
|
110
|
+
for (let i = 0; i < this.clusteredLocations.length; i++) {
|
|
111
|
+
const e = this.clusteredLocations[i];
|
|
112
|
+
if (e.visited)
|
|
113
113
|
continue;
|
|
114
|
-
|
|
115
|
-
const r = this.getNeighbors(
|
|
116
|
-
r.length < this.minClusterPoints ?
|
|
114
|
+
e.visited = !0;
|
|
115
|
+
const r = this.getNeighbors(e, t);
|
|
116
|
+
r.length < this.minClusterPoints ? e.clusterId = -1 : (r.forEach((o) => {
|
|
117
117
|
o.visited = !0, o.clusterId = s;
|
|
118
|
-
}),
|
|
118
|
+
}), e.clusterId = s, s++);
|
|
119
119
|
}
|
|
120
120
|
return this.createClusters();
|
|
121
121
|
}
|
|
@@ -126,8 +126,8 @@ class C {
|
|
|
126
126
|
* @param eps
|
|
127
127
|
* @returns
|
|
128
128
|
*/
|
|
129
|
-
getNeighbors(
|
|
130
|
-
return this.clusteredLocations.filter((
|
|
129
|
+
getNeighbors(t, s) {
|
|
130
|
+
return this.clusteredLocations.filter((i) => i.id === t.id || i.visited ? !1 : this.getDistance(t, i) <= s);
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
133
|
* 两点间的像素距离
|
|
@@ -135,9 +135,9 @@ class C {
|
|
|
135
135
|
* @param point2
|
|
136
136
|
* @returns
|
|
137
137
|
*/
|
|
138
|
-
getDistance(
|
|
138
|
+
getDistance(t, s) {
|
|
139
139
|
return Math.sqrt(
|
|
140
|
-
Math.pow(
|
|
140
|
+
Math.pow(t.properties.screenX - s.properties.screenX, 2) + Math.pow(t.properties.screenY - s.properties.screenY, 2)
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
@@ -146,13 +146,13 @@ class C {
|
|
|
146
146
|
* @returns
|
|
147
147
|
*/
|
|
148
148
|
createClusters() {
|
|
149
|
-
const
|
|
150
|
-
for (const
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
const o =
|
|
149
|
+
const t = {}, s = [];
|
|
150
|
+
for (const e of this.clusteredLocations)
|
|
151
|
+
e.clusterId === void 0 || e.clusterId === -1 ? s.push(e) : (t[e.clusterId] || (t[e.clusterId] = []), t[e.clusterId].push(e));
|
|
152
|
+
const i = Object.keys(t).map((e, r) => {
|
|
153
|
+
const o = t[Number(e)], a = o.length, l = o.reduce((c, h) => c + h.x, 0), n = o.reduce((c, h) => c + h.y, 0), m = l / a, d = n / a;
|
|
154
154
|
return {
|
|
155
|
-
id: Number(
|
|
155
|
+
id: Number(e),
|
|
156
156
|
items: o,
|
|
157
157
|
count: a,
|
|
158
158
|
center: {
|
|
@@ -161,26 +161,26 @@ class C {
|
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
163
|
});
|
|
164
|
-
return s.length > 0 &&
|
|
164
|
+
return s.length > 0 && i.push({
|
|
165
165
|
id: -1,
|
|
166
166
|
items: s,
|
|
167
167
|
count: s.length,
|
|
168
168
|
center: null
|
|
169
|
-
}),
|
|
169
|
+
}), i;
|
|
170
170
|
}
|
|
171
|
-
showClusterResult(
|
|
171
|
+
showClusterResult(t) {
|
|
172
172
|
this.crossLayer.removeAll();
|
|
173
|
-
let s = Number.MIN_VALUE,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}),
|
|
177
|
-
if (
|
|
178
|
-
let r =
|
|
173
|
+
let s = Number.MIN_VALUE, i = Number.MAX_VALUE;
|
|
174
|
+
t.forEach((e) => {
|
|
175
|
+
e.count > 1 && (i = Math.min(i, e.count), s = Math.max(s, e.count));
|
|
176
|
+
}), t.forEach((e) => {
|
|
177
|
+
if (e.id !== -1) {
|
|
178
|
+
let r = i === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (e.count - i) / (s - i) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
|
|
179
179
|
r *= 0.75;
|
|
180
|
-
const l = (
|
|
181
|
-
geometry: new u({ x:
|
|
180
|
+
const l = (e.count.toString().length * 8 + 6) / 2, n = new y({
|
|
181
|
+
geometry: new u({ x: e.center.x, y: e.center.y }),
|
|
182
182
|
attributes: {
|
|
183
|
-
count:
|
|
183
|
+
count: e.count
|
|
184
184
|
},
|
|
185
185
|
symbol: {
|
|
186
186
|
type: "cim",
|
|
@@ -292,7 +292,7 @@ class C {
|
|
|
292
292
|
});
|
|
293
293
|
this.crossLayer.add(n);
|
|
294
294
|
} else
|
|
295
|
-
|
|
295
|
+
e.items.forEach((r) => {
|
|
296
296
|
const o = new y({
|
|
297
297
|
geometry: new u({ x: r.x, y: r.y }),
|
|
298
298
|
attributes: {
|
|
@@ -307,21 +307,21 @@ class C {
|
|
|
307
307
|
});
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
|
-
getBrandLabel(
|
|
311
|
-
const s = (
|
|
312
|
-
return s === "scats" ? "SCATS" : s === "gc" ? "国产" :
|
|
310
|
+
getBrandLabel(t) {
|
|
311
|
+
const s = (t ?? "").toLowerCase();
|
|
312
|
+
return s === "scats" ? "SCATS" : s === "gc" ? "国产" : t ?? "";
|
|
313
313
|
}
|
|
314
|
-
getOnlineLabel(
|
|
315
|
-
return
|
|
314
|
+
getOnlineLabel(t) {
|
|
315
|
+
return t ? "在线" : "离线";
|
|
316
316
|
}
|
|
317
|
-
getMalfunctionLabel(
|
|
318
|
-
return
|
|
317
|
+
getMalfunctionLabel(t) {
|
|
318
|
+
return t ? "故障" : "正常";
|
|
319
319
|
}
|
|
320
|
-
getCrossSymbol(
|
|
321
|
-
var s;
|
|
320
|
+
getCrossSymbol(t) {
|
|
321
|
+
var s, i;
|
|
322
322
|
if (this.view.scale <= this.iconSymbolScale) {
|
|
323
|
-
let
|
|
324
|
-
return
|
|
323
|
+
let e = "/GisViewerAssets/Images/cross/ic_";
|
|
324
|
+
return e += ((s = t.brand) == null ? void 0 : s.toLowerCase()) === "scats" ? "scats_" : "gc_", e += t.isOnline ? "online_" : "offline_", e += t.isMalfunction ? "malfunction.png" : "normal.png", {
|
|
325
325
|
type: "cim",
|
|
326
326
|
data: {
|
|
327
327
|
type: "CIMSymbolReference",
|
|
@@ -401,20 +401,20 @@ class C {
|
|
|
401
401
|
size: 20,
|
|
402
402
|
rotateClockwise: !0,
|
|
403
403
|
textureFilter: "Picture",
|
|
404
|
-
url:
|
|
404
|
+
url: e
|
|
405
405
|
}
|
|
406
406
|
]
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
};
|
|
410
410
|
} else {
|
|
411
|
-
const
|
|
411
|
+
const e = {
|
|
412
412
|
type: "simple-marker",
|
|
413
413
|
style: "circle",
|
|
414
414
|
size: this.view.scale > this.largeMarkerScale ? 3 : 6,
|
|
415
|
-
outline: { width:
|
|
415
|
+
outline: { width: 1 }
|
|
416
416
|
};
|
|
417
|
-
return ((
|
|
417
|
+
return ((i = t.brand) == null ? void 0 : i.toLowerCase()) === "scats" ? t.isOnline ? (e.color = [68, 203, 188], e.outline.color = [59, 176, 163]) : (e.color = [100, 100, 100], e.outline.color = [150, 150, 150]) : t.isOnline ? (e.color = [129, 226, 73], e.outline.color = [108, 189, 61]) : (e.color = [100, 100, 100], e.outline.color = [150, 150, 150]), e;
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import m from "@arcgis/core/Graphic";
|
|
2
|
-
import
|
|
2
|
+
import w from "@arcgis/core/layers/FeatureLayer";
|
|
3
3
|
import D from "../common-utils.mjs";
|
|
4
|
-
import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as
|
|
5
|
-
class
|
|
4
|
+
import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as P } from "./layer-symbol.mjs";
|
|
5
|
+
class R {
|
|
6
6
|
constructor(i) {
|
|
7
|
-
this.roadConnections = [], this.view = i, this.subDistrictPointLayer = new
|
|
7
|
+
this.roadConnections = [], this.view = i, this.subDistrictPointLayer = new w(
|
|
8
8
|
I
|
|
9
|
-
), this.subDistrictPointLayer.spatialReference = i.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new
|
|
10
|
-
|
|
9
|
+
), this.subDistrictPointLayer.spatialReference = i.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new w(
|
|
10
|
+
P
|
|
11
11
|
), this.subDistrictLineLayer.spatialReference = i.spatialReference, this.subDistrictLineLayer.popupEnabled = !0, this.view.map.addMany([
|
|
12
12
|
this.subDistrictLineLayer,
|
|
13
13
|
this.subDistrictPointLayer
|
|
@@ -17,22 +17,22 @@ class C {
|
|
|
17
17
|
var a;
|
|
18
18
|
await this.clearSubDistricts(), (a = this.clickHandler) == null || a.remove(), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
|
|
19
19
|
let s = 0;
|
|
20
|
-
const
|
|
21
|
-
i.forEach((
|
|
22
|
-
|
|
23
|
-
value:
|
|
24
|
-
label:
|
|
20
|
+
const t = [], r = [];
|
|
21
|
+
i.forEach((e) => {
|
|
22
|
+
e.roadConnections.length > 0 && this.roadConnections.push(...e.roadConnections), r.push({
|
|
23
|
+
value: e.id,
|
|
24
|
+
label: e.name,
|
|
25
25
|
symbol: {
|
|
26
26
|
type: "simple-marker",
|
|
27
27
|
style: "circle",
|
|
28
|
-
color: [...
|
|
28
|
+
color: [...e.areaColor, 0.8],
|
|
29
29
|
size: "8px",
|
|
30
30
|
outline: {
|
|
31
|
-
color: [...
|
|
31
|
+
color: [...e.areaColor],
|
|
32
32
|
width: 4
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
}),
|
|
35
|
+
}), e.signals.forEach((n) => {
|
|
36
36
|
const d = new m({
|
|
37
37
|
geometry: {
|
|
38
38
|
type: "point",
|
|
@@ -43,16 +43,16 @@ class C {
|
|
|
43
43
|
ObjectID: s++,
|
|
44
44
|
id: n.nodeId,
|
|
45
45
|
name: n.name,
|
|
46
|
-
subDistrictId:
|
|
47
|
-
subDistrictName:
|
|
48
|
-
districtId:
|
|
49
|
-
districtName:
|
|
50
|
-
signalCount:
|
|
51
|
-
color:
|
|
46
|
+
subDistrictId: e.id,
|
|
47
|
+
subDistrictName: e.name,
|
|
48
|
+
districtId: e.parentId,
|
|
49
|
+
districtName: e.parentName,
|
|
50
|
+
signalCount: e.signalCount,
|
|
51
|
+
color: e.areaColor.join(","),
|
|
52
52
|
type: "subDistrict"
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
-
|
|
55
|
+
t.push(d);
|
|
56
56
|
});
|
|
57
57
|
}), this.subDistrictPointLayer.renderer = {
|
|
58
58
|
type: "unique-value",
|
|
@@ -97,118 +97,124 @@ class C {
|
|
|
97
97
|
}
|
|
98
98
|
]
|
|
99
99
|
}, this.currentPointRenderer = this.subDistrictPointLayer.renderer.clone(), await this.subDistrictPointLayer.applyEdits({
|
|
100
|
-
addFeatures:
|
|
101
|
-
}), await D.viewGoto(this.view,
|
|
100
|
+
addFeatures: t
|
|
101
|
+
}), await D.viewGoto(this.view, t);
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* 显示区控下的所有子区,用道路线表示
|
|
105
105
|
* @param id 区控ID
|
|
106
106
|
*/
|
|
107
107
|
async showRoads(i) {
|
|
108
|
-
const { type: s, id:
|
|
109
|
-
|
|
110
|
-
const
|
|
108
|
+
const { type: s, id: t } = i, r = this.subDistrictPointLayer.createQuery(), a = s === "district" ? "districtId" : "subDistrictId";
|
|
109
|
+
t !== "" ? r.where = `${a} = '${t}'` : r.where = "1=1";
|
|
110
|
+
const e = await this.subDistrictPointLayer.queryFeatures(
|
|
111
111
|
r
|
|
112
112
|
), n = /* @__PURE__ */ new Map();
|
|
113
|
-
|
|
113
|
+
e.features.forEach((o) => {
|
|
114
114
|
var b;
|
|
115
115
|
const {
|
|
116
|
-
subDistrictId:
|
|
116
|
+
subDistrictId: u,
|
|
117
117
|
color: c,
|
|
118
|
-
id:
|
|
119
|
-
districtName:
|
|
120
|
-
subDistrictName:
|
|
118
|
+
id: h,
|
|
119
|
+
districtName: p,
|
|
120
|
+
subDistrictName: f,
|
|
121
121
|
signalCount: y
|
|
122
|
-
} =
|
|
123
|
-
n.has(
|
|
122
|
+
} = o.attributes;
|
|
123
|
+
n.has(u) || n.set(u, {
|
|
124
124
|
color: c,
|
|
125
125
|
signalIds: [],
|
|
126
|
-
districtName:
|
|
127
|
-
subDistrictName:
|
|
126
|
+
districtName: p,
|
|
127
|
+
subDistrictName: f,
|
|
128
128
|
signalCount: y
|
|
129
|
-
}), (b = n.get(
|
|
129
|
+
}), (b = n.get(u)) == null || b.signalIds.push(h);
|
|
130
130
|
});
|
|
131
|
-
const d = [],
|
|
132
|
-
for (const
|
|
133
|
-
let
|
|
134
|
-
const c =
|
|
131
|
+
const d = [], L = [];
|
|
132
|
+
for (const o of n) {
|
|
133
|
+
let u = 0;
|
|
134
|
+
const c = o[0];
|
|
135
135
|
d.push({
|
|
136
136
|
value: c,
|
|
137
137
|
symbol: {
|
|
138
138
|
type: "simple-line",
|
|
139
|
-
color:
|
|
139
|
+
color: o[1].color.split(",").map(Number),
|
|
140
140
|
width: 2,
|
|
141
141
|
style: "solid"
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
|
-
const { districtName:
|
|
144
|
+
const { districtName: h, subDistrictName: p, signalIds: f, signalCount: y } = o[1];
|
|
145
145
|
this.roadConnections.filter(
|
|
146
146
|
(l) => l.subDistrictId === c
|
|
147
147
|
).forEach((l) => {
|
|
148
|
-
const
|
|
148
|
+
const v = new m({
|
|
149
149
|
geometry: {
|
|
150
150
|
type: "polyline",
|
|
151
151
|
paths: l.coordinates
|
|
152
152
|
},
|
|
153
153
|
attributes: {
|
|
154
|
-
ObjectID:
|
|
154
|
+
ObjectID: u++,
|
|
155
155
|
id: l.id,
|
|
156
156
|
districtId: l.districtId,
|
|
157
157
|
subDistrictId: c,
|
|
158
|
-
subDistrictName:
|
|
159
|
-
districtName:
|
|
158
|
+
subDistrictName: p,
|
|
159
|
+
districtName: h,
|
|
160
160
|
signalCount: y,
|
|
161
|
-
color:
|
|
161
|
+
color: o[1].color
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
|
-
|
|
164
|
+
L.push(v);
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
this.subDistrictLineLayer.renderer = {
|
|
168
|
-
type: "
|
|
169
|
-
|
|
170
|
-
defaultSymbol: {
|
|
168
|
+
type: "simple",
|
|
169
|
+
symbol: {
|
|
171
170
|
type: "simple-line",
|
|
172
|
-
color: [
|
|
173
|
-
width: 2
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
171
|
+
color: [23, 151, 255],
|
|
172
|
+
width: 2
|
|
173
|
+
}
|
|
174
|
+
// type: 'unique-value',
|
|
175
|
+
// field: 'subDistrictId',
|
|
176
|
+
// defaultSymbol: {
|
|
177
|
+
// type: 'simple-line',
|
|
178
|
+
// color: [180, 180, 180, 0.5],
|
|
179
|
+
// width: 2,
|
|
180
|
+
// style: 'solid'
|
|
181
|
+
// },
|
|
182
|
+
// defaultLabel: '其他子区',
|
|
183
|
+
// uniqueValueInfos,
|
|
184
|
+
// visualVariables: [
|
|
185
|
+
// {
|
|
186
|
+
// type: 'size',
|
|
187
|
+
// valueExpression: '$view.scale',
|
|
188
|
+
// stops: [
|
|
189
|
+
// {
|
|
190
|
+
// size: 6,
|
|
191
|
+
// value: 2500
|
|
192
|
+
// },
|
|
193
|
+
// {
|
|
194
|
+
// size: 5,
|
|
195
|
+
// value: 5000
|
|
196
|
+
// },
|
|
197
|
+
// {
|
|
198
|
+
// size: 4,
|
|
199
|
+
// value: 18055.954822000003
|
|
200
|
+
// },
|
|
201
|
+
// {
|
|
202
|
+
// size: 3,
|
|
203
|
+
// value: 144447.638572
|
|
204
|
+
// },
|
|
205
|
+
// {
|
|
206
|
+
// size: 2,
|
|
207
|
+
// value: 1155581.108577
|
|
208
|
+
// }
|
|
209
|
+
// ]
|
|
210
|
+
// }
|
|
211
|
+
// ]
|
|
206
212
|
}, this.currentLineRenderer = this.subDistrictLineLayer.renderer.clone(), await this.subDistrictLineLayer.applyEdits({
|
|
207
|
-
addFeatures:
|
|
213
|
+
addFeatures: L
|
|
208
214
|
});
|
|
209
215
|
}
|
|
210
216
|
async clearSubDistricts() {
|
|
211
|
-
var
|
|
217
|
+
var t;
|
|
212
218
|
const i = await this.subDistrictPointLayer.queryFeatures();
|
|
213
219
|
i.features.length > 0 && await this.subDistrictPointLayer.applyEdits({
|
|
214
220
|
deleteFeatures: i.features
|
|
@@ -216,7 +222,7 @@ class C {
|
|
|
216
222
|
const s = await this.subDistrictLineLayer.queryFeatures();
|
|
217
223
|
s.features.length > 0 && await this.subDistrictLineLayer.applyEdits({
|
|
218
224
|
deleteFeatures: s.features
|
|
219
|
-
}), this.subDistrictLineLayer.definitionExpression = "1=1", this.roadConnections = [], (
|
|
225
|
+
}), this.subDistrictLineLayer.definitionExpression = "1=1", this.roadConnections = [], (t = this.clickHandler) == null || t.remove();
|
|
220
226
|
}
|
|
221
227
|
setVisible(i) {
|
|
222
228
|
this.showRoads({ type: "district", id: "" }), this.subDistrictPointLayer.visible = i, this.subDistrictLineLayer.visible = i;
|
|
@@ -228,8 +234,8 @@ class C {
|
|
|
228
234
|
async locateSubDistrict(i) {
|
|
229
235
|
const s = this.subDistrictPointLayer.createQuery();
|
|
230
236
|
s.where = `subDistrictId = '${i}'`, s.returnGeometry = !0;
|
|
231
|
-
const
|
|
232
|
-
return
|
|
237
|
+
const t = await this.subDistrictPointLayer.queryFeatures(s);
|
|
238
|
+
return t.features.length > 0 ? (await D.viewGoto(this.view, t.features, !1), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
233
239
|
}
|
|
234
240
|
/**
|
|
235
241
|
* 高亮子区, 其他子区隐藏
|
|
@@ -238,14 +244,14 @@ class C {
|
|
|
238
244
|
*/
|
|
239
245
|
async highlightSubDistrict(i) {
|
|
240
246
|
let s = "";
|
|
241
|
-
const
|
|
247
|
+
const t = this.subDistrictPointLayer.definitionExpression;
|
|
242
248
|
this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${i.id}'`;
|
|
243
249
|
const r = await this.subDistrictPointLayer.queryFeatures(), a = r.features.length;
|
|
244
250
|
return a > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${i.id}'`, s = r.features[0].attributes.districtId, await D.viewGoto(
|
|
245
251
|
this.view,
|
|
246
252
|
r.features,
|
|
247
253
|
i.needZoom !== !1
|
|
248
|
-
)) : this.subDistrictPointLayer.definitionExpression =
|
|
254
|
+
)) : this.subDistrictPointLayer.definitionExpression = t, { count: a, parentId: s };
|
|
249
255
|
}
|
|
250
256
|
/**
|
|
251
257
|
* 按照区控、子区id显示子区
|
|
@@ -253,7 +259,7 @@ class C {
|
|
|
253
259
|
* @param id
|
|
254
260
|
*/
|
|
255
261
|
filter(i) {
|
|
256
|
-
const { type: s, id:
|
|
262
|
+
const { type: s, id: t } = i, r = `${s === "district" ? "districtId" : "subDistrictId"} = '${t}'`;
|
|
257
263
|
this.subDistrictPointLayer.definitionExpression = r, this.subDistrictLineLayer.definitionExpression = r;
|
|
258
264
|
}
|
|
259
265
|
/**
|
|
@@ -268,15 +274,15 @@ class C {
|
|
|
268
274
|
*/
|
|
269
275
|
async viewHitTest(i) {
|
|
270
276
|
var r;
|
|
271
|
-
const
|
|
277
|
+
const t = (r = (await this.view.hitTest(i, {
|
|
272
278
|
include: [this.subDistrictPointLayer, this.subDistrictLineLayer]
|
|
273
279
|
})).results) == null ? void 0 : r.filter(
|
|
274
280
|
(a) => a.type === "graphic"
|
|
275
281
|
);
|
|
276
|
-
if (
|
|
282
|
+
if (t.length === 0)
|
|
277
283
|
console.time("resetRenderer"), this.subDistrictPointLayer.renderer = this.currentPointRenderer, this.subDistrictLineLayer.renderer = this.currentLineRenderer;
|
|
278
284
|
else {
|
|
279
|
-
const a =
|
|
285
|
+
const a = t[0].graphic, e = a.attributes.color.split(",").map(Number);
|
|
280
286
|
this.subDistrictPointLayer.renderer = {
|
|
281
287
|
type: "unique-value",
|
|
282
288
|
field: "subDistrictId",
|
|
@@ -297,10 +303,10 @@ class C {
|
|
|
297
303
|
symbol: {
|
|
298
304
|
type: "simple-marker",
|
|
299
305
|
style: "circle",
|
|
300
|
-
color: [...
|
|
306
|
+
color: [...e, 0.8],
|
|
301
307
|
size: "8px",
|
|
302
308
|
outline: {
|
|
303
|
-
color:
|
|
309
|
+
color: e,
|
|
304
310
|
width: 4
|
|
305
311
|
}
|
|
306
312
|
}
|
|
@@ -388,5 +394,5 @@ class C {
|
|
|
388
394
|
}
|
|
389
395
|
}
|
|
390
396
|
export {
|
|
391
|
-
|
|
397
|
+
R as default
|
|
392
398
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),h=require("@turf/bearing"),y=require("@turf/destination"),b=require("@turf/helpers"),S=require("@turf/length"),x=require("@turf/line-slice-along"),A=require("pako"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),h=require("@turf/bearing"),y=require("@turf/destination"),b=require("@turf/helpers"),S=require("@turf/length"),x=require("@turf/line-slice-along"),A=require("pako"),P=require("proj4");function d(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const g=d(L),O=d(w),f=d(b);class o{static destinationWithPoint(e,t,n){const r=f.point([e.x,e.y]),i=y(r,n,t,{units:"meters"});return new p.Point({x:i.geometry.coordinates[0],y:i.geometry.coordinates[1]})}static angleOfLine(e){const t=e.paths[0],n=f.point(t[0]),r=f.point(t[t.length-1]);return h(n,r)}static extendLineInTowDir(e,t){const n=e.paths[0],r=f.point(n[0]),i=f.point(n[1]),a=h(i,r),c=y(r,t,a,{units:"meters"}),u=a>0?a-180:a+180,s=y(i,t,u,{units:"meters"});return new p.Polyline({paths:[[c.geometry.coordinates,s.geometry.coordinates]]})}static async getIntersectPointOfTwoLines(e,t){const n=await g.intersectLinesToPoints(e,t);if(n.length)return n[0]}static async getIntersectPointsOfStopLineAndLane(e,t,n){let r=await o.getIntersectPointOfLineAndPolygon(e,t);if(await o.pointDistance(r)<3&&n){for(const i of n)if(r=await o.getIntersectPointOfLineAndPolygon(e,t,i),await o.pointDistance(r)>2.5){const a=new p.Polyline({paths:[r]});return(await o.getOffsetLine(a,-i)).paths[0]}}else return r;return[]}static async pointDistance(e){if(e.length<2)return 0;const t=new p.Polyline({paths:[e]});return await g.geodesicLength(t,"meters")}static async getIntersectPointOfLineAndPolygon(e,t,n=0){n!==0&&(e=await o.getOffsetLine(e,n));const r=await g.intersect(e,t);if(r instanceof p.Polyline){const i=r.paths[0],a=i[0],c=i[i.length-1];return[a,c]}return[]}static async getOffsetLine(e,t){const n=O.geographicToWebMercator(e),r=await g.offset(n,t,"meters");return O.webMercatorToGeographic(r,!1)}static unzip(e){try{const t=[],n=e.split("");for(let i=0;i<n.length;i++){const a=n[i];t.push(a.charCodeAt(0))}const r=new Uint8Array(t);return A.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 o.getStdMapKeys(e))t.push([n,e.get(n)]);return t}static getStdMapKeys(e,t=!1){const n=[],r=e.keys();for(let i=0;i<r.size();i++)n.push(r.get(i));return r.delete(),t&&e.delete(),n}static setGeoData(e,t,n){o.geoReference=e,o.xOffset=t,o.yOffset=n}static transformLineProjection(e){try{return e.map(t=>P(o.geoReference).inverse([t[0]-o.xOffset,t[1]-o.yOffset]))}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",o.geoReference),e}}static transformPointProjection(e){try{return P(o.geoReference).inverse([e[0]-o.xOffset,e[1]-o.yOffset])}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",o.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=f.point(e),i=f.point(t),a=h(r,i);return y(i,n,a,{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=f.lineString(e),n=S(t,{units:"meters"})/2,r=x(t,0,n,{units:"meters"});return r.geometry.coordinates[r.geometry.coordinates.length-1]}static async viewGoto(e,t,n=!0){var a,c;const i=localStorage.getItem("gpu")!=="Unknown";if(!n){if(t.length>0){const u=t.map(s=>s.geometry).filter(s=>s);if(u.length>0){let s=(a=await g.union(u))==null?void 0:a.extent;s&&(s=s.expand(1.3),i?await e.goTo(s.center,{duration:1e3}):e.center=s.center)}}return}if(i)await e.goTo(t,{duration:1e3});else if(t.length>0){const u=t.map(s=>s.geometry).filter(s=>s);if(u.length>0){let s=(c=await g.union(u))==null?void 0:c.extent;s&&(s=s.expand(1.3),e.extent=s)}}}}exports.default=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class S{constructor(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class S{constructor(t){this.iconSymbolScale=1e4,this.largeMarkerScale=4e4,this.oldScale=0,this.showName="detail",this.showStyle="scatter",this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusteredLocations=[],this.locations=[],this.view=t,this.crossLayer=new p({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}didCrossScaleThreshold(t,s,i){return t<i&&s>=i||t>=i&&s<i}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(t=>{const s=this.view.toScreen(new u.Point({x:t.x,y:t.y}));s.x>0&&s.y>0&&(t.properties.screenX=s.x,t.properties.screenY=s.y,t.visited=!1,t.clusterId=void 0,this.clusteredLocations.push(t))})}showSignalCross(t){if(this.crossLayer.removeAll(),this.showName=t.showName||"detail",this.showStyle=t.style||"scatter",this.oldScale=this.view.scale,this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("stationary",()=>{if(this.showStyle==="scatter"){const s=this.view.scale,i=this.didCrossScaleThreshold(this.oldScale,s,this.iconSymbolScale),e=this.didCrossScaleThreshold(this.oldScale,s,this.largeMarkerScale);(i||e)&&this.updateScatterSymbol(),this.oldScale=s}else{this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}})),this.showStyle==="scatter"){const s=[],i=[];t.points.forEach(e=>{const r=this.getCrossSymbol(e),o=this.getBrandLabel(e.brand),n=this.getOnlineLabel(e.isOnline),l=this.getMalfunctionLabel(e.isMalfunction),a=new y({geometry:{type:"point",longitude:e.x,latitude:e.y},symbol:r,attributes:{type:"signal-cross",id:e.crossId,brandLabel:o,isOnlineLabel:n,isMalfunctionLabel:l,...e}});e.isMalfunction===!0||e.isOnline===!1?i.push(a):s.push(a)}),this.crossLayer.addMany(s),this.crossLayer.addMany(i)}else{this.locations=t.points.map(i=>({id:i.crossId,x:i.x,y:i.y,visited:!1,clusterId:void 0,properties:i})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}return{status:0,message:"ok"}}clearSignalCross(){var t;this.crossLayer.removeAll(),(t=this.scaleWatchHandle)==null||t.remove(),this.scaleWatchHandle=null}changeShowName(t){this.showName=t,this.showStyle==="scatter"&&this.updateScatterSymbol()}updateScatterSymbol(){this.crossLayer.graphics.forEach(t=>{t.symbol=this.getCrossSymbol(t.attributes)})}doPixelCluster(t){let s=0;for(let i=0;i<this.clusteredLocations.length;i++){const e=this.clusteredLocations[i];if(e.visited)continue;e.visited=!0;const r=this.getNeighbors(e,t);r.length<this.minClusterPoints?e.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=s}),e.clusterId=s,s++)}return this.createClusters()}getNeighbors(t,s){return this.clusteredLocations.filter(i=>i.id===t.id||i.visited?!1:this.getDistance(t,i)<=s)}getDistance(t,s){return Math.sqrt(Math.pow(t.properties.screenX-s.properties.screenX,2)+Math.pow(t.properties.screenY-s.properties.screenY,2))}createClusters(){const t={},s=[];for(const e of this.clusteredLocations)e.clusterId===void 0||e.clusterId===-1?s.push(e):(t[e.clusterId]||(t[e.clusterId]=[]),t[e.clusterId].push(e));const i=Object.keys(t).map((e,r)=>{const o=t[Number(e)],n=o.length,l=o.reduce((c,h)=>c+h.x,0),a=o.reduce((c,h)=>c+h.y,0),m=l/n,d=a/n;return{id:Number(e),items:o,count:n,center:{x:m,y:d}}});return s.length>0&&i.push({id:-1,items:s,count:s.length,center:null}),i}showClusterResult(t){this.crossLayer.removeAll();let s=Number.MIN_VALUE,i=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(i=Math.min(i,e.count),s=Math.max(s,e.count))}),t.forEach(e=>{if(e.id!==-1){let r=i===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-i)/(s-i)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const l=(e.count.toString().length*8+6)/2,a=new y({geometry:new u.Point({x:e.center.x,y:e.center.y}),attributes:{count:e.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:r,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-l,40],[l,40],[l,20],[-l,20],[-l,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}});this.crossLayer.add(a)}else e.items.forEach(r=>{const o=new y({geometry:new u.Point({x:r.x,y:r.y}),attributes:{...r,...r.properties,type:"signal-cross",id:r.id},symbol:this.getCrossSymbol(r.properties)});this.crossLayer.add(o)})})}getBrandLabel(t){const s=(t??"").toLowerCase();return s==="scats"?"SCATS":s==="gc"?"国产":t??""}getOnlineLabel(t){return t?"在线":"离线"}getMalfunctionLabel(t){return t?"故障":"正常"}getCrossSymbol(t){var s,i;if(this.view.scale<=this.iconSymbolScale){let e="/GisViewerAssets/Images/cross/ic_";return e+=((s=t.brand)==null?void 0:s.toLowerCase())==="scats"?"scats_":"gc_",e+=t.isOnline?"online_":"offline_",e+=t.isMalfunction?"malfunction.png":"normal.png",{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:this.showName==="crossName"?'Replace($feature.name, "与", "/")':this.showName==="signalId"?"$feature.signalId":'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:25,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize: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:20,rotateClockwise:!0,textureFilter:"Picture",url:e}]}}}}else{const e={type:"simple-marker",style:"circle",size:this.view.scale>this.largeMarkerScale?3:6,outline:{width:1}};return((i=t.brand)==null?void 0:i.toLowerCase())==="scats"?t.isOnline?(e.color=[68,203,188],e.outline.color=[59,176,163]):(e.color=[100,100,100],e.outline.color=[150,150,150]):t.isOnline?(e.color=[129,226,73],e.outline.color=[108,189,61]):(e.color=[100,100,100],e.outline.color=[150,150,150]),e}}}exports.default=S;
|
|
@@ -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 m=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/FeatureLayer"),D=require("../common-utils.js"),v=require("./layer-symbol.js");class g{constructor(i){this.roadConnections=[],this.view=i,this.subDistrictPointLayer=new w(v.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=i.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new w(v.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=i.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(i){var a;await this.clearSubDistricts(),(a=this.clickHandler)==null||a.remove(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const e=[],r=[];i.forEach(t=>{t.roadConnections.length>0&&this.roadConnections.push(...t.roadConnections),r.push({value:t.id,label:t.name,symbol:{type:"simple-marker",style:"circle",color:[...t.areaColor,.8],size:"8px",outline:{color:[...t.areaColor],width:4}}}),t.signals.forEach(n=>{const d=new m({geometry:{type:"point",longitude:n.longitude,latitude:n.latitude},attributes:{ObjectID:s++,id:n.nodeId,name:n.name,subDistrictId:t.id,subDistrictName:t.name,districtId:t.parentId,districtName:t.parentName,signalCount:t.signalCount,color:t.areaColor.join(","),type:"subDistrict"}});e.push(d)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:e}),await D.default.viewGoto(this.view,e)}async showRoads(i){const{type:s,id:e}=i,r=this.subDistrictPointLayer.createQuery(),a=s==="district"?"districtId":"subDistrictId";e!==""?r.where=`${a} = '${e}'`:r.where="1=1";const t=await this.subDistrictPointLayer.queryFeatures(r),n=new Map;t.features.forEach(u=>{var p;const{subDistrictId:o,color:c,id:h,districtName:y,subDistrictName:f,signalCount:b}=u.attributes;n.has(o)||n.set(o,{color:c,signalIds:[],districtName:y,subDistrictName:f,signalCount:b}),(p=n.get(o))==null||p.signalIds.push(h)});const d=[],L=[];for(const u of n){let o=0;const c=u[0];d.push({value:c,symbol:{type:"simple-line",color:u[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:h,subDistrictName:y,signalIds:f,signalCount:b}=u[1];this.roadConnections.filter(l=>l.subDistrictId===c).forEach(l=>{const I=new m({geometry:{type:"polyline",paths:l.coordinates},attributes:{ObjectID:o++,id:l.id,districtId:l.districtId,subDistrictId:c,subDistrictName:y,districtName:h,signalCount:b,color:u[1].color}});L.push(I)})}this.subDistrictLineLayer.renderer={type:"simple",symbol:{type:"simple-line",color:[23,151,255],width:2}},this.currentLineRenderer=this.subDistrictLineLayer.renderer.clone(),await this.subDistrictLineLayer.applyEdits({addFeatures:L})}async clearSubDistricts(){var e;const i=await this.subDistrictPointLayer.queryFeatures();i.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:i.features}),this.subDistrictPointLayer.definitionExpression="1=1";const s=await this.subDistrictLineLayer.queryFeatures();s.features.length>0&&await this.subDistrictLineLayer.applyEdits({deleteFeatures:s.features}),this.subDistrictLineLayer.definitionExpression="1=1",this.roadConnections=[],(e=this.clickHandler)==null||e.remove()}setVisible(i){this.showRoads({type:"district",id:""}),this.subDistrictPointLayer.visible=i,this.subDistrictLineLayer.visible=i}async locateSubDistrict(i){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${i}'`,s.returnGeometry=!0;const e=await this.subDistrictPointLayer.queryFeatures(s);return e.features.length>0?(await D.default.viewGoto(this.view,e.features,!1),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(i){let s="";const e=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${i.id}'`;const r=await this.subDistrictPointLayer.queryFeatures(),a=r.features.length;return a>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${i.id}'`,s=r.features[0].attributes.districtId,await D.default.viewGoto(this.view,r.features,i.needZoom!==!1)):this.subDistrictPointLayer.definitionExpression=e,{count:a,parentId:s}}filter(i){const{type:s,id:e}=i,r=`${s==="district"?"districtId":"subDistrictId"} = '${e}'`;this.subDistrictPointLayer.definitionExpression=r,this.subDistrictLineLayer.definitionExpression=r}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(i){var r;const e=(r=(await this.view.hitTest(i,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(a=>a.type==="graphic");if(e.length===0)console.time("resetRenderer"),this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const a=e[0].graphic,t=a.attributes.color.split(",").map(Number);this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[180,180,180,.5],width:4}},defaultLabel:"其他子区",uniqueValueInfos:[{value:a.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[...t,.8],size:"8px",outline:{color:t,width:4}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:a.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:a.attributes.color.split(",").map(Number),width:"8px"}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}}}}exports.default=g;
|