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.
Files changed (27) hide show
  1. package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +11 -11
  2. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +2 -1
  3. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +22 -15
  4. package/es/src/gis-map/utils/signal-control-area-controller/layer-symbol.d.ts +8 -1
  5. package/es/src/gis-map/utils/signal-control-area-controller/layer-symbol.mjs +74 -56
  6. package/es/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.d.ts +40 -0
  7. package/es/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.mjs +123 -0
  8. package/es/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.d.ts +22 -0
  9. package/es/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.mjs +124 -0
  10. package/es/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.d.ts +27 -0
  11. package/es/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.mjs +142 -0
  12. package/es/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +4 -14
  13. package/es/src/gis-map/utils/signal-control-area-controller/show-area.mjs +284 -341
  14. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
  15. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +2 -1
  16. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
  17. package/lib/src/gis-map/utils/signal-control-area-controller/layer-symbol.d.ts +8 -1
  18. package/lib/src/gis-map/utils/signal-control-area-controller/layer-symbol.js +1 -1
  19. package/lib/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.d.ts +40 -0
  20. package/lib/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.js +1 -0
  21. package/lib/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.d.ts +22 -0
  22. package/lib/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.js +1 -0
  23. package/lib/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.d.ts +27 -0
  24. package/lib/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.js +1 -0
  25. package/lib/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +4 -14
  26. package/lib/src/gis-map/utils/signal-control-area-controller/show-area.js +1 -1
  27. package/package.json +1 -1
