gisviewer-vue3-arcgis 1.0.141 → 1.0.142
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,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as g from "@arcgis/core/core/reactiveUtils.js";
|
|
2
2
|
import y from "@arcgis/core/Graphic";
|
|
3
3
|
import o from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import * as
|
|
4
|
+
import d from "@turf/buffer";
|
|
5
|
+
import f from "@turf/concave";
|
|
6
|
+
import m from "@turf/convex";
|
|
7
|
+
import * as h from "@turf/helpers";
|
|
8
8
|
import b from "./district-controller.mjs";
|
|
9
9
|
class x {
|
|
10
10
|
constructor(e) {
|
|
@@ -36,13 +36,13 @@ class x {
|
|
|
36
36
|
showSignalControlArea(e) {
|
|
37
37
|
this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0;
|
|
38
38
|
for (const t of e) {
|
|
39
|
-
const
|
|
40
|
-
this.drawArea(
|
|
39
|
+
const r = new b(t);
|
|
40
|
+
this.drawArea(r, !0);
|
|
41
41
|
}
|
|
42
|
-
return this.watchHandle =
|
|
42
|
+
return this.watchHandle = g.watch(
|
|
43
43
|
() => this.view.scale,
|
|
44
|
-
(t,
|
|
45
|
-
t > this.crossScale &&
|
|
44
|
+
(t, r) => {
|
|
45
|
+
t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((s) => {
|
|
46
46
|
s.symbol = this.getCrossGraphicSymbol(
|
|
47
47
|
s.attributes,
|
|
48
48
|
"marker"
|
|
@@ -52,7 +52,7 @@ class x {
|
|
|
52
52
|
s.attributes,
|
|
53
53
|
"marker"
|
|
54
54
|
));
|
|
55
|
-
})) : t <= this.crossScale &&
|
|
55
|
+
})) : t <= this.crossScale && r > this.crossScale && (this.crossLayer.graphics.forEach((s) => {
|
|
56
56
|
s.symbol = this.getCrossGraphicSymbol(
|
|
57
57
|
s.attributes,
|
|
58
58
|
"picture"
|
|
@@ -86,12 +86,12 @@ class x {
|
|
|
86
86
|
}
|
|
87
87
|
async highlightSignalControlArea(e) {
|
|
88
88
|
this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1;
|
|
89
|
-
const t = this.districtControllerLayer.graphics.filter((
|
|
90
|
-
(
|
|
91
|
-
).toArray().map((
|
|
92
|
-
(
|
|
93
|
-
).toArray().map((
|
|
94
|
-
return t.length > 0 && this.highlightLayer.addMany(t),
|
|
89
|
+
const t = this.districtControllerLayer.graphics.filter((i) => i.getAttribute("id") === e.id).toArray().map((i) => i.clone()), r = this.subDistrictControllerLayer.graphics.filter(
|
|
90
|
+
(i) => i.getAttribute("id") === e.id || i.getAttribute("parentId") === e.id
|
|
91
|
+
).toArray().map((i) => i.clone()), s = this.crossLayer.graphics.filter(
|
|
92
|
+
(i) => i.getAttribute("id") === e.id || i.getAttribute("districtId") === e.id || i.getAttribute("subDistrictId") === e.id
|
|
93
|
+
).toArray().map((i) => i.clone());
|
|
94
|
+
return t.length > 0 && this.highlightLayer.addMany(t), r.length > 0 && (this.highlightLayer.addMany(r), this.showPopup(r[0])), s.length > 0 && this.highlightLayer.addMany(s), this.highlightLayer.graphics.length === 0 ? { status: 1, message: "未找到" } : (t.length > 0 ? (await this.view.goTo(t), this.showPopup(t[0])) : r.length > 0 ? (await this.view.goTo(r), this.showPopup(r[0])) : (s.length > 1 ? await this.view.goTo(s) : await this.view.goTo({
|
|
95
95
|
target: s[0].geometry,
|
|
96
96
|
scale: 1500
|
|
97
97
|
}), this.showPopup(s[0])), { status: 0, message: "ok" });
|
|
@@ -106,11 +106,11 @@ class x {
|
|
|
106
106
|
*/
|
|
107
107
|
findAreaGraphic(e) {
|
|
108
108
|
let t = this.districtControllerLayer.graphics.find(
|
|
109
|
-
(
|
|
109
|
+
(r) => r.attributes.id === e
|
|
110
110
|
);
|
|
111
111
|
return t || (t = this.subDistrictControllerLayer.graphics.find(
|
|
112
|
-
(
|
|
113
|
-
)), t || (t = this.crossLayer.graphics.find((
|
|
112
|
+
(r) => r.attributes.id === e
|
|
113
|
+
)), t || (t = this.crossLayer.graphics.find((r) => r.attributes.id === e)), t;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* 绘制区控与子区
|
|
@@ -119,23 +119,23 @@ class x {
|
|
|
119
119
|
* @returns
|
|
120
120
|
*/
|
|
121
121
|
drawArea(e, t) {
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
let
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
else if (
|
|
128
|
-
const
|
|
129
|
-
|
|
122
|
+
const r = e.getAllCrossCoordinates();
|
|
123
|
+
if (r.length >= 2) {
|
|
124
|
+
let i = null;
|
|
125
|
+
if (r.length === 2)
|
|
126
|
+
i = h.lineString(r);
|
|
127
|
+
else if (r.length > 2) {
|
|
128
|
+
const n = h.featureCollection(
|
|
129
|
+
r.map((p) => h.point(p))
|
|
130
130
|
);
|
|
131
|
-
|
|
131
|
+
t ? i = m(n) : (i = f(n, { maxEdge: 400, units: "meters" }), i || (i = m(n)));
|
|
132
132
|
}
|
|
133
|
-
if (!
|
|
133
|
+
if (!i) {
|
|
134
134
|
console.log("生成区控面失败", e);
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
const a =
|
|
138
|
-
|
|
137
|
+
const a = d(
|
|
138
|
+
i.geometry,
|
|
139
139
|
// 区控面积更大,需要更大的缓冲半径
|
|
140
140
|
t ? 200 : 30,
|
|
141
141
|
{
|
|
@@ -166,7 +166,7 @@ class x {
|
|
|
166
166
|
label: "路口数量"
|
|
167
167
|
}
|
|
168
168
|
];
|
|
169
|
-
const
|
|
169
|
+
const u = {
|
|
170
170
|
type: "signalControlArea",
|
|
171
171
|
id: e.id,
|
|
172
172
|
name: e.name,
|
|
@@ -174,7 +174,7 @@ class x {
|
|
|
174
174
|
parentName: e.parentName,
|
|
175
175
|
crossCount: e.crossCount,
|
|
176
176
|
subDistrictCount: e.subDistrictCount
|
|
177
|
-
},
|
|
177
|
+
}, c = new y({
|
|
178
178
|
geometry: {
|
|
179
179
|
type: "polygon",
|
|
180
180
|
rings: a.geometry.coordinates
|
|
@@ -188,7 +188,7 @@ class x {
|
|
|
188
188
|
style: t ? "solid" : "long-dash"
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
|
-
attributes:
|
|
191
|
+
attributes: u,
|
|
192
192
|
popupTemplate: {
|
|
193
193
|
title: `${t ? "区控" : "子区"} ${e.name}`,
|
|
194
194
|
content: [
|
|
@@ -199,33 +199,33 @@ class x {
|
|
|
199
199
|
]
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
|
-
t ? this.districtControllerLayer.add(
|
|
202
|
+
t ? this.districtControllerLayer.add(c) : this.subDistrictControllerLayer.add(c);
|
|
203
203
|
}
|
|
204
|
-
for (const
|
|
205
|
-
this.drawArea(
|
|
206
|
-
const s = e.crosses.map((
|
|
204
|
+
for (const i of e.subDistricts)
|
|
205
|
+
this.drawArea(i, !1);
|
|
206
|
+
const s = e.crosses.map((i) => {
|
|
207
207
|
const a = {
|
|
208
208
|
type: "cross",
|
|
209
|
-
id:
|
|
210
|
-
name:
|
|
209
|
+
id: i.id,
|
|
210
|
+
name: i.name,
|
|
211
211
|
color: e.areaColor,
|
|
212
|
-
signalId:
|
|
212
|
+
signalId: i.signalId,
|
|
213
213
|
districtId: t ? e.id : e.parentId,
|
|
214
214
|
districtName: t ? e.name : e.parentName,
|
|
215
215
|
subDistrictId: t ? "" : e.id,
|
|
216
216
|
subDistrictName: t ? "" : e.name,
|
|
217
|
-
isKey:
|
|
217
|
+
isKey: i.isKey
|
|
218
218
|
};
|
|
219
219
|
return new y({
|
|
220
220
|
geometry: {
|
|
221
221
|
type: "point",
|
|
222
|
-
x:
|
|
223
|
-
y:
|
|
222
|
+
x: i.longitude,
|
|
223
|
+
y: i.latitude
|
|
224
224
|
},
|
|
225
225
|
symbol: this.getCrossGraphicSymbol(a, "marker"),
|
|
226
226
|
attributes: a,
|
|
227
227
|
popupTemplate: {
|
|
228
|
-
title:
|
|
228
|
+
title: i.name,
|
|
229
229
|
content: [
|
|
230
230
|
{
|
|
231
231
|
type: "fields",
|
|
@@ -261,16 +261,16 @@ class x {
|
|
|
261
261
|
* @returns
|
|
262
262
|
*/
|
|
263
263
|
getCrossGraphicSymbol(e, t) {
|
|
264
|
-
const { isKey:
|
|
264
|
+
const { isKey: r, color: s } = e;
|
|
265
265
|
if (t === "marker")
|
|
266
266
|
return {
|
|
267
267
|
type: "simple-marker",
|
|
268
|
-
style:
|
|
268
|
+
style: r ? "diamond" : "circle",
|
|
269
269
|
color: s,
|
|
270
|
-
size:
|
|
270
|
+
size: r ? 16 : 8,
|
|
271
271
|
outline: {
|
|
272
|
-
color:
|
|
273
|
-
width:
|
|
272
|
+
color: r ? "red" : "white",
|
|
273
|
+
width: r ? 2 : 1
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
if (t === "picture")
|
|
@@ -317,7 +317,7 @@ class x {
|
|
|
317
317
|
height: 12,
|
|
318
318
|
horizontalAlignment: "Center",
|
|
319
319
|
offsetX: 0,
|
|
320
|
-
offsetY:
|
|
320
|
+
offsetY: r ? 30 : 22,
|
|
321
321
|
haloSize: 1,
|
|
322
322
|
haloSymbol: {
|
|
323
323
|
type: "CIMPolygonSymbol",
|
|
@@ -356,10 +356,10 @@ class x {
|
|
|
356
356
|
y: 0
|
|
357
357
|
},
|
|
358
358
|
anchorPointUnits: "Relative",
|
|
359
|
-
size:
|
|
359
|
+
size: r ? 45 : 30,
|
|
360
360
|
rotateClockwise: !0,
|
|
361
361
|
textureFilter: "Picture",
|
|
362
|
-
url: `/GisViewerAssets/Images/xhj_${
|
|
362
|
+
url: `/GisViewerAssets/Images/xhj_${r ? 4 : 1}.png`
|
|
363
363
|
}
|
|
364
364
|
]
|
|
365
365
|
}
|
|
@@ -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 b=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/buffer"),L=require("@turf/concave"),m=require("@turf/convex"),v=require("@turf/helpers"),C=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 i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const w=g(b),c=g(v);class S{constructor(e){this.crossScale=3e3,this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0},this.districtControllerLayer=new l({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new l({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new l({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new l({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 i=new C.default(t);this.drawArea(i,!0)}return this.watchHandle=w.watch(()=>this.view.scale,(t,i)=>{t>this.crossScale&&i<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&i>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{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);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),this.showPopup(t),{status:0,message:"ok"}):{status:1,message:"未找到"}}showPopup(e){const t=e.geometry.type==="point"?e.geometry:e.geometry.centroid;this.view.openPopup({features:[e],location:t})}async highlightSignalControlArea(e){this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id).toArray().map(r=>r.clone()),i=this.subDistrictControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("parentId")===e.id).toArray().map(r=>r.clone()),s=this.crossLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("districtId")===e.id||r.getAttribute("subDistrictId")===e.id).toArray().map(r=>r.clone());return t.length>0&&this.highlightLayer.addMany(t),i.length>0&&(this.highlightLayer.addMany(i),this.showPopup(i[0])),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(t.length>0?(await this.view.goTo(t),this.showPopup(t[0])):i.length>0?(await this.view.goTo(i),this.showPopup(i[0])):(s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500}),this.showPopup(s[0])),{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(i=>i.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(i=>i.attributes.id===e)),t||(t=this.crossLayer.graphics.find(i=>i.attributes.id===e)),t}drawArea(e,t){const i=e.getAllCrossCoordinates();if(i.length>=2){let r=null;if(i.length===2)r=c.lineString(i);else if(i.length>2){const h=c.featureCollection(i.map(d=>c.point(d)));t?r=m(h):(r=L(h,{maxEdge:400,units:"meters"}),r||(r=m(h)))}if(!r){console.log("生成区控面失败",e);return}const o=f(r.geometry,t?200:30,{units:"meters"});let n;t?n=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:n=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const p={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},u=new y({geometry:{type:"polygon",rings:o.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:p,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:n}]}});t?this.districtControllerLayer.add(u):this.subDistrictControllerLayer.add(u)}for(const r of e.subDistricts)this.drawArea(r,!1);const s=e.crosses.map(r=>{const o={type:"cross",id:r.id,name:r.name,color:e.areaColor,signalId:r.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:r.isKey};return new y({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossGraphicSymbol(o,"marker"),attributes:o,popupTemplate:{title:r.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}})});this.crossLayer.addMany(s)}getCrossGraphicSymbol(e,t){const{isKey:i,color:s}=e;if(t==="marker")return{type:"simple-marker",style:i?"diamond":"circle",color:s,size:i?16:8,outline:{color:i?"red":"white",width:i?2:1}};if(t==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:i?30:22,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:i?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${i?4:1}.png`}]}}}}}exports.default=S;
|