gisviewer-vue3-arcgis 1.0.134 → 1.0.136
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.
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +1 -0
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +5 -4
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +2 -1
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +77 -24
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +2 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class i {
|
|
2
2
|
constructor(t) {
|
|
3
3
|
this.parentName = "", this.crosses = [], this.subDistricts = [], this.areaColor = [
|
|
4
4
|
Math.floor(Math.random() * 255),
|
|
@@ -7,7 +7,7 @@ class r {
|
|
|
7
7
|
], this.crossCount = 0, this.subDistrictCount = 0, this.id = t.id, this.name = t.name, this.parentId = t.parentId;
|
|
8
8
|
for (const s of t.children)
|
|
9
9
|
if (s.children) {
|
|
10
|
-
const o = new
|
|
10
|
+
const o = new i(s);
|
|
11
11
|
o.parentName = this.name, o.areaColor = this.areaColor, this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
|
|
12
12
|
} else {
|
|
13
13
|
const o = {
|
|
@@ -15,7 +15,8 @@ class r {
|
|
|
15
15
|
name: s.name,
|
|
16
16
|
parentId: s.parentId,
|
|
17
17
|
latitude: Number(s.latitude),
|
|
18
|
-
longitude: Number(s.longitude)
|
|
18
|
+
longitude: Number(s.longitude),
|
|
19
|
+
signalId: s.signalId
|
|
19
20
|
};
|
|
20
21
|
this.crosses.push(o), this.crossCount++;
|
|
21
22
|
}
|
|
@@ -30,5 +31,5 @@ class r {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
export {
|
|
33
|
-
|
|
34
|
+
i as default
|
|
34
35
|
};
|
|
@@ -5,7 +5,8 @@ export default class SignalControlAreaController {
|
|
|
5
5
|
private subDistrictControllerLayer;
|
|
6
6
|
private crossLayer;
|
|
7
7
|
private highlightLayer;
|
|
8
|
-
private
|
|
8
|
+
private watchHandle?;
|
|
9
|
+
private readonly crossScale;
|
|
9
10
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
10
11
|
showSignalControlArea(params: any): IResult;
|
|
11
12
|
clearSignalControlArea(): IResult;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as m from "@arcgis/core/core/reactiveUtils.js";
|
|
2
|
+
import n from "@arcgis/core/Graphic";
|
|
2
3
|
import a from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
4
|
+
import u from "@turf/buffer";
|
|
5
|
+
import d from "@turf/convex";
|
|
5
6
|
import * as c from "@turf/helpers";
|
|
6
|
-
import
|
|
7
|
+
import p from "./district-controller.mjs";
|
|
7
8
|
class C {
|
|
8
9
|
constructor(e) {
|
|
9
|
-
this.view = e, this.view.popup.visibleElements = {
|
|
10
|
+
this.crossScale = 3e3, this.view = e, this.view.popup.visibleElements = {
|
|
10
11
|
closeButton: !0,
|
|
11
12
|
collapseButton: !1,
|
|
12
13
|
actionBar: !0
|
|
@@ -34,19 +35,62 @@ class C {
|
|
|
34
35
|
showSignalControlArea(e) {
|
|
35
36
|
this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0;
|
|
36
37
|
for (const t of e) {
|
|
37
|
-
const r = new
|
|
38
|
+
const r = new p(t);
|
|
38
39
|
this.drawArea(r, !0);
|
|
39
40
|
}
|
|
40
|
-
return
|
|
41
|
+
return this.watchHandle = m.watch(
|
|
42
|
+
() => this.view.scale,
|
|
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
|
+
});
|
|
65
|
+
});
|
|
66
|
+
else if (t <= this.crossScale && r > this.crossScale) {
|
|
67
|
+
const s = {
|
|
68
|
+
type: "picture-marker",
|
|
69
|
+
url: "/GisViewerAssets/Images/xhj_1.png",
|
|
70
|
+
width: "37px",
|
|
71
|
+
height: "57px",
|
|
72
|
+
yoffset: "25px"
|
|
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);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
), { status: 0, message: "ok" };
|
|
41
82
|
}
|
|
42
83
|
clearSignalControlArea() {
|
|
43
84
|
var e;
|
|
44
|
-
return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), (e = this.
|
|
85
|
+
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" };
|
|
45
86
|
}
|
|
46
87
|
async locateSignalControlArea(e) {
|
|
47
88
|
const t = this.findAreaGraphic(e.id);
|
|
48
89
|
if (t) {
|
|
49
|
-
await this.view.goTo(
|
|
90
|
+
t.attributes.type === "cross" ? await this.view.goTo({
|
|
91
|
+
target: t.geometry,
|
|
92
|
+
scale: 1500
|
|
93
|
+
}) : await this.view.goTo(t.geometry);
|
|
50
94
|
const r = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
|
|
51
95
|
return this.view.openPopup({
|
|
52
96
|
features: [t],
|
|
@@ -62,9 +106,10 @@ class C {
|
|
|
62
106
|
).toArray().map((i) => i.clone()), s = this.crossLayer.graphics.filter(
|
|
63
107
|
(i) => i.getAttribute("id") === e.id || i.getAttribute("districtId") === e.id || i.getAttribute("subDistrictId") === e.id
|
|
64
108
|
).toArray().map((i) => i.clone());
|
|
65
|
-
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: "未找到" } : (await this.view.goTo(
|
|
66
|
-
|
|
67
|
-
|
|
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,
|
|
111
|
+
scale: 1500
|
|
112
|
+
}), { status: 0, message: "ok" });
|
|
68
113
|
}
|
|
69
114
|
resetHighlight() {
|
|
70
115
|
return this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0, this.crossLayer.visible = !0, { status: 0, message: "ok" };
|
|
@@ -92,11 +137,11 @@ class C {
|
|
|
92
137
|
const r = e.getAllCrossCoordinates();
|
|
93
138
|
if (r.length > 2) {
|
|
94
139
|
const i = c.featureCollection(
|
|
95
|
-
r.map((
|
|
96
|
-
), l =
|
|
140
|
+
r.map((y) => c.point(y))
|
|
141
|
+
), l = d(i);
|
|
97
142
|
if (!l)
|
|
98
143
|
return;
|
|
99
|
-
const
|
|
144
|
+
const g = u(
|
|
100
145
|
l.geometry,
|
|
101
146
|
// 区控面积更大,需要更大的缓冲半径
|
|
102
147
|
t ? 200 : 30,
|
|
@@ -132,10 +177,10 @@ class C {
|
|
|
132
177
|
label: "路口数量"
|
|
133
178
|
}
|
|
134
179
|
];
|
|
135
|
-
const
|
|
180
|
+
const h = new n({
|
|
136
181
|
geometry: {
|
|
137
182
|
type: "polygon",
|
|
138
|
-
rings:
|
|
183
|
+
rings: g.geometry.coordinates
|
|
139
184
|
},
|
|
140
185
|
symbol: {
|
|
141
186
|
type: "simple-fill",
|
|
@@ -165,11 +210,11 @@ class C {
|
|
|
165
210
|
]
|
|
166
211
|
}
|
|
167
212
|
});
|
|
168
|
-
t ? this.districtControllerLayer.add(
|
|
213
|
+
t ? this.districtControllerLayer.add(h) : this.subDistrictControllerLayer.add(h);
|
|
169
214
|
}
|
|
170
215
|
for (const i of e.subDistricts)
|
|
171
216
|
this.drawArea(i, !1);
|
|
172
|
-
const s = e.crosses.map((i) => new
|
|
217
|
+
const s = e.crosses.map((i) => new n({
|
|
173
218
|
geometry: {
|
|
174
219
|
type: "point",
|
|
175
220
|
x: i.longitude,
|
|
@@ -188,8 +233,12 @@ class C {
|
|
|
188
233
|
type: "cross",
|
|
189
234
|
id: i.id,
|
|
190
235
|
name: i.name,
|
|
236
|
+
color: e.areaColor,
|
|
237
|
+
signalId: i.signalId,
|
|
191
238
|
districtId: t ? e.id : e.parentId,
|
|
192
|
-
|
|
239
|
+
districtName: t ? e.name : e.parentName,
|
|
240
|
+
subDistrictId: t ? "" : e.id,
|
|
241
|
+
subDistrictName: t ? "" : e.name
|
|
193
242
|
},
|
|
194
243
|
popupTemplate: {
|
|
195
244
|
title: i.name,
|
|
@@ -198,16 +247,20 @@ class C {
|
|
|
198
247
|
type: "fields",
|
|
199
248
|
fieldInfos: [
|
|
200
249
|
{
|
|
201
|
-
fieldName: "
|
|
202
|
-
label: "
|
|
250
|
+
fieldName: "districtName",
|
|
251
|
+
label: "区控名称"
|
|
203
252
|
},
|
|
204
253
|
{
|
|
205
|
-
fieldName: "
|
|
206
|
-
label: "
|
|
254
|
+
fieldName: "subDistrictName",
|
|
255
|
+
label: "子区名称"
|
|
207
256
|
},
|
|
208
257
|
{
|
|
209
258
|
fieldName: "id",
|
|
210
259
|
label: "路口编号"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
fieldName: "signalId",
|
|
263
|
+
label: "信号机编号"
|
|
211
264
|
}
|
|
212
265
|
]
|
|
213
266
|
}
|
|
@@ -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)};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(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;
|
|
@@ -5,7 +5,8 @@ export default class SignalControlAreaController {
|
|
|
5
5
|
private subDistrictControllerLayer;
|
|
6
6
|
private crossLayer;
|
|
7
7
|
private highlightLayer;
|
|
8
|
-
private
|
|
8
|
+
private watchHandle?;
|
|
9
|
+
private readonly crossScale;
|
|
9
10
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
10
11
|
showSignalControlArea(params: any): IResult;
|
|
11
12
|
clearSignalControlArea(): IResult;
|
|
@@ -1 +1 @@
|
|
|
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"),
|
|
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;
|