@@ -1,112 +1,67 @@
1
- import * as L from "@arcgis/core/core/reactiveUtils";
2
- import { Polygon as b } from "@arcgis/core/geometry";
3
- import { webMercatorToGeographic as w } from "@arcgis/core/geometry/support/webMercatorUtils";
4
- import y from "@arcgis/core/Graphic";
5
- import c from "@arcgis/core/layers/FeatureLayer";
6
- import C from "@arcgis/core/layers/GraphicsLayer";
7
- import E from "@turf/buffer";
8
- import D from "@turf/convex";
9
- import * as d from "@turf/helpers";
10
- import m from "concaveman";
11
- import F from "../../stores/index.mjs";
12
- import k from "./district-controller.mjs";
13
- import { districtDashLineLayerOptions as G, districtSolidLineLayerOptions as v, subDistrictLayerOptions as x, signalMarkerLayerOptions as S, signalPictureLayerOptions as I, signalClusterLayerOptions as M } from "./layer-symbol.mjs";
14
- class V {
15
- constructor(e) {
16
- this.detachmentLayerLoaded = !1, this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0, this.popupEnabled = !0, this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.view = e, this.hasGpu = localStorage.getItem("gpu") !== "Unknown";
17
- const t = F.useAppDataStore;
18
- this.mapConfig = JSON.parse(JSON.stringify(t.mapConfig)), this.detachmentLayer = new C(), this.districtControllerDashLayer = new c(
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(e) {
46
- this.detachmentLayerLoaded || await this.loadDetachmentLayer(), await this.clearSignalControlArea(), this.districtControllerDashLayer.visible = !1, this.districtControllerSolidLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.signalMarkerLayer.visible = !1, this.signalPictureLayer.visible = !1, this.signalClusterLayer.visible = !0;
47
- for (const t of e.areaList) {
48
- const s = new k(
49
- t,
50
- e.style || ""
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
- this.generateGraphic(s, !0, e.style);
33
+ e.push(a), s.push(...a.subDistricts);
53
34
  }
54
- return await this.districtControllerDashLayer.applyEdits({
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(e) {
95
- switch (e.visible === !1 && this.view.closePopup(), e.id) {
49
+ setLayerVisibility(t) {
50
+ switch (t.visible === !1 && this.view.closePopup(), t.id) {
96
51
  case "district":
97
- this.districtControllerDashLayer.visible = e.visible, this.districtControllerSolidLayer.visible = e.visible;
52
+ this.districtRenderer.setVisible(t.visible);
98
53
  break;
99
54
  case "subDistrict":
100
- this.subDistrictControllerLayer.visible = e.visible;
55
+ this.subDistrictRenderer.setVisible(t.visible);
101
56
  break;
102
57
  case "signal":
103
- this.signalMarkerLayer.visible = e.visible, this.signalPictureLayer.visible = e.visible;
58
+ this.signalRenderer.setPointVisible(t.visible);
104
59
  break;
105
60
  case "signalCluster":
106
- this.signalClusterLayer.visible = e.visible;
61
+ this.signalRenderer.setClusterVisible(t.visible);
107
62
  break;
108
63
  case "shanghai_district":
109
- this.detachmentLayer.visible = e.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(e) {
120
- switch (e.type) {
121
- case "district": {
122
- const i = this.districtControllerDashLayer.createQuery();
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
- const t = this.subDistrictControllerLayer.createQuery();
133
- t.where = `id = '${e.id}'`, t.returnGeometry = !0, t.outFields = ["*"];
134
- const s = await this.subDistrictControllerLayer.queryFeatures(
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(e) {
161
- var t;
162
- switch ((t = this.view.popup) != null && t.visible && this.view.popup.close(), e.type) {
163
- case "district": {
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.subDistrictControllerLayer.definitionExpression;
173
- this.subDistrictControllerLayer.definitionExpression = `id = '${e.id}'`;
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.signalMarkerLayer.definitionExpression;
186
- this.signalMarkerLayer.definitionExpression = `id = '${e.id}'`;
187
- const i = await this.signalMarkerLayer.queryFeatures();
188
- if (i.features.length > 0) {
189
- this.signalPictureLayer.definitionExpression = `id = '${e.id}'`, this.signalClusterLayer.definitionExpression = `id = '${e.id}'`;
190
- const r = i.features[0], { districtId: o, subDistrictId: h } = r.attributes;
191
- return this.districtControllerDashLayer.definitionExpression = `id = '${o}'`, this.districtControllerSolidLayer.definitionExpression = `id = '${o}'`, this.subDistrictControllerLayer.definitionExpression = `id = '${h}'`, await this.view.goTo(
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.districtControllerDashLayer.definitionExpression = "1=1", this.districtControllerSolidLayer.definitionExpression = "1=1", this.subDistrictControllerLayer.definitionExpression = "1=1", this.signalMarkerLayer.definitionExpression = "1=1", this.signalClusterLayer.definitionExpression = "1=1", this.signalPictureLayer.definitionExpression = "1=1";
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(e, t, s) {
222
- const i = e.getAllSignalCoordinates();
223
- let r = null;
224
- if (i.length >= 2)
225
- if (i.length === 2)
226
- r = d.lineString(i);
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 (t) {
229
- const n = d.featureCollection(
230
- i.map((a) => d.point(a))
132
+ if (e) {
133
+ const i = c.featureCollection(
134
+ r.map((o) => c.point(o))
231
135
  );
232
- r = D(n);
136
+ a = w(i);
233
137
  } else {
234
- const n = m(i, 0.5);
235
- n.length >= 4 && (r = d.polygon([n]));
138
+ const i = R(r, 0.5);
139
+ i.length >= 4 && (a = c.polygon([i]));
236
140
  }
237
- r || (r = d.lineString(i));
141
+ a || (a = c.lineString(r));
238
142
  }
239
- else if (i.length === 1)
240
- r = d.point(i[0]);
143
+ else if (r.length === 1)
144
+ a = c.point(r[0]);
241
145
  else
242
146
  return;
243
- const o = E(
244
- r.geometry,
147
+ const n = D(
148
+ a.geometry,
245
149
  // 区控面积更大,需要更大的缓冲半径
246
- t ? 200 : 30,
150
+ e ? 200 : 30,
247
151
  {
248
152
  units: "meters"
249
153
  }
250
- ), h = new y({
154
+ ), l = new u({
251
155
  geometry: {
252
156
  type: "polyline",
253
- paths: o.geometry.coordinates
157
+ paths: n.geometry.coordinates
254
158
  },
255
159
  attributes: {
256
- ObjectID: t ? this.districtControllerOid++ : this.subDistrictControllerOid++,
257
- id: e.id,
258
- name: e.name,
259
- subDistrictCount: e.subDistrictCount,
260
- signalCount: e.signalCount,
261
- parentId: e.parentId,
262
- parentName: e.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: t ? "district" : "subDistrict"
168
+ type: e ? "district" : "subDistrict"
265
169
  }
266
170
  });
267
- t ? this.districtGraphics.push(h) : this.subDistrictGraphics.push(h);
268
- for (const n of e.subDistricts)
269
- this.generateGraphic(n, !1, s);
270
- e.signals.forEach((n) => {
271
- const a = new y({
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: n.longitude,
275
- y: n.latitude
178
+ x: i.longitude,
179
+ y: i.latitude
276
180
  },
277
181
  attributes: {
278
182
  ObjectID: this.signalOid++,
279
- id: n.id,
280
- name: n.name,
281
- signalId: n.signalId,
282
- nodeId: n.nodeId,
283
- isKey: n.isKey,
284
- districtId: t ? e.id : e.parentId,
285
- districtName: t ? e.name : e.parentName,
286
- subDistrictId: t ? "" : e.id,
287
- subDistrictName: t ? "" : e.name,
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(a);
196
+ this.signalGraphics.push(o);
293
197
  });
294
198
  }
295
- async viewHitTest(e) {
296
- var n;
297
- const s = (n = (await this.view.hitTest(e, {
298
- include: [
299
- this.districtControllerSolidLayer,
300
- this.subDistrictControllerLayer,
301
- this.signalMarkerLayer,
302
- this.signalPictureLayer,
303
- this.signalClusterLayer
304
- ]
305
- })).results) == null ? void 0 : n.filter(
306
- (a) => a.type === "graphic"
307
- );
308
- if (s.length === 0)
309
- return;
310
- const i = s[0].graphic;
311
- let r = null;
312
- i.geometry.type === "point" ? r = i.geometry : i.geometry.type === "polyline" ? r = i.geometry.extent.center : i.geometry.type === "polygon" && (r = i.geometry.centroid), r !== null && await this.view.goTo(r, { duration: 1e3 });
313
- const o = i.getAttribute("type"), h = i.getAttribute("id");
314
- switch (o) {
315
- case "district": {
316
- let a = await this.districtControllerSolidLayer.queryFeatures();
317
- a.features.forEach((l) => {
318
- l.attributes.selected = l.attributes.id === h;
319
- }), await this.districtControllerSolidLayer.applyEdits({
320
- updateFeatures: a.features
321
- }), a = await this.districtControllerDashLayer.queryFeatures(), a.features.forEach((l) => {
322
- l.attributes.selected = l.attributes.id === h;
323
- }), await this.districtControllerDashLayer.applyEdits({
324
- updateFeatures: a.features
325
- });
326
- break;
327
- }
328
- case "subDistrict": {
329
- let a = await this.subDistrictControllerLayer.queryFeatures();
330
- a.features.forEach((u) => {
331
- u.attributes.selected = u.attributes.id === h;
332
- }), await this.subDistrictControllerLayer.applyEdits({
333
- updateFeatures: a.features
334
- }), a = await this.signalMarkerLayer.queryFeatures(), a.features.forEach((u) => {
335
- u.attributes.selected = u.attributes.subDistrictId === h;
336
- });
337
- let l = await this.signalMarkerLayer.applyEdits({
338
- updateFeatures: a.features
339
- });
340
- console.log(l), a = await this.signalPictureLayer.queryFeatures(), a.features.forEach((u) => {
341
- u.attributes.selected = u.attributes.subDistrictId === h;
342
- }), l = await this.signalPictureLayer.applyEdits({
343
- updateFeatures: a.features
344
- }), console.log(l);
345
- break;
346
- }
347
- }
348
- L.when(
349
- () => this.view.popup.visible === !1,
350
- async () => {
351
- await this.resetSelectedSymbol(o);
352
- },
353
- {
354
- once: !0
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(e) {
362
- switch (e) {
363
- case "district": {
364
- let t = await this.districtControllerSolidLayer.queryFeatures();
365
- t.features.forEach((s) => {
366
- s.attributes.selected = !0;
367
- }), await this.districtControllerSolidLayer.applyEdits({
368
- updateFeatures: t.features
369
- }), t = await this.districtControllerDashLayer.queryFeatures(), t.features.forEach((s) => {
370
- s.attributes.selected = !0;
371
- }), await this.districtControllerDashLayer.applyEdits({
372
- updateFeatures: t.features
373
- });
374
- break;
375
- }
376
- case "subDistrict": {
377
- let t = await this.subDistrictControllerLayer.queryFeatures();
378
- t.features.forEach((s) => {
379
- s.attributes.selected = !0;
380
- }), await this.subDistrictControllerLayer.applyEdits({
381
- updateFeatures: t.features
382
- }), t = await this.signalMarkerLayer.queryFeatures(), t.features.forEach((s) => {
383
- s.attributes.selected = !0;
384
- }), await this.signalMarkerLayer.applyEdits({
385
- updateFeatures: t.features
386
- }), t = await this.signalPictureLayer.queryFeatures(), t.features.forEach((s) => {
387
- s.attributes.selected = !0;
388
- }), await this.signalPictureLayer.applyEdits({
389
- updateFeatures: t.features
390
- });
391
- break;
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
- * 改为图层到处未json,用json创建Graphic,再将Graphic添加到FeatureLayer
337
+ * 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
399
338
  */
400
339
  async loadDetachmentLayer() {
401
- const e = this.mapConfig.baseLayers;
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 i = await (await fetch(
410
- "/GisViewerAssets/ShangHai/Layers/district.json"
411
- )).json(), r = [], { renderer: o, labelingInfo: h } = t.options;
412
- i.features.forEach((n) => {
413
- const a = n.attributes.ZD_NAME;
414
- if (a !== "高架支队") {
415
- let l = new b({
416
- rings: n.geometry.rings
417
- });
418
- l = w(l);
419
- const u = new y({
420
- geometry: l,
421
- attributes: n.attributes
422
- });
423
- if (o) {
424
- if (o.type === "simple")
425
- u.symbol = o.symbol;
426
- else if (o.type === "unique-value") {
427
- const p = u.getAttribute("OBJECTID"), g = o.uniqueValueInfos.find(
428
- (f) => f.value == p
429
- );
430
- u.symbol = g ? g.symbol : o.defaultSymbol;
431
- }
432
- } else
433
- u.symbol = {
434
- type: "simple-fill",
435
- color: [227, 237, 255, 0.4],
436
- outline: {
437
- color: [255, 195, 153],
438
- width: 2
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
- if (r.push(u), h && a !== "边防港航支队" && a !== "机场支队") {
442
- const p = new y({
443
- geometry: l.centroid,
444
- symbol: { ...h.symbol, text: a }
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
- V as default
396
+ T as default
454
397
  };