gisviewer-vue3-arcgis 1.0.275 → 1.0.276
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/dbscan-cluster/index.d.ts +2 -0
- package/es/src/gis-map/utils/dbscan-cluster/index.mjs +46 -22
- package/es/src/gis-map/utils/edpass-device-controller.d.ts +9 -0
- package/es/src/gis-map/utils/edpass-device-controller.mjs +146 -117
- package/es/src/types/index.d.ts +1 -0
- package/lib/src/gis-map/utils/dbscan-cluster/index.d.ts +2 -0
- package/lib/src/gis-map/utils/dbscan-cluster/index.js +1 -1
- package/lib/src/gis-map/utils/edpass-device-controller.d.ts +9 -0
- package/lib/src/gis-map/utils/edpass-device-controller.js +1 -1
- package/lib/src/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ export default class DbscanCluster {
|
|
|
8
8
|
private readonly minClusterPoints;
|
|
9
9
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
10
10
|
private zoomWatchHandle;
|
|
11
|
+
private scaleThreshold?;
|
|
11
12
|
private locations;
|
|
12
13
|
private clusteredLocations;
|
|
13
14
|
private clusterMarkUrl;
|
|
@@ -15,6 +16,7 @@ export default class DbscanCluster {
|
|
|
15
16
|
* 将地理位置转换为屏幕坐标
|
|
16
17
|
*/
|
|
17
18
|
private locationToScreen;
|
|
19
|
+
private currentStyle;
|
|
18
20
|
/**
|
|
19
21
|
* 添加聚类点到视图
|
|
20
22
|
* @param params
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Point as
|
|
1
|
+
import { Point as n } from "@arcgis/core/geometry";
|
|
2
2
|
import m from "@arcgis/core/Graphic";
|
|
3
3
|
import p from "@arcgis/core/layers/GraphicsLayer";
|
|
4
4
|
class S {
|
|
5
5
|
constructor(t) {
|
|
6
|
-
this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusterRadius = 120, this.minClusterPoints = 2, this.zoomWatchHandle = null, this.locations = [], this.clusteredLocations = [], this.clusterMarkUrl = "", this.view = t, this.clusterLayer = new p(), this.view.map.add(this.clusterLayer);
|
|
6
|
+
this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusterRadius = 120, this.minClusterPoints = 2, this.zoomWatchHandle = null, this.locations = [], this.clusteredLocations = [], this.clusterMarkUrl = "", this.currentStyle = "cluster", this.view = t, this.clusterLayer = new p(), this.view.map.add(this.clusterLayer);
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* 将地理位置转换为屏幕坐标
|
|
@@ -11,7 +11,7 @@ class S {
|
|
|
11
11
|
locationToScreen() {
|
|
12
12
|
this.clusteredLocations = [], this.locations.forEach((t) => {
|
|
13
13
|
const s = this.view.toScreen(
|
|
14
|
-
new
|
|
14
|
+
new n({ x: t.x, y: t.y })
|
|
15
15
|
);
|
|
16
16
|
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));
|
|
17
17
|
});
|
|
@@ -22,7 +22,7 @@ class S {
|
|
|
22
22
|
*/
|
|
23
23
|
addClusterPoints(t) {
|
|
24
24
|
var r;
|
|
25
|
-
this.locations = t.points, this.clusterMarkUrl = ((r = t.clusterSymbol) == null ? void 0 : r.url) || "/GisViewerAssets/Images/cross/gis_xhj_blue.png", this.locations = this.locations.filter((e) => e.x !== null && e.y !== null && !isNaN(e.x) && !isNaN(e.y)), this.locations.forEach((e) => {
|
|
25
|
+
this.locations = t.points, this.scaleThreshold = t.scaleThreshold, this.clusterMarkUrl = ((r = t.clusterSymbol) == null ? void 0 : r.url) || "/GisViewerAssets/Images/cross/gis_xhj_blue.png", this.locations = this.locations.filter((e) => e.x !== null && e.y !== null && !isNaN(e.x) && !isNaN(e.y)), this.locations.forEach((e) => {
|
|
26
26
|
e.x = Number(e.x), e.y = Number(e.y), e.symbol || (e.symbol = t.pointSymbol || {
|
|
27
27
|
type: "simple-marker",
|
|
28
28
|
style: "circle",
|
|
@@ -34,14 +34,38 @@ class S {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
}), this.zoomWatchHandle || (this.zoomWatchHandle = this.view.watch("stationary", () => {
|
|
37
|
-
if (this.view.stationary)
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
if (this.view.stationary)
|
|
38
|
+
if (this.scaleThreshold) {
|
|
39
|
+
if (this.view.scale < this.scaleThreshold && this.currentStyle === "cluster")
|
|
40
|
+
this.currentStyle = "normal", this.clusterLayer.removeAll(), this.locations.forEach((e) => {
|
|
41
|
+
const i = new m({
|
|
42
|
+
geometry: new n({ x: e.x, y: e.y }),
|
|
43
|
+
attributes: {
|
|
44
|
+
...e,
|
|
45
|
+
...e.properties,
|
|
46
|
+
type: "clusterPoint",
|
|
47
|
+
id: e.id
|
|
48
|
+
},
|
|
49
|
+
symbol: e.symbol
|
|
50
|
+
});
|
|
51
|
+
this.clusterLayer.add(i);
|
|
52
|
+
});
|
|
53
|
+
else if (this.view.scale > this.scaleThreshold) {
|
|
54
|
+
this.currentStyle = "cluster", this.locationToScreen();
|
|
55
|
+
const e = this.doPixelCluster(
|
|
56
|
+
this.clusterRadius,
|
|
57
|
+
this.minClusterPoints
|
|
58
|
+
);
|
|
59
|
+
this.showClusters(e);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
this.locationToScreen();
|
|
63
|
+
const e = this.doPixelCluster(
|
|
64
|
+
this.clusterRadius,
|
|
65
|
+
this.minClusterPoints
|
|
66
|
+
);
|
|
67
|
+
this.showClusters(e);
|
|
68
|
+
}
|
|
45
69
|
})), this.locationToScreen();
|
|
46
70
|
const s = this.doPixelCluster(
|
|
47
71
|
this.clusterRadius,
|
|
@@ -62,8 +86,8 @@ class S {
|
|
|
62
86
|
if (e.id !== -1) {
|
|
63
87
|
let i = r === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (e.count - r) / (s - r) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
|
|
64
88
|
i *= 0.75;
|
|
65
|
-
const
|
|
66
|
-
geometry: new
|
|
89
|
+
const c = (e.count.toString().length * 8 + 6) / 2, u = new m({
|
|
90
|
+
geometry: new n({ x: e.center.x, y: e.center.y }),
|
|
67
91
|
attributes: {
|
|
68
92
|
count: e.count
|
|
69
93
|
},
|
|
@@ -102,11 +126,11 @@ class S {
|
|
|
102
126
|
geometry: {
|
|
103
127
|
rings: [
|
|
104
128
|
[
|
|
105
|
-
[-
|
|
106
|
-
[
|
|
107
|
-
[
|
|
108
|
-
[-
|
|
109
|
-
[-
|
|
129
|
+
[-c, 40],
|
|
130
|
+
[c, 40],
|
|
131
|
+
[c, 20],
|
|
132
|
+
[-c, 20],
|
|
133
|
+
[-c, 40]
|
|
110
134
|
]
|
|
111
135
|
]
|
|
112
136
|
},
|
|
@@ -175,11 +199,11 @@ class S {
|
|
|
175
199
|
}
|
|
176
200
|
}
|
|
177
201
|
});
|
|
178
|
-
this.clusterLayer.add(
|
|
202
|
+
this.clusterLayer.add(u);
|
|
179
203
|
} else
|
|
180
204
|
e.items.forEach((i) => {
|
|
181
205
|
const o = new m({
|
|
182
|
-
geometry: new
|
|
206
|
+
geometry: new n({ x: i.x, y: i.y }),
|
|
183
207
|
attributes: {
|
|
184
208
|
...i,
|
|
185
209
|
...i.properties,
|
|
@@ -223,7 +247,7 @@ class S {
|
|
|
223
247
|
for (const e of this.clusteredLocations)
|
|
224
248
|
e.clusterId === void 0 || e.clusterId === -1 ? s.push(e) : (t[e.clusterId] || (t[e.clusterId] = []), t[e.clusterId].push(e));
|
|
225
249
|
const r = Object.keys(t).map((e, i) => {
|
|
226
|
-
const o = t[Number(e)], l = o.length,
|
|
250
|
+
const o = t[Number(e)], l = o.length, c = o.reduce((h, a) => h + a.x, 0), u = o.reduce((h, a) => h + a.y, 0), y = c / l, d = u / l;
|
|
227
251
|
return {
|
|
228
252
|
id: Number(e),
|
|
229
253
|
items: o,
|
|
@@ -6,10 +6,12 @@ export default class EdpassDeviceController {
|
|
|
6
6
|
private kkNormalLayer;
|
|
7
7
|
private kkAbnormalLayer;
|
|
8
8
|
private mapInitializer;
|
|
9
|
+
private readonly clusterScaleThreshold;
|
|
9
10
|
private watchHandle;
|
|
10
11
|
private currentShowParams;
|
|
11
12
|
private isCameraVisible;
|
|
12
13
|
private isKkVisible;
|
|
14
|
+
private clusterEnabled;
|
|
13
15
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
14
16
|
setEdpassLayerVisibility(params: IShowEdpassDeviceParams): Promise<IResult>;
|
|
15
17
|
/**
|
|
@@ -18,5 +20,12 @@ export default class EdpassDeviceController {
|
|
|
18
20
|
*/
|
|
19
21
|
private showScatter;
|
|
20
22
|
private getLayerConfig;
|
|
23
|
+
private getAutoStyleByScale;
|
|
24
|
+
private updateClusterEnabled;
|
|
25
|
+
private ensureStationaryWatch;
|
|
26
|
+
private hasAnyClusterEnabled;
|
|
27
|
+
private tryRemoveWatchIfNoVisible;
|
|
28
|
+
private applyScatterMode;
|
|
29
|
+
private applyClusterMode;
|
|
21
30
|
private showClusterInExtent;
|
|
22
31
|
}
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { toRaw as
|
|
1
|
+
import * as b from "@arcgis/core/core/reactiveUtils.js";
|
|
2
|
+
import d from "@arcgis/core/Graphic";
|
|
3
|
+
import c from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
+
import { toRaw as u } from "vue";
|
|
5
5
|
import k from "../stores/index.mjs";
|
|
6
|
-
class
|
|
6
|
+
class w {
|
|
7
7
|
constructor(e) {
|
|
8
|
-
this.watchHandle = null, this.currentShowParams = null, this.isCameraVisible = !1, this.isKkVisible = !1, this.
|
|
8
|
+
this.clusterScaleThreshold = 5e3, this.watchHandle = null, this.currentShowParams = null, this.isCameraVisible = !1, this.isKkVisible = !1, this.clusterEnabled = {
|
|
9
|
+
cameraNormal: !1,
|
|
10
|
+
cameraAbnormal: !1,
|
|
11
|
+
kkNormal: !1,
|
|
12
|
+
kkAbnormal: !1
|
|
13
|
+
}, this.view = e;
|
|
9
14
|
const t = k.useAppDataStore;
|
|
10
|
-
this.mapInitializer =
|
|
15
|
+
this.mapInitializer = u(t.mapInitializer), this.cameraNormalLayer = new c({
|
|
11
16
|
id: "cameraNormalLayer",
|
|
12
17
|
visible: !1
|
|
13
|
-
}), this.cameraAbnormalLayer = new
|
|
18
|
+
}), this.cameraAbnormalLayer = new c({
|
|
14
19
|
id: "cameraAbnormalLayer",
|
|
15
20
|
visible: !1
|
|
16
|
-
}), this.kkNormalLayer = new
|
|
21
|
+
}), this.kkNormalLayer = new c({
|
|
17
22
|
id: "kkNormalLayer",
|
|
18
23
|
visible: !1
|
|
19
|
-
}), this.kkAbnormalLayer = new
|
|
24
|
+
}), this.kkAbnormalLayer = new c({
|
|
20
25
|
id: "kkAbnormalLayer",
|
|
21
26
|
visible: !1
|
|
22
27
|
}), this.view.map.addMany([
|
|
@@ -27,70 +32,24 @@ class S {
|
|
|
27
32
|
]);
|
|
28
33
|
}
|
|
29
34
|
async setEdpassLayerVisibility(e) {
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
if (this.currentShowParams = {
|
|
36
|
+
...this.currentShowParams ?? {},
|
|
37
|
+
...e
|
|
38
|
+
}, e.deviceType !== "camera" && e.deviceType !== "kk")
|
|
32
39
|
return { status: -1, message: "不支持的设备类型" };
|
|
33
|
-
|
|
40
|
+
e.deviceType === "camera" && (this.isCameraVisible = e.visible), e.deviceType === "kk" && (this.isKkVisible = e.visible), this.updateClusterEnabled(e);
|
|
41
|
+
const t = e.style ?? this.getAutoStyleByScale();
|
|
42
|
+
switch (t === "cluster" || e.style == null ? this.ensureStationaryWatch() : this.tryRemoveWatchIfNoVisible(), t) {
|
|
34
43
|
case "scatter": {
|
|
35
|
-
this.
|
|
44
|
+
this.applyScatterMode(), this.tryRemoveWatchIfNoVisible();
|
|
36
45
|
break;
|
|
37
46
|
}
|
|
38
47
|
case "cluster": {
|
|
39
|
-
|
|
40
|
-
i.visible = e.visible, e.visible ? (await this.showClusterInExtent(e, this.view.extent), this.watchHandle || (this.watchHandle = v.when(
|
|
41
|
-
() => this.view.stationary,
|
|
42
|
-
async () => {
|
|
43
|
-
var r, s, o, l, c, a, y, h;
|
|
44
|
-
this.cameraNormalLayer.visible && await this.showClusterInExtent(
|
|
45
|
-
{
|
|
46
|
-
deviceType: "camera",
|
|
47
|
-
deviceState: "normal",
|
|
48
|
-
style: "cluster",
|
|
49
|
-
ddCode: ((r = this.currentShowParams) == null ? void 0 : r.ddCode) || "",
|
|
50
|
-
zdCode: ((s = this.currentShowParams) == null ? void 0 : s.zdCode) || "",
|
|
51
|
-
visible: !0
|
|
52
|
-
},
|
|
53
|
-
this.view.extent
|
|
54
|
-
), this.cameraAbnormalLayer.visible && await this.showClusterInExtent(
|
|
55
|
-
{
|
|
56
|
-
deviceType: "camera",
|
|
57
|
-
deviceState: "abnormal",
|
|
58
|
-
style: "cluster",
|
|
59
|
-
ddCode: ((o = this.currentShowParams) == null ? void 0 : o.ddCode) || "",
|
|
60
|
-
zdCode: ((l = this.currentShowParams) == null ? void 0 : l.zdCode) || "",
|
|
61
|
-
visible: !0
|
|
62
|
-
},
|
|
63
|
-
this.view.extent
|
|
64
|
-
), this.kkNormalLayer.visible && await this.showClusterInExtent(
|
|
65
|
-
{
|
|
66
|
-
deviceType: "kk",
|
|
67
|
-
deviceState: "normal",
|
|
68
|
-
style: "cluster",
|
|
69
|
-
ddCode: ((c = this.currentShowParams) == null ? void 0 : c.ddCode) || "",
|
|
70
|
-
zdCode: ((a = this.currentShowParams) == null ? void 0 : a.zdCode) || "",
|
|
71
|
-
visible: !0
|
|
72
|
-
},
|
|
73
|
-
this.view.extent
|
|
74
|
-
), this.kkAbnormalLayer.visible && await this.showClusterInExtent(
|
|
75
|
-
{
|
|
76
|
-
deviceType: "kk",
|
|
77
|
-
deviceState: "abnormal",
|
|
78
|
-
style: "cluster",
|
|
79
|
-
ddCode: ((y = this.currentShowParams) == null ? void 0 : y.ddCode) || "",
|
|
80
|
-
zdCode: ((h = this.currentShowParams) == null ? void 0 : h.zdCode) || "",
|
|
81
|
-
visible: !0
|
|
82
|
-
},
|
|
83
|
-
this.view.extent
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
))) : (i.removeAll(), !this.cameraNormalLayer.visible && !this.cameraAbnormalLayer.visible && !this.kkNormalLayer.visible && !this.kkAbnormalLayer.visible && ((t = this.watchHandle) == null || t.remove(), this.watchHandle = null));
|
|
48
|
+
await this.applyClusterMode();
|
|
87
49
|
break;
|
|
88
50
|
}
|
|
89
51
|
}
|
|
90
|
-
return {
|
|
91
|
-
status: 0,
|
|
92
|
-
message: "Success"
|
|
93
|
-
};
|
|
52
|
+
return { status: 0, message: "Success" };
|
|
94
53
|
}
|
|
95
54
|
/**
|
|
96
55
|
* 控制散点图层显示隐藏
|
|
@@ -113,13 +72,99 @@ class S {
|
|
|
113
72
|
});
|
|
114
73
|
}
|
|
115
74
|
getLayerConfig(e) {
|
|
116
|
-
let t, i,
|
|
117
|
-
return e.deviceType === "camera" ? e.deviceState === "normal" ? (t = "/GisViewerAssets/Images/gis/gis_sxj_map.png", i = [45, 108, 196],
|
|
75
|
+
let t, i, a;
|
|
76
|
+
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), {
|
|
118
77
|
icon: t,
|
|
119
78
|
color: i,
|
|
120
|
-
deviceLayer:
|
|
79
|
+
deviceLayer: a
|
|
121
80
|
};
|
|
122
81
|
}
|
|
82
|
+
getAutoStyleByScale() {
|
|
83
|
+
return this.view.scale > this.clusterScaleThreshold ? "cluster" : "scatter";
|
|
84
|
+
}
|
|
85
|
+
updateClusterEnabled(e) {
|
|
86
|
+
const t = e.deviceState;
|
|
87
|
+
e.deviceType === "camera" ? t ? t === "normal" ? this.clusterEnabled.cameraNormal = e.visible : this.clusterEnabled.cameraAbnormal = e.visible : (this.clusterEnabled.cameraNormal = e.visible, this.clusterEnabled.cameraAbnormal = e.visible) : t ? t === "normal" ? this.clusterEnabled.kkNormal = e.visible : this.clusterEnabled.kkAbnormal = e.visible : (this.clusterEnabled.kkNormal = e.visible, this.clusterEnabled.kkAbnormal = e.visible);
|
|
88
|
+
}
|
|
89
|
+
ensureStationaryWatch() {
|
|
90
|
+
this.watchHandle || (this.watchHandle = b.when(
|
|
91
|
+
() => this.view.stationary,
|
|
92
|
+
async () => {
|
|
93
|
+
if (!this.currentShowParams)
|
|
94
|
+
return;
|
|
95
|
+
if ((this.currentShowParams.style ?? this.getAutoStyleByScale()) === "scatter") {
|
|
96
|
+
this.applyScatterMode();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
await this.applyClusterMode();
|
|
100
|
+
}
|
|
101
|
+
));
|
|
102
|
+
}
|
|
103
|
+
hasAnyClusterEnabled() {
|
|
104
|
+
return this.clusterEnabled.cameraNormal || this.clusterEnabled.cameraAbnormal || this.clusterEnabled.kkNormal || this.clusterEnabled.kkAbnormal;
|
|
105
|
+
}
|
|
106
|
+
tryRemoveWatchIfNoVisible() {
|
|
107
|
+
var i;
|
|
108
|
+
const e = this.isCameraVisible || this.isKkVisible, t = this.hasAnyClusterEnabled();
|
|
109
|
+
!e && !t && ((i = this.watchHandle) == null || i.remove(), this.watchHandle = null);
|
|
110
|
+
}
|
|
111
|
+
applyScatterMode() {
|
|
112
|
+
this.showScatter(), this.cameraNormalLayer.visible = !1, this.cameraAbnormalLayer.visible = !1, this.kkNormalLayer.visible = !1, this.kkAbnormalLayer.visible = !1, this.cameraNormalLayer.removeAll(), this.cameraAbnormalLayer.removeAll(), this.kkNormalLayer.removeAll(), this.kkAbnormalLayer.removeAll();
|
|
113
|
+
}
|
|
114
|
+
async applyClusterMode() {
|
|
115
|
+
var l, r;
|
|
116
|
+
this.showScatter(!1);
|
|
117
|
+
const e = ((l = this.currentShowParams) == null ? void 0 : l.ddCode) || "", t = ((r = this.currentShowParams) == null ? void 0 : r.zdCode) || "", i = this.view.extent, a = [];
|
|
118
|
+
this.cameraNormalLayer.visible = this.clusterEnabled.cameraNormal, this.clusterEnabled.cameraNormal ? a.push(
|
|
119
|
+
this.showClusterInExtent(
|
|
120
|
+
{
|
|
121
|
+
deviceType: "camera",
|
|
122
|
+
deviceState: "normal",
|
|
123
|
+
style: "cluster",
|
|
124
|
+
ddCode: e,
|
|
125
|
+
zdCode: t,
|
|
126
|
+
visible: !0
|
|
127
|
+
},
|
|
128
|
+
i
|
|
129
|
+
)
|
|
130
|
+
) : this.cameraNormalLayer.removeAll(), this.cameraAbnormalLayer.visible = this.clusterEnabled.cameraAbnormal, this.clusterEnabled.cameraAbnormal ? a.push(
|
|
131
|
+
this.showClusterInExtent(
|
|
132
|
+
{
|
|
133
|
+
deviceType: "camera",
|
|
134
|
+
deviceState: "abnormal",
|
|
135
|
+
style: "cluster",
|
|
136
|
+
ddCode: e,
|
|
137
|
+
zdCode: t,
|
|
138
|
+
visible: !0
|
|
139
|
+
},
|
|
140
|
+
i
|
|
141
|
+
)
|
|
142
|
+
) : this.cameraAbnormalLayer.removeAll(), this.kkNormalLayer.visible = this.clusterEnabled.kkNormal, this.clusterEnabled.kkNormal ? a.push(
|
|
143
|
+
this.showClusterInExtent(
|
|
144
|
+
{
|
|
145
|
+
deviceType: "kk",
|
|
146
|
+
deviceState: "normal",
|
|
147
|
+
style: "cluster",
|
|
148
|
+
ddCode: e,
|
|
149
|
+
zdCode: t,
|
|
150
|
+
visible: !0
|
|
151
|
+
},
|
|
152
|
+
i
|
|
153
|
+
)
|
|
154
|
+
) : this.kkNormalLayer.removeAll(), this.kkAbnormalLayer.visible = this.clusterEnabled.kkAbnormal, this.clusterEnabled.kkAbnormal ? a.push(
|
|
155
|
+
this.showClusterInExtent(
|
|
156
|
+
{
|
|
157
|
+
deviceType: "kk",
|
|
158
|
+
deviceState: "abnormal",
|
|
159
|
+
style: "cluster",
|
|
160
|
+
ddCode: e,
|
|
161
|
+
zdCode: t,
|
|
162
|
+
visible: !0
|
|
163
|
+
},
|
|
164
|
+
i
|
|
165
|
+
)
|
|
166
|
+
) : this.kkAbnormalLayer.removeAll(), await Promise.all(a), this.tryRemoveWatchIfNoVisible();
|
|
167
|
+
}
|
|
123
168
|
async showClusterInExtent(e, t) {
|
|
124
169
|
const i = await fetch("/es/queryGeoAggregation", {
|
|
125
170
|
method: "POST",
|
|
@@ -142,36 +187,35 @@ class S {
|
|
|
142
187
|
console.error(i.statusText);
|
|
143
188
|
return;
|
|
144
189
|
}
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
190
|
+
const a = await i.json();
|
|
191
|
+
if (a.code !== 200)
|
|
147
192
|
return;
|
|
148
|
-
const { icon:
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
var
|
|
152
|
-
const
|
|
193
|
+
const { icon: l, color: r, deviceLayer: m } = this.getLayerConfig(e);
|
|
194
|
+
m.removeAll();
|
|
195
|
+
const y = a.data.map((s) => {
|
|
196
|
+
var h;
|
|
197
|
+
const o = (s.count.toString().length * 6 + 6) / 2, n = new d({
|
|
153
198
|
geometry: {
|
|
154
199
|
type: "point",
|
|
155
|
-
x:
|
|
156
|
-
y:
|
|
200
|
+
x: s.lon,
|
|
201
|
+
y: s.lat
|
|
157
202
|
},
|
|
158
203
|
attributes: {
|
|
159
|
-
id: ((
|
|
204
|
+
id: ((h = s.devInfo) == null ? void 0 : h.deviceId) || s.key,
|
|
160
205
|
type: e.deviceType,
|
|
161
|
-
count:
|
|
206
|
+
count: s.count,
|
|
162
207
|
typeName: e.deviceType === "camera" ? "视频" : "卡口",
|
|
163
208
|
stateName: e.deviceState === "normal" ? "正常" : "异常",
|
|
164
|
-
...
|
|
209
|
+
...s.devInfo
|
|
165
210
|
}
|
|
166
211
|
});
|
|
167
|
-
return
|
|
212
|
+
return s.count > 1 ? n.symbol = {
|
|
168
213
|
type: "cim",
|
|
169
214
|
data: {
|
|
170
215
|
type: "CIMSymbolReference",
|
|
171
216
|
symbol: {
|
|
172
217
|
type: "CIMPointSymbol",
|
|
173
218
|
symbolLayers: [
|
|
174
|
-
// 聚合数量
|
|
175
219
|
{
|
|
176
220
|
type: "CIMVectorMarker",
|
|
177
221
|
size: 32,
|
|
@@ -179,17 +223,16 @@ class S {
|
|
|
179
223
|
anchorPointUnits: "Relative",
|
|
180
224
|
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
181
225
|
markerGraphics: [
|
|
182
|
-
// 数量文本框
|
|
183
226
|
{
|
|
184
227
|
type: "CIMMarkerGraphic",
|
|
185
228
|
geometry: {
|
|
186
229
|
rings: [
|
|
187
230
|
[
|
|
188
|
-
[-
|
|
189
|
-
[
|
|
190
|
-
[
|
|
191
|
-
[-
|
|
192
|
-
[-
|
|
231
|
+
[-o, 30],
|
|
232
|
+
[o, 30],
|
|
233
|
+
[o, 15],
|
|
234
|
+
[-o, 15],
|
|
235
|
+
[-o, 30]
|
|
193
236
|
]
|
|
194
237
|
]
|
|
195
238
|
},
|
|
@@ -199,18 +242,17 @@ class S {
|
|
|
199
242
|
{
|
|
200
243
|
type: "CIMSolidFill",
|
|
201
244
|
enable: !0,
|
|
202
|
-
color:
|
|
245
|
+
color: r.concat([255])
|
|
203
246
|
},
|
|
204
247
|
{
|
|
205
248
|
type: "CIMSolidStroke",
|
|
206
249
|
enable: !0,
|
|
207
250
|
width: 3,
|
|
208
|
-
color:
|
|
251
|
+
color: r.concat([128])
|
|
209
252
|
}
|
|
210
253
|
]
|
|
211
254
|
}
|
|
212
255
|
},
|
|
213
|
-
// 数量文字
|
|
214
256
|
{
|
|
215
257
|
type: "CIMMarkerGraphic",
|
|
216
258
|
primitiveName: "textGraphic",
|
|
@@ -234,13 +276,12 @@ class S {
|
|
|
234
276
|
},
|
|
235
277
|
verticalAlignment: "Center"
|
|
236
278
|
},
|
|
237
|
-
textString:
|
|
279
|
+
textString: s.count.toString()
|
|
238
280
|
}
|
|
239
281
|
],
|
|
240
282
|
scaleSymbolsProportionally: !0,
|
|
241
283
|
respectFrame: !0
|
|
242
284
|
},
|
|
243
|
-
// 聚合图标
|
|
244
285
|
{
|
|
245
286
|
type: "CIMPictureMarker",
|
|
246
287
|
enable: !0,
|
|
@@ -252,46 +293,34 @@ class S {
|
|
|
252
293
|
size: 24,
|
|
253
294
|
rotateClockwise: !0,
|
|
254
295
|
textureFilter: "Picture",
|
|
255
|
-
url:
|
|
296
|
+
url: l
|
|
256
297
|
}
|
|
257
298
|
]
|
|
258
299
|
}
|
|
259
300
|
}
|
|
260
|
-
} : (
|
|
301
|
+
} : (n.symbol = {
|
|
261
302
|
type: "picture-marker",
|
|
262
|
-
url:
|
|
303
|
+
url: l,
|
|
263
304
|
width: 18,
|
|
264
305
|
height: 18
|
|
265
|
-
},
|
|
306
|
+
}, n.popupTemplate = {
|
|
266
307
|
title: "视频信息",
|
|
267
308
|
content: [
|
|
268
309
|
{
|
|
269
310
|
type: "fields",
|
|
270
311
|
fieldInfos: [
|
|
271
|
-
{
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
{
|
|
276
|
-
fieldName: "deviceName",
|
|
277
|
-
label: "设备名称"
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
fieldName: "typeName",
|
|
281
|
-
label: "设备类型"
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
fieldName: "stateName",
|
|
285
|
-
label: "设备状态"
|
|
286
|
-
}
|
|
312
|
+
{ fieldName: "deviceId", label: "设备编号" },
|
|
313
|
+
{ fieldName: "deviceName", label: "设备名称" },
|
|
314
|
+
{ fieldName: "typeName", label: "设备类型" },
|
|
315
|
+
{ fieldName: "stateName", label: "设备状态" }
|
|
287
316
|
]
|
|
288
317
|
}
|
|
289
318
|
]
|
|
290
|
-
}),
|
|
319
|
+
}), n;
|
|
291
320
|
});
|
|
292
|
-
|
|
321
|
+
m.addMany(y);
|
|
293
322
|
}
|
|
294
323
|
}
|
|
295
324
|
export {
|
|
296
|
-
|
|
325
|
+
w as default
|
|
297
326
|
};
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export default class DbscanCluster {
|
|
|
8
8
|
private readonly minClusterPoints;
|
|
9
9
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
10
10
|
private zoomWatchHandle;
|
|
11
|
+
private scaleThreshold?;
|
|
11
12
|
private locations;
|
|
12
13
|
private clusteredLocations;
|
|
13
14
|
private clusterMarkUrl;
|
|
@@ -15,6 +16,7 @@ export default class DbscanCluster {
|
|
|
15
16
|
* 将地理位置转换为屏幕坐标
|
|
16
17
|
*/
|
|
17
18
|
private locationToScreen;
|
|
19
|
+
private currentStyle;
|
|
18
20
|
/**
|
|
19
21
|
* 添加聚类点到视图
|
|
20
22
|
* @param params
|
|
@@ -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 c=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class f{constructor(t){this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusterRadius=120,this.minClusterPoints=2,this.zoomWatchHandle=null,this.locations=[],this.clusteredLocations=[],this.clusterMarkUrl="",this.currentStyle="cluster",this.view=t,this.clusterLayer=new p,this.view.map.add(this.clusterLayer)}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(t=>{const s=this.view.toScreen(new c.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))})}addClusterPoints(t){var r;this.locations=t.points,this.scaleThreshold=t.scaleThreshold,this.clusterMarkUrl=((r=t.clusterSymbol)==null?void 0:r.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",this.locations=this.locations.filter(e=>e.x!==null&&e.y!==null&&!isNaN(e.x)&&!isNaN(e.y)),this.locations.forEach(e=>{e.x=Number(e.x),e.y=Number(e.y),e.symbol||(e.symbol=t.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=this.view.watch("stationary",()=>{if(this.view.stationary)if(this.scaleThreshold){if(this.view.scale<this.scaleThreshold&&this.currentStyle==="cluster")this.currentStyle="normal",this.clusterLayer.removeAll(),this.locations.forEach(e=>{const i=new y({geometry:new c.Point({x:e.x,y:e.y}),attributes:{...e,...e.properties,type:"clusterPoint",id:e.id},symbol:e.symbol});this.clusterLayer.add(i)});else if(this.view.scale>this.scaleThreshold){this.currentStyle="cluster",this.locationToScreen();const e=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusters(e)}}else{this.locationToScreen();const e=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusters(e)}})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusters(s)}removeAllClusterPoints(){var t;(t=this.zoomWatchHandle)==null||t.remove(),this.zoomWatchHandle=null,this.clusterLayer.removeAll()}showClusters(t){this.clusterLayer.removeAll();let s=Number.MIN_VALUE,r=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(r=Math.min(r,e.count),s=Math.max(s,e.count))}),t.forEach(e=>{if(e.id!==-1){let i=r===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-r)/(s-r)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);i*=.75;const n=(e.count.toString().length*8+6)/2,u=new y({geometry:new c.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:i,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-n,40],[n,40],[n,20],[-n,20],[-n,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:i,rotateClockwise:!0,textureFilter:"Picture",url:this.clusterMarkUrl}]}}}});this.clusterLayer.add(u)}else e.items.forEach(i=>{const o=new y({geometry:new c.Point({x:i.x,y:i.y}),attributes:{...i,...i.properties,type:"clusterPoint",id:i.id},symbol:i.symbol});this.clusterLayer.add(o)})})}getNeighbors(t,s){return this.clusteredLocations.filter(r=>r.id===t.id||r.visited?!1:this.getDistance(t,r)<=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 r=Object.keys(t).map((e,i)=>{const o=t[Number(e)],l=o.length,n=o.reduce((h,a)=>h+a.x,0),u=o.reduce((h,a)=>h+a.y,0),m=n/l,d=u/l;return{id:Number(e),items:o,count:l,center:{x:m,y:d}}});return s.length>0&&r.push({id:-1,items:s,count:s.length,center:null}),r}doPixelCluster(t,s){let r=0;for(let e=0;e<this.clusteredLocations.length;e++){const i=this.clusteredLocations[e];if(i.visited)continue;i.visited=!0;const o=this.getNeighbors(i,t);o.length<s?i.clusterId=-1:(o.forEach(l=>{l.visited=!0,l.clusterId=r}),i.clusterId=r,r++)}return this.createClusters()}}exports.default=f;
|
|
@@ -6,10 +6,12 @@ export default class EdpassDeviceController {
|
|
|
6
6
|
private kkNormalLayer;
|
|
7
7
|
private kkAbnormalLayer;
|
|
8
8
|
private mapInitializer;
|
|
9
|
+
private readonly clusterScaleThreshold;
|
|
9
10
|
private watchHandle;
|
|
10
11
|
private currentShowParams;
|
|
11
12
|
private isCameraVisible;
|
|
12
13
|
private isKkVisible;
|
|
14
|
+
private clusterEnabled;
|
|
13
15
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
14
16
|
setEdpassLayerVisibility(params: IShowEdpassDeviceParams): Promise<IResult>;
|
|
15
17
|
/**
|
|
@@ -18,5 +20,12 @@ export default class EdpassDeviceController {
|
|
|
18
20
|
*/
|
|
19
21
|
private showScatter;
|
|
20
22
|
private getLayerConfig;
|
|
23
|
+
private getAutoStyleByScale;
|
|
24
|
+
private updateClusterEnabled;
|
|
25
|
+
private ensureStationaryWatch;
|
|
26
|
+
private hasAnyClusterEnabled;
|
|
27
|
+
private tryRemoveWatchIfNoVisible;
|
|
28
|
+
private applyScatterMode;
|
|
29
|
+
private applyClusterMode;
|
|
21
30
|
private showClusterInExtent;
|
|
22
31
|
}
|
|
@@ -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 b=require("@arcgis/core/core/reactiveUtils.js"),u=require("@arcgis/core/Graphic"),m=require("@arcgis/core/layers/GraphicsLayer"),v=require("vue"),k=require("../stores/index.js");function f(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const p=f(b);class S{constructor(e){this.clusterScaleThreshold=5e3,this.watchHandle=null,this.currentShowParams=null,this.isCameraVisible=!1,this.isKkVisible=!1,this.clusterEnabled={cameraNormal:!1,cameraAbnormal:!1,kkNormal:!1,kkAbnormal:!1},this.view=e;const t=k.default.useAppDataStore;this.mapInitializer=v.toRaw(t.mapInitializer),this.cameraNormalLayer=new m({id:"cameraNormalLayer",visible:!1}),this.cameraAbnormalLayer=new m({id:"cameraAbnormalLayer",visible:!1}),this.kkNormalLayer=new m({id:"kkNormalLayer",visible:!1}),this.kkAbnormalLayer=new m({id:"kkAbnormalLayer",visible:!1}),this.view.map.addMany([this.cameraNormalLayer,this.cameraAbnormalLayer,this.kkNormalLayer,this.kkAbnormalLayer])}async setEdpassLayerVisibility(e){if(this.currentShowParams={...this.currentShowParams??{},...e},e.deviceType!=="camera"&&e.deviceType!=="kk")return{status:-1,message:"不支持的设备类型"};e.deviceType==="camera"&&(this.isCameraVisible=e.visible),e.deviceType==="kk"&&(this.isKkVisible=e.visible),this.updateClusterEnabled(e);const t=e.style??this.getAutoStyleByScale();switch(t==="cluster"||e.style==null?this.ensureStationaryWatch():this.tryRemoveWatchIfNoVisible(),t){case"scatter":{this.applyScatterMode(),this.tryRemoveWatchIfNoVisible();break}case"cluster":{await this.applyClusterMode();break}}return{status:0,message:"Success"}}showScatter(e){const t=e??this.isCameraVisible,i=e??this.isKkVisible;this.mapInitializer.setLayerVisibility({id:"camera-normal",visible:t}),this.mapInitializer.setLayerVisibility({id:"camera-abnormal",visible:t}),this.mapInitializer.setLayerVisibility({id:"kk-normal",visible:i}),this.mapInitializer.setLayerVisibility({id:"kk-abnormal",visible:i})}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}}getAutoStyleByScale(){return this.view.scale>this.clusterScaleThreshold?"cluster":"scatter"}updateClusterEnabled(e){const t=e.deviceState;e.deviceType==="camera"?t?t==="normal"?this.clusterEnabled.cameraNormal=e.visible:this.clusterEnabled.cameraAbnormal=e.visible:(this.clusterEnabled.cameraNormal=e.visible,this.clusterEnabled.cameraAbnormal=e.visible):t?t==="normal"?this.clusterEnabled.kkNormal=e.visible:this.clusterEnabled.kkAbnormal=e.visible:(this.clusterEnabled.kkNormal=e.visible,this.clusterEnabled.kkAbnormal=e.visible)}ensureStationaryWatch(){this.watchHandle||(this.watchHandle=p.when(()=>this.view.stationary,async()=>{if(!this.currentShowParams)return;if((this.currentShowParams.style??this.getAutoStyleByScale())==="scatter"){this.applyScatterMode();return}await this.applyClusterMode()}))}hasAnyClusterEnabled(){return this.clusterEnabled.cameraNormal||this.clusterEnabled.cameraAbnormal||this.clusterEnabled.kkNormal||this.clusterEnabled.kkAbnormal}tryRemoveWatchIfNoVisible(){var i;const e=this.isCameraVisible||this.isKkVisible,t=this.hasAnyClusterEnabled();!e&&!t&&((i=this.watchHandle)==null||i.remove(),this.watchHandle=null)}applyScatterMode(){this.showScatter(),this.cameraNormalLayer.visible=!1,this.cameraAbnormalLayer.visible=!1,this.kkNormalLayer.visible=!1,this.kkAbnormalLayer.visible=!1,this.cameraNormalLayer.removeAll(),this.cameraAbnormalLayer.removeAll(),this.kkNormalLayer.removeAll(),this.kkAbnormalLayer.removeAll()}async applyClusterMode(){var l,o;this.showScatter(!1);const e=((l=this.currentShowParams)==null?void 0:l.ddCode)||"",t=((o=this.currentShowParams)==null?void 0:o.zdCode)||"",i=this.view.extent,a=[];this.cameraNormalLayer.visible=this.clusterEnabled.cameraNormal,this.clusterEnabled.cameraNormal?a.push(this.showClusterInExtent({deviceType:"camera",deviceState:"normal",style:"cluster",ddCode:e,zdCode:t,visible:!0},i)):this.cameraNormalLayer.removeAll(),this.cameraAbnormalLayer.visible=this.clusterEnabled.cameraAbnormal,this.clusterEnabled.cameraAbnormal?a.push(this.showClusterInExtent({deviceType:"camera",deviceState:"abnormal",style:"cluster",ddCode:e,zdCode:t,visible:!0},i)):this.cameraAbnormalLayer.removeAll(),this.kkNormalLayer.visible=this.clusterEnabled.kkNormal,this.clusterEnabled.kkNormal?a.push(this.showClusterInExtent({deviceType:"kk",deviceState:"normal",style:"cluster",ddCode:e,zdCode:t,visible:!0},i)):this.kkNormalLayer.removeAll(),this.kkAbnormalLayer.visible=this.clusterEnabled.kkAbnormal,this.clusterEnabled.kkAbnormal?a.push(this.showClusterInExtent({deviceType:"kk",deviceState:"abnormal",style:"cluster",ddCode:e,zdCode:t,visible:!0},i)):this.kkAbnormalLayer.removeAll(),await Promise.all(a),this.tryRemoveWatchIfNoVisible()}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:l,color:o,deviceLayer:h}=this.getLayerConfig(e);h.removeAll();const d=a.data.map(s=>{var y;const n=(s.count.toString().length*6+6)/2,c=new u({geometry:{type:"point",x:s.lon,y:s.lat},attributes:{id:((y=s.devInfo)==null?void 0:y.deviceId)||s.key,type:e.deviceType,count:s.count,typeName:e.deviceType==="camera"?"视频":"卡口",stateName:e.deviceState==="normal"?"正常":"异常",...s.devInfo}});return s.count>1?c.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:[[[-n,30],[n,30],[n,15],[-n,15],[-n,30]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:o.concat([255])},{type:"CIMSolidStroke",enable:!0,width:3,color:o.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:s.count.toString()}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:24,rotateClockwise:!0,textureFilter:"Picture",url:l}]}}}:(c.symbol={type:"picture-marker",url:l,width:18,height:18},c.popupTemplate={title:"视频信息",content:[{type:"fields",fieldInfos:[{fieldName:"deviceId",label:"设备编号"},{fieldName:"deviceName",label:"设备名称"},{fieldName:"typeName",label:"设备类型"},{fieldName:"stateName",label:"设备状态"}]}]}),c});h.addMany(d)}}exports.default=S;
|
package/lib/src/types/index.d.ts
CHANGED