gisviewer-vue3-arcgis 1.0.125 → 1.0.127

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,12 +1,12 @@
1
1
  import n from "@arcgis/core/Graphic";
2
2
  import s from "@arcgis/core/layers/GraphicsLayer";
3
- import u from "@turf/convex";
3
+ import p from "@turf/convex";
4
4
  import * as c from "@turf/helpers";
5
- import p from "./district-controller.mjs";
5
+ import u from "./district-controller.mjs";
6
6
  class C {
7
7
  constructor(e) {
8
8
  this.view = e, this.view.popup.visibleElements = {
9
- closeButton: !1,
9
+ closeButton: !0,
10
10
  collapseButton: !1,
11
11
  actionBar: !1
12
12
  }, this.districtControllerLayer = new s({
@@ -29,43 +29,43 @@ class C {
29
29
  }
30
30
  showSignalControlArea(e) {
31
31
  for (const t of e) {
32
- const i = new p(t);
33
- this.drawArea(i, !0);
32
+ const r = new u(t);
33
+ this.drawArea(r, !0);
34
34
  }
35
35
  return { status: 0, message: "ok" };
36
36
  }
37
37
  clearSignalControlArea() {
38
38
  var e;
39
- return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), (e = this.eventHandle) == null || e.remove(), this.view.closePopup(), { status: 0, message: "ok" };
39
+ return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), (e = this.eventHandle) == null || e.remove(), this.view.closePopup(), { status: 0, message: "ok" };
40
40
  }
41
41
  locateSignalControlArea(e) {
42
42
  let t = this.districtControllerLayer.graphics.find(
43
- (i) => i.attributes.id === e.id
43
+ (r) => r.attributes.id === e.id
44
44
  );
45
45
  if (t || (t = this.subDistrictControllerLayer.graphics.find(
46
- (i) => i.attributes.id === e.id
46
+ (r) => r.attributes.id === e.id
47
47
  )), t || (t = this.crossLayer.graphics.find(
48
- (i) => i.attributes.id === e.id
48
+ (r) => r.attributes.id === e.id
49
49
  )), t) {
50
50
  this.view.goTo(t.geometry);
51
- const i = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
51
+ const r = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
52
52
  return this.view.popup.open({
53
53
  features: [t],
54
- location: i
54
+ location: r
55
55
  }), { status: 0, message: "ok" };
56
56
  }
57
57
  return { status: 1, message: "未找到" };
58
58
  }
59
59
  drawArea(e, t) {
60
- const i = e.getAllCrossCoordinates();
61
- if (i.length > 2) {
62
- const r = c.featureCollection(
63
- i.map((m) => c.point(m))
64
- ), a = u(r);
65
- if (!a)
60
+ const r = e.getAllCrossCoordinates();
61
+ if (r.length > 2) {
62
+ const a = c.featureCollection(
63
+ r.map((m) => c.point(m))
64
+ ), o = p(a);
65
+ if (!o)
66
66
  return;
67
- let o;
68
- t ? o = [
67
+ let i;
68
+ t ? i = [
69
69
  {
70
70
  fieldName: "id",
71
71
  label: "区控编号"
@@ -78,7 +78,11 @@ class C {
78
78
  fieldName: "subDistrictCount",
79
79
  label: "子区数量"
80
80
  }
81
- ] : o = [
81
+ ] : i = [
82
+ {
83
+ fieldName: "parentId",
84
+ label: "区控编号"
85
+ },
82
86
  {
83
87
  fieldName: "id",
84
88
  label: "子区编号"
@@ -91,7 +95,7 @@ class C {
91
95
  const l = new n({
92
96
  geometry: {
93
97
  type: "polygon",
94
- rings: a.geometry.coordinates
98
+ rings: o.geometry.coordinates
95
99
  },
96
100
  symbol: {
97
101
  type: "simple-fill",
@@ -105,6 +109,7 @@ class C {
105
109
  type: "signalControlArea",
106
110
  id: e.id,
107
111
  name: e.name,
112
+ parentId: e.parentId,
108
113
  crossCount: e.crossCount,
109
114
  subDistrictCount: e.subDistrictCount
110
115
  },
@@ -113,20 +118,20 @@ class C {
113
118
  content: [
114
119
  {
115
120
  type: "fields",
116
- fieldInfos: o
121
+ fieldInfos: i
117
122
  }
118
123
  ]
119
124
  }
120
125
  });
121
126
  t ? this.districtControllerLayer.add(l) : this.subDistrictControllerLayer.add(l);
122
127
  }
123
- for (const r of e.subDistricts)
124
- this.drawArea(r, !1);
125
- const d = e.crosses.map((r) => new n({
128
+ for (const a of e.subDistricts)
129
+ this.drawArea(a, !1);
130
+ const d = e.crosses.map((a) => new n({
126
131
  geometry: {
127
132
  type: "point",
128
- x: r.longitude,
129
- y: r.latitude
133
+ x: a.longitude,
134
+ y: a.latitude
130
135
  },
131
136
  symbol: {
132
137
  type: "simple-marker",
@@ -135,13 +140,13 @@ class C {
135
140
  },
136
141
  attributes: {
137
142
  type: "cross",
138
- id: r.id,
139
- name: r.name,
143
+ id: a.id,
144
+ name: a.name,
140
145
  districtId: t ? e.id : e.parentId,
141
146
  subDistrictId: t ? "" : e.id
142
147
  },
143
148
  popupTemplate: {
144
- title: r.name,
149
+ title: a.name,
145
150
  content: [
146
151
  {
147
152
  type: "fields",
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),a=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/convex"),m=require("@turf/helpers"),y=require("./district-controller.js");function b(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=b(m);class g{constructor(e){this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.districtControllerLayer=new a({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new a({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new a({id:"crossLayer",maxScale:0,minScale:18056}),this.view.map.addMany([this.crossLayer,this.districtControllerLayer,this.subDistrictControllerLayer])}showSignalControlArea(e){for(const t of e){const r=new y.default(t);this.drawArea(r,!0)}return{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),(e=this.eventHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}locateSignalControlArea(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e.id);if(t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e.id)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e.id)),t){this.view.goTo(t.geometry);const r=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.popup.open({features:[t],location:r}),{status:0,message:"ok"}}return{status:1,message:"未找到"}}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>2){const i=u.featureCollection(r.map(p=>u.point(p))),l=f(i);if(!l)return;let o;t?o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:o=[{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const n=new c({geometry:{type:"polygon",rings:l.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.5],outline:{color:e.areaColor,width:1}},attributes:{type:"signalControlArea",id:e.id,name:e.name,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:o}]}});t?this.districtControllerLayer.add(n):this.subDistrictControllerLayer.add(n)}for(const i of e.subDistricts)this.drawArea(i,!1);const d=e.crosses.map(i=>new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8},attributes:{type:"cross",id:i.id,name:i.name,districtId:t?e.id:e.parentId,subDistrictId:t?"":e.id},popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"路口编号"},{fieldName:"districtId",label:"区控编号"},{fieldName:"subDistrictId",label:"子区编号"}]}]}}));this.crossLayer.addMany(d)}}exports.default=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),o=require("@arcgis/core/layers/GraphicsLayer"),m=require("@turf/convex"),f=require("@turf/helpers"),y=require("./district-controller.js");function b(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=b(f);class h{constructor(e){this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1},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:18056}),this.view.map.addMany([this.crossLayer,this.districtControllerLayer,this.subDistrictControllerLayer])}showSignalControlArea(e){for(const t of e){const r=new y.default(t);this.drawArea(r,!0)}return{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),(e=this.eventHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}locateSignalControlArea(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e.id);if(t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e.id)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e.id)),t){this.view.goTo(t.geometry);const r=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.popup.open({features:[t],location:r}),{status:0,message:"ok"}}return{status:1,message:"未找到"}}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>2){const a=u.featureCollection(r.map(p=>u.point(p))),l=m(a);if(!l)return;let i;t?i=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:i=[{fieldName:"parentId",label:"区控编号"},{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const n=new c({geometry:{type:"polygon",rings:l.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.5],outline:{color:e.areaColor,width:1}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:i}]}});t?this.districtControllerLayer.add(n):this.subDistrictControllerLayer.add(n)}for(const a of e.subDistricts)this.drawArea(a,!1);const d=e.crosses.map(a=>new c({geometry:{type:"point",x:a.longitude,y:a.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8},attributes:{type:"cross",id:a.id,name:a.name,districtId:t?e.id:e.parentId,subDistrictId:t?"":e.id},popupTemplate:{title:a.name,content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"路口编号"},{fieldName:"districtId",label:"区控编号"},{fieldName:"subDistrictId",label:"子区编号"}]}]}}));this.crossLayer.addMany(d)}}exports.default=h;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.125",
3
+ "version": "1.0.127",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [