gisviewer-vue3-arcgis 1.0.226 → 1.0.228
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/holo-flow/signal-holo-flow-lsr.mjs +11 -11
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +2 -1
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +22 -15
- package/es/src/gis-map/utils/signal-control-area-controller/layer-symbol.d.ts +8 -1
- package/es/src/gis-map/utils/signal-control-area-controller/layer-symbol.mjs +74 -56
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.d.ts +40 -0
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.mjs +123 -0
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.d.ts +22 -0
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.mjs +124 -0
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.d.ts +27 -0
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.mjs +142 -0
- package/es/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +4 -14
- package/es/src/gis-map/utils/signal-control-area-controller/show-area.mjs +284 -341
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +2 -1
- 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/layer-symbol.d.ts +8 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/layer-symbol.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.d.ts +40 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.d.ts +22 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.d.ts +27 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +4 -14
- package/lib/src/gis-map/utils/signal-control-area-controller/show-area.js +1 -1
- package/package.json +1 -1
|
@@ -1,112 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import y from "@arcgis/core/
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
class
|
|
15
|
-
constructor(
|
|
16
|
-
this.detachmentLayerLoaded = !1, this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0, this.popupEnabled = !0, this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.view =
|
|
17
|
-
const
|
|
18
|
-
this.mapConfig = JSON.parse(JSON.stringify(
|
|
19
|
-
G
|
|
20
|
-
), this.districtControllerDashLayer.spatialReference = e.spatialReference, this.districtControllerSolidLayer = new c(
|
|
21
|
-
v
|
|
22
|
-
), this.districtControllerSolidLayer.spatialReference = e.spatialReference, this.districtControllerSolidLayer.popupEnabled = this.popupEnabled, this.subDistrictControllerLayer = new c(
|
|
23
|
-
x
|
|
24
|
-
), this.subDistrictControllerLayer.spatialReference = e.spatialReference, this.subDistrictControllerLayer.popupEnabled = this.popupEnabled, this.signalMarkerLayer = new c(
|
|
25
|
-
S
|
|
26
|
-
), this.signalMarkerLayer.spatialReference = e.spatialReference, this.signalMarkerLayer.popupEnabled = this.popupEnabled, this.signalPictureLayer = new c(
|
|
27
|
-
I
|
|
28
|
-
), this.signalPictureLayer.spatialReference = e.spatialReference, this.signalPictureLayer.popupEnabled = this.popupEnabled, this.signalClusterLayer = new c(
|
|
29
|
-
M
|
|
30
|
-
), this.signalClusterLayer.spatialReference = e.spatialReference, this.signalClusterLayer.popupEnabled = this.popupEnabled, this.view.map.addMany([
|
|
31
|
-
this.detachmentLayer,
|
|
32
|
-
this.districtControllerSolidLayer,
|
|
33
|
-
this.districtControllerDashLayer,
|
|
34
|
-
this.signalMarkerLayer,
|
|
35
|
-
this.signalPictureLayer,
|
|
36
|
-
this.signalClusterLayer,
|
|
37
|
-
this.subDistrictControllerLayer
|
|
38
|
-
]), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
|
|
1
|
+
import { Polygon as f } from "@arcgis/core/geometry";
|
|
2
|
+
import { webMercatorToGeographic as m } from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
3
|
+
import u from "@arcgis/core/Graphic";
|
|
4
|
+
import y from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
+
import D from "@turf/buffer";
|
|
6
|
+
import w from "@turf/convex";
|
|
7
|
+
import * as c from "@turf/helpers";
|
|
8
|
+
import R from "concaveman";
|
|
9
|
+
import S from "../../stores/index.mjs";
|
|
10
|
+
import G from "./district-controller.mjs";
|
|
11
|
+
import C from "./renderer/district-renderer.mjs";
|
|
12
|
+
import I from "./renderer/signal-renderer.mjs";
|
|
13
|
+
import L from "./renderer/sub-district-renderer.mjs";
|
|
14
|
+
class T {
|
|
15
|
+
constructor(t) {
|
|
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);
|
|
39
19
|
}
|
|
40
20
|
/**
|
|
41
21
|
* 显示所有区控、子区、信号机
|
|
42
22
|
* @param params
|
|
43
23
|
* @returns
|
|
44
24
|
*/
|
|
45
|
-
async showSignalControlArea(
|
|
46
|
-
this.detachmentLayerLoaded || await this.loadDetachmentLayer(), await this.clearSignalControlArea(), this.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
25
|
+
async showSignalControlArea(t) {
|
|
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 e = [], s = [];
|
|
28
|
+
for (const r of t.areaList) {
|
|
29
|
+
const a = new G(
|
|
30
|
+
r,
|
|
31
|
+
t.style || ""
|
|
51
32
|
);
|
|
52
|
-
|
|
33
|
+
e.push(a), s.push(...a.subDistricts);
|
|
53
34
|
}
|
|
54
|
-
return await this.
|
|
55
|
-
addFeatures: this.districtGraphics
|
|
56
|
-
}), await this.districtControllerSolidLayer.applyEdits({
|
|
57
|
-
addFeatures: this.districtGraphics
|
|
58
|
-
}), this.view.goTo(this.districtGraphics), this.districtGraphics = [], await this.subDistrictControllerLayer.applyEdits({
|
|
59
|
-
addFeatures: this.subDistrictGraphics
|
|
60
|
-
}), this.subDistrictGraphics = [], await this.signalMarkerLayer.applyEdits({
|
|
61
|
-
addFeatures: this.signalGraphics
|
|
62
|
-
}), await this.signalPictureLayer.applyEdits({
|
|
63
|
-
addFeatures: this.signalGraphics
|
|
64
|
-
}), await this.signalClusterLayer.applyEdits({
|
|
65
|
-
addFeatures: this.signalGraphics
|
|
66
|
-
}), this.signalGraphics = [], { status: 0, message: "ok" };
|
|
35
|
+
return this.districtRenderer.style = t.style || "", await this.districtRenderer.showDistricts(e), await this.subDistrictRenderer.showSubDistricts(s), await this.signalRenderer.showSignals(e), { status: 0, message: "ok" };
|
|
67
36
|
}
|
|
68
37
|
/**
|
|
69
38
|
* 清空区控、子区、信号机
|
|
70
39
|
* @returns
|
|
71
40
|
*/
|
|
72
41
|
async clearSignalControlArea() {
|
|
73
|
-
this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0;
|
|
74
|
-
let e = await this.districtControllerDashLayer.queryFeatures();
|
|
75
|
-
return await this.districtControllerDashLayer.applyEdits({
|
|
76
|
-
deleteFeatures: e.features
|
|
77
|
-
}), this.districtControllerDashLayer.definitionExpression = "1=1", e = await this.districtControllerSolidLayer.queryFeatures(), await this.districtControllerSolidLayer.applyEdits({
|
|
78
|
-
deleteFeatures: e.features
|
|
79
|
-
}), this.districtControllerSolidLayer.definitionExpression = "1=1", e = await this.subDistrictControllerLayer.queryFeatures(), await this.subDistrictControllerLayer.applyEdits({
|
|
80
|
-
deleteFeatures: e.features
|
|
81
|
-
}), this.subDistrictControllerLayer.definitionExpression = "1=1", e = await this.signalMarkerLayer.queryFeatures(), await this.signalMarkerLayer.applyEdits({
|
|
82
|
-
deleteFeatures: e.features
|
|
83
|
-
}), this.signalMarkerLayer.definitionExpression = "1=1", e = await this.signalPictureLayer.queryFeatures(), await this.signalPictureLayer.applyEdits({
|
|
84
|
-
deleteFeatures: e.features
|
|
85
|
-
}), this.signalPictureLayer.definitionExpression = "1=1", e = await this.signalClusterLayer.queryFeatures(), await this.signalClusterLayer.applyEdits({
|
|
86
|
-
deleteFeatures: e.features
|
|
87
|
-
}), this.signalClusterLayer.definitionExpression = "1=1", { status: 0, message: "ok" };
|
|
42
|
+
return this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0, await this.districtRenderer.clearDistricts(), await this.subDistrictRenderer.clearSubDistricts(), await this.signalRenderer.clearSignals(), { status: 0, message: "ok" };
|
|
88
43
|
}
|
|
89
44
|
/**
|
|
90
45
|
* 设置区控、子区、信号机图层可见性
|
|
91
46
|
* @param layerName
|
|
92
47
|
* @param visible
|
|
93
48
|
*/
|
|
94
|
-
setLayerVisibility(
|
|
95
|
-
switch (
|
|
49
|
+
setLayerVisibility(t) {
|
|
50
|
+
switch (t.visible === !1 && this.view.closePopup(), t.id) {
|
|
96
51
|
case "district":
|
|
97
|
-
this.
|
|
52
|
+
this.districtRenderer.setVisible(t.visible);
|
|
98
53
|
break;
|
|
99
54
|
case "subDistrict":
|
|
100
|
-
this.
|
|
55
|
+
this.subDistrictRenderer.setVisible(t.visible);
|
|
101
56
|
break;
|
|
102
57
|
case "signal":
|
|
103
|
-
this.
|
|
58
|
+
this.signalRenderer.setPointVisible(t.visible);
|
|
104
59
|
break;
|
|
105
60
|
case "signalCluster":
|
|
106
|
-
this.
|
|
61
|
+
this.signalRenderer.setClusterVisible(t.visible);
|
|
107
62
|
break;
|
|
108
63
|
case "shanghai_district":
|
|
109
|
-
this.detachmentLayer.visible =
|
|
64
|
+
this.detachmentLayer.visible = t.visible;
|
|
110
65
|
break;
|
|
111
66
|
}
|
|
112
67
|
return { status: 0, message: "ok" };
|
|
@@ -116,38 +71,14 @@ class V {
|
|
|
116
71
|
* @param params
|
|
117
72
|
* @returns
|
|
118
73
|
*/
|
|
119
|
-
async locateSignalControlArea(
|
|
120
|
-
switch (
|
|
121
|
-
case "district":
|
|
122
|
-
|
|
123
|
-
i.where = `id = '${e.id}'`, i.returnGeometry = !0, i.outFields = ["*"];
|
|
124
|
-
const r = await this.districtControllerDashLayer.queryFeatures(
|
|
125
|
-
i
|
|
126
|
-
);
|
|
127
|
-
return r.features.length > 0 ? (await this.view.goTo(r.features, {
|
|
128
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
129
|
-
}), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
|
|
130
|
-
}
|
|
74
|
+
async locateSignalControlArea(t) {
|
|
75
|
+
switch (t.type) {
|
|
76
|
+
case "district":
|
|
77
|
+
return await this.districtRenderer.locateDistrict(t.id);
|
|
131
78
|
case "subDistrict":
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
t
|
|
136
|
-
);
|
|
137
|
-
return s.features.length > 0 ? (await this.view.goTo(s.features, {
|
|
138
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
139
|
-
}), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
140
|
-
case "signal": {
|
|
141
|
-
const i = this.signalMarkerLayer.createQuery();
|
|
142
|
-
i.where = `id = '${e.id}'`, i.returnGeometry = !0, i.outFields = ["*"];
|
|
143
|
-
const r = await this.signalMarkerLayer.queryFeatures(i);
|
|
144
|
-
return r.features.length > 0 ? (await this.view.goTo(
|
|
145
|
-
{ target: r.features[0], scale: e.scale || 1e3 },
|
|
146
|
-
{
|
|
147
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
148
|
-
}
|
|
149
|
-
), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
|
|
150
|
-
}
|
|
79
|
+
return await this.subDistrictRenderer.locateSubDistrict(t.id);
|
|
80
|
+
case "signal":
|
|
81
|
+
return await this.signalRenderer.locateSignal(t.id);
|
|
151
82
|
default:
|
|
152
83
|
return { status: 1, message: "未知类型" };
|
|
153
84
|
}
|
|
@@ -157,45 +88,22 @@ class V {
|
|
|
157
88
|
* @param params
|
|
158
89
|
* @returns
|
|
159
90
|
*/
|
|
160
|
-
async highlightSignalControlArea(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const s = this.districtControllerDashLayer.definitionExpression;
|
|
165
|
-
this.districtControllerDashLayer.definitionExpression = `id = '${e.id}'`;
|
|
166
|
-
const i = await this.districtControllerDashLayer.queryFeatures();
|
|
167
|
-
return i.features.length > 0 ? (this.districtControllerSolidLayer.definitionExpression = `id = '${e.id}'`, this.subDistrictControllerLayer.definitionExpression = `parentId = '${e.id}'`, this.signalMarkerLayer.definitionExpression = `districtId = '${e.id}'`, this.signalPictureLayer.definitionExpression = `districtId = '${e.id}'`, this.signalClusterLayer.definitionExpression = `districtId = '${e.id}'`, await this.view.goTo(i.features, {
|
|
168
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
169
|
-
}), { status: 0, message: "ok" }) : (this.districtControllerDashLayer.definitionExpression = s, { status: 1, message: "未找到区控" });
|
|
170
|
-
}
|
|
91
|
+
async highlightSignalControlArea(t) {
|
|
92
|
+
switch (this.view.closePopup(), t.type) {
|
|
93
|
+
case "district":
|
|
94
|
+
return await this.districtRenderer.highlightDistrict(t.id) ? (this.subDistrictRenderer.filter("district", t.id), this.signalRenderer.filter("district", t.id), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
|
|
171
95
|
case "subDistrict": {
|
|
172
|
-
const s = this.
|
|
173
|
-
this.
|
|
174
|
-
const i = await this.subDistrictControllerLayer.queryFeatures();
|
|
175
|
-
if (i.features.length > 0) {
|
|
176
|
-
this.signalMarkerLayer.definitionExpression = `subDistrictId = '${e.id}'`, this.signalPictureLayer.definitionExpression = `subDistrictId = '${e.id}'`, this.signalClusterLayer.definitionExpression = `subDistrictId = '${e.id}'`;
|
|
177
|
-
const o = i.features[0].attributes.parentId;
|
|
178
|
-
return this.districtControllerDashLayer.definitionExpression = `id = '${o}'`, this.districtControllerSolidLayer.definitionExpression = `id = '${o}'`, await this.view.goTo(i.features, {
|
|
179
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
180
|
-
}), { status: 0, message: "ok" };
|
|
181
|
-
} else
|
|
182
|
-
return this.subDistrictControllerLayer.definitionExpression = s, { status: 1, message: "未找到子区" };
|
|
96
|
+
const { count: e, parentId: s } = await this.subDistrictRenderer.highlightSubDistrict(t.id);
|
|
97
|
+
return e > 0 ? (this.districtRenderer.filter(s), this.signalRenderer.filter("subDistrict", t.id), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
183
98
|
}
|
|
184
99
|
case "signal": {
|
|
185
|
-
const s = this.
|
|
186
|
-
this.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
{ target: i.features, scale: e.scale || 1e3 },
|
|
193
|
-
{
|
|
194
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
195
|
-
}
|
|
196
|
-
), { status: 0, message: "ok" };
|
|
197
|
-
} else
|
|
198
|
-
return this.signalMarkerLayer.definitionExpression = s, { status: 1, message: "未找到信号机" };
|
|
100
|
+
const { districtId: e, subDistrictId: s, count: r } = await this.signalRenderer.highlightSignal(t.id);
|
|
101
|
+
return r > 0 ? (this.districtRenderer.filter(e), this.subDistrictRenderer.filter("subDistrict", s), await this.view.goTo(
|
|
102
|
+
{ target: this.signalGraphics, scale: t.scale || 1e3 },
|
|
103
|
+
{
|
|
104
|
+
duration: this.hasGpu ? 1e3 : 0
|
|
105
|
+
}
|
|
106
|
+
), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
|
|
199
107
|
}
|
|
200
108
|
default:
|
|
201
109
|
return { status: 1, message: "未知类型" };
|
|
@@ -206,11 +114,7 @@ class V {
|
|
|
206
114
|
* @returns
|
|
207
115
|
*/
|
|
208
116
|
async resetHighlight() {
|
|
209
|
-
this.
|
|
210
|
-
const e = await this.districtControllerDashLayer.queryFeatures();
|
|
211
|
-
return this.view.goTo(e.features, {
|
|
212
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
213
|
-
}), { status: 0, message: "ok" };
|
|
117
|
+
return this.districtRenderer.resetFilter(), this.subDistrictRenderer.resetFilter(), this.signalRenderer.resetFilter(), { status: 0, message: "ok" };
|
|
214
118
|
}
|
|
215
119
|
/**
|
|
216
120
|
* 生成区控、子区和信号机graphic
|
|
@@ -218,237 +122,276 @@ class V {
|
|
|
218
122
|
* @param isDistrict 是否是区控
|
|
219
123
|
* @returns
|
|
220
124
|
*/
|
|
221
|
-
generateGraphic(
|
|
222
|
-
const
|
|
223
|
-
let
|
|
224
|
-
if (
|
|
225
|
-
if (
|
|
226
|
-
|
|
125
|
+
generateGraphic(t, e, s) {
|
|
126
|
+
const r = t.getAllSignalCoordinates();
|
|
127
|
+
let a = null;
|
|
128
|
+
if (r.length >= 2)
|
|
129
|
+
if (r.length === 2)
|
|
130
|
+
a = c.lineString(r);
|
|
227
131
|
else {
|
|
228
|
-
if (
|
|
229
|
-
const
|
|
230
|
-
|
|
132
|
+
if (e) {
|
|
133
|
+
const i = c.featureCollection(
|
|
134
|
+
r.map((o) => c.point(o))
|
|
231
135
|
);
|
|
232
|
-
|
|
136
|
+
a = w(i);
|
|
233
137
|
} else {
|
|
234
|
-
const
|
|
235
|
-
|
|
138
|
+
const i = R(r, 0.5);
|
|
139
|
+
i.length >= 4 && (a = c.polygon([i]));
|
|
236
140
|
}
|
|
237
|
-
|
|
141
|
+
a || (a = c.lineString(r));
|
|
238
142
|
}
|
|
239
|
-
else if (
|
|
240
|
-
|
|
143
|
+
else if (r.length === 1)
|
|
144
|
+
a = c.point(r[0]);
|
|
241
145
|
else
|
|
242
146
|
return;
|
|
243
|
-
const
|
|
244
|
-
|
|
147
|
+
const n = D(
|
|
148
|
+
a.geometry,
|
|
245
149
|
// 区控面积更大,需要更大的缓冲半径
|
|
246
|
-
|
|
150
|
+
e ? 200 : 30,
|
|
247
151
|
{
|
|
248
152
|
units: "meters"
|
|
249
153
|
}
|
|
250
|
-
),
|
|
154
|
+
), l = new u({
|
|
251
155
|
geometry: {
|
|
252
156
|
type: "polyline",
|
|
253
|
-
paths:
|
|
157
|
+
paths: n.geometry.coordinates
|
|
254
158
|
},
|
|
255
159
|
attributes: {
|
|
256
|
-
ObjectID:
|
|
257
|
-
id:
|
|
258
|
-
name:
|
|
259
|
-
subDistrictCount:
|
|
260
|
-
signalCount:
|
|
261
|
-
parentId:
|
|
262
|
-
parentName:
|
|
160
|
+
ObjectID: e ? this.districtControllerOid++ : this.subDistrictControllerOid++,
|
|
161
|
+
id: t.id,
|
|
162
|
+
name: t.name,
|
|
163
|
+
subDistrictCount: t.subDistrictCount,
|
|
164
|
+
signalCount: t.signalCount,
|
|
165
|
+
parentId: t.parentId,
|
|
166
|
+
parentName: t.parentName,
|
|
263
167
|
selected: s,
|
|
264
|
-
type:
|
|
168
|
+
type: e ? "district" : "subDistrict"
|
|
265
169
|
}
|
|
266
170
|
});
|
|
267
|
-
|
|
268
|
-
for (const
|
|
269
|
-
this.generateGraphic(
|
|
270
|
-
|
|
271
|
-
const
|
|
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({
|
|
272
176
|
geometry: {
|
|
273
177
|
type: "point",
|
|
274
|
-
x:
|
|
275
|
-
y:
|
|
178
|
+
x: i.longitude,
|
|
179
|
+
y: i.latitude
|
|
276
180
|
},
|
|
277
181
|
attributes: {
|
|
278
182
|
ObjectID: this.signalOid++,
|
|
279
|
-
id:
|
|
280
|
-
name:
|
|
281
|
-
signalId:
|
|
282
|
-
nodeId:
|
|
283
|
-
isKey:
|
|
284
|
-
districtId:
|
|
285
|
-
districtName:
|
|
286
|
-
subDistrictId:
|
|
287
|
-
subDistrictName:
|
|
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,
|
|
288
192
|
type: "signal",
|
|
289
193
|
selected: !0
|
|
290
194
|
}
|
|
291
195
|
});
|
|
292
|
-
this.signalGraphics.push(
|
|
196
|
+
this.signalGraphics.push(o);
|
|
293
197
|
});
|
|
294
198
|
}
|
|
295
|
-
async viewHitTest(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
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
|
+
// }
|
|
358
286
|
/**
|
|
359
287
|
* 重置所有graphic的置灰状态
|
|
360
288
|
*/
|
|
361
|
-
async resetSelectedSymbol(
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
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
|
+
// }
|
|
395
334
|
/**
|
|
396
335
|
* 加载支队图层
|
|
397
336
|
* 现场环境用url创建FeatureLayer有各种问题,
|
|
398
|
-
*
|
|
337
|
+
* 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
|
|
399
338
|
*/
|
|
400
339
|
async loadDetachmentLayer() {
|
|
401
|
-
const
|
|
402
|
-
if (!e)
|
|
403
|
-
return;
|
|
404
|
-
const t = e.find(
|
|
405
|
-
(n) => n.options.id === "shanghai_district"
|
|
406
|
-
);
|
|
340
|
+
const t = this.mapConfig.baseLayers;
|
|
407
341
|
if (!t)
|
|
408
342
|
return;
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
)
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
343
|
+
const e = t.find(
|
|
344
|
+
(s) => s.options.id === "shanghai_district"
|
|
345
|
+
);
|
|
346
|
+
if (e)
|
|
347
|
+
try {
|
|
348
|
+
const r = await (await fetch(
|
|
349
|
+
"/GisViewerAssets/ShangHai/Layers/district.json"
|
|
350
|
+
)).json(), a = [], { renderer: n, labelingInfo: l } = e.options;
|
|
351
|
+
r.features.forEach((i) => {
|
|
352
|
+
const o = i.attributes.ZD_NAME;
|
|
353
|
+
if (o !== "高架支队") {
|
|
354
|
+
let d = new f({
|
|
355
|
+
rings: i.geometry.rings
|
|
356
|
+
});
|
|
357
|
+
d = m(d);
|
|
358
|
+
const h = new u({
|
|
359
|
+
geometry: d,
|
|
360
|
+
attributes: i.attributes
|
|
361
|
+
});
|
|
362
|
+
if (n) {
|
|
363
|
+
if (n.type === "simple")
|
|
364
|
+
h.symbol = n.symbol;
|
|
365
|
+
else if (n.type === "unique-value") {
|
|
366
|
+
const g = h.getAttribute("OBJECTID"), b = n.uniqueValueInfos.find(
|
|
367
|
+
(p) => p.value == g
|
|
368
|
+
);
|
|
369
|
+
h.symbol = b ? b.symbol : n.defaultSymbol;
|
|
370
|
+
}
|
|
371
|
+
} else
|
|
372
|
+
h.symbol = {
|
|
373
|
+
type: "simple-fill",
|
|
374
|
+
color: [227, 237, 255, 0.4],
|
|
375
|
+
outline: {
|
|
376
|
+
color: [255, 195, 153],
|
|
377
|
+
width: 2
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
if (a.push(h), l && o !== "边防港航支队" && o !== "机场支队") {
|
|
381
|
+
const g = new u({
|
|
382
|
+
geometry: d.centroid,
|
|
383
|
+
symbol: { ...l.symbol, text: o }
|
|
384
|
+
});
|
|
385
|
+
a.push(g);
|
|
439
386
|
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
});
|
|
446
|
-
r.push(p);
|
|
447
|
-
}
|
|
387
|
+
}
|
|
388
|
+
}), this.detachmentLayer.addMany(a), this.detachmentLayerLoaded = !0;
|
|
389
|
+
} catch (s) {
|
|
390
|
+
console.error("加载支队图层失败:", s);
|
|
391
|
+
return;
|
|
448
392
|
}
|
|
449
|
-
}), this.detachmentLayer.addMany(r), this.detachmentLayerLoaded = !0;
|
|
450
393
|
}
|
|
451
394
|
}
|
|
452
395
|
export {
|
|
453
|
-
|
|
396
|
+
T as default
|
|
454
397
|
};
|