gisviewer-vue3-arcgis 1.0.137 → 1.0.138

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,6 +5,7 @@ interface ICross {
5
5
  latitude: number;
6
6
  longitude: number;
7
7
  signalId: string;
8
+ isKey: boolean;
8
9
  }
9
10
  export default class DistrictController {
10
11
  id: string;
@@ -16,7 +16,8 @@ class i {
16
16
  parentId: s.parentId,
17
17
  latitude: Number(s.latitude),
18
18
  longitude: Number(s.longitude),
19
- signalId: s.signalId
19
+ signalId: s.signalId,
20
+ isKey: s.isKey === 1
20
21
  };
21
22
  this.crosses.push(o), this.crossCount++;
22
23
  }
@@ -1,10 +1,10 @@
1
- import * as m from "@arcgis/core/core/reactiveUtils.js";
2
- import n from "@arcgis/core/Graphic";
1
+ import * as g from "@arcgis/core/core/reactiveUtils.js";
2
+ import h from "@arcgis/core/Graphic";
3
3
  import a from "@arcgis/core/layers/GraphicsLayer";
4
- import u from "@turf/buffer";
4
+ import m from "@turf/buffer";
5
5
  import d from "@turf/convex";
6
- import * as c from "@turf/helpers";
7
- import p from "./district-controller.mjs";
6
+ import * as l from "@turf/helpers";
7
+ import b from "./district-controller.mjs";
8
8
  class C {
9
9
  constructor(e) {
10
10
  this.crossScale = 3e3, this.view = e, this.view.popup.visibleElements = {
@@ -35,48 +35,51 @@ class C {
35
35
  showSignalControlArea(e) {
36
36
  this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0;
37
37
  for (const t of e) {
38
- const r = new p(t);
38
+ const r = new b(t);
39
39
  this.drawArea(r, !0);
40
40
  }
41
- return this.watchHandle = m.watch(
41
+ return this.watchHandle = g.watch(
42
42
  () => this.view.scale,
43
43
  (t, r) => {
44
- if (t > this.crossScale && r <= this.crossScale)
45
- this.crossLayer.graphics.forEach((s) => {
46
- s.symbol = {
47
- type: "simple-marker",
48
- color: s.getAttribute("color"),
49
- size: 8,
50
- outline: {
51
- color: "white",
52
- width: 1
53
- }
54
- };
55
- }), this.highlightLayer.graphics.forEach((s) => {
56
- s.getAttribute("type") === "cross" && (s.symbol = {
57
- type: "simple-marker",
58
- color: s.getAttribute("color"),
59
- size: 8,
60
- outline: {
61
- color: "white",
62
- width: 1
63
- }
64
- });
44
+ t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((i) => {
45
+ i.symbol = {
46
+ type: "simple-marker",
47
+ style: i.getAttribute("isKey") ? "diamond" : "circle",
48
+ color: i.getAttribute("color"),
49
+ size: i.getAttribute("isKey") ? 16 : 8,
50
+ outline: {
51
+ color: i.getAttribute("isKey") ? "red" : "white",
52
+ width: i.getAttribute("isKey") ? 2 : 1
53
+ }
54
+ };
55
+ }), this.highlightLayer.graphics.forEach((i) => {
56
+ i.getAttribute("type") === "cross" && (i.symbol = {
57
+ type: "simple-marker",
58
+ style: i.getAttribute("isKey") ? "diamond" : "circle",
59
+ color: i.getAttribute("color"),
60
+ size: i.getAttribute("isKey") ? 16 : 8,
61
+ outline: {
62
+ color: i.getAttribute("isKey") ? "red" : "white",
63
+ width: i.getAttribute("isKey") ? 2 : 1
64
+ }
65
65
  });
66
- else if (t <= this.crossScale && r > this.crossScale) {
67
- const s = {
66
+ })) : t <= this.crossScale && r > this.crossScale && (this.crossLayer.graphics.forEach((i) => {
67
+ i.symbol = {
68
68
  type: "picture-marker",
69
- url: "/GisViewerAssets/Images/xhj_1.png",
70
- width: "37px",
71
- height: "57px",
72
- yoffset: "25px"
69
+ url: `/GisViewerAssets/Images/xhj_${i.getAttribute("isKey") ? 4 : 1}.png`,
70
+ width: i.getAttribute("isKey") ? "55px" : "37px",
71
+ height: i.getAttribute("isKey") ? "85px" : "57px",
72
+ yoffset: i.getAttribute("isKey") ? "37px" : "25px"
73
73
  };
74
- this.crossLayer.graphics.forEach((i) => {
75
- i.symbol = s;
76
- }), this.highlightLayer.graphics.forEach((i) => {
77
- i.getAttribute("type") === "cross" && (i.symbol = s);
74
+ }), this.highlightLayer.graphics.forEach((i) => {
75
+ i.getAttribute("type") === "cross" && (i.symbol = {
76
+ type: "picture-marker",
77
+ url: `/GisViewerAssets/Images/xhj_${i.getAttribute("isKey") ? 4 : 1}.png`,
78
+ width: i.getAttribute("isKey") ? "55px" : "37px",
79
+ height: i.getAttribute("isKey") ? "85px" : "57px",
80
+ yoffset: i.getAttribute("isKey") ? "37px" : "25px"
78
81
  });
79
- }
82
+ }));
80
83
  }
81
84
  ), { status: 0, message: "ok" };
82
85
  }
@@ -101,13 +104,13 @@ class C {
101
104
  }
102
105
  async highlightSignalControlArea(e) {
103
106
  this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1;
104
- const t = this.districtControllerLayer.graphics.filter((i) => i.getAttribute("id") === e.id).toArray().map((i) => i.clone()), r = this.subDistrictControllerLayer.graphics.filter(
105
- (i) => i.getAttribute("id") === e.id || i.getAttribute("parentId") === e.id
106
- ).toArray().map((i) => i.clone()), s = this.crossLayer.graphics.filter(
107
- (i) => i.getAttribute("id") === e.id || i.getAttribute("districtId") === e.id || i.getAttribute("subDistrictId") === e.id
108
- ).toArray().map((i) => i.clone());
109
- return t.length > 0 && this.highlightLayer.addMany(t), r.length > 0 && this.highlightLayer.addMany(r), s.length > 0 && this.highlightLayer.addMany(s), this.highlightLayer.graphics.length === 0 ? { status: 1, message: "未找到" } : (t.length > 0 ? await this.view.goTo(t) : r.length > 0 ? await this.view.goTo(r) : s.length > 1 ? await this.view.goTo(s) : await this.view.goTo({
110
- target: s[0].geometry,
107
+ const t = this.districtControllerLayer.graphics.filter((s) => s.getAttribute("id") === e.id).toArray().map((s) => s.clone()), r = this.subDistrictControllerLayer.graphics.filter(
108
+ (s) => s.getAttribute("id") === e.id || s.getAttribute("parentId") === e.id
109
+ ).toArray().map((s) => s.clone()), i = this.crossLayer.graphics.filter(
110
+ (s) => s.getAttribute("id") === e.id || s.getAttribute("districtId") === e.id || s.getAttribute("subDistrictId") === e.id
111
+ ).toArray().map((s) => s.clone());
112
+ return t.length > 0 && this.highlightLayer.addMany(t), r.length > 0 && this.highlightLayer.addMany(r), i.length > 0 && this.highlightLayer.addMany(i), this.highlightLayer.graphics.length === 0 ? { status: 1, message: "未找到" } : (t.length > 0 ? await this.view.goTo(t) : r.length > 0 ? await this.view.goTo(r) : i.length > 1 ? await this.view.goTo(i) : await this.view.goTo({
113
+ target: i[0].geometry,
111
114
  scale: 1500
112
115
  }), { status: 0, message: "ok" });
113
116
  }
@@ -135,14 +138,20 @@ class C {
135
138
  */
136
139
  drawArea(e, t) {
137
140
  const r = e.getAllCrossCoordinates();
138
- if (r.length > 2) {
139
- const i = c.featureCollection(
140
- r.map((y) => c.point(y))
141
- ), l = d(i);
142
- if (!l)
141
+ if (r.length >= 2) {
142
+ let s = null;
143
+ if (r.length === 2)
144
+ s = l.lineString(r);
145
+ else if (r.length > 2) {
146
+ const u = l.featureCollection(
147
+ r.map((c) => l.point(c))
148
+ );
149
+ s = d(u);
150
+ }
151
+ if (!s)
143
152
  return;
144
- const g = u(
145
- l.geometry,
153
+ const y = m(
154
+ s.geometry,
146
155
  // 区控面积更大,需要更大的缓冲半径
147
156
  t ? 200 : 30,
148
157
  {
@@ -166,21 +175,17 @@ class C {
166
175
  ] : o = [
167
176
  {
168
177
  fieldName: "parentName",
169
- label: "区控名称"
170
- },
171
- {
172
- fieldName: "id",
173
- label: "子区编号"
178
+ label: "所属区控"
174
179
  },
175
180
  {
176
181
  fieldName: "crossCount",
177
182
  label: "路口数量"
178
183
  }
179
184
  ];
180
- const h = new n({
185
+ const n = new h({
181
186
  geometry: {
182
187
  type: "polygon",
183
- rings: g.geometry.coordinates
188
+ rings: y.geometry.coordinates
184
189
  },
185
190
  symbol: {
186
191
  type: "simple-fill",
@@ -201,7 +206,7 @@ class C {
201
206
  subDistrictCount: e.subDistrictCount
202
207
  },
203
208
  popupTemplate: {
204
- title: e.name,
209
+ title: `${t ? "区控" : "子区"} ${e.name}`,
205
210
  content: [
206
211
  {
207
212
  type: "fields",
@@ -210,38 +215,40 @@ class C {
210
215
  ]
211
216
  }
212
217
  });
213
- t ? this.districtControllerLayer.add(h) : this.subDistrictControllerLayer.add(h);
218
+ t ? this.districtControllerLayer.add(n) : this.subDistrictControllerLayer.add(n);
214
219
  }
215
- for (const i of e.subDistricts)
216
- this.drawArea(i, !1);
217
- const s = e.crosses.map((i) => new n({
220
+ for (const s of e.subDistricts)
221
+ this.drawArea(s, !1);
222
+ const i = e.crosses.map((s) => new h({
218
223
  geometry: {
219
224
  type: "point",
220
- x: i.longitude,
221
- y: i.latitude
225
+ x: s.longitude,
226
+ y: s.latitude
222
227
  },
223
228
  symbol: {
224
229
  type: "simple-marker",
230
+ style: s.isKey ? "diamond" : "circle",
225
231
  color: e.areaColor,
226
- size: 8,
232
+ size: s.isKey ? 16 : 8,
227
233
  outline: {
228
- color: "white",
229
- width: 1
234
+ color: s.isKey ? "red" : "white",
235
+ width: s.isKey ? 2 : 1
230
236
  }
231
237
  },
232
238
  attributes: {
233
239
  type: "cross",
234
- id: i.id,
235
- name: i.name,
240
+ id: s.id,
241
+ name: s.name,
236
242
  color: e.areaColor,
237
- signalId: i.signalId,
243
+ signalId: s.signalId,
238
244
  districtId: t ? e.id : e.parentId,
239
245
  districtName: t ? e.name : e.parentName,
240
246
  subDistrictId: t ? "" : e.id,
241
- subDistrictName: t ? "" : e.name
247
+ subDistrictName: t ? "" : e.name,
248
+ isKey: s.isKey
242
249
  },
243
250
  popupTemplate: {
244
- title: i.name,
251
+ title: s.name,
245
252
  content: [
246
253
  {
247
254
  type: "fields",
@@ -267,7 +274,7 @@ class C {
267
274
  ]
268
275
  }
269
276
  }));
270
- this.crossLayer.addMany(s);
277
+ this.crossLayer.addMany(i);
271
278
  }
272
279
  }
273
280
  export {
@@ -5,6 +5,7 @@ interface ICross {
5
5
  latitude: number;
6
6
  longitude: number;
7
7
  signalId: string;
8
+ isKey: boolean;
8
9
  }
9
10
  export default class DistrictController {
10
11
  id: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class e{constructor(s){this.parentName="",this.crosses=[],this.subDistricts=[],this.areaColor=[Math.floor(Math.random()*255),Math.floor(Math.random()*255),Math.floor(Math.random()*255)],this.crossCount=0,this.subDistrictCount=0,this.id=s.id,this.name=s.name,this.parentId=s.parentId;for(const t of s.children)if(t.children){const o=new e(t);o.parentName=this.name,o.areaColor=this.areaColor,this.subDistricts.push(o),this.subDistrictCount++,this.crossCount+=o.crossCount}else{const o={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId};this.crosses.push(o),this.crossCount++}}getAllCrossCoordinates(){const s=[];for(const t of this.crosses)s.push([t.longitude,t.latitude]);for(const t of this.subDistricts)s.push(...t.getAllCrossCoordinates());return s}}exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class e{constructor(t){this.parentName="",this.crosses=[],this.subDistricts=[],this.areaColor=[Math.floor(Math.random()*255),Math.floor(Math.random()*255),Math.floor(Math.random()*255)],this.crossCount=0,this.subDistrictCount=0,this.id=t.id,this.name=t.name,this.parentId=t.parentId;for(const s of t.children)if(s.children){const o=new e(s);o.parentName=this.name,o.areaColor=this.areaColor,this.subDistricts.push(o),this.subDistrictCount++,this.crossCount+=o.crossCount}else{const o={id:s.id,name:s.name,parentId:s.parentId,latitude:Number(s.latitude),longitude:Number(s.longitude),signalId:s.signalId,isKey:s.isKey===1};this.crosses.push(o),this.crossCount++}}getAllCrossCoordinates(){const t=[];for(const s of this.crosses)t.push([s.longitude,s.latitude]);for(const s of this.subDistricts)t.push(...s.getAllCrossCoordinates());return t}}exports.default=e;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/core/reactiveUtils.js"),c=require("@arcgis/core/Graphic"),o=require("@arcgis/core/layers/GraphicsLayer"),p=require("@turf/buffer"),f=require("@turf/convex"),b=require("@turf/helpers"),L=require("./district-controller.js");function g(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const w=g(m),u=g(b);class v{constructor(e){this.crossScale=3e3,this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0},this.districtControllerLayer=new o({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new o({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new o({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new o({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const r=new L.default(t);this.drawArea(r,!0)}return this.watchHandle=w.watch(()=>this.view.scale,(t,r)=>{if(t>this.crossScale&&r<=this.crossScale)this.crossLayer.graphics.forEach(s=>{s.symbol={type:"simple-marker",color:s.getAttribute("color"),size:8,outline:{color:"white",width:1}}}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol={type:"simple-marker",color:s.getAttribute("color"),size:8,outline:{color:"white",width:1}})});else if(t<=this.crossScale&&r>this.crossScale){const s={type:"picture-marker",url:"/GisViewerAssets/Images/xhj_1.png",width:"37px",height:"57px",yoffset:"25px"};this.crossLayer.graphics.forEach(i=>{i.symbol=s}),this.highlightLayer.graphics.forEach(i=>{i.getAttribute("type")==="cross"&&(i.symbol=s)})}}),{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.watchHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);if(t){t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry);const r=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.openPopup({features:[t],location:r}),{status:0,message:"ok"}}else return{status:1,message:"未找到"}}async highlightSignalControlArea(e){this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id).toArray().map(i=>i.clone()),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray().map(i=>i.clone());return t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(t.length>0?await this.view.goTo(t):r.length>0?await this.view.goTo(r):s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500}),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>2){const i=u.featureCollection(r.map(d=>u.point(d))),n=f(i);if(!n)return;const y=p(n.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"区控名称"},{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const h=new c({geometry:{type:"polygon",rings:y.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const i of e.subDistricts)this.drawArea(i,!1);const s=e.crosses.map(i=>new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8,outline:{color:"white",width:1}},attributes:{type:"cross",id:i.id,name:i.name,color:e.areaColor,signalId:i.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name},popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}}));this.crossLayer.addMany(s)}}exports.default=v;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/core/reactiveUtils.js"),u=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/buffer"),f=require("@turf/convex"),p=require("@turf/helpers"),A=require("./district-controller.js");function c(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const L=c(m),n=c(p);class w{constructor(e){this.crossScale=3e3,this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0},this.districtControllerLayer=new l({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new l({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new l({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new l({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const r=new A.default(t);this.drawArea(r,!0)}return this.watchHandle=L.watch(()=>this.view.scale,(t,r)=>{t>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(i=>{i.symbol={type:"simple-marker",style:i.getAttribute("isKey")?"diamond":"circle",color:i.getAttribute("color"),size:i.getAttribute("isKey")?16:8,outline:{color:i.getAttribute("isKey")?"red":"white",width:i.getAttribute("isKey")?2:1}}}),this.highlightLayer.graphics.forEach(i=>{i.getAttribute("type")==="cross"&&(i.symbol={type:"simple-marker",style:i.getAttribute("isKey")?"diamond":"circle",color:i.getAttribute("color"),size:i.getAttribute("isKey")?16:8,outline:{color:i.getAttribute("isKey")?"red":"white",width:i.getAttribute("isKey")?2:1}})})):t<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(i=>{i.symbol={type:"picture-marker",url:`/GisViewerAssets/Images/xhj_${i.getAttribute("isKey")?4:1}.png`,width:i.getAttribute("isKey")?"55px":"37px",height:i.getAttribute("isKey")?"85px":"57px",yoffset:i.getAttribute("isKey")?"37px":"25px"}}),this.highlightLayer.graphics.forEach(i=>{i.getAttribute("type")==="cross"&&(i.symbol={type:"picture-marker",url:`/GisViewerAssets/Images/xhj_${i.getAttribute("isKey")?4:1}.png`,width:i.getAttribute("isKey")?"55px":"37px",height:i.getAttribute("isKey")?"85px":"57px",yoffset:i.getAttribute("isKey")?"37px":"25px"})}))}),{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.watchHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);if(t){t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry);const r=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.openPopup({features:[t],location:r}),{status:0,message:"ok"}}else return{status:1,message:"未找到"}}async highlightSignalControlArea(e){this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id).toArray().map(s=>s.clone()),r=this.subDistrictControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("parentId")===e.id).toArray().map(s=>s.clone()),i=this.crossLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("districtId")===e.id||s.getAttribute("subDistrictId")===e.id).toArray().map(s=>s.clone());return t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),i.length>0&&this.highlightLayer.addMany(i),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(t.length>0?await this.view.goTo(t):r.length>0?await this.view.goTo(r):i.length>1?await this.view.goTo(i):await this.view.goTo({target:i[0].geometry,scale:1500}),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>=2){let s=null;if(r.length===2)s=n.lineString(r);else if(r.length>2){const g=n.featureCollection(r.map(d=>n.point(d)));s=f(g)}if(!s)return;const y=b(s.geometry,t?200:30,{units:"meters"});let o;t?o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:o=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const h=new u({geometry:{type:"polygon",rings:y.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:o}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const s of e.subDistricts)this.drawArea(s,!1);const i=e.crosses.map(s=>new u({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:{type:"simple-marker",style:s.isKey?"diamond":"circle",color:e.areaColor,size:s.isKey?16:8,outline:{color:s.isKey?"red":"white",width:s.isKey?2:1}},attributes:{type:"cross",id:s.id,name:s.name,color:e.areaColor,signalId:s.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:s.isKey},popupTemplate:{title:s.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}}));this.crossLayer.addMany(i)}}exports.default=w;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.137",
3
+ "version": "1.0.138",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [