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.
@@ -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 L } from "@arcgis/core/geometry";
2
- import * as l from "@arcgis/core/geometry/geometryEngine";
3
- import i from "@arcgis/core/Graphic";
4
- import S from "@arcgis/core/layers/GraphicsLayer";
5
- import _ from "axios";
6
- import { toRaw as b } from "vue";
7
- import k from "../stores/index.mjs";
8
- class M {
9
- constructor(e) {
10
- this.view = e, this.maskLayer = new S({
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 a = k.useAppDataStore, n = b(a.mapConfig);
14
- this.geoServer = n.geoServer;
14
+ const t = E.useAppDataStore, r = L(t.mapConfig);
15
+ this.geoServer = r.geoServer;
15
16
  }
16
- async showJurisdiction(e) {
17
- if (!this.geoServer)
18
- return { status: -1, message: "未配置GeoServer" };
19
- const a = e.type.toLowerCase() === "zd" ? "VIEW_SH_ZD" : "VW_DWD_GEO_SH_DD", n = e.type.toLowerCase() === "zd" ? "ZD_CODE" : "DD_CODE", y = e.type.toLowerCase() === "zd" ? "ZD_NAME" : "DD_NAME", h = e.ids.join(","), s = await _.get(`${this.geoServer}/zd_edpass/wms`, {
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: `zd_edpass:${a}`,
30
+ typename: "zd_edpass:VIEW_SH_ZD",
25
31
  outputFormat: "application/json",
26
- CQL_FILTER: `${n} IN (${h})`
32
+ CQL_FILTER: `ZD_CODE = ${o}`
27
33
  }
28
34
  });
29
- if (s.status !== 200)
30
- return { status: -1, message: s.status + " " + s.statusText };
31
- const { features: c } = s.data;
32
- if (!c || c.length === 0)
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 t = [], p = [], d = [];
36
- c.forEach((o) => {
37
- const w = o.geometry.coordinates, r = new L({
38
- rings: w[0]
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
- d.push(G);
46
+ s.push(i);
75
47
  });
76
- const u = t[0].centroid, f = l.geodesicBuffer(
77
- u,
48
+ const p = s[0].centroid, u = n.geodesicBuffer(
49
+ p,
78
50
  100,
79
51
  "kilometers"
80
52
  );
81
- let m = l.difference(
82
- f,
83
- t[0]
53
+ let a = n.difference(
54
+ u,
55
+ s[0]
84
56
  );
85
- for (let o = 1; o < t.length; o++)
86
- m = l.difference(
87
- m,
88
- t[o]
57
+ for (let e = 1; e < s.length; e++)
58
+ a = n.difference(
59
+ a,
60
+ s[e]
89
61
  );
90
- const g = new i({
91
- geometry: m,
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
- return this.maskLayer.add(g), this.maskLayer.addMany(p), this.maskLayer.addMany(d), await this.view.goTo(t), { status: 0, message: "ok" };
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
- M as default
201
+ R as default
109
202
  };
@@ -368,7 +368,7 @@ export interface IRoadLine {
368
368
  }
369
369
  export interface IShowJurisdictionParams {
370
370
  type: string;
371
- ids: string[];
371
+ id: string;
372
372
  }
373
373
  export interface IShowEdpassDeviceParams {
374
374
  deviceType: string;
@@ -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 S=require("@arcgis/core/geometry"),G=require("@arcgis/core/geometry/geometryEngine"),c=require("@arcgis/core/Graphic"),k=require("@arcgis/core/layers/GraphicsLayer"),L=require("axios"),C=require("vue"),E=require("../stores/index.js");function O(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const d=O(G);class j{constructor(e){this.view=e,this.maskLayer=new k({id:"police-jurisdiction"}),this.view.map.add(this.maskLayer);const t=E.default.useAppDataStore,o=C.toRaw(t.mapConfig);this.geoServer=o.geoServer}async showJurisdiction(e){if(!this.geoServer)return{status:-1,message:"未配置GeoServer"};const t=e.type.toLowerCase()==="zd"?"VIEW_SH_ZD":"VW_DWD_GEO_SH_DD",o=e.type.toLowerCase()==="zd"?"ZD_CODE":"DD_CODE",y=e.type.toLowerCase()==="zd"?"ZD_NAME":"DD_NAME",h=e.ids.join(","),a=await L.get(`${this.geoServer}/zd_edpass/wms`,{params:{service:"WFS",version:"1.1.0",request:"GetFeature",typename:`zd_edpass:${t}`,outputFormat:"application/json",CQL_FILTER:`${o} IN (${h})`}});if(a.status!==200)return{status:-1,message:a.status+" "+a.statusText};const{features:l}=a.data;if(!l||l.length===0)return{status:-1,message:"未查询到数据"};this.maskLayer.removeAll();const r=[],m=[],p=[];l.forEach(i=>{const b=i.geometry.coordinates,n=new S.Polygon({rings:b[0]});r.push(n);const v=new c({geometry:n,symbol:{type:"simple-line",style:"dash",color:[111,100,255],width:4}}),D=new c({geometry:n,symbol:{type:"simple-line",style:"solid",color:[111,100,255,.6],width:4}});m.push(v,D);const _=new c({geometry:n.centroid,symbol:{type:"text",color:[0,0,0],haloColor:[255,255,255],haloSize:"1px",text:i.properties[y],font:{size:"14px",weight:"bold",family:"msyh"}}});p.push(_)});const g=r[0].centroid,f=d.geodesicBuffer(g,100,"kilometers");let u=d.difference(f,r[0]);for(let i=1;i<r.length;i++)u=d.difference(u,r[i]);const w=new c({geometry:u,symbol:{type:"simple-fill",color:[100,100,100,.8],outline:{width:0}},attributes:{type:"mask"}});return this.maskLayer.add(w),this.maskLayer.addMany(m),this.maskLayer.addMany(p),await this.view.goTo(r),{status:0,message:"ok"}}clearJurisdiction(){this.maskLayer.removeAll()}}exports.default=j;
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;
@@ -368,7 +368,7 @@ export interface IRoadLine {
368
368
  }
369
369
  export interface IShowJurisdictionParams {
370
370
  type: string;
371
- ids: string[];
371
+ id: string;
372
372
  }
373
373
  export interface IShowEdpassDeviceParams {
374
374
  deviceType: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.267",
3
+ "version": "1.0.268",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [