gisviewer-vue3-arcgis 1.0.124 → 1.0.126
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,8 +1,8 @@
|
|
|
1
1
|
import n from "@arcgis/core/Graphic";
|
|
2
2
|
import s from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
-
import
|
|
3
|
+
import p from "@turf/convex";
|
|
4
4
|
import * as c from "@turf/helpers";
|
|
5
|
-
import
|
|
5
|
+
import u from "./district-controller.mjs";
|
|
6
6
|
class C {
|
|
7
7
|
constructor(e) {
|
|
8
8
|
this.view = e, this.view.popup.visibleElements = {
|
|
@@ -29,8 +29,8 @@ class C {
|
|
|
29
29
|
}
|
|
30
30
|
showSignalControlArea(e) {
|
|
31
31
|
for (const t of e) {
|
|
32
|
-
const
|
|
33
|
-
this.drawArea(
|
|
32
|
+
const a = new u(t);
|
|
33
|
+
this.drawArea(a, !0);
|
|
34
34
|
}
|
|
35
35
|
return { status: 0, message: "ok" };
|
|
36
36
|
}
|
|
@@ -40,32 +40,32 @@ class C {
|
|
|
40
40
|
}
|
|
41
41
|
locateSignalControlArea(e) {
|
|
42
42
|
let t = this.districtControllerLayer.graphics.find(
|
|
43
|
-
(
|
|
43
|
+
(a) => a.attributes.id === e.id
|
|
44
44
|
);
|
|
45
45
|
if (t || (t = this.subDistrictControllerLayer.graphics.find(
|
|
46
|
-
(
|
|
46
|
+
(a) => a.attributes.id === e.id
|
|
47
47
|
)), t || (t = this.crossLayer.graphics.find(
|
|
48
|
-
(
|
|
48
|
+
(a) => a.attributes.id === e.id
|
|
49
49
|
)), t) {
|
|
50
50
|
this.view.goTo(t.geometry);
|
|
51
|
-
const
|
|
51
|
+
const a = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
|
|
52
52
|
return this.view.popup.open({
|
|
53
53
|
features: [t],
|
|
54
|
-
location:
|
|
54
|
+
location: a
|
|
55
55
|
}), { status: 0, message: "ok" };
|
|
56
56
|
}
|
|
57
57
|
return { status: 1, message: "未找到" };
|
|
58
58
|
}
|
|
59
59
|
drawArea(e, t) {
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
),
|
|
65
|
-
if (!
|
|
60
|
+
const a = e.getAllCrossCoordinates();
|
|
61
|
+
if (a.length > 2) {
|
|
62
|
+
const i = c.featureCollection(
|
|
63
|
+
a.map((m) => c.point(m))
|
|
64
|
+
), o = p(i);
|
|
65
|
+
if (!o)
|
|
66
66
|
return;
|
|
67
|
-
let
|
|
68
|
-
t ?
|
|
67
|
+
let r;
|
|
68
|
+
t ? r = [
|
|
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
|
-
] :
|
|
81
|
+
] : r = [
|
|
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:
|
|
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:
|
|
121
|
+
fieldInfos: r
|
|
117
122
|
}
|
|
118
123
|
]
|
|
119
124
|
}
|
|
120
125
|
});
|
|
121
126
|
t ? this.districtControllerLayer.add(l) : this.subDistrictControllerLayer.add(l);
|
|
122
127
|
}
|
|
123
|
-
for (const
|
|
124
|
-
this.drawArea(
|
|
125
|
-
const d = e.crosses.map((
|
|
128
|
+
for (const i of e.subDistricts)
|
|
129
|
+
this.drawArea(i, !1);
|
|
130
|
+
const d = e.crosses.map((i) => new n({
|
|
126
131
|
geometry: {
|
|
127
132
|
type: "point",
|
|
128
|
-
x:
|
|
129
|
-
y:
|
|
133
|
+
x: i.longitude,
|
|
134
|
+
y: i.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:
|
|
139
|
-
name:
|
|
143
|
+
id: i.id,
|
|
144
|
+
name: i.name,
|
|
140
145
|
districtId: t ? e.id : e.parentId,
|
|
141
146
|
subDistrictId: t ? "" : e.id
|
|
142
147
|
},
|
|
143
148
|
popupTemplate: {
|
|
144
|
-
title:
|
|
149
|
+
title: i.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"),
|
|
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"),f=require("@turf/convex"),m=require("@turf/helpers"),y=require("./district-controller.js");function b(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>i[t]})}}return e.default=i,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 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(),(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=f(a);if(!l)return;let s;t?s=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:s=[{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:s}]}});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=g;
|