gisviewer-vue3-arcgis 1.0.135 → 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.
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as m from "@arcgis/core/core/reactiveUtils.js";
|
|
2
2
|
import n from "@arcgis/core/Graphic";
|
|
3
3
|
import a from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
-
import
|
|
4
|
+
import u from "@turf/buffer";
|
|
5
5
|
import d from "@turf/convex";
|
|
6
6
|
import * as c from "@turf/helpers";
|
|
7
7
|
import p from "./district-controller.mjs";
|
|
8
8
|
class C {
|
|
9
9
|
constructor(e) {
|
|
10
|
-
this.crossScale =
|
|
10
|
+
this.crossScale = 3e3, this.view = e, this.view.popup.visibleElements = {
|
|
11
11
|
closeButton: !0,
|
|
12
12
|
collapseButton: !1,
|
|
13
13
|
actionBar: !0
|
|
@@ -38,28 +38,45 @@ class C {
|
|
|
38
38
|
const r = new p(t);
|
|
39
39
|
this.drawArea(r, !0);
|
|
40
40
|
}
|
|
41
|
-
return this.watchHandle =
|
|
41
|
+
return this.watchHandle = m.watch(
|
|
42
42
|
() => this.view.scale,
|
|
43
43
|
(t, r) => {
|
|
44
|
-
t > this.crossScale && r <= this.crossScale
|
|
45
|
-
s
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
s
|
|
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 = {
|
|
56
68
|
type: "picture-marker",
|
|
57
|
-
url: "/GisViewerAssets/
|
|
69
|
+
url: "/GisViewerAssets/Images/xhj_1.png",
|
|
58
70
|
width: "37px",
|
|
59
71
|
height: "57px",
|
|
60
72
|
yoffset: "25px"
|
|
61
73
|
};
|
|
62
|
-
|
|
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
|
+
}
|
|
63
80
|
}
|
|
64
81
|
), { status: 0, message: "ok" };
|
|
65
82
|
}
|
|
@@ -70,7 +87,10 @@ class C {
|
|
|
70
87
|
async locateSignalControlArea(e) {
|
|
71
88
|
const t = this.findAreaGraphic(e.id);
|
|
72
89
|
if (t) {
|
|
73
|
-
t.attributes.type === "cross" ? 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);
|
|
74
94
|
const r = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
|
|
75
95
|
return this.view.openPopup({
|
|
76
96
|
features: [t],
|
|
@@ -86,9 +106,10 @@ class C {
|
|
|
86
106
|
).toArray().map((i) => i.clone()), s = this.crossLayer.graphics.filter(
|
|
87
107
|
(i) => i.getAttribute("id") === e.id || i.getAttribute("districtId") === e.id || i.getAttribute("subDistrictId") === e.id
|
|
88
108
|
).toArray().map((i) => i.clone());
|
|
89
|
-
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(
|
|
90
|
-
|
|
91
|
-
|
|
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" });
|
|
92
113
|
}
|
|
93
114
|
resetHighlight() {
|
|
94
115
|
return this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0, this.crossLayer.visible = !0, { status: 0, message: "ok" };
|
|
@@ -116,11 +137,11 @@ class C {
|
|
|
116
137
|
const r = e.getAllCrossCoordinates();
|
|
117
138
|
if (r.length > 2) {
|
|
118
139
|
const i = c.featureCollection(
|
|
119
|
-
r.map((
|
|
140
|
+
r.map((y) => c.point(y))
|
|
120
141
|
), l = d(i);
|
|
121
142
|
if (!l)
|
|
122
143
|
return;
|
|
123
|
-
const
|
|
144
|
+
const g = u(
|
|
124
145
|
l.geometry,
|
|
125
146
|
// 区控面积更大,需要更大的缓冲半径
|
|
126
147
|
t ? 200 : 30,
|
|
@@ -159,7 +180,7 @@ class C {
|
|
|
159
180
|
const h = new n({
|
|
160
181
|
geometry: {
|
|
161
182
|
type: "polygon",
|
|
162
|
-
rings:
|
|
183
|
+
rings: g.geometry.coordinates
|
|
163
184
|
},
|
|
164
185
|
symbol: {
|
|
165
186
|
type: "simple-fill",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/core/reactiveUtils.js"),
|
|
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;
|