gisviewer-vue3-arcgis 1.0.267 → 1.0.268
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/police-jurisdiction.d.ts +6 -0
- package/es/src/gis-map/utils/police-jurisdiction.mjs +167 -74
- package/es/src/types/index.d.ts +1 -1
- package/lib/src/gis-map/utils/police-jurisdiction.d.ts +6 -0
- package/lib/src/gis-map/utils/police-jurisdiction.js +1 -1
- package/lib/src/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -5,5 +5,11 @@ export default class PoliceJurisdiction {
|
|
|
5
5
|
private maskLayer;
|
|
6
6
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
7
7
|
showJurisdiction(params: IShowJurisdictionParams): Promise<IResult>;
|
|
8
|
+
/**
|
|
9
|
+
* 显示支队辖区
|
|
10
|
+
* @param zdCode
|
|
11
|
+
*/
|
|
12
|
+
private showZD;
|
|
13
|
+
private showDD;
|
|
8
14
|
clearJurisdiction(): void;
|
|
9
15
|
}
|
|
@@ -1,94 +1,66 @@
|
|
|
1
|
-
import { Polygon as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { toRaw as
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { Polygon as h } from "@arcgis/core/geometry";
|
|
2
|
+
import * as n from "@arcgis/core/geometry/geometryEngine.js";
|
|
3
|
+
import m from "@arcgis/core/Graphic";
|
|
4
|
+
import k from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
+
import g from "axios";
|
|
6
|
+
import { toRaw as L } from "vue";
|
|
7
|
+
import E from "../stores/index.mjs";
|
|
8
|
+
import f from "./common-utils.mjs";
|
|
9
|
+
class R {
|
|
10
|
+
constructor(o) {
|
|
11
|
+
this.view = o, this.maskLayer = new k({
|
|
11
12
|
id: "police-jurisdiction"
|
|
12
13
|
}), this.view.map.add(this.maskLayer);
|
|
13
|
-
const
|
|
14
|
-
this.geoServer =
|
|
14
|
+
const t = E.useAppDataStore, r = L(t.mapConfig);
|
|
15
|
+
this.geoServer = r.geoServer;
|
|
15
16
|
}
|
|
16
|
-
async showJurisdiction(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
async showJurisdiction(o) {
|
|
18
|
+
return this.geoServer ? o.type.toLowerCase() === "zd" ? await this.showZD(o.id) : o.type.toLowerCase() === "dd" ? await this.showDD(o.id) : { status: 0, message: "ok" } : { status: -1, message: "未配置GeoServer" };
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 显示支队辖区
|
|
22
|
+
* @param zdCode
|
|
23
|
+
*/
|
|
24
|
+
async showZD(o) {
|
|
25
|
+
let t = await g.get(`${this.geoServer}/zd_edpass/wms`, {
|
|
20
26
|
params: {
|
|
21
27
|
service: "WFS",
|
|
22
28
|
version: "1.1.0",
|
|
23
29
|
request: "GetFeature",
|
|
24
|
-
typename:
|
|
30
|
+
typename: "zd_edpass:VIEW_SH_ZD",
|
|
25
31
|
outputFormat: "application/json",
|
|
26
|
-
CQL_FILTER:
|
|
32
|
+
CQL_FILTER: `ZD_CODE = ${o}`
|
|
27
33
|
}
|
|
28
34
|
});
|
|
29
|
-
if (
|
|
30
|
-
return { status: -1, message:
|
|
31
|
-
const { features:
|
|
32
|
-
if (!
|
|
35
|
+
if (t.status !== 200)
|
|
36
|
+
return { status: -1, message: t.status + " " + t.statusText };
|
|
37
|
+
const { features: r } = t.data;
|
|
38
|
+
if (!r || r.length === 0)
|
|
33
39
|
return { status: -1, message: "未查询到数据" };
|
|
34
40
|
this.maskLayer.removeAll();
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
rings:
|
|
39
|
-
});
|
|
40
|
-
t.push(r);
|
|
41
|
-
const v = new i({
|
|
42
|
-
geometry: r,
|
|
43
|
-
symbol: {
|
|
44
|
-
type: "simple-line",
|
|
45
|
-
style: "dash",
|
|
46
|
-
color: [111, 100, 255],
|
|
47
|
-
width: 4
|
|
48
|
-
}
|
|
49
|
-
}), D = new i({
|
|
50
|
-
geometry: r,
|
|
51
|
-
symbol: {
|
|
52
|
-
type: "simple-line",
|
|
53
|
-
style: "solid",
|
|
54
|
-
color: [111, 100, 255, 0.6],
|
|
55
|
-
width: 4
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
p.push(v, D);
|
|
59
|
-
const G = new i({
|
|
60
|
-
geometry: r.centroid,
|
|
61
|
-
symbol: {
|
|
62
|
-
type: "text",
|
|
63
|
-
color: [0, 0, 0],
|
|
64
|
-
haloColor: [255, 255, 255],
|
|
65
|
-
haloSize: "1px",
|
|
66
|
-
text: o.properties[y],
|
|
67
|
-
font: {
|
|
68
|
-
size: "14px",
|
|
69
|
-
weight: "bold",
|
|
70
|
-
family: "msyh"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
41
|
+
const l = r[0].geometry.coordinates, s = [];
|
|
42
|
+
l.forEach((e) => {
|
|
43
|
+
const i = new h({
|
|
44
|
+
rings: e
|
|
73
45
|
});
|
|
74
|
-
|
|
46
|
+
s.push(i);
|
|
75
47
|
});
|
|
76
|
-
const
|
|
77
|
-
|
|
48
|
+
const p = s[0].centroid, u = n.geodesicBuffer(
|
|
49
|
+
p,
|
|
78
50
|
100,
|
|
79
51
|
"kilometers"
|
|
80
52
|
);
|
|
81
|
-
let
|
|
82
|
-
|
|
83
|
-
|
|
53
|
+
let a = n.difference(
|
|
54
|
+
u,
|
|
55
|
+
s[0]
|
|
84
56
|
);
|
|
85
|
-
for (let
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
57
|
+
for (let e = 1; e < s.length; e++)
|
|
58
|
+
a = n.difference(
|
|
59
|
+
a,
|
|
60
|
+
s[e]
|
|
89
61
|
);
|
|
90
|
-
const
|
|
91
|
-
geometry:
|
|
62
|
+
const y = new m({
|
|
63
|
+
geometry: a,
|
|
92
64
|
symbol: {
|
|
93
65
|
type: "simple-fill",
|
|
94
66
|
color: [100, 100, 100, 0.8],
|
|
@@ -98,12 +70,133 @@ class M {
|
|
|
98
70
|
},
|
|
99
71
|
attributes: { type: "mask" }
|
|
100
72
|
});
|
|
101
|
-
|
|
73
|
+
this.maskLayer.add(y);
|
|
74
|
+
const d = s.map((e) => new m({
|
|
75
|
+
geometry: e,
|
|
76
|
+
symbol: {
|
|
77
|
+
type: "simple-line",
|
|
78
|
+
style: "solid",
|
|
79
|
+
color: [240, 156, 69],
|
|
80
|
+
width: 2
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
83
|
+
if (this.maskLayer.addMany(d), await f.viewGoto(this.view, d), t = await g.get(`${this.geoServer}/zd_edpass/wms`, {
|
|
84
|
+
params: {
|
|
85
|
+
service: "WFS",
|
|
86
|
+
version: "1.1.0",
|
|
87
|
+
request: "GetFeature",
|
|
88
|
+
typename: "zd_edpass:VW_DWD_GEO_SH_DD",
|
|
89
|
+
outputFormat: "application/json",
|
|
90
|
+
CQL_FILTER: `ZD_CODE = ${o}`
|
|
91
|
+
}
|
|
92
|
+
}), t.status === 200) {
|
|
93
|
+
const { features: e } = t.data;
|
|
94
|
+
if (e && e.length > 0) {
|
|
95
|
+
const i = [];
|
|
96
|
+
e.forEach((c) => {
|
|
97
|
+
c.geometry.coordinates.forEach((_) => {
|
|
98
|
+
const v = new h({
|
|
99
|
+
rings: _
|
|
100
|
+
}), G = new m({
|
|
101
|
+
geometry: v,
|
|
102
|
+
symbol: {
|
|
103
|
+
type: "simple-line",
|
|
104
|
+
style: "dash",
|
|
105
|
+
color: [240, 156, 69],
|
|
106
|
+
width: 1
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
i.push(G);
|
|
110
|
+
});
|
|
111
|
+
const w = c.properties.DD_NAME, D = new m({
|
|
112
|
+
geometry: {
|
|
113
|
+
type: "point",
|
|
114
|
+
longitude: c.properties.CENTER_X,
|
|
115
|
+
latitude: c.properties.CENTER_Y
|
|
116
|
+
},
|
|
117
|
+
symbol: {
|
|
118
|
+
type: "text",
|
|
119
|
+
color: [240, 156, 69],
|
|
120
|
+
haloColor: [255, 255, 255],
|
|
121
|
+
haloSize: "2px",
|
|
122
|
+
text: w,
|
|
123
|
+
font: {
|
|
124
|
+
size: "14px",
|
|
125
|
+
weight: "bold",
|
|
126
|
+
family: "msyh"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
i.push(D);
|
|
131
|
+
}), this.maskLayer.addMany(i);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return { status: 0, message: "ok" };
|
|
135
|
+
}
|
|
136
|
+
async showDD(o) {
|
|
137
|
+
this.maskLayer.removeAll();
|
|
138
|
+
const t = await g.get(`${this.geoServer}/zd_edpass/wms`, {
|
|
139
|
+
params: {
|
|
140
|
+
service: "WFS",
|
|
141
|
+
version: "1.1.0",
|
|
142
|
+
request: "GetFeature",
|
|
143
|
+
typename: "zd_edpass:VW_DWD_GEO_SH_DD",
|
|
144
|
+
outputFormat: "application/json",
|
|
145
|
+
CQL_FILTER: `DD_CODE = ${o}`
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
if (console.log(t), t.status !== 200)
|
|
149
|
+
return { status: -1, message: t.status + " " + t.statusText };
|
|
150
|
+
const { features: r } = t.data;
|
|
151
|
+
if (!r || r.length === 0)
|
|
152
|
+
return { status: -1, message: "未查询到数据" };
|
|
153
|
+
const l = r[0].geometry.coordinates, s = [];
|
|
154
|
+
l.forEach((e) => {
|
|
155
|
+
const i = new h({
|
|
156
|
+
rings: e
|
|
157
|
+
});
|
|
158
|
+
s.push(i);
|
|
159
|
+
});
|
|
160
|
+
const p = s[0].centroid, u = n.geodesicBuffer(
|
|
161
|
+
p,
|
|
162
|
+
100,
|
|
163
|
+
"kilometers"
|
|
164
|
+
);
|
|
165
|
+
let a = n.difference(
|
|
166
|
+
u,
|
|
167
|
+
s[0]
|
|
168
|
+
);
|
|
169
|
+
for (let e = 1; e < s.length; e++)
|
|
170
|
+
a = n.difference(
|
|
171
|
+
a,
|
|
172
|
+
s[e]
|
|
173
|
+
);
|
|
174
|
+
const y = new m({
|
|
175
|
+
geometry: a,
|
|
176
|
+
symbol: {
|
|
177
|
+
type: "simple-fill",
|
|
178
|
+
color: [100, 100, 100, 0.8],
|
|
179
|
+
outline: {
|
|
180
|
+
width: 0
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
this.maskLayer.add(y);
|
|
185
|
+
const d = s.map((e) => new m({
|
|
186
|
+
geometry: e,
|
|
187
|
+
symbol: {
|
|
188
|
+
type: "simple-line",
|
|
189
|
+
style: "dash",
|
|
190
|
+
color: [240, 156, 69],
|
|
191
|
+
width: 1
|
|
192
|
+
}
|
|
193
|
+
}));
|
|
194
|
+
return this.maskLayer.addMany(d), await f.viewGoto(this.view, d), { status: 0, message: "ok" };
|
|
102
195
|
}
|
|
103
196
|
clearJurisdiction() {
|
|
104
197
|
this.maskLayer.removeAll();
|
|
105
198
|
}
|
|
106
199
|
}
|
|
107
200
|
export {
|
|
108
|
-
|
|
201
|
+
R as default
|
|
109
202
|
};
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -5,5 +5,11 @@ export default class PoliceJurisdiction {
|
|
|
5
5
|
private maskLayer;
|
|
6
6
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
7
7
|
showJurisdiction(params: IShowJurisdictionParams): Promise<IResult>;
|
|
8
|
+
/**
|
|
9
|
+
* 显示支队辖区
|
|
10
|
+
* @param zdCode
|
|
11
|
+
*/
|
|
12
|
+
private showZD;
|
|
13
|
+
private showDD;
|
|
8
14
|
clearJurisdiction(): void;
|
|
9
15
|
}
|
|
@@ -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 h=require("@arcgis/core/geometry"),E=require("@arcgis/core/geometry/geometryEngine.js"),c=require("@arcgis/core/Graphic"),L=require("@arcgis/core/layers/GraphicsLayer"),f=require("axios"),S=require("vue"),b=require("../stores/index.js"),w=require("./common-utils.js");function F(n){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(s,e,r.get?r:{enumerable:!0,get:()=>n[e]})}}return s.default=n,Object.freeze(s)}const d=F(E);class C{constructor(s){this.view=s,this.maskLayer=new L({id:"police-jurisdiction"}),this.view.map.add(this.maskLayer);const e=b.default.useAppDataStore,r=S.toRaw(e.mapConfig);this.geoServer=r.geoServer}async showJurisdiction(s){return this.geoServer?s.type.toLowerCase()==="zd"?await this.showZD(s.id):s.type.toLowerCase()==="dd"?await this.showDD(s.id):{status:0,message:"ok"}:{status:-1,message:"未配置GeoServer"}}async showZD(s){let e=await f.get(`${this.geoServer}/zd_edpass/wms`,{params:{service:"WFS",version:"1.1.0",request:"GetFeature",typename:"zd_edpass:VIEW_SH_ZD",outputFormat:"application/json",CQL_FILTER:`ZD_CODE = ${s}`}});if(e.status!==200)return{status:-1,message:e.status+" "+e.statusText};const{features:r}=e.data;if(!r||r.length===0)return{status:-1,message:"未查询到数据"};this.maskLayer.removeAll();const m=r[0].geometry.coordinates,o=[];m.forEach(t=>{const i=new h.Polygon({rings:t});o.push(i)});const p=o[0].centroid,y=d.geodesicBuffer(p,100,"kilometers");let a=d.difference(y,o[0]);for(let t=1;t<o.length;t++)a=d.difference(a,o[t]);const g=new c({geometry:a,symbol:{type:"simple-fill",color:[100,100,100,.8],outline:{width:0}},attributes:{type:"mask"}});this.maskLayer.add(g);const l=o.map(t=>new c({geometry:t,symbol:{type:"simple-line",style:"solid",color:[240,156,69],width:2}}));if(this.maskLayer.addMany(l),await w.default.viewGoto(this.view,l),e=await f.get(`${this.geoServer}/zd_edpass/wms`,{params:{service:"WFS",version:"1.1.0",request:"GetFeature",typename:"zd_edpass:VW_DWD_GEO_SH_DD",outputFormat:"application/json",CQL_FILTER:`ZD_CODE = ${s}`}}),e.status===200){const{features:t}=e.data;if(t&&t.length>0){const i=[];t.forEach(u=>{u.geometry.coordinates.forEach(D=>{const k=new h.Polygon({rings:D}),G=new c({geometry:k,symbol:{type:"simple-line",style:"dash",color:[240,156,69],width:1}});i.push(G)});const _=u.properties.DD_NAME,v=new c({geometry:{type:"point",longitude:u.properties.CENTER_X,latitude:u.properties.CENTER_Y},symbol:{type:"text",color:[240,156,69],haloColor:[255,255,255],haloSize:"2px",text:_,font:{size:"14px",weight:"bold",family:"msyh"}}});i.push(v)}),this.maskLayer.addMany(i)}}return{status:0,message:"ok"}}async showDD(s){this.maskLayer.removeAll();const e=await f.get(`${this.geoServer}/zd_edpass/wms`,{params:{service:"WFS",version:"1.1.0",request:"GetFeature",typename:"zd_edpass:VW_DWD_GEO_SH_DD",outputFormat:"application/json",CQL_FILTER:`DD_CODE = ${s}`}});if(console.log(e),e.status!==200)return{status:-1,message:e.status+" "+e.statusText};const{features:r}=e.data;if(!r||r.length===0)return{status:-1,message:"未查询到数据"};const m=r[0].geometry.coordinates,o=[];m.forEach(t=>{const i=new h.Polygon({rings:t});o.push(i)});const p=o[0].centroid,y=d.geodesicBuffer(p,100,"kilometers");let a=d.difference(y,o[0]);for(let t=1;t<o.length;t++)a=d.difference(a,o[t]);const g=new c({geometry:a,symbol:{type:"simple-fill",color:[100,100,100,.8],outline:{width:0}}});this.maskLayer.add(g);const l=o.map(t=>new c({geometry:t,symbol:{type:"simple-line",style:"dash",color:[240,156,69],width:1}}));return this.maskLayer.addMany(l),await w.default.viewGoto(this.view,l),{status:0,message:"ok"}}clearJurisdiction(){this.maskLayer.removeAll()}}exports.default=C;
|
package/lib/src/types/index.d.ts
CHANGED