gisviewer-vue3-arcgis 1.0.137 → 1.0.139
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 +2 -1
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +1 -0
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +114 -108
- 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 +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as g from "@arcgis/core/core/reactiveUtils.js";
|
|
2
2
|
import n from "@arcgis/core/Graphic";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import o from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
+
import m from "@turf/buffer";
|
|
5
5
|
import d from "@turf/convex";
|
|
6
|
-
import * as
|
|
6
|
+
import * as l from "@turf/helpers";
|
|
7
7
|
import p from "./district-controller.mjs";
|
|
8
8
|
class C {
|
|
9
9
|
constructor(e) {
|
|
@@ -11,19 +11,19 @@ class C {
|
|
|
11
11
|
closeButton: !0,
|
|
12
12
|
collapseButton: !1,
|
|
13
13
|
actionBar: !0
|
|
14
|
-
}, this.districtControllerLayer = new
|
|
14
|
+
}, this.districtControllerLayer = new o({
|
|
15
15
|
id: "districtControllerLayer",
|
|
16
16
|
maxScale: 144447,
|
|
17
17
|
minScale: 1155582
|
|
18
|
-
}), this.subDistrictControllerLayer = new
|
|
18
|
+
}), this.subDistrictControllerLayer = new o({
|
|
19
19
|
id: "subDistrictControllerLayer",
|
|
20
20
|
maxScale: 0,
|
|
21
21
|
minScale: 144447
|
|
22
|
-
}), this.crossLayer = new
|
|
22
|
+
}), this.crossLayer = new o({
|
|
23
23
|
id: "crossLayer",
|
|
24
24
|
maxScale: 0,
|
|
25
25
|
minScale: 36112
|
|
26
|
-
}), this.highlightLayer = new
|
|
26
|
+
}), this.highlightLayer = new o({
|
|
27
27
|
id: "highlightLayer"
|
|
28
28
|
}), this.view.map.addMany([
|
|
29
29
|
this.districtControllerLayer,
|
|
@@ -34,49 +34,52 @@ class C {
|
|
|
34
34
|
}
|
|
35
35
|
showSignalControlArea(e) {
|
|
36
36
|
this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0;
|
|
37
|
-
for (const
|
|
38
|
-
const r = new p(
|
|
37
|
+
for (const i of e) {
|
|
38
|
+
const r = new p(i);
|
|
39
39
|
this.drawArea(r, !0);
|
|
40
40
|
}
|
|
41
|
-
return this.watchHandle =
|
|
41
|
+
return this.watchHandle = g.watch(
|
|
42
42
|
() => this.view.scale,
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
43
|
+
(i, r) => {
|
|
44
|
+
i > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((t) => {
|
|
45
|
+
t.symbol = {
|
|
46
|
+
type: "simple-marker",
|
|
47
|
+
style: t.getAttribute("isKey") ? "diamond" : "circle",
|
|
48
|
+
color: t.getAttribute("color"),
|
|
49
|
+
size: t.getAttribute("isKey") ? 16 : 8,
|
|
50
|
+
outline: {
|
|
51
|
+
color: t.getAttribute("isKey") ? "red" : "white",
|
|
52
|
+
width: t.getAttribute("isKey") ? 2 : 1
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}), this.highlightLayer.graphics.forEach((t) => {
|
|
56
|
+
t.getAttribute("type") === "cross" && (t.symbol = {
|
|
57
|
+
type: "simple-marker",
|
|
58
|
+
style: t.getAttribute("isKey") ? "diamond" : "circle",
|
|
59
|
+
color: t.getAttribute("color"),
|
|
60
|
+
size: t.getAttribute("isKey") ? 16 : 8,
|
|
61
|
+
outline: {
|
|
62
|
+
color: t.getAttribute("isKey") ? "red" : "white",
|
|
63
|
+
width: t.getAttribute("isKey") ? 2 : 1
|
|
64
|
+
}
|
|
65
65
|
});
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
})) : i <= this.crossScale && r > this.crossScale && (this.crossLayer.graphics.forEach((t) => {
|
|
67
|
+
t.symbol = {
|
|
68
68
|
type: "picture-marker",
|
|
69
|
-
url:
|
|
70
|
-
width: "37px",
|
|
71
|
-
height: "57px",
|
|
72
|
-
yoffset: "25px"
|
|
69
|
+
url: `/GisViewerAssets/Images/xhj_${t.getAttribute("isKey") ? 4 : 1}.png`,
|
|
70
|
+
width: t.getAttribute("isKey") ? "55px" : "37px",
|
|
71
|
+
height: t.getAttribute("isKey") ? "85px" : "57px",
|
|
72
|
+
yoffset: t.getAttribute("isKey") ? "37px" : "25px"
|
|
73
73
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
}), this.highlightLayer.graphics.forEach((t) => {
|
|
75
|
+
t.getAttribute("type") === "cross" && (t.symbol = {
|
|
76
|
+
type: "picture-marker",
|
|
77
|
+
url: `/GisViewerAssets/Images/xhj_${t.getAttribute("isKey") ? 4 : 1}.png`,
|
|
78
|
+
width: t.getAttribute("isKey") ? "55px" : "37px",
|
|
79
|
+
height: t.getAttribute("isKey") ? "85px" : "57px",
|
|
80
|
+
yoffset: t.getAttribute("isKey") ? "37px" : "25px"
|
|
78
81
|
});
|
|
79
|
-
}
|
|
82
|
+
}));
|
|
80
83
|
}
|
|
81
84
|
), { status: 0, message: "ok" };
|
|
82
85
|
}
|
|
@@ -85,31 +88,30 @@ class C {
|
|
|
85
88
|
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" };
|
|
86
89
|
}
|
|
87
90
|
async locateSignalControlArea(e) {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
return { status: 1, message: "未找到" };
|
|
91
|
+
const i = this.findAreaGraphic(e.id);
|
|
92
|
+
return i ? (i.attributes.type === "cross" ? await this.view.goTo({
|
|
93
|
+
target: i.geometry,
|
|
94
|
+
scale: 1500
|
|
95
|
+
}) : await this.view.goTo(i.geometry), this.showPopup(i), { status: 0, message: "ok" }) : { status: 1, message: "未找到" };
|
|
96
|
+
}
|
|
97
|
+
showPopup(e) {
|
|
98
|
+
const i = e.geometry.type === "point" ? e.geometry : e.geometry.centroid;
|
|
99
|
+
this.view.openPopup({
|
|
100
|
+
features: [e],
|
|
101
|
+
location: i
|
|
102
|
+
});
|
|
101
103
|
}
|
|
102
104
|
async highlightSignalControlArea(e) {
|
|
103
105
|
this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1;
|
|
104
|
-
const
|
|
105
|
-
(
|
|
106
|
-
).toArray().map((
|
|
107
|
-
(
|
|
108
|
-
).toArray().map((
|
|
109
|
-
return
|
|
110
|
-
target:
|
|
106
|
+
const i = this.districtControllerLayer.graphics.filter((s) => s.getAttribute("id") === e.id).toArray().map((s) => s.clone()), r = this.subDistrictControllerLayer.graphics.filter(
|
|
107
|
+
(s) => s.getAttribute("id") === e.id || s.getAttribute("parentId") === e.id
|
|
108
|
+
).toArray().map((s) => s.clone()), t = this.crossLayer.graphics.filter(
|
|
109
|
+
(s) => s.getAttribute("id") === e.id || s.getAttribute("districtId") === e.id || s.getAttribute("subDistrictId") === e.id
|
|
110
|
+
).toArray().map((s) => s.clone());
|
|
111
|
+
return i.length > 0 && this.highlightLayer.addMany(i), r.length > 0 && (this.highlightLayer.addMany(r), this.showPopup(r[0])), t.length > 0 && this.highlightLayer.addMany(t), this.highlightLayer.graphics.length === 0 ? { status: 1, message: "未找到" } : (i.length > 0 ? (await this.view.goTo(i), this.showPopup(i[0])) : r.length > 0 ? (await this.view.goTo(r), this.showPopup(r[0])) : (t.length > 1 ? await this.view.goTo(t) : await this.view.goTo({
|
|
112
|
+
target: t[0].geometry,
|
|
111
113
|
scale: 1500
|
|
112
|
-
}), { status: 0, message: "ok" });
|
|
114
|
+
}), this.showPopup(t[0])), { status: 0, message: "ok" });
|
|
113
115
|
}
|
|
114
116
|
resetHighlight() {
|
|
115
117
|
return this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0, this.crossLayer.visible = !0, { status: 0, message: "ok" };
|
|
@@ -120,12 +122,12 @@ class C {
|
|
|
120
122
|
* @returns
|
|
121
123
|
*/
|
|
122
124
|
findAreaGraphic(e) {
|
|
123
|
-
let
|
|
125
|
+
let i = this.districtControllerLayer.graphics.find(
|
|
124
126
|
(r) => r.attributes.id === e
|
|
125
127
|
);
|
|
126
|
-
return
|
|
128
|
+
return i || (i = this.subDistrictControllerLayer.graphics.find(
|
|
127
129
|
(r) => r.attributes.id === e
|
|
128
|
-
)),
|
|
130
|
+
)), i || (i = this.crossLayer.graphics.find((r) => r.attributes.id === e)), i;
|
|
129
131
|
}
|
|
130
132
|
/**
|
|
131
133
|
* 绘制区控与子区
|
|
@@ -133,24 +135,30 @@ class C {
|
|
|
133
135
|
* @param isDistrict 是否是区控
|
|
134
136
|
* @returns
|
|
135
137
|
*/
|
|
136
|
-
drawArea(e,
|
|
138
|
+
drawArea(e, i) {
|
|
137
139
|
const r = e.getAllCrossCoordinates();
|
|
138
|
-
if (r.length
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (
|
|
140
|
+
if (r.length >= 2) {
|
|
141
|
+
let s = null;
|
|
142
|
+
if (r.length === 2)
|
|
143
|
+
s = l.lineString(r);
|
|
144
|
+
else if (r.length > 2) {
|
|
145
|
+
const u = l.featureCollection(
|
|
146
|
+
r.map((c) => l.point(c))
|
|
147
|
+
);
|
|
148
|
+
s = d(u);
|
|
149
|
+
}
|
|
150
|
+
if (!s)
|
|
143
151
|
return;
|
|
144
|
-
const
|
|
145
|
-
|
|
152
|
+
const y = m(
|
|
153
|
+
s.geometry,
|
|
146
154
|
// 区控面积更大,需要更大的缓冲半径
|
|
147
|
-
|
|
155
|
+
i ? 200 : 30,
|
|
148
156
|
{
|
|
149
157
|
units: "meters"
|
|
150
158
|
}
|
|
151
159
|
);
|
|
152
|
-
let
|
|
153
|
-
|
|
160
|
+
let a;
|
|
161
|
+
i ? a = [
|
|
154
162
|
{
|
|
155
163
|
fieldName: "id",
|
|
156
164
|
label: "区控编号"
|
|
@@ -163,14 +171,10 @@ class C {
|
|
|
163
171
|
fieldName: "subDistrictCount",
|
|
164
172
|
label: "子区数量"
|
|
165
173
|
}
|
|
166
|
-
] :
|
|
174
|
+
] : a = [
|
|
167
175
|
{
|
|
168
176
|
fieldName: "parentName",
|
|
169
|
-
label: "
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
fieldName: "id",
|
|
173
|
-
label: "子区编号"
|
|
177
|
+
label: "所属区控"
|
|
174
178
|
},
|
|
175
179
|
{
|
|
176
180
|
fieldName: "crossCount",
|
|
@@ -180,15 +184,15 @@ class C {
|
|
|
180
184
|
const h = new n({
|
|
181
185
|
geometry: {
|
|
182
186
|
type: "polygon",
|
|
183
|
-
rings:
|
|
187
|
+
rings: y.geometry.coordinates
|
|
184
188
|
},
|
|
185
189
|
symbol: {
|
|
186
190
|
type: "simple-fill",
|
|
187
|
-
color: [...e.areaColor,
|
|
191
|
+
color: [...e.areaColor, i ? 0.6 : 0.8],
|
|
188
192
|
outline: {
|
|
189
193
|
color: e.areaColor,
|
|
190
194
|
width: 2,
|
|
191
|
-
style:
|
|
195
|
+
style: i ? "solid" : "long-dash"
|
|
192
196
|
}
|
|
193
197
|
},
|
|
194
198
|
attributes: {
|
|
@@ -201,47 +205,49 @@ class C {
|
|
|
201
205
|
subDistrictCount: e.subDistrictCount
|
|
202
206
|
},
|
|
203
207
|
popupTemplate: {
|
|
204
|
-
title: e.name
|
|
208
|
+
title: `${i ? "区控" : "子区"} ${e.name}`,
|
|
205
209
|
content: [
|
|
206
210
|
{
|
|
207
211
|
type: "fields",
|
|
208
|
-
fieldInfos:
|
|
212
|
+
fieldInfos: a
|
|
209
213
|
}
|
|
210
214
|
]
|
|
211
215
|
}
|
|
212
216
|
});
|
|
213
|
-
|
|
217
|
+
i ? this.districtControllerLayer.add(h) : this.subDistrictControllerLayer.add(h);
|
|
214
218
|
}
|
|
215
|
-
for (const
|
|
216
|
-
this.drawArea(
|
|
217
|
-
const
|
|
219
|
+
for (const s of e.subDistricts)
|
|
220
|
+
this.drawArea(s, !1);
|
|
221
|
+
const t = e.crosses.map((s) => new n({
|
|
218
222
|
geometry: {
|
|
219
223
|
type: "point",
|
|
220
|
-
x:
|
|
221
|
-
y:
|
|
224
|
+
x: s.longitude,
|
|
225
|
+
y: s.latitude
|
|
222
226
|
},
|
|
223
227
|
symbol: {
|
|
224
228
|
type: "simple-marker",
|
|
229
|
+
style: s.isKey ? "diamond" : "circle",
|
|
225
230
|
color: e.areaColor,
|
|
226
|
-
size: 8,
|
|
231
|
+
size: s.isKey ? 16 : 8,
|
|
227
232
|
outline: {
|
|
228
|
-
color: "white",
|
|
229
|
-
width: 1
|
|
233
|
+
color: s.isKey ? "red" : "white",
|
|
234
|
+
width: s.isKey ? 2 : 1
|
|
230
235
|
}
|
|
231
236
|
},
|
|
232
237
|
attributes: {
|
|
233
238
|
type: "cross",
|
|
234
|
-
id:
|
|
235
|
-
name:
|
|
239
|
+
id: s.id,
|
|
240
|
+
name: s.name,
|
|
236
241
|
color: e.areaColor,
|
|
237
|
-
signalId:
|
|
238
|
-
districtId:
|
|
239
|
-
districtName:
|
|
240
|
-
subDistrictId:
|
|
241
|
-
subDistrictName:
|
|
242
|
+
signalId: s.signalId,
|
|
243
|
+
districtId: i ? e.id : e.parentId,
|
|
244
|
+
districtName: i ? e.name : e.parentName,
|
|
245
|
+
subDistrictId: i ? "" : e.id,
|
|
246
|
+
subDistrictName: i ? "" : e.name,
|
|
247
|
+
isKey: s.isKey
|
|
242
248
|
},
|
|
243
249
|
popupTemplate: {
|
|
244
|
-
title:
|
|
250
|
+
title: s.name,
|
|
245
251
|
content: [
|
|
246
252
|
{
|
|
247
253
|
type: "fields",
|
|
@@ -267,7 +273,7 @@ class C {
|
|
|
267
273
|
]
|
|
268
274
|
}
|
|
269
275
|
}));
|
|
270
|
-
this.crossLayer.addMany(
|
|
276
|
+
this.crossLayer.addMany(t);
|
|
271
277
|
}
|
|
272
278
|
}
|
|
273
279
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class e{constructor(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class e{constructor(t){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=t.id,this.name=t.name,this.parentId=t.parentId;for(const s of t.children)if(s.children){const o=new e(s);o.parentName=this.name,o.areaColor=this.areaColor,this.subDistricts.push(o),this.subDistrictCount++,this.crossCount+=o.crossCount}else{const o={id:s.id,name:s.name,parentId:s.parentId,latitude:Number(s.latitude),longitude:Number(s.longitude),signalId:s.signalId,isKey:s.isKey===1};this.crosses.push(o),this.crossCount++}}getAllCrossCoordinates(){const t=[];for(const s of this.crosses)t.push([s.longitude,s.latitude]);for(const s of this.subDistricts)t.push(...s.getAllCrossCoordinates());return t}}exports.default=e;
|
|
@@ -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"),u=require("@arcgis/core/Graphic"),o=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/buffer"),p=require("@turf/convex"),f=require("@turf/helpers"),A=require("./district-controller.js");function c(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=c(m),n=c(f);class L{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 A.default(t);this.drawArea(r,!0)}return this.watchHandle=w.watch(()=>this.view.scale,(t,r)=>{t>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(i=>{i.symbol={type:"simple-marker",style:i.getAttribute("isKey")?"diamond":"circle",color:i.getAttribute("color"),size:i.getAttribute("isKey")?16:8,outline:{color:i.getAttribute("isKey")?"red":"white",width:i.getAttribute("isKey")?2:1}}}),this.highlightLayer.graphics.forEach(i=>{i.getAttribute("type")==="cross"&&(i.symbol={type:"simple-marker",style:i.getAttribute("isKey")?"diamond":"circle",color:i.getAttribute("color"),size:i.getAttribute("isKey")?16:8,outline:{color:i.getAttribute("isKey")?"red":"white",width:i.getAttribute("isKey")?2:1}})})):t<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(i=>{i.symbol={type:"picture-marker",url:`/GisViewerAssets/Images/xhj_${i.getAttribute("isKey")?4:1}.png`,width:i.getAttribute("isKey")?"55px":"37px",height:i.getAttribute("isKey")?"85px":"57px",yoffset:i.getAttribute("isKey")?"37px":"25px"}}),this.highlightLayer.graphics.forEach(i=>{i.getAttribute("type")==="cross"&&(i.symbol={type:"picture-marker",url:`/GisViewerAssets/Images/xhj_${i.getAttribute("isKey")?4:1}.png`,width:i.getAttribute("isKey")?"55px":"37px",height:i.getAttribute("isKey")?"85px":"57px",yoffset:i.getAttribute("isKey")?"37px":"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);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(s=>s.getAttribute("id")===e.id).toArray().map(s=>s.clone()),r=this.subDistrictControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("parentId")===e.id).toArray().map(s=>s.clone()),i=this.crossLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("districtId")===e.id||s.getAttribute("subDistrictId")===e.id).toArray().map(s=>s.clone());return t.length>0&&this.highlightLayer.addMany(t),r.length>0&&(this.highlightLayer.addMany(r),this.showPopup(r[0])),i.length>0&&this.highlightLayer.addMany(i),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])):(i.length>1?await this.view.goTo(i):await this.view.goTo({target:i[0].geometry,scale:1500}),this.showPopup(i[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(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){let s=null;if(r.length===2)s=n.lineString(r);else if(r.length>2){const g=n.featureCollection(r.map(d=>n.point(d)));s=p(g)}if(!s)return;const y=b(s.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const h=new u({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:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const s of e.subDistricts)this.drawArea(s,!1);const i=e.crosses.map(s=>new u({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:{type:"simple-marker",style:s.isKey?"diamond":"circle",color:e.areaColor,size:s.isKey?16:8,outline:{color:s.isKey?"red":"white",width:s.isKey?2:1}},attributes:{type:"cross",id:s.id,name:s.name,color:e.areaColor,signalId:s.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:s.isKey},popupTemplate:{title:s.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}}));this.crossLayer.addMany(i)}}exports.default=L;
|