gisviewer-vue3-arcgis 1.0.231 → 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.mjs +5 -21
- 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 +5 -2
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +219 -65
- 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.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 +5 -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,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
class
|
|
3
|
-
constructor(s,
|
|
4
|
-
this.parentName = "", this.signals = [], this.subDistricts = [], this.areaColor = this.getDarkNonGrayColor(), this.signalCount = 0, this.subDistrictCount = 0, this.id = s.name, this.name = s.areaDesc, this.parentId = s.parentId,
|
|
1
|
+
import u from "../common-utils.mjs";
|
|
2
|
+
class h {
|
|
3
|
+
constructor(s, a) {
|
|
4
|
+
this.parentName = "", this.signals = [], this.subDistricts = [], this.areaColor = this.getDarkNonGrayColor(), this.signalCount = 0, this.subDistrictCount = 0, this.id = s.name, this.name = s.areaDesc, this.parentId = s.parentId, a === "alarm" && (this.areaColor = [255, 0, 0]);
|
|
5
5
|
for (const t of s.children)
|
|
6
6
|
if (t.children) {
|
|
7
|
-
const i = new
|
|
8
|
-
i.id = t.id, i.name = `SS ${t.name}`, i.parentId = this.id, i.parentName = this.name, this.subDistricts.push(i), this.subDistrictCount++, this.signalCount += i.signalCount;
|
|
9
|
-
} else if (
|
|
7
|
+
const i = new h(t, a);
|
|
8
|
+
i.id = t.id, i.name = `SS ${t.name}`, i.parentId = this.id, i.parentName = this.name, i.areaColor = this.getDarkNonGrayColor(t.id), this.subDistricts.push(i), this.subDistrictCount++, this.signalCount += i.signalCount;
|
|
9
|
+
} else if (u.isCoordinateValid(t)) {
|
|
10
10
|
const i = {
|
|
11
11
|
id: t.id,
|
|
12
12
|
name: t.name,
|
|
@@ -26,20 +26,32 @@ class r {
|
|
|
26
26
|
*/
|
|
27
27
|
getAllSignalCoordinates() {
|
|
28
28
|
const s = [];
|
|
29
|
-
for (const
|
|
30
|
-
s.push([
|
|
31
|
-
for (const
|
|
32
|
-
s.push(...
|
|
29
|
+
for (const a of this.signals)
|
|
30
|
+
s.push([a.longitude, a.latitude]);
|
|
31
|
+
for (const a of this.subDistricts)
|
|
32
|
+
s.push(...a.getAllSignalCoordinates());
|
|
33
33
|
return s;
|
|
34
34
|
}
|
|
35
|
-
getDarkNonGrayColor() {
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
getDarkNonGrayColor(s) {
|
|
36
|
+
let a, t, i;
|
|
37
|
+
if (s) {
|
|
38
|
+
const r = this.cyrb53(s);
|
|
39
|
+
a = Math.abs(r) % 360, t = 80 + Math.abs(r >> 3) % 21, i = 10 + Math.abs(r >> 7) % 41;
|
|
40
|
+
} else
|
|
41
|
+
a = Math.floor(Math.random() * 360), t = 80 + Math.random() * 20, i = 15 + Math.random() * 35;
|
|
42
|
+
const o = t / 100 * Math.min(i / 100, 1 - i / 100), n = (r) => {
|
|
43
|
+
const e = (r + a / 30) % 12, l = i / 100 - o * Math.max(Math.min(e - 3, 9 - e, 1), -1);
|
|
38
44
|
return Math.round(255 * l);
|
|
39
45
|
};
|
|
40
|
-
return [
|
|
46
|
+
return [n(0), n(8), n(4)];
|
|
47
|
+
}
|
|
48
|
+
cyrb53(s, a = 0) {
|
|
49
|
+
let t = 3735928559 ^ a, i = 1103547991 ^ a;
|
|
50
|
+
for (let o = 0, n; o < s.length; o++)
|
|
51
|
+
n = s.charCodeAt(o), t = Math.imul(t ^ n, 2654435761), i = Math.imul(i ^ n, 1597334677);
|
|
52
|
+
return t = Math.imul(t ^ t >>> 16, 2246822507), t ^= Math.imul(i ^ i >>> 13, 3266489909), i = Math.imul(i ^ i >>> 16, 2246822507), i ^= Math.imul(t ^ t >>> 13, 3266489909), 4294967296 * (2097151 & i) + (t >>> 0);
|
|
41
53
|
}
|
|
42
54
|
}
|
|
43
55
|
export {
|
|
44
|
-
|
|
56
|
+
h as default
|
|
45
57
|
};
|
|
@@ -131,7 +131,7 @@ const e = {
|
|
|
131
131
|
]
|
|
132
132
|
}
|
|
133
133
|
}, i = {
|
|
134
|
-
id: "
|
|
134
|
+
id: "subDistrictPointController",
|
|
135
135
|
source: [],
|
|
136
136
|
objectIdField: "ObjectID",
|
|
137
137
|
outFields: ["*"],
|
|
@@ -205,11 +205,11 @@ const e = {
|
|
|
205
205
|
]
|
|
206
206
|
}
|
|
207
207
|
}, r = {
|
|
208
|
-
id: "
|
|
208
|
+
id: "subDistrictLineController",
|
|
209
209
|
source: [],
|
|
210
210
|
objectIdField: "ObjectID",
|
|
211
211
|
outFields: ["*"],
|
|
212
|
-
geometryType: "
|
|
212
|
+
geometryType: "polyline",
|
|
213
213
|
fields: [
|
|
214
214
|
{
|
|
215
215
|
name: "ObjectID",
|
|
@@ -219,36 +219,20 @@ const e = {
|
|
|
219
219
|
name: "id",
|
|
220
220
|
type: "string"
|
|
221
221
|
},
|
|
222
|
-
{
|
|
223
|
-
name: "name",
|
|
224
|
-
type: "string"
|
|
225
|
-
},
|
|
226
222
|
{
|
|
227
223
|
name: "districtId",
|
|
228
224
|
type: "string"
|
|
229
225
|
},
|
|
230
|
-
{
|
|
231
|
-
name: "districtName",
|
|
232
|
-
type: "string"
|
|
233
|
-
},
|
|
234
226
|
{
|
|
235
227
|
name: "subDistrictId",
|
|
236
228
|
type: "string"
|
|
237
229
|
},
|
|
238
230
|
{
|
|
239
|
-
name: "
|
|
240
|
-
type: "string"
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
name: "signalCount",
|
|
244
|
-
type: "integer"
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
name: "selected",
|
|
231
|
+
name: "fromNode",
|
|
248
232
|
type: "string"
|
|
249
233
|
},
|
|
250
234
|
{
|
|
251
|
-
name: "
|
|
235
|
+
name: "toNode",
|
|
252
236
|
type: "string"
|
|
253
237
|
},
|
|
254
238
|
{
|
|
@@ -8,19 +8,9 @@ export default class SignalControlAreaController1 {
|
|
|
8
8
|
private districtRenderer;
|
|
9
9
|
private subDistrictRenderer;
|
|
10
10
|
private signalRenderer;
|
|
11
|
-
private clickHandler;
|
|
12
|
-
private districtControllerOid;
|
|
13
|
-
private subDistrictControllerOid;
|
|
14
|
-
private signalOid;
|
|
15
|
-
private popupEnabled;
|
|
16
11
|
private mapConfig;
|
|
12
|
+
private roadLines;
|
|
17
13
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
18
|
-
/** 暂存等待绘制的区控graphic */
|
|
19
|
-
private districtGraphics;
|
|
20
|
-
/** 暂存等待绘制的子区graphic */
|
|
21
|
-
private subDistrictGraphics;
|
|
22
|
-
/** 暂存等待绘制的信号机graphic */
|
|
23
|
-
private signalGraphics;
|
|
24
14
|
/**
|
|
25
15
|
* 显示所有区控、子区、信号机
|
|
26
16
|
* @param params
|
|
@@ -62,15 +52,10 @@ export default class SignalControlAreaController1 {
|
|
|
62
52
|
message: string;
|
|
63
53
|
}>;
|
|
64
54
|
/**
|
|
65
|
-
*
|
|
66
|
-
* @param districtController
|
|
67
|
-
* @param isDistrict 是否是区控
|
|
55
|
+
* 获取道路线
|
|
68
56
|
* @returns
|
|
69
57
|
*/
|
|
70
|
-
private
|
|
71
|
-
/**
|
|
72
|
-
* 重置所有graphic的置灰状态
|
|
73
|
-
*/
|
|
58
|
+
private loadRoadLine;
|
|
74
59
|
/**
|
|
75
60
|
* 加载支队图层
|
|
76
61
|
* 现场环境用url创建FeatureLayer有各种问题,
|
|
@@ -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
|
};
|