gisviewer-vue3-arcgis 1.0.134 → 1.0.135
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 +53 -21
- 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 y 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 g 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 = 1500, this.view = e, this.view.popup.visibleElements = {
|
|
10
11
|
closeButton: !0,
|
|
11
12
|
collapseButton: !1,
|
|
12
13
|
actionBar: !0
|
|
@@ -34,19 +35,42 @@ 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 = y.watch(
|
|
42
|
+
() => this.view.scale,
|
|
43
|
+
(t, r) => {
|
|
44
|
+
t > this.crossScale && r <= this.crossScale ? this.crossLayer.graphics.forEach((s) => {
|
|
45
|
+
s.symbol = {
|
|
46
|
+
type: "simple-marker",
|
|
47
|
+
color: s.getAttribute("color"),
|
|
48
|
+
size: 8,
|
|
49
|
+
outline: {
|
|
50
|
+
color: "white",
|
|
51
|
+
width: 1
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}) : t <= this.crossScale && r > this.crossScale && this.crossLayer.graphics.forEach((s) => {
|
|
55
|
+
s.symbol = {
|
|
56
|
+
type: "picture-marker",
|
|
57
|
+
url: "/GisViewerAssets/images/xhj_1.png",
|
|
58
|
+
width: "37px",
|
|
59
|
+
height: "57px",
|
|
60
|
+
yoffset: "25px"
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
), { status: 0, message: "ok" };
|
|
41
65
|
}
|
|
42
66
|
clearSignalControlArea() {
|
|
43
67
|
var e;
|
|
44
|
-
return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), (e = this.
|
|
68
|
+
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
69
|
}
|
|
46
70
|
async locateSignalControlArea(e) {
|
|
47
71
|
const t = this.findAreaGraphic(e.id);
|
|
48
72
|
if (t) {
|
|
49
|
-
await this.view.goTo(t.geometry);
|
|
73
|
+
t.attributes.type === "cross" ? await this.view.goTo({ target: t.geometry, scale: 3e3 }) : await this.view.goTo(t.geometry);
|
|
50
74
|
const r = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
|
|
51
75
|
return this.view.openPopup({
|
|
52
76
|
features: [t],
|
|
@@ -92,11 +116,11 @@ class C {
|
|
|
92
116
|
const r = e.getAllCrossCoordinates();
|
|
93
117
|
if (r.length > 2) {
|
|
94
118
|
const i = c.featureCollection(
|
|
95
|
-
r.map((
|
|
96
|
-
), l =
|
|
119
|
+
r.map((u) => c.point(u))
|
|
120
|
+
), l = d(i);
|
|
97
121
|
if (!l)
|
|
98
122
|
return;
|
|
99
|
-
const
|
|
123
|
+
const m = g(
|
|
100
124
|
l.geometry,
|
|
101
125
|
// 区控面积更大,需要更大的缓冲半径
|
|
102
126
|
t ? 200 : 30,
|
|
@@ -132,10 +156,10 @@ class C {
|
|
|
132
156
|
label: "路口数量"
|
|
133
157
|
}
|
|
134
158
|
];
|
|
135
|
-
const
|
|
159
|
+
const h = new n({
|
|
136
160
|
geometry: {
|
|
137
161
|
type: "polygon",
|
|
138
|
-
rings:
|
|
162
|
+
rings: m.geometry.coordinates
|
|
139
163
|
},
|
|
140
164
|
symbol: {
|
|
141
165
|
type: "simple-fill",
|
|
@@ -165,11 +189,11 @@ class C {
|
|
|
165
189
|
]
|
|
166
190
|
}
|
|
167
191
|
});
|
|
168
|
-
t ? this.districtControllerLayer.add(
|
|
192
|
+
t ? this.districtControllerLayer.add(h) : this.subDistrictControllerLayer.add(h);
|
|
169
193
|
}
|
|
170
194
|
for (const i of e.subDistricts)
|
|
171
195
|
this.drawArea(i, !1);
|
|
172
|
-
const s = e.crosses.map((i) => new
|
|
196
|
+
const s = e.crosses.map((i) => new n({
|
|
173
197
|
geometry: {
|
|
174
198
|
type: "point",
|
|
175
199
|
x: i.longitude,
|
|
@@ -188,8 +212,12 @@ class C {
|
|
|
188
212
|
type: "cross",
|
|
189
213
|
id: i.id,
|
|
190
214
|
name: i.name,
|
|
215
|
+
color: e.areaColor,
|
|
216
|
+
signalId: i.signalId,
|
|
191
217
|
districtId: t ? e.id : e.parentId,
|
|
192
|
-
|
|
218
|
+
districtName: t ? e.name : e.parentName,
|
|
219
|
+
subDistrictId: t ? "" : e.id,
|
|
220
|
+
subDistrictName: t ? "" : e.name
|
|
193
221
|
},
|
|
194
222
|
popupTemplate: {
|
|
195
223
|
title: i.name,
|
|
@@ -198,16 +226,20 @@ class C {
|
|
|
198
226
|
type: "fields",
|
|
199
227
|
fieldInfos: [
|
|
200
228
|
{
|
|
201
|
-
fieldName: "
|
|
202
|
-
label: "
|
|
229
|
+
fieldName: "districtName",
|
|
230
|
+
label: "区控名称"
|
|
203
231
|
},
|
|
204
232
|
{
|
|
205
|
-
fieldName: "
|
|
206
|
-
label: "
|
|
233
|
+
fieldName: "subDistrictName",
|
|
234
|
+
label: "子区名称"
|
|
207
235
|
},
|
|
208
236
|
{
|
|
209
237
|
fieldName: "id",
|
|
210
238
|
label: "路口编号"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
fieldName: "signalId",
|
|
242
|
+
label: "信号机编号"
|
|
211
243
|
}
|
|
212
244
|
]
|
|
213
245
|
}
|
|
@@ -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
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/core/reactiveUtils.js"),h=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 v=g(m),u=g(b);class w{constructor(e){this.crossScale=1500,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=v.watch(()=>this.view.scale,(t,r)=>{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}}}):t<=this.crossScale&&r>this.crossScale&&this.crossLayer.graphics.forEach(s=>{s.symbol={type:"picture-marker",url:"/GisViewerAssets/images/xhj_1.png",width:"37px",height:"57px",yoffset:"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:3e3}):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:"未找到"}:(await this.view.goTo(t.length>0?t:r.length>0?r:s),{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(y=>u.point(y))),n=f(i);if(!n)return;const d=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 c=new h({geometry:{type:"polygon",rings:d.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(c):this.subDistrictControllerLayer.add(c)}for(const i of e.subDistricts)this.drawArea(i,!1);const s=e.crosses.map(i=>new h({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=w;
|