gisviewer-vue3-arcgis 1.0.273 → 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/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/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
|
}
|
|
@@ -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 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;
|