gisviewer-vue3-arcgis 1.0.138 → 1.0.139

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.
@@ -13,6 +13,7 @@ export default class SignalControlAreaController {
13
13
  locateSignalControlArea(params: {
14
14
  id: string;
15
15
  }): Promise<IResult>;
16
+ private showPopup;
16
17
  highlightSignalControlArea(params: {
17
18
  id: string;
18
19
  }): Promise<IResult>;
@@ -1,29 +1,29 @@
1
1
  import * as g from "@arcgis/core/core/reactiveUtils.js";
2
- import h from "@arcgis/core/Graphic";
3
- import a from "@arcgis/core/layers/GraphicsLayer";
2
+ import n from "@arcgis/core/Graphic";
3
+ import o from "@arcgis/core/layers/GraphicsLayer";
4
4
  import m from "@turf/buffer";
5
5
  import d from "@turf/convex";
6
6
  import * as l from "@turf/helpers";
7
- import b from "./district-controller.mjs";
7
+ import p from "./district-controller.mjs";
8
8
  class C {
9
9
  constructor(e) {
10
10
  this.crossScale = 3e3, this.view = e, this.view.popup.visibleElements = {
11
11
  closeButton: !0,
12
12
  collapseButton: !1,
13
13
  actionBar: !0
14
- }, this.districtControllerLayer = new a({
14
+ }, this.districtControllerLayer = new o({
15
15
  id: "districtControllerLayer",
16
16
  maxScale: 144447,
17
17
  minScale: 1155582
18
- }), this.subDistrictControllerLayer = new a({
18
+ }), this.subDistrictControllerLayer = new o({
19
19
  id: "subDistrictControllerLayer",
20
20
  maxScale: 0,
21
21
  minScale: 144447
22
- }), this.crossLayer = new a({
22
+ }), this.crossLayer = new o({
23
23
  id: "crossLayer",
24
24
  maxScale: 0,
25
25
  minScale: 36112
26
- }), this.highlightLayer = new a({
26
+ }), this.highlightLayer = new o({
27
27
  id: "highlightLayer"
28
28
  }), this.view.map.addMany([
29
29
  this.districtControllerLayer,
@@ -34,50 +34,50 @@ class C {
34
34
  }
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
- for (const t of e) {
38
- const r = new b(t);
37
+ for (const i of e) {
38
+ const r = new p(i);
39
39
  this.drawArea(r, !0);
40
40
  }
41
41
  return this.watchHandle = g.watch(
42
42
  () => this.view.scale,
43
- (t, r) => {
44
- t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((i) => {
45
- i.symbol = {
43
+ (i, r) => {
44
+ i > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((t) => {
45
+ t.symbol = {
46
46
  type: "simple-marker",
47
- style: i.getAttribute("isKey") ? "diamond" : "circle",
48
- color: i.getAttribute("color"),
49
- size: i.getAttribute("isKey") ? 16 : 8,
47
+ style: t.getAttribute("isKey") ? "diamond" : "circle",
48
+ color: t.getAttribute("color"),
49
+ size: t.getAttribute("isKey") ? 16 : 8,
50
50
  outline: {
51
- color: i.getAttribute("isKey") ? "red" : "white",
52
- width: i.getAttribute("isKey") ? 2 : 1
51
+ color: t.getAttribute("isKey") ? "red" : "white",
52
+ width: t.getAttribute("isKey") ? 2 : 1
53
53
  }
54
54
  };
55
- }), this.highlightLayer.graphics.forEach((i) => {
56
- i.getAttribute("type") === "cross" && (i.symbol = {
55
+ }), this.highlightLayer.graphics.forEach((t) => {
56
+ t.getAttribute("type") === "cross" && (t.symbol = {
57
57
  type: "simple-marker",
58
- style: i.getAttribute("isKey") ? "diamond" : "circle",
59
- color: i.getAttribute("color"),
60
- size: i.getAttribute("isKey") ? 16 : 8,
58
+ style: t.getAttribute("isKey") ? "diamond" : "circle",
59
+ color: t.getAttribute("color"),
60
+ size: t.getAttribute("isKey") ? 16 : 8,
61
61
  outline: {
62
- color: i.getAttribute("isKey") ? "red" : "white",
63
- width: i.getAttribute("isKey") ? 2 : 1
62
+ color: t.getAttribute("isKey") ? "red" : "white",
63
+ width: t.getAttribute("isKey") ? 2 : 1
64
64
  }
65
65
  });
66
- })) : t <= this.crossScale && r > this.crossScale && (this.crossLayer.graphics.forEach((i) => {
67
- i.symbol = {
66
+ })) : i <= this.crossScale && r > this.crossScale && (this.crossLayer.graphics.forEach((t) => {
67
+ t.symbol = {
68
68
  type: "picture-marker",
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"
69
+ url: `/GisViewerAssets/Images/xhj_${t.getAttribute("isKey") ? 4 : 1}.png`,
70
+ width: t.getAttribute("isKey") ? "55px" : "37px",
71
+ height: t.getAttribute("isKey") ? "85px" : "57px",
72
+ yoffset: t.getAttribute("isKey") ? "37px" : "25px"
73
73
  };
74
- }), this.highlightLayer.graphics.forEach((i) => {
75
- i.getAttribute("type") === "cross" && (i.symbol = {
74
+ }), this.highlightLayer.graphics.forEach((t) => {
75
+ t.getAttribute("type") === "cross" && (t.symbol = {
76
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"
77
+ url: `/GisViewerAssets/Images/xhj_${t.getAttribute("isKey") ? 4 : 1}.png`,
78
+ width: t.getAttribute("isKey") ? "55px" : "37px",
79
+ height: t.getAttribute("isKey") ? "85px" : "57px",
80
+ yoffset: t.getAttribute("isKey") ? "37px" : "25px"
81
81
  });
82
82
  }));
83
83
  }
@@ -88,31 +88,30 @@ class C {
88
88
  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" };
89
89
  }
90
90
  async locateSignalControlArea(e) {
91
- const t = this.findAreaGraphic(e.id);
92
- if (t) {
93
- t.attributes.type === "cross" ? await this.view.goTo({
94
- target: t.geometry,
95
- scale: 1500
96
- }) : await this.view.goTo(t.geometry);
97
- const r = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
98
- return this.view.openPopup({
99
- features: [t],
100
- location: r
101
- }), { status: 0, message: "ok" };
102
- } else
103
- return { status: 1, message: "未找到" };
91
+ const i = this.findAreaGraphic(e.id);
92
+ return i ? (i.attributes.type === "cross" ? await this.view.goTo({
93
+ target: i.geometry,
94
+ scale: 1500
95
+ }) : await this.view.goTo(i.geometry), this.showPopup(i), { status: 0, message: "ok" }) : { status: 1, message: "未找到" };
96
+ }
97
+ showPopup(e) {
98
+ const i = e.geometry.type === "point" ? e.geometry : e.geometry.centroid;
99
+ this.view.openPopup({
100
+ features: [e],
101
+ location: i
102
+ });
104
103
  }
105
104
  async highlightSignalControlArea(e) {
106
105
  this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1;
107
- const t = this.districtControllerLayer.graphics.filter((s) => s.getAttribute("id") === e.id).toArray().map((s) => s.clone()), r = this.subDistrictControllerLayer.graphics.filter(
106
+ const i = this.districtControllerLayer.graphics.filter((s) => s.getAttribute("id") === e.id).toArray().map((s) => s.clone()), r = this.subDistrictControllerLayer.graphics.filter(
108
107
  (s) => s.getAttribute("id") === e.id || s.getAttribute("parentId") === e.id
109
- ).toArray().map((s) => s.clone()), i = this.crossLayer.graphics.filter(
108
+ ).toArray().map((s) => s.clone()), t = this.crossLayer.graphics.filter(
110
109
  (s) => s.getAttribute("id") === e.id || s.getAttribute("districtId") === e.id || s.getAttribute("subDistrictId") === e.id
111
110
  ).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
+ return i.length > 0 && this.highlightLayer.addMany(i), r.length > 0 && (this.highlightLayer.addMany(r), this.showPopup(r[0])), t.length > 0 && this.highlightLayer.addMany(t), this.highlightLayer.graphics.length === 0 ? { status: 1, message: "未找到" } : (i.length > 0 ? (await this.view.goTo(i), this.showPopup(i[0])) : r.length > 0 ? (await this.view.goTo(r), this.showPopup(r[0])) : (t.length > 1 ? await this.view.goTo(t) : await this.view.goTo({
112
+ target: t[0].geometry,
114
113
  scale: 1500
115
- }), { status: 0, message: "ok" });
114
+ }), this.showPopup(t[0])), { status: 0, message: "ok" });
116
115
  }
117
116
  resetHighlight() {
118
117
  return this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0, this.crossLayer.visible = !0, { status: 0, message: "ok" };
@@ -123,12 +122,12 @@ class C {
123
122
  * @returns
124
123
  */
125
124
  findAreaGraphic(e) {
126
- let t = this.districtControllerLayer.graphics.find(
125
+ let i = this.districtControllerLayer.graphics.find(
127
126
  (r) => r.attributes.id === e
128
127
  );
129
- return t || (t = this.subDistrictControllerLayer.graphics.find(
128
+ return i || (i = this.subDistrictControllerLayer.graphics.find(
130
129
  (r) => r.attributes.id === e
131
- )), t || (t = this.crossLayer.graphics.find((r) => r.attributes.id === e)), t;
130
+ )), i || (i = this.crossLayer.graphics.find((r) => r.attributes.id === e)), i;
132
131
  }
133
132
  /**
134
133
  * 绘制区控与子区
@@ -136,7 +135,7 @@ class C {
136
135
  * @param isDistrict 是否是区控
137
136
  * @returns
138
137
  */
139
- drawArea(e, t) {
138
+ drawArea(e, i) {
140
139
  const r = e.getAllCrossCoordinates();
141
140
  if (r.length >= 2) {
142
141
  let s = null;
@@ -153,13 +152,13 @@ class C {
153
152
  const y = m(
154
153
  s.geometry,
155
154
  // 区控面积更大,需要更大的缓冲半径
156
- t ? 200 : 30,
155
+ i ? 200 : 30,
157
156
  {
158
157
  units: "meters"
159
158
  }
160
159
  );
161
- let o;
162
- t ? o = [
160
+ let a;
161
+ i ? a = [
163
162
  {
164
163
  fieldName: "id",
165
164
  label: "区控编号"
@@ -172,7 +171,7 @@ class C {
172
171
  fieldName: "subDistrictCount",
173
172
  label: "子区数量"
174
173
  }
175
- ] : o = [
174
+ ] : a = [
176
175
  {
177
176
  fieldName: "parentName",
178
177
  label: "所属区控"
@@ -182,18 +181,18 @@ class C {
182
181
  label: "路口数量"
183
182
  }
184
183
  ];
185
- const n = new h({
184
+ const h = new n({
186
185
  geometry: {
187
186
  type: "polygon",
188
187
  rings: y.geometry.coordinates
189
188
  },
190
189
  symbol: {
191
190
  type: "simple-fill",
192
- color: [...e.areaColor, t ? 0.6 : 0.8],
191
+ color: [...e.areaColor, i ? 0.6 : 0.8],
193
192
  outline: {
194
193
  color: e.areaColor,
195
194
  width: 2,
196
- style: t ? "solid" : "long-dash"
195
+ style: i ? "solid" : "long-dash"
197
196
  }
198
197
  },
199
198
  attributes: {
@@ -206,20 +205,20 @@ class C {
206
205
  subDistrictCount: e.subDistrictCount
207
206
  },
208
207
  popupTemplate: {
209
- title: `${t ? "区控" : "子区"} ${e.name}`,
208
+ title: `${i ? "区控" : "子区"} ${e.name}`,
210
209
  content: [
211
210
  {
212
211
  type: "fields",
213
- fieldInfos: o
212
+ fieldInfos: a
214
213
  }
215
214
  ]
216
215
  }
217
216
  });
218
- t ? this.districtControllerLayer.add(n) : this.subDistrictControllerLayer.add(n);
217
+ i ? this.districtControllerLayer.add(h) : this.subDistrictControllerLayer.add(h);
219
218
  }
220
219
  for (const s of e.subDistricts)
221
220
  this.drawArea(s, !1);
222
- const i = e.crosses.map((s) => new h({
221
+ const t = e.crosses.map((s) => new n({
223
222
  geometry: {
224
223
  type: "point",
225
224
  x: s.longitude,
@@ -241,10 +240,10 @@ class C {
241
240
  name: s.name,
242
241
  color: e.areaColor,
243
242
  signalId: s.signalId,
244
- districtId: t ? e.id : e.parentId,
245
- districtName: t ? e.name : e.parentName,
246
- subDistrictId: t ? "" : e.id,
247
- subDistrictName: t ? "" : e.name,
243
+ districtId: i ? e.id : e.parentId,
244
+ districtName: i ? e.name : e.parentName,
245
+ subDistrictId: i ? "" : e.id,
246
+ subDistrictName: i ? "" : e.name,
248
247
  isKey: s.isKey
249
248
  },
250
249
  popupTemplate: {
@@ -274,7 +273,7 @@ class C {
274
273
  ]
275
274
  }
276
275
  }));
277
- this.crossLayer.addMany(i);
276
+ this.crossLayer.addMany(t);
278
277
  }
279
278
  }
280
279
  export {
@@ -13,6 +13,7 @@ export default class SignalControlAreaController {
13
13
  locateSignalControlArea(params: {
14
14
  id: string;
15
15
  }): Promise<IResult>;
16
+ private showPopup;
16
17
  highlightSignalControlArea(params: {
17
18
  id: string;
18
19
  }): Promise<IResult>;
@@ -1 +1 @@
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;
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"),o=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/buffer"),p=require("@turf/convex"),f=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 w=c(m),n=c(f);class L{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 A.default(t);this.drawArea(r,!0)}return this.watchHandle=w.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);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),this.showPopup(t),{status:0,message:"ok"}):{status:1,message:"未找到"}}showPopup(e){const t=e.geometry.type==="point"?e.geometry:e.geometry.centroid;this.view.openPopup({features:[e],location:t})}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),this.showPopup(r[0])),i.length>0&&this.highlightLayer.addMany(i),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(t.length>0?(await this.view.goTo(t),this.showPopup(t[0])):r.length>0?(await this.view.goTo(r),this.showPopup(r[0])):(i.length>1?await this.view.goTo(i):await this.view.goTo({target:i[0].geometry,scale:1500}),this.showPopup(i[0])),{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=p(g)}if(!s)return;const y=b(s.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{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:l}]}});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=L;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.138",
3
+ "version": "1.0.139",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [