gisviewer-vue3-arcgis 1.0.247 → 1.0.248
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.
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { toRaw as
|
|
5
|
-
import
|
|
6
|
-
class
|
|
1
|
+
import * as d from "@arcgis/core/core/reactiveUtils.js";
|
|
2
|
+
import v from "@arcgis/core/Graphic";
|
|
3
|
+
import l from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
+
import { toRaw as b } from "vue";
|
|
5
|
+
import p from "../stores/index.mjs";
|
|
6
|
+
class S {
|
|
7
7
|
constructor(e) {
|
|
8
8
|
this.watchHandle = null, this.view = e;
|
|
9
|
-
const t =
|
|
10
|
-
this.mapInitializer =
|
|
11
|
-
id: "cameraNormalLayer"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}), this.
|
|
17
|
-
id: "
|
|
9
|
+
const t = p.useAppDataStore;
|
|
10
|
+
this.mapInitializer = b(t.mapInitializer), this.cameraNormalLayer = new l({
|
|
11
|
+
id: "cameraNormalLayer",
|
|
12
|
+
visible: !1
|
|
13
|
+
}), this.cameraAbnormalLayer = new l({
|
|
14
|
+
id: "cameraAbnormalLayer",
|
|
15
|
+
visible: !1
|
|
16
|
+
}), this.kkNormalLayer = new l({
|
|
17
|
+
id: "kkNormalLayer",
|
|
18
|
+
visible: !1
|
|
19
|
+
}), this.kkAbnormalLayer = new l({
|
|
20
|
+
id: "kkAbnormalLayer",
|
|
21
|
+
visible: !1
|
|
18
22
|
}), this.view.map.addMany([
|
|
19
23
|
this.cameraNormalLayer,
|
|
20
|
-
this.kkNormalLayer,
|
|
21
24
|
this.cameraAbnormalLayer,
|
|
25
|
+
this.kkNormalLayer,
|
|
22
26
|
this.kkAbnormalLayer
|
|
23
27
|
]);
|
|
24
28
|
}
|
|
@@ -34,10 +38,10 @@ class x {
|
|
|
34
38
|
});
|
|
35
39
|
case "cluster": {
|
|
36
40
|
const { deviceLayer: i } = this.getLayerConfig(e);
|
|
37
|
-
i.visible = e.visible, e.visible ? (await this.showClusterInExtent(e, this.view.extent), this.watchHandle || (this.watchHandle =
|
|
41
|
+
i.visible = e.visible, console.log(i.id, i.visible), e.visible ? (await this.showClusterInExtent(e, this.view.extent), this.watchHandle || (this.watchHandle = d.when(
|
|
38
42
|
() => this.view.stationary,
|
|
39
43
|
async () => {
|
|
40
|
-
this.cameraNormalLayer.visible && await this.showClusterInExtent(
|
|
44
|
+
this.cameraNormalLayer.visible && (console.log("刷新 camera normal"), await this.showClusterInExtent(
|
|
41
45
|
{
|
|
42
46
|
deviceType: "camera",
|
|
43
47
|
deviceState: "normal",
|
|
@@ -45,7 +49,7 @@ class x {
|
|
|
45
49
|
visible: !0
|
|
46
50
|
},
|
|
47
51
|
this.view.extent
|
|
48
|
-
), this.cameraAbnormalLayer.visible && await this.showClusterInExtent(
|
|
52
|
+
)), this.cameraAbnormalLayer.visible && (console.log("刷新 camera abnormal"), await this.showClusterInExtent(
|
|
49
53
|
{
|
|
50
54
|
deviceType: "camera",
|
|
51
55
|
deviceState: "abnormal",
|
|
@@ -53,7 +57,7 @@ class x {
|
|
|
53
57
|
visible: !0
|
|
54
58
|
},
|
|
55
59
|
this.view.extent
|
|
56
|
-
), this.kkNormalLayer.visible && await this.showClusterInExtent(
|
|
60
|
+
)), this.kkNormalLayer.visible && (console.log("刷新 kk normal"), await this.showClusterInExtent(
|
|
57
61
|
{
|
|
58
62
|
deviceType: "kk",
|
|
59
63
|
deviceState: "normal",
|
|
@@ -61,7 +65,7 @@ class x {
|
|
|
61
65
|
visible: !0
|
|
62
66
|
},
|
|
63
67
|
this.view.extent
|
|
64
|
-
), this.kkAbnormalLayer.visible && await this.showClusterInExtent(
|
|
68
|
+
)), this.kkAbnormalLayer.visible && (console.log("刷新 kk abnormal"), await this.showClusterInExtent(
|
|
65
69
|
{
|
|
66
70
|
deviceType: "kk",
|
|
67
71
|
deviceState: "abnormal",
|
|
@@ -69,7 +73,7 @@ class x {
|
|
|
69
73
|
visible: !0
|
|
70
74
|
},
|
|
71
75
|
this.view.extent
|
|
72
|
-
);
|
|
76
|
+
));
|
|
73
77
|
}
|
|
74
78
|
))) : (i.removeAll(), !this.cameraNormalLayer.visible && !this.cameraAbnormalLayer.visible && !this.kkNormalLayer.visible && !this.kkAbnormalLayer.visible && ((t = this.watchHandle) == null || t.remove(), this.watchHandle = null));
|
|
75
79
|
break;
|
|
@@ -89,7 +93,6 @@ class x {
|
|
|
89
93
|
};
|
|
90
94
|
}
|
|
91
95
|
async showClusterInExtent(e, t) {
|
|
92
|
-
console.time("request");
|
|
93
96
|
const i = await fetch("/es/queryGeoAggregation", {
|
|
94
97
|
method: "POST",
|
|
95
98
|
headers: {
|
|
@@ -113,125 +116,153 @@ class x {
|
|
|
113
116
|
const r = await i.json();
|
|
114
117
|
if (r.code !== 200)
|
|
115
118
|
return;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
return new d({
|
|
119
|
+
const { icon: n, color: c, deviceLayer: m } = this.getLayerConfig(e);
|
|
120
|
+
m.removeAll();
|
|
121
|
+
const h = r.data.map((a) => {
|
|
122
|
+
var y;
|
|
123
|
+
const o = (a.count.toString().length * 6 + 6) / 2, s = new v({
|
|
122
124
|
geometry: {
|
|
123
125
|
type: "point",
|
|
124
126
|
x: a.lon,
|
|
125
127
|
y: a.lat
|
|
126
128
|
},
|
|
127
129
|
attributes: {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
]
|
|
130
|
+
id: ((y = a.devInfo) == null ? void 0 : y.deviceId) || a.key,
|
|
131
|
+
type: e.deviceType,
|
|
132
|
+
count: a.count,
|
|
133
|
+
typeName: e.deviceType === "camera" ? "视频" : "卡口",
|
|
134
|
+
stateName: e.deviceState === "normal" ? "正常" : "异常",
|
|
135
|
+
...a.devInfo
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return a.count > 1 ? s.symbol = {
|
|
139
|
+
type: "cim",
|
|
140
|
+
data: {
|
|
141
|
+
type: "CIMSymbolReference",
|
|
142
|
+
symbol: {
|
|
143
|
+
type: "CIMPointSymbol",
|
|
144
|
+
symbolLayers: [
|
|
145
|
+
// 聚合数量
|
|
146
|
+
{
|
|
147
|
+
type: "CIMVectorMarker",
|
|
148
|
+
size: 32,
|
|
149
|
+
colorLocked: !0,
|
|
150
|
+
anchorPointUnits: "Relative",
|
|
151
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
152
|
+
markerGraphics: [
|
|
153
|
+
// 数量文本框
|
|
154
|
+
{
|
|
155
|
+
type: "CIMMarkerGraphic",
|
|
156
|
+
geometry: {
|
|
157
|
+
rings: [
|
|
158
|
+
[
|
|
159
|
+
[-o, 30],
|
|
160
|
+
[o, 30],
|
|
161
|
+
[o, 15],
|
|
162
|
+
[-o, 15],
|
|
163
|
+
[-o, 30]
|
|
158
164
|
]
|
|
159
|
-
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
symbol: {
|
|
168
|
+
type: "CIMPolygonSymbol",
|
|
169
|
+
symbolLayers: [
|
|
170
|
+
{
|
|
171
|
+
type: "CIMSolidFill",
|
|
172
|
+
enable: !0,
|
|
173
|
+
color: c.concat([255])
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
type: "CIMSolidStroke",
|
|
177
|
+
enable: !0,
|
|
178
|
+
width: 3,
|
|
179
|
+
color: c.concat([128])
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
// 数量文字
|
|
185
|
+
{
|
|
186
|
+
type: "CIMMarkerGraphic",
|
|
187
|
+
primitiveName: "textGraphic",
|
|
188
|
+
geometry: { x: 0, y: 0 },
|
|
189
|
+
symbol: {
|
|
190
|
+
type: "CIMTextSymbol",
|
|
191
|
+
fontFamilyName: "msyh",
|
|
192
|
+
height: 12,
|
|
193
|
+
horizontalAlignment: "Center",
|
|
194
|
+
offsetX: 0,
|
|
195
|
+
offsetY: 22,
|
|
160
196
|
symbol: {
|
|
161
197
|
type: "CIMPolygonSymbol",
|
|
162
198
|
symbolLayers: [
|
|
163
199
|
{
|
|
164
200
|
type: "CIMSolidFill",
|
|
165
201
|
enable: !0,
|
|
166
|
-
color:
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
type: "CIMSolidStroke",
|
|
170
|
-
enable: !0,
|
|
171
|
-
width: 3,
|
|
172
|
-
color: n.concat([128])
|
|
202
|
+
color: [255, 255, 255, 255]
|
|
173
203
|
}
|
|
174
204
|
]
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
// 数量文字
|
|
178
|
-
{
|
|
179
|
-
type: "CIMMarkerGraphic",
|
|
180
|
-
primitiveName: "textGraphic",
|
|
181
|
-
geometry: { x: 0, y: 0 },
|
|
182
|
-
symbol: {
|
|
183
|
-
type: "CIMTextSymbol",
|
|
184
|
-
fontFamilyName: "msyh",
|
|
185
|
-
height: 12,
|
|
186
|
-
horizontalAlignment: "Center",
|
|
187
|
-
offsetX: 0,
|
|
188
|
-
offsetY: 22,
|
|
189
|
-
symbol: {
|
|
190
|
-
type: "CIMPolygonSymbol",
|
|
191
|
-
symbolLayers: [
|
|
192
|
-
{
|
|
193
|
-
type: "CIMSolidFill",
|
|
194
|
-
enable: !0,
|
|
195
|
-
color: [255, 255, 255, 255]
|
|
196
|
-
}
|
|
197
|
-
]
|
|
198
|
-
},
|
|
199
|
-
verticalAlignment: "Center"
|
|
200
205
|
},
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
verticalAlignment: "Center"
|
|
207
|
+
},
|
|
208
|
+
textString: a.count.toString()
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
scaleSymbolsProportionally: !0,
|
|
212
|
+
respectFrame: !0
|
|
213
|
+
},
|
|
214
|
+
// 聚合图标
|
|
215
|
+
{
|
|
216
|
+
type: "CIMPictureMarker",
|
|
217
|
+
enable: !0,
|
|
218
|
+
anchorPoint: {
|
|
219
|
+
x: 0,
|
|
220
|
+
y: 0
|
|
206
221
|
},
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
},
|
|
215
|
-
anchorPointUnits: "Relative",
|
|
216
|
-
size: 24,
|
|
217
|
-
rotateClockwise: !0,
|
|
218
|
-
textureFilter: "Picture",
|
|
219
|
-
url: l
|
|
220
|
-
}
|
|
221
|
-
]
|
|
222
|
-
}
|
|
222
|
+
anchorPointUnits: "Relative",
|
|
223
|
+
size: 24,
|
|
224
|
+
rotateClockwise: !0,
|
|
225
|
+
textureFilter: "Picture",
|
|
226
|
+
url: n
|
|
227
|
+
}
|
|
228
|
+
]
|
|
223
229
|
}
|
|
224
|
-
} : {
|
|
225
|
-
type: "picture-marker",
|
|
226
|
-
url: l,
|
|
227
|
-
width: 24,
|
|
228
|
-
height: 24
|
|
229
230
|
}
|
|
230
|
-
}
|
|
231
|
+
} : (s.symbol = {
|
|
232
|
+
type: "picture-marker",
|
|
233
|
+
url: n,
|
|
234
|
+
width: 18,
|
|
235
|
+
height: 18
|
|
236
|
+
}, s.popupTemplate = {
|
|
237
|
+
title: "视频信息",
|
|
238
|
+
content: [
|
|
239
|
+
{
|
|
240
|
+
type: "fields",
|
|
241
|
+
fieldInfos: [
|
|
242
|
+
{
|
|
243
|
+
fieldName: "deviceId",
|
|
244
|
+
label: "设备编号"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
fieldName: "deviceName",
|
|
248
|
+
label: "设备名称"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
fieldName: "typeName",
|
|
252
|
+
label: "设备类型"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
fieldName: "stateName",
|
|
256
|
+
label: "设备状态"
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
}), s;
|
|
231
262
|
});
|
|
232
|
-
|
|
263
|
+
m.addMany(h);
|
|
233
264
|
}
|
|
234
265
|
}
|
|
235
266
|
export {
|
|
236
|
-
|
|
267
|
+
S as default
|
|
237
268
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/core/reactiveUtils.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/core/reactiveUtils.js"),b=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer"),v=require("vue"),p=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 f=g(u);class k{constructor(e){this.watchHandle=null,this.view=e;const t=p.default.useAppDataStore;this.mapInitializer=v.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(e.deviceType!=="camera"&&e.deviceType!=="kk")return{status:-1,message:"不支持的设备类型"};switch(e.mode){case"scatter":return this.mapInitializer.setLayerVisibility({id:`${e.deviceType}-${e.deviceState}`,visible:e.visible});case"cluster":{const{deviceLayer:i}=this.getLayerConfig(e);i.visible=e.visible,console.log(i.id,i.visible),e.visible?(await this.showClusterInExtent(e,this.view.extent),this.watchHandle||(this.watchHandle=f.when(()=>this.view.stationary,async()=>{this.cameraNormalLayer.visible&&(console.log("刷新 camera normal"),await this.showClusterInExtent({deviceType:"camera",deviceState:"normal",mode:"cluster",visible:!0},this.view.extent)),this.cameraAbnormalLayer.visible&&(console.log("刷新 camera abnormal"),await this.showClusterInExtent({deviceType:"camera",deviceState:"abnormal",mode:"cluster",visible:!0},this.view.extent)),this.kkNormalLayer.visible&&(console.log("刷新 kk normal"),await this.showClusterInExtent({deviceType:"kk",deviceState:"normal",mode:"cluster",visible:!0},this.view.extent)),this.kkAbnormalLayer.visible&&(console.log("刷新 kk abnormal"),await this.showClusterInExtent({deviceType:"kk",deviceState:"abnormal",mode:"cluster",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,r;return e.deviceType==="camera"?e.deviceState==="normal"?(t="/GisViewerAssets/Images/gis/gis_sxj_map.png",i=[45,108,196],r=this.cameraNormalLayer):(t="/GisViewerAssets/Images/gis/gis_sxj_yc.png",i=[189,49,50],r=this.cameraAbnormalLayer):e.deviceState==="normal"?(t="/GisViewerAssets/Images/gis/gis_kk_map.png",i=[45,108,196],r=this.kkNormalLayer):(t="/GisViewerAssets/Images/gis/gis_kk_yc.png",i=[189,49,50],r=this.kkAbnormalLayer),{icon:t,color:i,deviceLayer:r}}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==="normal"?"1":"2"],mapLevel:this.view.zoom+9})});if(i.status!==200){console.error(i.statusText);return}const r=await i.json();if(r.code!==200)return;const{icon:c,color:y,deviceLayer:m}=this.getLayerConfig(e);m.removeAll();const h=r.data.map(a=>{var d;const o=(a.count.toString().length*6+6)/2,l=new b({geometry:{type:"point",x:a.lon,y:a.lat},attributes:{id:((d=a.devInfo)==null?void 0:d.deviceId)||a.key,type:e.deviceType,count:a.count,typeName:e.deviceType==="camera"?"视频":"卡口",stateName:e.deviceState==="normal"?"正常":"异常",...a.devInfo}});return a.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:y.concat([255])},{type:"CIMSolidStroke",enable:!0,width:3,color:y.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:a.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});m.addMany(h)}}exports.default=k;
|