gisviewer-vue3-arcgis 1.0.272 → 1.0.274
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/edpass-device-controller.mjs +32 -24
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +83 -83
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +127 -158
- package/es/src/types/index.d.ts +2 -2
- package/lib/src/gis-map/utils/edpass-device-controller.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/lib/src/types/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as h from "@arcgis/core/core/reactiveUtils.js";
|
|
2
|
-
import
|
|
2
|
+
import v from "@arcgis/core/Graphic";
|
|
3
3
|
import l from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
-
import { toRaw as
|
|
5
|
-
import
|
|
4
|
+
import { toRaw as b } from "vue";
|
|
5
|
+
import u from "../stores/index.mjs";
|
|
6
6
|
class I {
|
|
7
7
|
constructor(e) {
|
|
8
8
|
this.watchHandle = null, this.currentZdCode = "", this.currentDdCode = "", this.view = e;
|
|
9
|
-
const t =
|
|
10
|
-
this.mapInitializer =
|
|
9
|
+
const t = u.useAppDataStore;
|
|
10
|
+
this.mapInitializer = b(t.mapInitializer), this.cameraNormalLayer = new l({
|
|
11
11
|
id: "cameraNormalLayer",
|
|
12
12
|
visible: !1
|
|
13
13
|
}), this.cameraAbnormalLayer = new l({
|
|
@@ -28,12 +28,20 @@ class I {
|
|
|
28
28
|
}
|
|
29
29
|
async setEdpassLayerVisibility(e) {
|
|
30
30
|
var t;
|
|
31
|
-
if (e.deviceType !== "camera" && e.deviceType !== "kk")
|
|
31
|
+
if (console.log(e), e.deviceType !== "camera" && e.deviceType !== "kk")
|
|
32
32
|
return { status: -1, message: "不支持的设备类型" };
|
|
33
|
-
switch (e.
|
|
33
|
+
switch (e.style) {
|
|
34
34
|
case "scatter":
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
if (e.deviceState)
|
|
36
|
+
return this.mapInitializer.setLayerVisibility({
|
|
37
|
+
id: `${e.deviceType}-${e.deviceState}`,
|
|
38
|
+
visible: e.visible
|
|
39
|
+
});
|
|
40
|
+
this.mapInitializer.setLayerVisibility({
|
|
41
|
+
id: `${e.deviceType}-normal`,
|
|
42
|
+
visible: e.visible
|
|
43
|
+
}), this.mapInitializer.setLayerVisibility({
|
|
44
|
+
id: `${e.deviceType}-abnormal`,
|
|
37
45
|
visible: e.visible
|
|
38
46
|
});
|
|
39
47
|
case "cluster": {
|
|
@@ -45,7 +53,7 @@ class I {
|
|
|
45
53
|
{
|
|
46
54
|
deviceType: "camera",
|
|
47
55
|
deviceState: "normal",
|
|
48
|
-
|
|
56
|
+
style: "cluster",
|
|
49
57
|
ddCode: this.currentDdCode,
|
|
50
58
|
zdCode: this.currentZdCode,
|
|
51
59
|
visible: !0
|
|
@@ -55,7 +63,7 @@ class I {
|
|
|
55
63
|
{
|
|
56
64
|
deviceType: "camera",
|
|
57
65
|
deviceState: "abnormal",
|
|
58
|
-
|
|
66
|
+
style: "cluster",
|
|
59
67
|
ddCode: this.currentDdCode,
|
|
60
68
|
zdCode: this.currentZdCode,
|
|
61
69
|
visible: !0
|
|
@@ -65,7 +73,7 @@ class I {
|
|
|
65
73
|
{
|
|
66
74
|
deviceType: "kk",
|
|
67
75
|
deviceState: "normal",
|
|
68
|
-
|
|
76
|
+
style: "cluster",
|
|
69
77
|
ddCode: this.currentDdCode,
|
|
70
78
|
zdCode: this.currentZdCode,
|
|
71
79
|
visible: !0
|
|
@@ -75,7 +83,7 @@ class I {
|
|
|
75
83
|
{
|
|
76
84
|
deviceType: "kk",
|
|
77
85
|
deviceState: "abnormal",
|
|
78
|
-
|
|
86
|
+
style: "cluster",
|
|
79
87
|
ddCode: this.currentDdCode,
|
|
80
88
|
zdCode: this.currentZdCode,
|
|
81
89
|
visible: !0
|
|
@@ -112,7 +120,7 @@ class I {
|
|
|
112
120
|
topLeftLon: t.xmin,
|
|
113
121
|
bottomRightLat: t.ymin,
|
|
114
122
|
bottomRightLon: t.xmax,
|
|
115
|
-
devStateSet: [e.deviceState === "normal" ? "1" : "2"],
|
|
123
|
+
devStateSet: e.deviceState ? [e.deviceState === "normal" ? "1" : "2"] : ["1", "2"],
|
|
116
124
|
zdCode: e.zdCode || "",
|
|
117
125
|
ddCode: e.ddCode || "",
|
|
118
126
|
mapLevel: this.view.zoom + 9
|
|
@@ -129,7 +137,7 @@ class I {
|
|
|
129
137
|
d.removeAll();
|
|
130
138
|
const m = a.data.map((r) => {
|
|
131
139
|
var y;
|
|
132
|
-
const
|
|
140
|
+
const s = (r.count.toString().length * 6 + 6) / 2, o = new v({
|
|
133
141
|
geometry: {
|
|
134
142
|
type: "point",
|
|
135
143
|
x: r.lon,
|
|
@@ -144,7 +152,7 @@ class I {
|
|
|
144
152
|
...r.devInfo
|
|
145
153
|
}
|
|
146
154
|
});
|
|
147
|
-
return r.count > 1 ?
|
|
155
|
+
return r.count > 1 ? o.symbol = {
|
|
148
156
|
type: "cim",
|
|
149
157
|
data: {
|
|
150
158
|
type: "CIMSymbolReference",
|
|
@@ -165,11 +173,11 @@ class I {
|
|
|
165
173
|
geometry: {
|
|
166
174
|
rings: [
|
|
167
175
|
[
|
|
168
|
-
[-
|
|
169
|
-
[
|
|
170
|
-
[
|
|
171
|
-
[-
|
|
172
|
-
[-
|
|
176
|
+
[-s, 30],
|
|
177
|
+
[s, 30],
|
|
178
|
+
[s, 15],
|
|
179
|
+
[-s, 15],
|
|
180
|
+
[-s, 30]
|
|
173
181
|
]
|
|
174
182
|
]
|
|
175
183
|
},
|
|
@@ -237,12 +245,12 @@ class I {
|
|
|
237
245
|
]
|
|
238
246
|
}
|
|
239
247
|
}
|
|
240
|
-
} : (
|
|
248
|
+
} : (o.symbol = {
|
|
241
249
|
type: "picture-marker",
|
|
242
250
|
url: n,
|
|
243
251
|
width: 18,
|
|
244
252
|
height: 18
|
|
245
|
-
},
|
|
253
|
+
}, o.popupTemplate = {
|
|
246
254
|
title: "视频信息",
|
|
247
255
|
content: [
|
|
248
256
|
{
|
|
@@ -267,7 +275,7 @@ class I {
|
|
|
267
275
|
]
|
|
268
276
|
}
|
|
269
277
|
]
|
|
270
|
-
}),
|
|
278
|
+
}), o;
|
|
271
279
|
});
|
|
272
280
|
d.addMany(m);
|
|
273
281
|
}
|
|
@@ -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
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,24 +1,24 @@
|
|
|
1
1
|
import m from "@arcgis/core/Graphic";
|
|
2
2
|
import w from "@arcgis/core/layers/FeatureLayer";
|
|
3
3
|
import D from "../common-utils.mjs";
|
|
4
|
-
import { subDistrictPointLayerOptions as
|
|
5
|
-
class
|
|
6
|
-
constructor(
|
|
7
|
-
this.roadConnections = [], this.view =
|
|
8
|
-
I
|
|
9
|
-
), this.subDistrictPointLayer.spatialReference = i.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new w(
|
|
4
|
+
import { subDistrictPointLayerOptions as P, subDistrictLineLayerOptions as g } from "./layer-symbol.mjs";
|
|
5
|
+
class q {
|
|
6
|
+
constructor(t) {
|
|
7
|
+
this.roadConnections = [], this.view = t, this.subDistrictPointLayer = new w(
|
|
10
8
|
P
|
|
11
|
-
), this.
|
|
9
|
+
), this.subDistrictPointLayer.spatialReference = t.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new w(
|
|
10
|
+
g
|
|
11
|
+
), this.subDistrictLineLayer.spatialReference = t.spatialReference, this.subDistrictLineLayer.popupEnabled = !0, this.view.map.addMany([
|
|
12
12
|
this.subDistrictLineLayer,
|
|
13
13
|
this.subDistrictPointLayer
|
|
14
14
|
]);
|
|
15
15
|
}
|
|
16
|
-
async showSubDistricts(
|
|
17
|
-
var
|
|
18
|
-
await this.clearSubDistricts(), (
|
|
16
|
+
async showSubDistricts(t) {
|
|
17
|
+
var n;
|
|
18
|
+
await this.clearSubDistricts(), (n = this.clickHandler) == null || n.remove(), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
|
|
19
19
|
let s = 0;
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const i = [], r = [];
|
|
21
|
+
t.forEach((e) => {
|
|
22
22
|
e.roadConnections.length > 0 && this.roadConnections.push(...e.roadConnections), r.push({
|
|
23
23
|
value: e.id,
|
|
24
24
|
label: e.name,
|
|
@@ -32,17 +32,17 @@ class R {
|
|
|
32
32
|
width: 4
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
}), e.signals.forEach((
|
|
35
|
+
}), e.signals.forEach((a) => {
|
|
36
36
|
const d = new m({
|
|
37
37
|
geometry: {
|
|
38
38
|
type: "point",
|
|
39
|
-
longitude:
|
|
40
|
-
latitude:
|
|
39
|
+
longitude: a.longitude,
|
|
40
|
+
latitude: a.latitude
|
|
41
41
|
},
|
|
42
42
|
attributes: {
|
|
43
43
|
ObjectID: s++,
|
|
44
|
-
id:
|
|
45
|
-
name:
|
|
44
|
+
id: a.nodeId,
|
|
45
|
+
name: a.name,
|
|
46
46
|
subDistrictId: e.id,
|
|
47
47
|
subDistrictName: e.name,
|
|
48
48
|
districtId: e.parentId,
|
|
@@ -52,88 +52,57 @@ class R {
|
|
|
52
52
|
type: "subDistrict"
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
-
|
|
55
|
+
i.push(d);
|
|
56
56
|
});
|
|
57
57
|
}), this.subDistrictPointLayer.renderer = {
|
|
58
|
-
type: "
|
|
59
|
-
|
|
60
|
-
defaultSymbol: {
|
|
58
|
+
type: "simple",
|
|
59
|
+
symbol: {
|
|
61
60
|
type: "simple-marker",
|
|
62
|
-
color: [
|
|
61
|
+
color: [23, 151, 255, 0.8],
|
|
63
62
|
size: "8px",
|
|
64
63
|
outline: {
|
|
65
64
|
color: "white",
|
|
66
65
|
width: 1
|
|
67
66
|
}
|
|
68
|
-
}
|
|
69
|
-
defaultLabel: "其他子区",
|
|
70
|
-
uniqueValueInfos: r,
|
|
71
|
-
visualVariables: [
|
|
72
|
-
{
|
|
73
|
-
type: "size",
|
|
74
|
-
valueExpression: "$view.scale",
|
|
75
|
-
stops: [
|
|
76
|
-
{
|
|
77
|
-
size: 24,
|
|
78
|
-
value: 2500
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
size: 20,
|
|
82
|
-
value: 5e3
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
size: 8,
|
|
86
|
-
value: 18055.954822000003
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
size: 4,
|
|
90
|
-
value: 144447.638572
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
size: 2,
|
|
94
|
-
value: 1155581108577e-6
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
]
|
|
67
|
+
}
|
|
99
68
|
}, this.currentPointRenderer = this.subDistrictPointLayer.renderer.clone(), await this.subDistrictPointLayer.applyEdits({
|
|
100
|
-
addFeatures:
|
|
101
|
-
}), await D.viewGoto(this.view,
|
|
69
|
+
addFeatures: i
|
|
70
|
+
}), await D.viewGoto(this.view, i);
|
|
102
71
|
}
|
|
103
72
|
/**
|
|
104
73
|
* 显示区控下的所有子区,用道路线表示
|
|
105
74
|
* @param id 区控ID
|
|
106
75
|
*/
|
|
107
|
-
async showRoads(
|
|
108
|
-
const { type: s, id:
|
|
109
|
-
|
|
76
|
+
async showRoads(t) {
|
|
77
|
+
const { type: s, id: i } = t, r = this.subDistrictPointLayer.createQuery(), n = s === "district" ? "districtId" : "subDistrictId";
|
|
78
|
+
i !== "" ? r.where = `${n} = '${i}'` : r.where = "1=1";
|
|
110
79
|
const e = await this.subDistrictPointLayer.queryFeatures(
|
|
111
80
|
r
|
|
112
|
-
),
|
|
81
|
+
), a = /* @__PURE__ */ new Map();
|
|
113
82
|
e.features.forEach((o) => {
|
|
114
83
|
var b;
|
|
115
84
|
const {
|
|
116
|
-
subDistrictId:
|
|
117
|
-
color:
|
|
85
|
+
subDistrictId: c,
|
|
86
|
+
color: u,
|
|
118
87
|
id: h,
|
|
119
88
|
districtName: p,
|
|
120
89
|
subDistrictName: f,
|
|
121
90
|
signalCount: y
|
|
122
91
|
} = o.attributes;
|
|
123
|
-
|
|
124
|
-
color:
|
|
92
|
+
a.has(c) || a.set(c, {
|
|
93
|
+
color: u,
|
|
125
94
|
signalIds: [],
|
|
126
95
|
districtName: p,
|
|
127
96
|
subDistrictName: f,
|
|
128
97
|
signalCount: y
|
|
129
|
-
}), (b =
|
|
98
|
+
}), (b = a.get(c)) == null || b.signalIds.push(h);
|
|
130
99
|
});
|
|
131
100
|
const d = [], L = [];
|
|
132
|
-
for (const o of
|
|
133
|
-
let
|
|
134
|
-
const
|
|
101
|
+
for (const o of a) {
|
|
102
|
+
let c = 0;
|
|
103
|
+
const u = o[0];
|
|
135
104
|
d.push({
|
|
136
|
-
value:
|
|
105
|
+
value: u,
|
|
137
106
|
symbol: {
|
|
138
107
|
type: "simple-line",
|
|
139
108
|
color: o[1].color.split(",").map(Number),
|
|
@@ -143,25 +112,25 @@ class R {
|
|
|
143
112
|
});
|
|
144
113
|
const { districtName: h, subDistrictName: p, signalIds: f, signalCount: y } = o[1];
|
|
145
114
|
this.roadConnections.filter(
|
|
146
|
-
(l) => l.subDistrictId ===
|
|
115
|
+
(l) => l.subDistrictId === u
|
|
147
116
|
).forEach((l) => {
|
|
148
|
-
const
|
|
117
|
+
const I = new m({
|
|
149
118
|
geometry: {
|
|
150
119
|
type: "polyline",
|
|
151
120
|
paths: l.coordinates
|
|
152
121
|
},
|
|
153
122
|
attributes: {
|
|
154
|
-
ObjectID:
|
|
123
|
+
ObjectID: c++,
|
|
155
124
|
id: l.id,
|
|
156
125
|
districtId: l.districtId,
|
|
157
|
-
subDistrictId:
|
|
126
|
+
subDistrictId: u,
|
|
158
127
|
subDistrictName: p,
|
|
159
128
|
districtName: h,
|
|
160
129
|
signalCount: y,
|
|
161
130
|
color: o[1].color
|
|
162
131
|
}
|
|
163
132
|
});
|
|
164
|
-
L.push(
|
|
133
|
+
L.push(I);
|
|
165
134
|
});
|
|
166
135
|
}
|
|
167
136
|
this.subDistrictLineLayer.renderer = {
|
|
@@ -214,52 +183,52 @@ class R {
|
|
|
214
183
|
});
|
|
215
184
|
}
|
|
216
185
|
async clearSubDistricts() {
|
|
217
|
-
var
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
deleteFeatures:
|
|
186
|
+
var i;
|
|
187
|
+
const t = await this.subDistrictPointLayer.queryFeatures();
|
|
188
|
+
t.features.length > 0 && await this.subDistrictPointLayer.applyEdits({
|
|
189
|
+
deleteFeatures: t.features
|
|
221
190
|
}), this.subDistrictPointLayer.definitionExpression = "1=1";
|
|
222
191
|
const s = await this.subDistrictLineLayer.queryFeatures();
|
|
223
192
|
s.features.length > 0 && await this.subDistrictLineLayer.applyEdits({
|
|
224
193
|
deleteFeatures: s.features
|
|
225
|
-
}), this.subDistrictLineLayer.definitionExpression = "1=1", this.roadConnections = [], (
|
|
194
|
+
}), this.subDistrictLineLayer.definitionExpression = "1=1", this.roadConnections = [], (i = this.clickHandler) == null || i.remove();
|
|
226
195
|
}
|
|
227
|
-
setVisible(
|
|
228
|
-
this.showRoads({ type: "district", id: "" }), this.subDistrictPointLayer.visible =
|
|
196
|
+
setVisible(t) {
|
|
197
|
+
this.showRoads({ type: "district", id: "" }), this.subDistrictPointLayer.visible = t, this.subDistrictLineLayer.visible = t;
|
|
229
198
|
}
|
|
230
199
|
/**
|
|
231
200
|
* 定位子区
|
|
232
201
|
* @param id 子区ID
|
|
233
202
|
*/
|
|
234
|
-
async locateSubDistrict(
|
|
203
|
+
async locateSubDistrict(t) {
|
|
235
204
|
const s = this.subDistrictPointLayer.createQuery();
|
|
236
|
-
s.where = `subDistrictId = '${
|
|
237
|
-
const
|
|
238
|
-
return
|
|
205
|
+
s.where = `subDistrictId = '${t}'`, s.returnGeometry = !0;
|
|
206
|
+
const i = await this.subDistrictPointLayer.queryFeatures(s);
|
|
207
|
+
return i.features.length > 0 ? (await D.viewGoto(this.view, i.features, !1), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
239
208
|
}
|
|
240
209
|
/**
|
|
241
210
|
* 高亮子区, 其他子区隐藏
|
|
242
211
|
* @param id 子区ID
|
|
243
212
|
* @return 返回高亮子区的数量以及区控id
|
|
244
213
|
*/
|
|
245
|
-
async highlightSubDistrict(
|
|
214
|
+
async highlightSubDistrict(t) {
|
|
246
215
|
let s = "";
|
|
247
|
-
const
|
|
248
|
-
this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${
|
|
249
|
-
const r = await this.subDistrictPointLayer.queryFeatures(),
|
|
250
|
-
return
|
|
216
|
+
const i = this.subDistrictPointLayer.definitionExpression;
|
|
217
|
+
this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${t.id}'`;
|
|
218
|
+
const r = await this.subDistrictPointLayer.queryFeatures(), n = r.features.length;
|
|
219
|
+
return n > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${t.id}'`, s = r.features[0].attributes.districtId, await D.viewGoto(
|
|
251
220
|
this.view,
|
|
252
221
|
r.features,
|
|
253
|
-
|
|
254
|
-
)) : this.subDistrictPointLayer.definitionExpression =
|
|
222
|
+
t.needZoom !== !1
|
|
223
|
+
)) : this.subDistrictPointLayer.definitionExpression = i, { count: n, parentId: s };
|
|
255
224
|
}
|
|
256
225
|
/**
|
|
257
226
|
* 按照区控、子区id显示子区
|
|
258
227
|
* @param type 类型,district 或 subDistrict
|
|
259
228
|
* @param id
|
|
260
229
|
*/
|
|
261
|
-
filter(
|
|
262
|
-
const { type: s, id:
|
|
230
|
+
filter(t) {
|
|
231
|
+
const { type: s, id: i } = t, r = `${s === "district" ? "districtId" : "subDistrictId"} = '${i}'`;
|
|
263
232
|
this.subDistrictPointLayer.definitionExpression = r, this.subDistrictLineLayer.definitionExpression = r;
|
|
264
233
|
}
|
|
265
234
|
/**
|
|
@@ -272,17 +241,17 @@ class R {
|
|
|
272
241
|
* 监听地图点击事件,进行子区高亮
|
|
273
242
|
* @param event
|
|
274
243
|
*/
|
|
275
|
-
async viewHitTest(
|
|
244
|
+
async viewHitTest(t) {
|
|
276
245
|
var r;
|
|
277
|
-
const
|
|
246
|
+
const i = (r = (await this.view.hitTest(t, {
|
|
278
247
|
include: [this.subDistrictPointLayer, this.subDistrictLineLayer]
|
|
279
248
|
})).results) == null ? void 0 : r.filter(
|
|
280
|
-
(
|
|
249
|
+
(n) => n.type === "graphic"
|
|
281
250
|
);
|
|
282
|
-
if (
|
|
251
|
+
if (i.length === 0)
|
|
283
252
|
console.time("resetRenderer"), this.subDistrictPointLayer.renderer = this.currentPointRenderer, this.subDistrictLineLayer.renderer = this.currentLineRenderer;
|
|
284
253
|
else {
|
|
285
|
-
const
|
|
254
|
+
const n = i[0].graphic, e = n.attributes.color.split(",").map(Number);
|
|
286
255
|
this.subDistrictPointLayer.renderer = {
|
|
287
256
|
type: "unique-value",
|
|
288
257
|
field: "subDistrictId",
|
|
@@ -299,7 +268,7 @@ class R {
|
|
|
299
268
|
defaultLabel: "其他子区",
|
|
300
269
|
uniqueValueInfos: [
|
|
301
270
|
{
|
|
302
|
-
value:
|
|
271
|
+
value: n.attributes.subDistrictId,
|
|
303
272
|
symbol: {
|
|
304
273
|
type: "simple-marker",
|
|
305
274
|
style: "circle",
|
|
@@ -311,35 +280,35 @@ class R {
|
|
|
311
280
|
}
|
|
312
281
|
}
|
|
313
282
|
}
|
|
314
|
-
],
|
|
315
|
-
visualVariables: [
|
|
316
|
-
{
|
|
317
|
-
type: "size",
|
|
318
|
-
valueExpression: "$view.scale",
|
|
319
|
-
stops: [
|
|
320
|
-
{
|
|
321
|
-
size: 24,
|
|
322
|
-
value: 2500
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
size: 20,
|
|
326
|
-
value: 5e3
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
size: 8,
|
|
330
|
-
value: 18055.954822000003
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
size: 4,
|
|
334
|
-
value: 144447.638572
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
size: 2,
|
|
338
|
-
value: 1155581108577e-6
|
|
339
|
-
}
|
|
340
|
-
]
|
|
341
|
-
}
|
|
342
283
|
]
|
|
284
|
+
// visualVariables: [
|
|
285
|
+
// {
|
|
286
|
+
// type: 'size',
|
|
287
|
+
// valueExpression: '$view.scale',
|
|
288
|
+
// stops: [
|
|
289
|
+
// {
|
|
290
|
+
// size: 24,
|
|
291
|
+
// value: 2500
|
|
292
|
+
// },
|
|
293
|
+
// {
|
|
294
|
+
// size: 20,
|
|
295
|
+
// value: 5000
|
|
296
|
+
// },
|
|
297
|
+
// {
|
|
298
|
+
// size: 8,
|
|
299
|
+
// value: 18055.954822000003
|
|
300
|
+
// },
|
|
301
|
+
// {
|
|
302
|
+
// size: 4,
|
|
303
|
+
// value: 144447.638572
|
|
304
|
+
// },
|
|
305
|
+
// {
|
|
306
|
+
// size: 2,
|
|
307
|
+
// value: 1155581.108577
|
|
308
|
+
// }
|
|
309
|
+
// ]
|
|
310
|
+
// }
|
|
311
|
+
// ]
|
|
343
312
|
}, this.subDistrictLineLayer.renderer = {
|
|
344
313
|
type: "unique-value",
|
|
345
314
|
field: "subDistrictId",
|
|
@@ -352,47 +321,47 @@ class R {
|
|
|
352
321
|
defaultLabel: "其他子区",
|
|
353
322
|
uniqueValueInfos: [
|
|
354
323
|
{
|
|
355
|
-
value:
|
|
324
|
+
value: n.attributes.subDistrictId,
|
|
356
325
|
symbol: {
|
|
357
326
|
type: "simple-line",
|
|
358
327
|
style: "solid",
|
|
359
|
-
color:
|
|
328
|
+
color: n.attributes.color.split(",").map(Number),
|
|
360
329
|
width: "8px"
|
|
361
330
|
}
|
|
362
331
|
}
|
|
363
|
-
],
|
|
364
|
-
visualVariables: [
|
|
365
|
-
{
|
|
366
|
-
type: "size",
|
|
367
|
-
valueExpression: "$view.scale",
|
|
368
|
-
stops: [
|
|
369
|
-
{
|
|
370
|
-
size: 6,
|
|
371
|
-
value: 2500
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
size: 5,
|
|
375
|
-
value: 5e3
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
size: 4,
|
|
379
|
-
value: 18055.954822000003
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
size: 3,
|
|
383
|
-
value: 144447.638572
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
size: 2,
|
|
387
|
-
value: 1155581108577e-6
|
|
388
|
-
}
|
|
389
|
-
]
|
|
390
|
-
}
|
|
391
332
|
]
|
|
333
|
+
// visualVariables: [
|
|
334
|
+
// {
|
|
335
|
+
// type: 'size',
|
|
336
|
+
// valueExpression: '$view.scale',
|
|
337
|
+
// stops: [
|
|
338
|
+
// {
|
|
339
|
+
// size: 6,
|
|
340
|
+
// value: 2500
|
|
341
|
+
// },
|
|
342
|
+
// {
|
|
343
|
+
// size: 5,
|
|
344
|
+
// value: 5000
|
|
345
|
+
// },
|
|
346
|
+
// {
|
|
347
|
+
// size: 4,
|
|
348
|
+
// value: 18055.954822000003
|
|
349
|
+
// },
|
|
350
|
+
// {
|
|
351
|
+
// size: 3,
|
|
352
|
+
// value: 144447.638572
|
|
353
|
+
// },
|
|
354
|
+
// {
|
|
355
|
+
// size: 2,
|
|
356
|
+
// value: 1155581.108577
|
|
357
|
+
// }
|
|
358
|
+
// ]
|
|
359
|
+
// }
|
|
360
|
+
// ]
|
|
392
361
|
};
|
|
393
362
|
}
|
|
394
363
|
}
|
|
395
364
|
}
|
|
396
365
|
export {
|
|
397
|
-
|
|
366
|
+
q as default
|
|
398
367
|
};
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -372,8 +372,8 @@ export interface IShowJurisdictionParams {
|
|
|
372
372
|
}
|
|
373
373
|
export interface IShowEdpassDeviceParams {
|
|
374
374
|
deviceType: string;
|
|
375
|
-
deviceState
|
|
376
|
-
|
|
375
|
+
deviceState?: string;
|
|
376
|
+
style: string;
|
|
377
377
|
visible: boolean;
|
|
378
378
|
zdCode?: string;
|
|
379
379
|
ddCode?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/core/reactiveUtils.js"),v=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer"),b=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/core/reactiveUtils.js"),v=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer"),b=require("vue"),f=require("../stores/index.js");function g(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const p=g(u);class C{constructor(e){this.watchHandle=null,this.currentZdCode="",this.currentDdCode="",this.view=e;const t=f.default.useAppDataStore;this.mapInitializer=b.toRaw(t.mapInitializer),this.cameraNormalLayer=new n({id:"cameraNormalLayer",visible:!1}),this.cameraAbnormalLayer=new n({id:"cameraAbnormalLayer",visible:!1}),this.kkNormalLayer=new n({id:"kkNormalLayer",visible:!1}),this.kkAbnormalLayer=new n({id:"kkAbnormalLayer",visible:!1}),this.view.map.addMany([this.cameraNormalLayer,this.cameraAbnormalLayer,this.kkNormalLayer,this.kkAbnormalLayer])}async setEdpassLayerVisibility(e){var t;if(console.log(e),e.deviceType!=="camera"&&e.deviceType!=="kk")return{status:-1,message:"不支持的设备类型"};switch(e.style){case"scatter":if(e.deviceState)return this.mapInitializer.setLayerVisibility({id:`${e.deviceType}-${e.deviceState}`,visible:e.visible});this.mapInitializer.setLayerVisibility({id:`${e.deviceType}-normal`,visible:e.visible}),this.mapInitializer.setLayerVisibility({id:`${e.deviceType}-abnormal`,visible:e.visible});case"cluster":{const{deviceLayer:i}=this.getLayerConfig(e);i.visible=e.visible,this.currentDdCode=e.ddCode||"",this.currentZdCode=e.zdCode||"",e.visible?(await this.showClusterInExtent(e,this.view.extent),this.watchHandle||(this.watchHandle=p.when(()=>this.view.stationary,async()=>{this.cameraNormalLayer.visible&&await this.showClusterInExtent({deviceType:"camera",deviceState:"normal",style:"cluster",ddCode:this.currentDdCode,zdCode:this.currentZdCode,visible:!0},this.view.extent),this.cameraAbnormalLayer.visible&&await this.showClusterInExtent({deviceType:"camera",deviceState:"abnormal",style:"cluster",ddCode:this.currentDdCode,zdCode:this.currentZdCode,visible:!0},this.view.extent),this.kkNormalLayer.visible&&await this.showClusterInExtent({deviceType:"kk",deviceState:"normal",style:"cluster",ddCode:this.currentDdCode,zdCode:this.currentZdCode,visible:!0},this.view.extent),this.kkAbnormalLayer.visible&&await this.showClusterInExtent({deviceType:"kk",deviceState:"abnormal",style:"cluster",ddCode:this.currentDdCode,zdCode:this.currentZdCode,visible:!0},this.view.extent)}))):(i.removeAll(),!this.cameraNormalLayer.visible&&!this.cameraAbnormalLayer.visible&&!this.kkNormalLayer.visible&&!this.kkAbnormalLayer.visible&&((t=this.watchHandle)==null||t.remove(),this.watchHandle=null));break}}return{status:0,message:"Success"}}getLayerConfig(e){let t,i,a;return e.deviceType==="camera"?e.deviceState==="normal"?(t="/GisViewerAssets/Images/gis/gis_sxj_map.png",i=[45,108,196],a=this.cameraNormalLayer):(t="/GisViewerAssets/Images/gis/gis_sxj_yc.png",i=[189,49,50],a=this.cameraAbnormalLayer):e.deviceState==="normal"?(t="/GisViewerAssets/Images/gis/gis_kk_map.png",i=[45,108,196],a=this.kkNormalLayer):(t="/GisViewerAssets/Images/gis/gis_kk_yc.png",i=[189,49,50],a=this.kkAbnormalLayer),{icon:t,color:i,deviceLayer:a}}async showClusterInExtent(e,t){const i=await fetch("/es/queryGeoAggregation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceType:e.deviceType,topLeftLat:t.ymax,topLeftLon:t.xmin,bottomRightLat:t.ymin,bottomRightLon:t.xmax,devStateSet:e.deviceState?[e.deviceState==="normal"?"1":"2"]:["1","2"],zdCode:e.zdCode||"",ddCode:e.ddCode||"",mapLevel:this.view.zoom+9})});if(i.status!==200){console.error(i.statusText);return}const a=await i.json();if(a.code!==200)return;const{icon:c,color:d,deviceLayer:y}=this.getLayerConfig(e);y.removeAll();const m=a.data.map(r=>{var h;const o=(r.count.toString().length*6+6)/2,l=new v({geometry:{type:"point",x:r.lon,y:r.lat},attributes:{id:((h=r.devInfo)==null?void 0:h.deviceId)||r.key,type:e.deviceType,count:r.count,typeName:e.deviceType==="camera"?"视频":"卡口",stateName:e.deviceState==="normal"?"正常":"异常",...r.devInfo}});return r.count>1?l.symbol={type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-o,30],[o,30],[o,15],[-o,15],[-o,30]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:d.concat([255])},{type:"CIMSolidStroke",enable:!0,width:3,color:d.concat([128])}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",fontFamilyName:"msyh",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:22,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:r.count.toString()}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:24,rotateClockwise:!0,textureFilter:"Picture",url:c}]}}}:(l.symbol={type:"picture-marker",url:c,width:18,height:18},l.popupTemplate={title:"视频信息",content:[{type:"fields",fieldInfos:[{fieldName:"deviceId",label:"设备编号"},{fieldName:"deviceName",label:"设备名称"},{fieldName:"typeName",label:"设备类型"},{fieldName:"stateName",label:"设备状态"}]}]}),l});y.addMany(m)}}exports.default=C;
|
|
@@ -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 m=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/FeatureLayer"),D=require("../common-utils.js"),
|
|
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"),I=require("./layer-symbol.js");class P{constructor(t){this.roadConnections=[],this.view=t,this.subDistrictPointLayer=new w(I.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=t.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new w(I.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=t.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(t){var n;await this.clearSubDistricts(),(n=this.clickHandler)==null||n.remove(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const i=[],r=[];t.forEach(e=>{e.roadConnections.length>0&&this.roadConnections.push(...e.roadConnections),r.push({value:e.id,label:e.name,symbol:{type:"simple-marker",style:"circle",color:[...e.areaColor,.8],size:"8px",outline:{color:[...e.areaColor],width:4}}}),e.signals.forEach(a=>{const d=new m({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:s++,id:a.nodeId,name:a.name,subDistrictId:e.id,subDistrictName:e.name,districtId:e.parentId,districtName:e.parentName,signalCount:e.signalCount,color:e.areaColor.join(","),type:"subDistrict"}});i.push(d)})}),this.subDistrictPointLayer.renderer={type:"simple",symbol:{type:"simple-marker",color:[23,151,255,.8],size:"8px",outline:{color:"white",width:1}}},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:i}),await D.default.viewGoto(this.view,i)}async showRoads(t){const{type:s,id:i}=t,r=this.subDistrictPointLayer.createQuery(),n=s==="district"?"districtId":"subDistrictId";i!==""?r.where=`${n} = '${i}'`:r.where="1=1";const e=await this.subDistrictPointLayer.queryFeatures(r),a=new Map;e.features.forEach(o=>{var p;const{subDistrictId:u,color:c,id:h,districtName:y,subDistrictName:f,signalCount:b}=o.attributes;a.has(u)||a.set(u,{color:c,signalIds:[],districtName:y,subDistrictName:f,signalCount:b}),(p=a.get(u))==null||p.signalIds.push(h)});const d=[],L=[];for(const o of a){let u=0;const c=o[0];d.push({value:c,symbol:{type:"simple-line",color:o[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:h,subDistrictName:y,signalIds:f,signalCount:b}=o[1];this.roadConnections.filter(l=>l.subDistrictId===c).forEach(l=>{const g=new m({geometry:{type:"polyline",paths:l.coordinates},attributes:{ObjectID:u++,id:l.id,districtId:l.districtId,subDistrictId:c,subDistrictName:y,districtName:h,signalCount:b,color:o[1].color}});L.push(g)})}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 i;const t=await this.subDistrictPointLayer.queryFeatures();t.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:t.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=[],(i=this.clickHandler)==null||i.remove()}setVisible(t){this.showRoads({type:"district",id:""}),this.subDistrictPointLayer.visible=t,this.subDistrictLineLayer.visible=t}async locateSubDistrict(t){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${t}'`,s.returnGeometry=!0;const i=await this.subDistrictPointLayer.queryFeatures(s);return i.features.length>0?(await D.default.viewGoto(this.view,i.features,!1),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(t){let s="";const i=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${t.id}'`;const r=await this.subDistrictPointLayer.queryFeatures(),n=r.features.length;return n>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${t.id}'`,s=r.features[0].attributes.districtId,await D.default.viewGoto(this.view,r.features,t.needZoom!==!1)):this.subDistrictPointLayer.definitionExpression=i,{count:n,parentId:s}}filter(t){const{type:s,id:i}=t,r=`${s==="district"?"districtId":"subDistrictId"} = '${i}'`;this.subDistrictPointLayer.definitionExpression=r,this.subDistrictLineLayer.definitionExpression=r}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(t){var r;const i=(r=(await this.view.hitTest(t,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(n=>n.type==="graphic");if(i.length===0)console.time("resetRenderer"),this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const n=i[0].graphic,e=n.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:n.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[...e,.8],size:"8px",outline:{color:e,width:4}}}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:n.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:n.attributes.color.split(",").map(Number),width:"8px"}}]}}}}exports.default=P;
|
package/lib/src/types/index.d.ts
CHANGED
|
@@ -372,8 +372,8 @@ export interface IShowJurisdictionParams {
|
|
|
372
372
|
}
|
|
373
373
|
export interface IShowEdpassDeviceParams {
|
|
374
374
|
deviceType: string;
|
|
375
|
-
deviceState
|
|
376
|
-
|
|
375
|
+
deviceState?: string;
|
|
376
|
+
style: string;
|
|
377
377
|
visible: boolean;
|
|
378
378
|
zdCode?: string;
|
|
379
379
|
ddCode?: string;
|