gisviewer-vue3-arcgis 1.0.230 → 1.0.232
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/district-controller.d.ts +1 -0
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +28 -16
- package/es/src/gis-map/utils/signal-control-area/layer-symbol.d.ts +2 -1
- package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +43 -6
- package/es/src/gis-map/utils/signal-control-area/show-area.d.ts +3 -18
- package/es/src/gis-map/utils/signal-control-area/show-area.mjs +98 -288
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +14 -2
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +208 -39
- package/es/src/types/index.d.ts +6 -0
- package/lib/src/gis-map/utils/signal-control-area/district-controller.d.ts +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/layer-symbol.d.ts +2 -1
- package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/show-area.d.ts +3 -18
- package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +14 -2
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
- package/lib/src/types/index.d.ts +6 -0
- package/package.json +2 -1
|
@@ -1,67 +1,64 @@
|
|
|
1
1
|
import { Polygon as f } from "@arcgis/core/geometry";
|
|
2
|
-
import { webMercatorToGeographic as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.detachmentLayerLoaded = !1, this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0, this.popupEnabled = !0, this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.view = t, this.hasGpu = localStorage.getItem("gpu") !== "Unknown";
|
|
17
|
-
const e = S.useAppDataStore;
|
|
18
|
-
this.mapConfig = JSON.parse(JSON.stringify(e.mapConfig)), this.detachmentLayer = new y(), this.view.map.add(this.detachmentLayer), this.districtRenderer = new C(t, this.hasGpu), this.subDistrictRenderer = new L(t, this.hasGpu), this.signalRenderer = new I(t, this.hasGpu);
|
|
2
|
+
import { webMercatorToGeographic as y } from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
3
|
+
import g from "@arcgis/core/Graphic";
|
|
4
|
+
import m from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
+
import p from "papaparse";
|
|
6
|
+
import R from "../../stores/index.mjs";
|
|
7
|
+
import D from "./district-controller.mjs";
|
|
8
|
+
import w from "./district-renderer.mjs";
|
|
9
|
+
import L from "./signal-renderer.mjs";
|
|
10
|
+
import C from "./sub-district-renderer.mjs";
|
|
11
|
+
class P {
|
|
12
|
+
constructor(e) {
|
|
13
|
+
this.detachmentLayerLoaded = !1, this.view = e, this.hasGpu = localStorage.getItem("gpu") !== "Unknown";
|
|
14
|
+
const t = R.useAppDataStore;
|
|
15
|
+
this.mapConfig = JSON.parse(JSON.stringify(t.mapConfig)), this.detachmentLayer = new m(), this.view.map.add(this.detachmentLayer), this.districtRenderer = new w(e, this.hasGpu), this.subDistrictRenderer = new C(e, this.hasGpu), this.signalRenderer = new L(e, this.hasGpu);
|
|
19
16
|
}
|
|
20
17
|
/**
|
|
21
18
|
* 显示所有区控、子区、信号机
|
|
22
19
|
* @param params
|
|
23
20
|
* @returns
|
|
24
21
|
*/
|
|
25
|
-
async showSignalControlArea(
|
|
26
|
-
this.detachmentLayerLoaded || await this.loadDetachmentLayer(), await this.clearSignalControlArea(), this.districtRenderer.setVisible(!1), this.subDistrictRenderer.setVisible(!1), this.signalRenderer.setClusterVisible(!1), this.signalRenderer.setPointVisible(!1);
|
|
27
|
-
const
|
|
28
|
-
for (const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
async showSignalControlArea(e) {
|
|
23
|
+
this.detachmentLayerLoaded || await this.loadDetachmentLayer(), this.roadLines || (await this.loadRoadLine(), this.subDistrictRenderer.roadLines = this.roadLines), await this.clearSignalControlArea(), this.districtRenderer.setVisible(!1), this.subDistrictRenderer.setVisible(!1), this.signalRenderer.setClusterVisible(!1), this.signalRenderer.setPointVisible(!1);
|
|
24
|
+
const t = [], s = [];
|
|
25
|
+
for (const a of e.areaList) {
|
|
26
|
+
const i = new D(
|
|
27
|
+
a,
|
|
28
|
+
e.style || ""
|
|
32
29
|
);
|
|
33
|
-
|
|
30
|
+
t.push(i), s.push(...i.subDistricts);
|
|
34
31
|
}
|
|
35
|
-
return this.districtRenderer.style =
|
|
32
|
+
return this.districtRenderer.style = e.style || "", await this.districtRenderer.showDistricts(t), await this.subDistrictRenderer.showSubDistricts(s), await this.signalRenderer.showSignals(t), { status: 0, message: "ok" };
|
|
36
33
|
}
|
|
37
34
|
/**
|
|
38
35
|
* 清空区控、子区、信号机
|
|
39
36
|
* @returns
|
|
40
37
|
*/
|
|
41
38
|
async clearSignalControlArea() {
|
|
42
|
-
return
|
|
39
|
+
return await this.districtRenderer.clearDistricts(), await this.subDistrictRenderer.clearSubDistricts(), await this.signalRenderer.clearSignals(), { status: 0, message: "ok" };
|
|
43
40
|
}
|
|
44
41
|
/**
|
|
45
42
|
* 设置区控、子区、信号机图层可见性
|
|
46
43
|
* @param layerName
|
|
47
44
|
* @param visible
|
|
48
45
|
*/
|
|
49
|
-
setLayerVisibility(
|
|
50
|
-
switch (
|
|
46
|
+
setLayerVisibility(e) {
|
|
47
|
+
switch (e.visible === !1 && this.view.closePopup(), e.id) {
|
|
51
48
|
case "district":
|
|
52
|
-
this.districtRenderer.setVisible(
|
|
49
|
+
this.districtRenderer.setVisible(e.visible);
|
|
53
50
|
break;
|
|
54
51
|
case "subDistrict":
|
|
55
|
-
this.subDistrictRenderer.setVisible(
|
|
52
|
+
this.subDistrictRenderer.setVisible(e.visible);
|
|
56
53
|
break;
|
|
57
54
|
case "signal":
|
|
58
|
-
this.signalRenderer.setPointVisible(
|
|
55
|
+
this.signalRenderer.setPointVisible(e.visible);
|
|
59
56
|
break;
|
|
60
57
|
case "signalCluster":
|
|
61
|
-
this.signalRenderer.setClusterVisible(
|
|
58
|
+
this.signalRenderer.setClusterVisible(e.visible);
|
|
62
59
|
break;
|
|
63
60
|
case "shanghai_district":
|
|
64
|
-
this.detachmentLayer.visible =
|
|
61
|
+
this.detachmentLayer.visible = e.visible;
|
|
65
62
|
break;
|
|
66
63
|
}
|
|
67
64
|
return { status: 0, message: "ok" };
|
|
@@ -71,14 +68,14 @@ class T {
|
|
|
71
68
|
* @param params
|
|
72
69
|
* @returns
|
|
73
70
|
*/
|
|
74
|
-
async locateSignalControlArea(
|
|
75
|
-
switch (
|
|
71
|
+
async locateSignalControlArea(e) {
|
|
72
|
+
switch (e.type) {
|
|
76
73
|
case "district":
|
|
77
|
-
return await this.districtRenderer.locateDistrict(
|
|
74
|
+
return await this.districtRenderer.locateDistrict(e.id);
|
|
78
75
|
case "subDistrict":
|
|
79
|
-
return await this.subDistrictRenderer.locateSubDistrict(
|
|
76
|
+
return await this.subDistrictRenderer.locateSubDistrict(e.id);
|
|
80
77
|
case "signal":
|
|
81
|
-
return await this.signalRenderer.locateSignal(
|
|
78
|
+
return await this.signalRenderer.locateSignal(e.id);
|
|
82
79
|
default:
|
|
83
80
|
return { status: 1, message: "未知类型" };
|
|
84
81
|
}
|
|
@@ -88,22 +85,17 @@ class T {
|
|
|
88
85
|
* @param params
|
|
89
86
|
* @returns
|
|
90
87
|
*/
|
|
91
|
-
async highlightSignalControlArea(
|
|
92
|
-
switch (this.view.closePopup(),
|
|
88
|
+
async highlightSignalControlArea(e) {
|
|
89
|
+
switch (this.view.closePopup(), e.type) {
|
|
93
90
|
case "district":
|
|
94
|
-
return await this.districtRenderer.highlightDistrict(
|
|
91
|
+
return await this.districtRenderer.highlightDistrict(e.id) ? (this.subDistrictRenderer.filter("district", e.id), this.signalRenderer.filter("district", e.id), this.roadLines && this.roadLines.length > 0 && await this.subDistrictRenderer.showRoads(e.id), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
|
|
95
92
|
case "subDistrict": {
|
|
96
|
-
const { count:
|
|
97
|
-
return
|
|
93
|
+
const { count: t, parentId: s } = await this.subDistrictRenderer.highlightSubDistrict(e.id);
|
|
94
|
+
return t > 0 ? (this.districtRenderer.filter(s), this.signalRenderer.filter("subDistrict", e.id), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
98
95
|
}
|
|
99
96
|
case "signal": {
|
|
100
|
-
const { districtId:
|
|
101
|
-
return
|
|
102
|
-
{ target: this.signalGraphics, scale: t.scale || 1e3 },
|
|
103
|
-
{
|
|
104
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
105
|
-
}
|
|
106
|
-
), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
|
|
97
|
+
const { districtId: t, subDistrictId: s, count: a } = await this.signalRenderer.highlightSignal(e.id);
|
|
98
|
+
return a > 0 ? (this.districtRenderer.filter(t), this.subDistrictRenderer.filter("subDistrict", s), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
|
|
107
99
|
}
|
|
108
100
|
default:
|
|
109
101
|
return { status: 1, message: "未知类型" };
|
|
@@ -117,259 +109,77 @@ class T {
|
|
|
117
109
|
return this.districtRenderer.resetFilter(), this.subDistrictRenderer.resetFilter(), this.signalRenderer.resetFilter(), { status: 0, message: "ok" };
|
|
118
110
|
}
|
|
119
111
|
/**
|
|
120
|
-
*
|
|
121
|
-
* @param districtController
|
|
122
|
-
* @param isDistrict 是否是区控
|
|
112
|
+
* 获取道路线
|
|
123
113
|
* @returns
|
|
124
114
|
*/
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
a = c.lineString(r);
|
|
131
|
-
else {
|
|
132
|
-
if (e) {
|
|
133
|
-
const i = c.featureCollection(
|
|
134
|
-
r.map((o) => c.point(o))
|
|
135
|
-
);
|
|
136
|
-
a = w(i);
|
|
137
|
-
} else {
|
|
138
|
-
const i = R(r, 0.5);
|
|
139
|
-
i.length >= 4 && (a = c.polygon([i]));
|
|
140
|
-
}
|
|
141
|
-
a || (a = c.lineString(r));
|
|
142
|
-
}
|
|
143
|
-
else if (r.length === 1)
|
|
144
|
-
a = c.point(r[0]);
|
|
145
|
-
else
|
|
115
|
+
async loadRoadLine() {
|
|
116
|
+
var t;
|
|
117
|
+
const e = (t = this.mapConfig.signalControlArea) == null ? void 0 : t.roadLayerUrl;
|
|
118
|
+
if (!e) {
|
|
119
|
+
console.warn("未配置道路线图层URL");
|
|
146
120
|
return;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
id: t.id,
|
|
162
|
-
name: t.name,
|
|
163
|
-
subDistrictCount: t.subDistrictCount,
|
|
164
|
-
signalCount: t.signalCount,
|
|
165
|
-
parentId: t.parentId,
|
|
166
|
-
parentName: t.parentName,
|
|
167
|
-
selected: s,
|
|
168
|
-
type: e ? "district" : "subDistrict"
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
e ? this.districtGraphics.push(l) : this.subDistrictGraphics.push(l);
|
|
172
|
-
for (const i of t.subDistricts)
|
|
173
|
-
this.generateGraphic(i, !1, s);
|
|
174
|
-
t.signals.forEach((i) => {
|
|
175
|
-
const o = new u({
|
|
176
|
-
geometry: {
|
|
177
|
-
type: "point",
|
|
178
|
-
x: i.longitude,
|
|
179
|
-
y: i.latitude
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
const a = await (await fetch(`/GisViewerAssets/${e}`)).text();
|
|
124
|
+
p.parse(a, {
|
|
125
|
+
header: !0,
|
|
126
|
+
skipEmptyLines: !0,
|
|
127
|
+
complete: (i) => {
|
|
128
|
+
const { data: r } = i;
|
|
129
|
+
this.roadLines = r.map((n) => ({
|
|
130
|
+
id: n.ROADSECT_ID,
|
|
131
|
+
fromNode: n.FROM_NODE_ID,
|
|
132
|
+
toNode: n.TO_NODE_ID,
|
|
133
|
+
coordinates: JSON.parse(n.GEOM).coordinates
|
|
134
|
+
}));
|
|
180
135
|
},
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
id: i.id,
|
|
184
|
-
name: i.name,
|
|
185
|
-
signalId: i.signalId,
|
|
186
|
-
nodeId: i.nodeId,
|
|
187
|
-
isKey: i.isKey,
|
|
188
|
-
districtId: e ? t.id : t.parentId,
|
|
189
|
-
districtName: e ? t.name : t.parentName,
|
|
190
|
-
subDistrictId: e ? "" : t.id,
|
|
191
|
-
subDistrictName: e ? "" : t.name,
|
|
192
|
-
type: "signal",
|
|
193
|
-
selected: !0
|
|
136
|
+
error: (i) => {
|
|
137
|
+
console.error("道路线CSV解析失败:", i);
|
|
194
138
|
}
|
|
195
139
|
});
|
|
196
|
-
|
|
197
|
-
|
|
140
|
+
} catch (s) {
|
|
141
|
+
console.error("读取道路线CSV失败:", s);
|
|
142
|
+
}
|
|
198
143
|
}
|
|
199
|
-
// private async viewHitTest(event: __esri.ViewClickEvent) {
|
|
200
|
-
// // 捕捉点击事件
|
|
201
|
-
// const response = await this.view.hitTest(event, {
|
|
202
|
-
// include: [
|
|
203
|
-
// // this.districtControllerSolidLayer,
|
|
204
|
-
// this.subDistrictControllerLayer,
|
|
205
|
-
// this.signalMarkerLayer,
|
|
206
|
-
// this.signalPictureLayer,
|
|
207
|
-
// this.signalClusterLayer
|
|
208
|
-
// ]
|
|
209
|
-
// });
|
|
210
|
-
// const graphicHits = response.results?.filter(
|
|
211
|
-
// (hitResult) => hitResult.type === 'graphic'
|
|
212
|
-
// );
|
|
213
|
-
// if (graphicHits.length === 0) {
|
|
214
|
-
// return;
|
|
215
|
-
// }
|
|
216
|
-
// const hitGraphic = (graphicHits[0] as __esri.GraphicHit).graphic;
|
|
217
|
-
// let centerPoint: __esri.Point | null = null;
|
|
218
|
-
// if (hitGraphic.geometry.type === 'point') {
|
|
219
|
-
// centerPoint = hitGraphic.geometry as __esri.Point;
|
|
220
|
-
// } else if (hitGraphic.geometry.type === 'polyline') {
|
|
221
|
-
// centerPoint = hitGraphic.geometry.extent.center;
|
|
222
|
-
// } else if (hitGraphic.geometry.type === 'polygon') {
|
|
223
|
-
// centerPoint = (hitGraphic.geometry as __esri.Polygon).centroid;
|
|
224
|
-
// }
|
|
225
|
-
// if (centerPoint !== null)
|
|
226
|
-
// await this.view.goTo(centerPoint, { duration: 1000 });
|
|
227
|
-
// // 未选中的同级graphic置灰
|
|
228
|
-
// const clickedType = hitGraphic.getAttribute('type');
|
|
229
|
-
// const clickedId = hitGraphic.getAttribute('id');
|
|
230
|
-
// switch (clickedType) {
|
|
231
|
-
// case 'district': {
|
|
232
|
-
// let result = await this.districtControllerSolidLayer.queryFeatures();
|
|
233
|
-
// result.features.forEach((feature) => {
|
|
234
|
-
// feature.attributes.selected = feature.attributes.id === clickedId;
|
|
235
|
-
// });
|
|
236
|
-
// await this.districtControllerSolidLayer.applyEdits({
|
|
237
|
-
// updateFeatures: result.features
|
|
238
|
-
// });
|
|
239
|
-
// result = await this.districtControllerDashLayer.queryFeatures();
|
|
240
|
-
// result.features.forEach((feature) => {
|
|
241
|
-
// feature.attributes.selected = feature.attributes.id === clickedId;
|
|
242
|
-
// });
|
|
243
|
-
// await this.districtControllerDashLayer.applyEdits({
|
|
244
|
-
// updateFeatures: result.features
|
|
245
|
-
// });
|
|
246
|
-
// break;
|
|
247
|
-
// }
|
|
248
|
-
// case 'subDistrict': {
|
|
249
|
-
// let result = await this.subDistrictControllerLayer.queryFeatures();
|
|
250
|
-
// result.features.forEach((feature) => {
|
|
251
|
-
// feature.attributes.selected = feature.attributes.id === clickedId;
|
|
252
|
-
// });
|
|
253
|
-
// await this.subDistrictControllerLayer.applyEdits({
|
|
254
|
-
// updateFeatures: result.features
|
|
255
|
-
// });
|
|
256
|
-
// // 其他子区的信号机置灰
|
|
257
|
-
// result = await this.signalMarkerLayer.queryFeatures();
|
|
258
|
-
// result.features.forEach((feature) => {
|
|
259
|
-
// feature.attributes.selected =
|
|
260
|
-
// feature.attributes.subDistrictId === clickedId;
|
|
261
|
-
// });
|
|
262
|
-
// let editResult = await this.signalMarkerLayer.applyEdits({
|
|
263
|
-
// updateFeatures: result.features
|
|
264
|
-
// });
|
|
265
|
-
// result = await this.signalPictureLayer.queryFeatures();
|
|
266
|
-
// result.features.forEach((feature) => {
|
|
267
|
-
// feature.attributes.selected =
|
|
268
|
-
// feature.attributes.subDistrictId === clickedId;
|
|
269
|
-
// });
|
|
270
|
-
// editResult = await this.signalPictureLayer.applyEdits({
|
|
271
|
-
// updateFeatures: result.features
|
|
272
|
-
// });
|
|
273
|
-
// break;
|
|
274
|
-
// }
|
|
275
|
-
// }
|
|
276
|
-
// reactiveUtils.when(
|
|
277
|
-
// () => this.view.popup.visible === false,
|
|
278
|
-
// async () => {
|
|
279
|
-
// await this.resetSelectedSymbol(clickedType);
|
|
280
|
-
// },
|
|
281
|
-
// {
|
|
282
|
-
// once: true
|
|
283
|
-
// }
|
|
284
|
-
// );
|
|
285
|
-
// }
|
|
286
|
-
/**
|
|
287
|
-
* 重置所有graphic的置灰状态
|
|
288
|
-
*/
|
|
289
|
-
// private async resetSelectedSymbol(type: string) {
|
|
290
|
-
// switch (type) {
|
|
291
|
-
// case 'district': {
|
|
292
|
-
// let result = await this.districtControllerSolidLayer.queryFeatures();
|
|
293
|
-
// result.features.forEach((feature) => {
|
|
294
|
-
// feature.attributes.selected = true;
|
|
295
|
-
// });
|
|
296
|
-
// await this.districtControllerSolidLayer.applyEdits({
|
|
297
|
-
// updateFeatures: result.features
|
|
298
|
-
// });
|
|
299
|
-
// result = await this.districtControllerDashLayer.queryFeatures();
|
|
300
|
-
// result.features.forEach((feature) => {
|
|
301
|
-
// feature.attributes.selected = true;
|
|
302
|
-
// });
|
|
303
|
-
// await this.districtControllerDashLayer.applyEdits({
|
|
304
|
-
// updateFeatures: result.features
|
|
305
|
-
// });
|
|
306
|
-
// break;
|
|
307
|
-
// }
|
|
308
|
-
// case 'subDistrict': {
|
|
309
|
-
// let result = await this.subDistrictControllerLayer.queryFeatures();
|
|
310
|
-
// result.features.forEach((feature) => {
|
|
311
|
-
// feature.attributes.selected = true;
|
|
312
|
-
// });
|
|
313
|
-
// await this.subDistrictControllerLayer.applyEdits({
|
|
314
|
-
// updateFeatures: result.features
|
|
315
|
-
// });
|
|
316
|
-
// result = await this.signalMarkerLayer.queryFeatures();
|
|
317
|
-
// result.features.forEach((feature) => {
|
|
318
|
-
// feature.attributes.selected = true;
|
|
319
|
-
// });
|
|
320
|
-
// await this.signalMarkerLayer.applyEdits({
|
|
321
|
-
// updateFeatures: result.features
|
|
322
|
-
// });
|
|
323
|
-
// result = await this.signalPictureLayer.queryFeatures();
|
|
324
|
-
// result.features.forEach((feature) => {
|
|
325
|
-
// feature.attributes.selected = true;
|
|
326
|
-
// });
|
|
327
|
-
// await this.signalPictureLayer.applyEdits({
|
|
328
|
-
// updateFeatures: result.features
|
|
329
|
-
// });
|
|
330
|
-
// break;
|
|
331
|
-
// }
|
|
332
|
-
// }
|
|
333
|
-
// }
|
|
334
144
|
/**
|
|
335
145
|
* 加载支队图层
|
|
336
146
|
* 现场环境用url创建FeatureLayer有各种问题,
|
|
337
147
|
* 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
|
|
338
148
|
*/
|
|
339
149
|
async loadDetachmentLayer() {
|
|
340
|
-
const
|
|
341
|
-
if (!
|
|
150
|
+
const e = this.mapConfig.baseLayers;
|
|
151
|
+
if (!e)
|
|
342
152
|
return;
|
|
343
|
-
const
|
|
153
|
+
const t = e.find(
|
|
344
154
|
(s) => s.options.id === "shanghai_district"
|
|
345
155
|
);
|
|
346
|
-
if (
|
|
156
|
+
if (t)
|
|
347
157
|
try {
|
|
348
|
-
const
|
|
158
|
+
const a = await (await fetch(
|
|
349
159
|
"/GisViewerAssets/ShangHai/Layers/district.json"
|
|
350
|
-
)).json(),
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
354
|
-
let
|
|
355
|
-
rings:
|
|
160
|
+
)).json(), i = [], { renderer: r, labelingInfo: n } = t.options;
|
|
161
|
+
a.features.forEach((d) => {
|
|
162
|
+
const c = d.attributes.ZD_NAME;
|
|
163
|
+
if (c !== "高架支队") {
|
|
164
|
+
let l = new f({
|
|
165
|
+
rings: d.geometry.rings
|
|
356
166
|
});
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
geometry:
|
|
360
|
-
attributes:
|
|
167
|
+
l = y(l);
|
|
168
|
+
const o = new g({
|
|
169
|
+
geometry: l,
|
|
170
|
+
attributes: d.attributes
|
|
361
171
|
});
|
|
362
|
-
if (
|
|
363
|
-
if (
|
|
364
|
-
|
|
365
|
-
else if (
|
|
366
|
-
const
|
|
367
|
-
(
|
|
172
|
+
if (r) {
|
|
173
|
+
if (r.type === "simple")
|
|
174
|
+
o.symbol = r.symbol;
|
|
175
|
+
else if (r.type === "unique-value") {
|
|
176
|
+
const h = o.getAttribute("OBJECTID"), u = r.uniqueValueInfos.find(
|
|
177
|
+
(b) => b.value == h
|
|
368
178
|
);
|
|
369
|
-
|
|
179
|
+
o.symbol = u ? u.symbol : r.defaultSymbol;
|
|
370
180
|
}
|
|
371
181
|
} else
|
|
372
|
-
|
|
182
|
+
o.symbol = {
|
|
373
183
|
type: "simple-fill",
|
|
374
184
|
color: [227, 237, 255, 0.4],
|
|
375
185
|
outline: {
|
|
@@ -377,15 +187,15 @@ class T {
|
|
|
377
187
|
width: 2
|
|
378
188
|
}
|
|
379
189
|
};
|
|
380
|
-
if (
|
|
381
|
-
const
|
|
382
|
-
geometry:
|
|
383
|
-
symbol: { ...
|
|
190
|
+
if (i.push(o), n && c !== "边防港航支队" && c !== "机场支队") {
|
|
191
|
+
const h = new g({
|
|
192
|
+
geometry: l.centroid,
|
|
193
|
+
symbol: { ...n.symbol, text: c }
|
|
384
194
|
});
|
|
385
|
-
|
|
195
|
+
i.push(h);
|
|
386
196
|
}
|
|
387
197
|
}
|
|
388
|
-
}), this.detachmentLayer.addMany(
|
|
198
|
+
}), this.detachmentLayer.addMany(i), this.detachmentLayerLoaded = !0;
|
|
389
199
|
} catch (s) {
|
|
390
200
|
console.error("加载支队图层失败:", s);
|
|
391
201
|
return;
|
|
@@ -393,5 +203,5 @@ class T {
|
|
|
393
203
|
}
|
|
394
204
|
}
|
|
395
205
|
export {
|
|
396
|
-
|
|
206
|
+
P as default
|
|
397
207
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { IResult } from '../../../types';
|
|
1
|
+
import { IResult, IRoadLine } from '../../../types';
|
|
2
2
|
import DistrictController from './district-controller';
|
|
3
3
|
export default class SubDistrictRenderer {
|
|
4
4
|
private view;
|
|
5
5
|
private hasGpu;
|
|
6
6
|
private clickHandler;
|
|
7
7
|
private subDistrictPointLayer;
|
|
8
|
+
private subDistrictLineLayer;
|
|
9
|
+
roadLines: IRoadLine[];
|
|
8
10
|
constructor(view: __esri.MapView | __esri.SceneView, hasGpu: boolean);
|
|
9
11
|
showSubDistricts(controllers: DistrictController[]): Promise<void>;
|
|
12
|
+
showRoads(districtId: string): Promise<void>;
|
|
10
13
|
clearSubDistricts(): Promise<void>;
|
|
11
14
|
setVisible(visible: boolean): void;
|
|
12
15
|
/**
|
|
@@ -23,8 +26,17 @@ export default class SubDistrictRenderer {
|
|
|
23
26
|
count: number;
|
|
24
27
|
parentId: string;
|
|
25
28
|
}>;
|
|
29
|
+
/**
|
|
30
|
+
* 按照区控、子区id显示子区
|
|
31
|
+
* @param type 类型,district 或 subDistrict
|
|
32
|
+
* @param id
|
|
33
|
+
*/
|
|
26
34
|
filter(type: string, id: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* 重置过滤器,显示所有子区
|
|
37
|
+
*/
|
|
27
38
|
resetFilter(): void;
|
|
28
|
-
private
|
|
39
|
+
private currentPointRenderer;
|
|
40
|
+
private currentLineRenderer;
|
|
29
41
|
private viewHitTest;
|
|
30
42
|
}
|