gisviewer-vue3-arcgis 1.0.219 → 1.0.221

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.
@@ -1,63 +1,70 @@
1
- import * as u from "@arcgis/core/core/reactiveUtils";
2
- import { Point as f } from "@arcgis/core/geometry";
1
+ import * as g from "@arcgis/core/core/reactiveUtils";
2
+ import { Point as h } from "@arcgis/core/geometry";
3
3
  import * as d from "@arcgis/core/geometry/support/webMercatorUtils.js";
4
- import y from "@arcgis/core/layers/GraphicsLayer";
5
- import L from "./signal-holo-flow.mjs";
6
- class x extends L {
7
- constructor(n, s) {
8
- super(n), this.stopLineLayer = new y(), this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = s, this.view.map.add(this.stopLineLayer);
4
+ import u from "@arcgis/core/layers/GraphicsLayer";
5
+ import y from "./signal-holo-flow.mjs";
6
+ class b extends y {
7
+ constructor(s, a) {
8
+ super(s), this.stopLineLayer = new u(), this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = a, this.view.map.add(this.stopLineLayer);
9
9
  }
10
10
  async initializeLayer() {
11
- var p, l;
11
+ var p, c;
12
12
  console.time("初始化停止线图层");
13
- let n = (l = (p = this.mapConfig.holoFlow) == null ? void 0 : p.signal) == null ? void 0 : l.stopLineLayer;
14
- if (!n)
13
+ let s = (c = (p = this.mapConfig.holoFlow) == null ? void 0 : p.signal) == null ? void 0 : c.stopLineLayer;
14
+ if (!s)
15
15
  return;
16
- n = this.mapConfig.assetsRoot + "/" + n, (await (await fetch(n)).json()).features.forEach((t) => {
17
- const { roadId: o, nodeId: e, angle: a } = t.properties;
18
- let { destinationPoint: i } = t.properties;
19
- const { coordinates: r } = t.geometry;
20
- if (!i) {
21
- const w = r[0], P = r[r.length - 1], m = (w[0] + P[0]) / 2, g = (w[1] + P[1]) / 2;
22
- i = [m, g];
16
+ s = this.mapConfig.assetsRoot + "/" + s;
17
+ const l = await (await fetch(s)).json();
18
+ for (const t of l.features) {
19
+ const { roadId: o, nodeId: e } = t.properties;
20
+ let { destinationPoint: n } = t.properties;
21
+ const { coordinates: i } = t.geometry;
22
+ if (n) {
23
+ if (typeof n == "string")
24
+ try {
25
+ n = JSON.parse(n);
26
+ } catch (f) {
27
+ console.error("解析面板基准点失败", f);
28
+ continue;
29
+ }
30
+ } else {
31
+ const f = i[0], w = i[i.length - 1], P = (f[0] + w[0]) / 2, m = (f[1] + w[1]) / 2;
32
+ n = [P, m];
23
33
  }
24
- const h = this.stopLineMap.get(e);
25
- h ? h.set(o, {
26
- coord: r,
27
- panelPoint: i,
28
- angle: a
34
+ const r = this.stopLineMap.get(e);
35
+ r ? r.set(o, {
36
+ coord: i,
37
+ panelPoint: n
29
38
  }) : this.stopLineMap.set(
30
39
  e,
31
40
  /* @__PURE__ */ new Map([
32
- [
33
- o,
34
- { coord: r, panelPoint: i, angle: a }
35
- ]
41
+ [o, { coord: i, panelPoint: n }]
36
42
  ])
37
43
  );
38
- }), console.timeEnd("初始化停止线图层");
44
+ }
45
+ console.timeEnd("初始化停止线图层");
39
46
  }
40
47
  getPanelScale() {
41
- const n = this.view.scale;
42
- let s = 1;
43
- return n < 1e3 ? s = 1 : n < 2e3 ? s = 0.8 : n < 4e3 ? s = 0.4 : s = 0, s;
48
+ const s = this.view.scale;
49
+ let a = 1;
50
+ return s < 1e3 ? a = 1 : s < 2e3 ? a = 0.8 : s < 4e3 ? a = 0.4 : a = 0, a;
44
51
  }
45
- async handleSignalData(n) {
46
- this.watchHandle || (this.watchHandle = u.watch(
52
+ async handleSignalData(s) {
53
+ this.watchHandle || (this.watchHandle = g.watch(
47
54
  () => this.view.extent,
48
55
  () => {
49
56
  const t = this.getPanelScale();
50
57
  for (const o of this.countdownPanelProps) {
51
58
  t !== this.currentPanelScale && (o.scale = t);
52
59
  const { mapPoint: e } = o;
53
- let a = new f({
60
+ let n = new h({
54
61
  x: e[0],
55
62
  y: e[1]
56
63
  });
57
- this.view.spatialReference.isWebMercator && (a = d.geographicToWebMercator(
58
- a
64
+ this.view.spatialReference.isWebMercator && (n = d.geographicToWebMercator(
65
+ n
59
66
  ));
60
- const i = this.view.toScreen(a);
67
+ const i = this.view.toScreen(n);
61
68
  if (o.position.left = i.x, o.position.top = i.y, this.view.type === "3d") {
62
69
  const r = this.getPanelRotation(o.stopLine);
63
70
  o.rotation = r;
@@ -66,48 +73,48 @@ class x extends L {
66
73
  this.currentPanelScale = t;
67
74
  }
68
75
  ));
69
- const s = n.crossId, c = this.stopLineMap.get(s);
70
- if (!c)
76
+ const a = s.crossId, l = this.stopLineMap.get(a);
77
+ if (!l)
71
78
  return;
72
- const p = n.phaseCountDownList, l = /* @__PURE__ */ new Map();
79
+ const p = s.phaseCountDownList, c = /* @__PURE__ */ new Map();
73
80
  for (const t of p) {
74
81
  let o = "";
75
82
  for (let r of t.roadIdList)
76
- if (r.startsWith("-") && (r = r.slice(1)), c.has(r)) {
83
+ if (r.startsWith("-") && (r = r.slice(1)), l.has(r)) {
77
84
  o = r;
78
85
  break;
79
86
  }
80
87
  if (!o)
81
88
  continue;
82
- let e = l.get(o);
83
- if (e || (e = {}, l.set(o, e)), !t.direction) {
84
- console.log(`没有找到对应的方向${s}--${JSON.stringify(t)}`);
89
+ let e = c.get(o);
90
+ if (e || (e = {}, c.set(o, e)), !t.direction) {
91
+ console.log(`没有找到对应的方向${a}--${JSON.stringify(t)}`);
85
92
  continue;
86
93
  }
87
- const a = t.direction.toLowerCase(), i = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
88
- a === "u" ? (e.uNumber = t.leftTime, e.uColor = i) : a === "l" ? (e.lNumber = t.leftTime, e.lColor = i) : a === "s" ? (e.sNumber = t.leftTime, e.sColor = i) : a === "r" && (e.rNumber = t.leftTime, e.rColor = i);
94
+ const n = t.direction.toLowerCase(), i = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
95
+ n === "u" ? (e.uNumber = t.leftTime, e.uColor = i) : n === "l" ? (e.lNumber = t.leftTime, e.lColor = i) : n === "s" ? (e.sNumber = t.leftTime, e.sColor = i) : n === "r" && (e.rNumber = t.leftTime, e.rColor = i);
89
96
  }
90
- l.forEach((t, o) => {
91
- const e = c.get(o);
97
+ c.forEach((t, o) => {
98
+ const e = l.get(o);
92
99
  if (!e)
93
100
  return;
94
- const a = this.countdownPanelProps.find(
95
- (i) => i.crossId === s && i.roadId === o
101
+ const n = this.countdownPanelProps.find(
102
+ (i) => i.crossId === a && i.roadId === o
96
103
  );
97
- if (a)
98
- a.lampStatus = t;
104
+ if (n)
105
+ n.lampStatus = t;
99
106
  else {
100
- let i = new f({
107
+ let i = new h({
101
108
  x: e.panelPoint[0],
102
109
  y: e.panelPoint[1]
103
110
  });
104
111
  this.view.spatialReference.isWebMercator && (i = d.geographicToWebMercator(
105
112
  i
106
113
  ));
107
- const r = this.view.toScreen(i), h = this.getPanelRotation(e.coord);
114
+ const r = this.view.toScreen(i), f = this.getPanelRotation(e.coord);
108
115
  this.countdownPanelProps.push({
109
116
  displayMode: "complex",
110
- crossId: s,
117
+ crossId: a,
111
118
  roadId: o,
112
119
  mapPoint: e.panelPoint,
113
120
  // 定位点地理坐标
@@ -115,7 +122,7 @@ class x extends L {
115
122
  // 关联的停止线坐标
116
123
  position: { left: r.x, top: r.y },
117
124
  // 定位点屏幕坐标
118
- rotation: h,
125
+ rotation: f,
119
126
  // 面板旋转角度
120
127
  scale: this.getPanelScale(),
121
128
  lampStatus: t
@@ -125,35 +132,35 @@ class x extends L {
125
132
  });
126
133
  }
127
134
  clearSignal() {
128
- var n;
129
- this.stopLineLayer.removeAll(), this.countdownPanelProps.length = 0, (n = this.watchHandle) == null || n.remove(), this.watchHandle = null;
135
+ var s;
136
+ this.stopLineLayer.removeAll(), this.countdownPanelProps.length = 0, (s = this.watchHandle) == null || s.remove(), this.watchHandle = null;
130
137
  }
131
138
  /**
132
139
  * 从停止线坐标计算面板旋转角度
133
140
  * @param coordinates
134
141
  * @returns
135
142
  */
136
- getPanelRotation(n) {
137
- const s = n[0];
138
- let c = new f({
139
- x: s[0],
140
- y: s[1]
143
+ getPanelRotation(s) {
144
+ const a = s[0];
145
+ let l = new h({
146
+ x: a[0],
147
+ y: a[1]
141
148
  });
142
- this.view.spatialReference.isWebMercator && (c = d.geographicToWebMercator(
143
- c
149
+ this.view.spatialReference.isWebMercator && (l = d.geographicToWebMercator(
150
+ l
144
151
  ));
145
- const p = this.view.toScreen(c), l = n[n.length - 1];
146
- let t = new f({
147
- x: l[0],
148
- y: l[1]
152
+ const p = this.view.toScreen(l), c = s[s.length - 1];
153
+ let t = new h({
154
+ x: c[0],
155
+ y: c[1]
149
156
  });
150
157
  this.view.spatialReference.isWebMercator && (t = d.geographicToWebMercator(
151
158
  t
152
159
  ));
153
- const o = this.view.toScreen(t), e = o.x - p.x, a = o.y - p.y;
154
- return Math.atan2(a, e) * (180 / Math.PI);
160
+ const o = this.view.toScreen(t), e = o.x - p.x, n = o.y - p.y;
161
+ return Math.atan2(n, e) * (180 / Math.PI);
155
162
  }
156
163
  }
157
164
  export {
158
- x as default
165
+ b as default
159
166
  };
@@ -84,7 +84,8 @@ export default class SignalControlAreaController1 {
84
84
  private resetSelectedSymbol;
85
85
  /**
86
86
  * 加载支队图层
87
- * 现场环境用url创建FeatureLayer有各种问题,改为用url创建Graphic,再将Graphic添加到FeatureLayer
87
+ * 现场环境用url创建FeatureLayer有各种问题,
88
+ * 改为图层到处未json,用json创建Graphic,再将Graphic添加到FeatureLayer
88
89
  */
89
90
  private loadDetachmentLayer;
90
91
  }
@@ -10,24 +10,24 @@ import * as d from "@turf/helpers";
10
10
  import m from "concaveman";
11
11
  import F from "../../stores/index.mjs";
12
12
  import k from "./district-controller.mjs";
13
- import { districtDashLineLayerOptions as G, districtSolidLineLayerOptions as S, subDistrictLayerOptions as v, signalMarkerLayerOptions as x, signalPictureLayerOptions as I, signalClusterLayerOptions as M } from "./layer-symbol.mjs";
14
- class Q {
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 = F.useAppDataStore;
18
- this.mapConfig = JSON.parse(JSON.stringify(e.mapConfig)), this.detachmentLayer = new C(), this.districtControllerDashLayer = new c(
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
19
  G
20
- ), this.districtControllerDashLayer.spatialReference = t.spatialReference, this.districtControllerSolidLayer = new c(
21
- S
22
- ), this.districtControllerSolidLayer.spatialReference = t.spatialReference, this.districtControllerSolidLayer.popupEnabled = this.popupEnabled, this.subDistrictControllerLayer = new c(
20
+ ), this.districtControllerDashLayer.spatialReference = e.spatialReference, this.districtControllerSolidLayer = new c(
23
21
  v
24
- ), this.subDistrictControllerLayer.spatialReference = t.spatialReference, this.subDistrictControllerLayer.popupEnabled = this.popupEnabled, this.signalMarkerLayer = new c(
22
+ ), this.districtControllerSolidLayer.spatialReference = e.spatialReference, this.districtControllerSolidLayer.popupEnabled = this.popupEnabled, this.subDistrictControllerLayer = new c(
25
23
  x
26
- ), this.signalMarkerLayer.spatialReference = t.spatialReference, this.signalMarkerLayer.popupEnabled = this.popupEnabled, this.signalPictureLayer = new c(
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
27
  I
28
- ), this.signalPictureLayer.spatialReference = t.spatialReference, this.signalPictureLayer.popupEnabled = this.popupEnabled, this.signalClusterLayer = new c(
28
+ ), this.signalPictureLayer.spatialReference = e.spatialReference, this.signalPictureLayer.popupEnabled = this.popupEnabled, this.signalClusterLayer = new c(
29
29
  M
30
- ), this.signalClusterLayer.spatialReference = t.spatialReference, this.signalClusterLayer.popupEnabled = this.popupEnabled, this.view.map.addMany([
30
+ ), this.signalClusterLayer.spatialReference = e.spatialReference, this.signalClusterLayer.popupEnabled = this.popupEnabled, this.view.map.addMany([
31
31
  this.detachmentLayer,
32
32
  this.districtControllerSolidLayer,
33
33
  this.districtControllerDashLayer,
@@ -42,14 +42,14 @@ class Q {
42
42
  * @param params
43
43
  * @returns
44
44
  */
45
- async showSignalControlArea(t) {
45
+ async showSignalControlArea(e) {
46
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 e of t.areaList) {
47
+ for (const t of e.areaList) {
48
48
  const s = new k(
49
- e,
50
- t.style || ""
49
+ t,
50
+ e.style || ""
51
51
  );
52
- this.generateGraphic(s, !0, t.style);
52
+ this.generateGraphic(s, !0, e.style);
53
53
  }
54
54
  return await this.districtControllerDashLayer.applyEdits({
55
55
  addFeatures: this.districtGraphics
@@ -71,19 +71,19 @@ class Q {
71
71
  */
72
72
  async clearSignalControlArea() {
73
73
  this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0;
74
- let t = await this.districtControllerDashLayer.queryFeatures();
74
+ let e = await this.districtControllerDashLayer.queryFeatures();
75
75
  return await this.districtControllerDashLayer.applyEdits({
76
- deleteFeatures: t.features
77
- }), this.districtControllerDashLayer.definitionExpression = "1=1", t = await this.districtControllerSolidLayer.queryFeatures(), await this.districtControllerSolidLayer.applyEdits({
78
- deleteFeatures: t.features
79
- }), this.districtControllerSolidLayer.definitionExpression = "1=1", t = await this.subDistrictControllerLayer.queryFeatures(), await this.subDistrictControllerLayer.applyEdits({
80
- deleteFeatures: t.features
81
- }), this.subDistrictControllerLayer.definitionExpression = "1=1", t = await this.signalMarkerLayer.queryFeatures(), await this.signalMarkerLayer.applyEdits({
82
- deleteFeatures: t.features
83
- }), this.signalMarkerLayer.definitionExpression = "1=1", t = await this.signalPictureLayer.queryFeatures(), await this.signalPictureLayer.applyEdits({
84
- deleteFeatures: t.features
85
- }), this.signalPictureLayer.definitionExpression = "1=1", t = await this.signalClusterLayer.queryFeatures(), await this.signalClusterLayer.applyEdits({
86
- deleteFeatures: t.features
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
87
  }), this.signalClusterLayer.definitionExpression = "1=1", { status: 0, message: "ok" };
88
88
  }
89
89
  /**
@@ -91,22 +91,22 @@ class Q {
91
91
  * @param layerName
92
92
  * @param visible
93
93
  */
94
- setLayerVisibility(t) {
95
- switch (t.visible === !1 && this.view.closePopup(), t.id) {
94
+ setLayerVisibility(e) {
95
+ switch (e.visible === !1 && this.view.closePopup(), e.id) {
96
96
  case "district":
97
- this.districtControllerDashLayer.visible = t.visible, this.districtControllerSolidLayer.visible = t.visible;
97
+ this.districtControllerDashLayer.visible = e.visible, this.districtControllerSolidLayer.visible = e.visible;
98
98
  break;
99
99
  case "subDistrict":
100
- this.subDistrictControllerLayer.visible = t.visible;
100
+ this.subDistrictControllerLayer.visible = e.visible;
101
101
  break;
102
102
  case "signal":
103
- this.signalMarkerLayer.visible = t.visible, this.signalPictureLayer.visible = t.visible;
103
+ this.signalMarkerLayer.visible = e.visible, this.signalPictureLayer.visible = e.visible;
104
104
  break;
105
105
  case "signalCluster":
106
- this.signalClusterLayer.visible = t.visible;
106
+ this.signalClusterLayer.visible = e.visible;
107
107
  break;
108
108
  case "shanghai_district":
109
- this.detachmentLayer.visible = t.visible;
109
+ this.detachmentLayer.visible = e.visible;
110
110
  break;
111
111
  }
112
112
  return { status: 0, message: "ok" };
@@ -116,11 +116,11 @@ class Q {
116
116
  * @param params
117
117
  * @returns
118
118
  */
119
- async locateSignalControlArea(t) {
120
- switch (t.type) {
119
+ async locateSignalControlArea(e) {
120
+ switch (e.type) {
121
121
  case "district": {
122
122
  const i = this.districtControllerDashLayer.createQuery();
123
- i.where = `id = '${t.id}'`, i.returnGeometry = !0, i.outFields = ["*"];
123
+ i.where = `id = '${e.id}'`, i.returnGeometry = !0, i.outFields = ["*"];
124
124
  const r = await this.districtControllerDashLayer.queryFeatures(
125
125
  i
126
126
  );
@@ -129,20 +129,20 @@ class Q {
129
129
  }), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
130
130
  }
131
131
  case "subDistrict":
132
- const e = this.subDistrictControllerLayer.createQuery();
133
- e.where = `id = '${t.id}'`, e.returnGeometry = !0, e.outFields = ["*"];
132
+ const t = this.subDistrictControllerLayer.createQuery();
133
+ t.where = `id = '${e.id}'`, t.returnGeometry = !0, t.outFields = ["*"];
134
134
  const s = await this.subDistrictControllerLayer.queryFeatures(
135
- e
135
+ t
136
136
  );
137
137
  return s.features.length > 0 ? (await this.view.goTo(s.features, {
138
138
  duration: this.hasGpu ? 1e3 : 0
139
139
  }), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
140
140
  case "signal": {
141
141
  const i = this.signalMarkerLayer.createQuery();
142
- i.where = `id = '${t.id}'`, i.returnGeometry = !0, i.outFields = ["*"];
142
+ i.where = `id = '${e.id}'`, i.returnGeometry = !0, i.outFields = ["*"];
143
143
  const r = await this.signalMarkerLayer.queryFeatures(i);
144
144
  return r.features.length > 0 ? (await this.view.goTo(
145
- { target: r.features[0], scale: t.scale || 1e3 },
145
+ { target: r.features[0], scale: e.scale || 1e3 },
146
146
  {
147
147
  duration: this.hasGpu ? 1e3 : 0
148
148
  }
@@ -157,23 +157,23 @@ class Q {
157
157
  * @param params
158
158
  * @returns
159
159
  */
160
- async highlightSignalControlArea(t) {
161
- var e;
162
- switch ((e = this.view.popup) != null && e.visible && this.view.popup.close(), t.type) {
160
+ async highlightSignalControlArea(e) {
161
+ var t;
162
+ switch ((t = this.view.popup) != null && t.visible && this.view.popup.close(), e.type) {
163
163
  case "district": {
164
164
  const s = this.districtControllerDashLayer.definitionExpression;
165
- this.districtControllerDashLayer.definitionExpression = `id = '${t.id}'`;
165
+ this.districtControllerDashLayer.definitionExpression = `id = '${e.id}'`;
166
166
  const i = await this.districtControllerDashLayer.queryFeatures();
167
- return i.features.length > 0 ? (this.districtControllerSolidLayer.definitionExpression = `id = '${t.id}'`, this.subDistrictControllerLayer.definitionExpression = `parentId = '${t.id}'`, this.signalMarkerLayer.definitionExpression = `districtId = '${t.id}'`, this.signalPictureLayer.definitionExpression = `districtId = '${t.id}'`, this.signalClusterLayer.definitionExpression = `districtId = '${t.id}'`, await this.view.goTo(i.features, {
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
168
  duration: this.hasGpu ? 1e3 : 0
169
169
  }), { status: 0, message: "ok" }) : (this.districtControllerDashLayer.definitionExpression = s, { status: 1, message: "未找到区控" });
170
170
  }
171
171
  case "subDistrict": {
172
172
  const s = this.subDistrictControllerLayer.definitionExpression;
173
- this.subDistrictControllerLayer.definitionExpression = `id = '${t.id}'`;
173
+ this.subDistrictControllerLayer.definitionExpression = `id = '${e.id}'`;
174
174
  const i = await this.subDistrictControllerLayer.queryFeatures();
175
175
  if (i.features.length > 0) {
176
- this.signalMarkerLayer.definitionExpression = `subDistrictId = '${t.id}'`, this.signalPictureLayer.definitionExpression = `subDistrictId = '${t.id}'`, this.signalClusterLayer.definitionExpression = `subDistrictId = '${t.id}'`;
176
+ this.signalMarkerLayer.definitionExpression = `subDistrictId = '${e.id}'`, this.signalPictureLayer.definitionExpression = `subDistrictId = '${e.id}'`, this.signalClusterLayer.definitionExpression = `subDistrictId = '${e.id}'`;
177
177
  const o = i.features[0].attributes.parentId;
178
178
  return this.districtControllerDashLayer.definitionExpression = `id = '${o}'`, this.districtControllerSolidLayer.definitionExpression = `id = '${o}'`, await this.view.goTo(i.features, {
179
179
  duration: this.hasGpu ? 1e3 : 0
@@ -183,13 +183,13 @@ class Q {
183
183
  }
184
184
  case "signal": {
185
185
  const s = this.signalMarkerLayer.definitionExpression;
186
- this.signalMarkerLayer.definitionExpression = `id = '${t.id}'`;
186
+ this.signalMarkerLayer.definitionExpression = `id = '${e.id}'`;
187
187
  const i = await this.signalMarkerLayer.queryFeatures();
188
188
  if (i.features.length > 0) {
189
- this.signalPictureLayer.definitionExpression = `id = '${t.id}'`, this.signalClusterLayer.definitionExpression = `id = '${t.id}'`;
189
+ this.signalPictureLayer.definitionExpression = `id = '${e.id}'`, this.signalClusterLayer.definitionExpression = `id = '${e.id}'`;
190
190
  const r = i.features[0], { districtId: o, subDistrictId: h } = r.attributes;
191
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: t.scale || 1e3 },
192
+ { target: i.features, scale: e.scale || 1e3 },
193
193
  {
194
194
  duration: this.hasGpu ? 1e3 : 0
195
195
  }
@@ -207,8 +207,8 @@ class Q {
207
207
  */
208
208
  async resetHighlight() {
209
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 t = await this.districtControllerDashLayer.queryFeatures();
211
- return this.view.goTo(t.features, {
210
+ const e = await this.districtControllerDashLayer.queryFeatures();
211
+ return this.view.goTo(e.features, {
212
212
  duration: this.hasGpu ? 1e3 : 0
213
213
  }), { status: 0, message: "ok" };
214
214
  }
@@ -218,21 +218,21 @@ class Q {
218
218
  * @param isDistrict 是否是区控
219
219
  * @returns
220
220
  */
221
- generateGraphic(t, e, s) {
222
- const i = t.getAllSignalCoordinates();
221
+ generateGraphic(e, t, s) {
222
+ const i = e.getAllSignalCoordinates();
223
223
  let r = null;
224
224
  if (i.length >= 2)
225
225
  if (i.length === 2)
226
226
  r = d.lineString(i);
227
227
  else {
228
- if (e) {
229
- const a = d.featureCollection(
230
- i.map((n) => d.point(n))
228
+ if (t) {
229
+ const n = d.featureCollection(
230
+ i.map((a) => d.point(a))
231
231
  );
232
- r = D(a);
232
+ r = D(n);
233
233
  } else {
234
- const a = m(i, 0.5);
235
- a.length >= 4 && (r = d.polygon([a]));
234
+ const n = m(i, 0.5);
235
+ n.length >= 4 && (r = d.polygon([n]));
236
236
  }
237
237
  r || (r = d.lineString(i));
238
238
  }
@@ -243,7 +243,7 @@ class Q {
243
243
  const o = E(
244
244
  r.geometry,
245
245
  // 区控面积更大,需要更大的缓冲半径
246
- e ? 200 : 30,
246
+ t ? 200 : 30,
247
247
  {
248
248
  units: "meters"
249
249
  }
@@ -253,48 +253,48 @@ class Q {
253
253
  paths: o.geometry.coordinates
254
254
  },
255
255
  attributes: {
256
- ObjectID: e ? this.districtControllerOid++ : this.subDistrictControllerOid++,
257
- id: t.id,
258
- name: t.name,
259
- subDistrictCount: t.subDistrictCount,
260
- signalCount: t.signalCount,
261
- parentId: t.parentId,
262
- parentName: t.parentName,
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,
263
263
  selected: s,
264
- type: e ? "district" : "subDistrict"
264
+ type: t ? "district" : "subDistrict"
265
265
  }
266
266
  });
267
- e ? this.districtGraphics.push(h) : this.subDistrictGraphics.push(h);
268
- for (const a of t.subDistricts)
269
- this.generateGraphic(a, !1, s);
270
- t.signals.forEach((a) => {
271
- const n = new y({
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({
272
272
  geometry: {
273
273
  type: "point",
274
- x: a.longitude,
275
- y: a.latitude
274
+ x: n.longitude,
275
+ y: n.latitude
276
276
  },
277
277
  attributes: {
278
278
  ObjectID: this.signalOid++,
279
- id: a.id,
280
- name: a.name,
281
- signalId: a.signalId,
282
- nodeId: a.nodeId,
283
- isKey: a.isKey,
284
- districtId: e ? t.id : t.parentId,
285
- districtName: e ? t.name : t.parentName,
286
- subDistrictId: e ? "" : t.id,
287
- subDistrictName: e ? "" : t.name,
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,
288
288
  type: "signal",
289
289
  selected: !0
290
290
  }
291
291
  });
292
- this.signalGraphics.push(n);
292
+ this.signalGraphics.push(a);
293
293
  });
294
294
  }
295
- async viewHitTest(t) {
296
- var a;
297
- const s = (a = (await this.view.hitTest(t, {
295
+ async viewHitTest(e) {
296
+ var n;
297
+ const s = (n = (await this.view.hitTest(e, {
298
298
  include: [
299
299
  this.districtControllerSolidLayer,
300
300
  this.subDistrictControllerLayer,
@@ -302,8 +302,8 @@ class Q {
302
302
  this.signalPictureLayer,
303
303
  this.signalClusterLayer
304
304
  ]
305
- })).results) == null ? void 0 : a.filter(
306
- (n) => n.type === "graphic"
305
+ })).results) == null ? void 0 : n.filter(
306
+ (a) => a.type === "graphic"
307
307
  );
308
308
  if (s.length === 0)
309
309
  return;
@@ -313,34 +313,34 @@ class Q {
313
313
  const o = i.getAttribute("type"), h = i.getAttribute("id");
314
314
  switch (o) {
315
315
  case "district": {
316
- let n = await this.districtControllerSolidLayer.queryFeatures();
317
- n.features.forEach((l) => {
316
+ let a = await this.districtControllerSolidLayer.queryFeatures();
317
+ a.features.forEach((l) => {
318
318
  l.attributes.selected = l.attributes.id === h;
319
319
  }), await this.districtControllerSolidLayer.applyEdits({
320
- updateFeatures: n.features
321
- }), n = await this.districtControllerDashLayer.queryFeatures(), n.features.forEach((l) => {
320
+ updateFeatures: a.features
321
+ }), a = await this.districtControllerDashLayer.queryFeatures(), a.features.forEach((l) => {
322
322
  l.attributes.selected = l.attributes.id === h;
323
323
  }), await this.districtControllerDashLayer.applyEdits({
324
- updateFeatures: n.features
324
+ updateFeatures: a.features
325
325
  });
326
326
  break;
327
327
  }
328
328
  case "subDistrict": {
329
- let n = await this.subDistrictControllerLayer.queryFeatures();
330
- n.features.forEach((u) => {
329
+ let a = await this.subDistrictControllerLayer.queryFeatures();
330
+ a.features.forEach((u) => {
331
331
  u.attributes.selected = u.attributes.id === h;
332
332
  }), await this.subDistrictControllerLayer.applyEdits({
333
- updateFeatures: n.features
334
- }), n = await this.signalMarkerLayer.queryFeatures(), n.features.forEach((u) => {
333
+ updateFeatures: a.features
334
+ }), a = await this.signalMarkerLayer.queryFeatures(), a.features.forEach((u) => {
335
335
  u.attributes.selected = u.attributes.subDistrictId === h;
336
336
  });
337
337
  let l = await this.signalMarkerLayer.applyEdits({
338
- updateFeatures: n.features
338
+ updateFeatures: a.features
339
339
  });
340
- console.log(l), n = await this.signalPictureLayer.queryFeatures(), n.features.forEach((u) => {
340
+ console.log(l), a = await this.signalPictureLayer.queryFeatures(), a.features.forEach((u) => {
341
341
  u.attributes.selected = u.attributes.subDistrictId === h;
342
342
  }), l = await this.signalPictureLayer.applyEdits({
343
- updateFeatures: n.features
343
+ updateFeatures: a.features
344
344
  }), console.log(l);
345
345
  break;
346
346
  }
@@ -358,35 +358,35 @@ class Q {
358
358
  /**
359
359
  * 重置所有graphic的置灰状态
360
360
  */
361
- async resetSelectedSymbol(t) {
362
- switch (t) {
361
+ async resetSelectedSymbol(e) {
362
+ switch (e) {
363
363
  case "district": {
364
- let e = await this.districtControllerSolidLayer.queryFeatures();
365
- e.features.forEach((s) => {
364
+ let t = await this.districtControllerSolidLayer.queryFeatures();
365
+ t.features.forEach((s) => {
366
366
  s.attributes.selected = !0;
367
367
  }), await this.districtControllerSolidLayer.applyEdits({
368
- updateFeatures: e.features
369
- }), e = await this.districtControllerDashLayer.queryFeatures(), e.features.forEach((s) => {
368
+ updateFeatures: t.features
369
+ }), t = await this.districtControllerDashLayer.queryFeatures(), t.features.forEach((s) => {
370
370
  s.attributes.selected = !0;
371
371
  }), await this.districtControllerDashLayer.applyEdits({
372
- updateFeatures: e.features
372
+ updateFeatures: t.features
373
373
  });
374
374
  break;
375
375
  }
376
376
  case "subDistrict": {
377
- let e = await this.subDistrictControllerLayer.queryFeatures();
378
- e.features.forEach((s) => {
377
+ let t = await this.subDistrictControllerLayer.queryFeatures();
378
+ t.features.forEach((s) => {
379
379
  s.attributes.selected = !0;
380
380
  }), await this.subDistrictControllerLayer.applyEdits({
381
- updateFeatures: e.features
382
- }), e = await this.signalMarkerLayer.queryFeatures(), console.log("marker count", e.features.length), e.features.forEach((s) => {
381
+ updateFeatures: t.features
382
+ }), t = await this.signalMarkerLayer.queryFeatures(), t.features.forEach((s) => {
383
383
  s.attributes.selected = !0;
384
384
  }), await this.signalMarkerLayer.applyEdits({
385
- updateFeatures: e.features
386
- }), e = await this.signalPictureLayer.queryFeatures(), console.log("picture count", e.features.length), e.features.forEach((s) => {
385
+ updateFeatures: t.features
386
+ }), t = await this.signalPictureLayer.queryFeatures(), t.features.forEach((s) => {
387
387
  s.attributes.selected = !0;
388
388
  }), await this.signalPictureLayer.applyEdits({
389
- updateFeatures: e.features
389
+ updateFeatures: t.features
390
390
  });
391
391
  break;
392
392
  }
@@ -394,40 +394,38 @@ class Q {
394
394
  }
395
395
  /**
396
396
  * 加载支队图层
397
- * 现场环境用url创建FeatureLayer有各种问题,改为用url创建Graphic,再将Graphic添加到FeatureLayer
397
+ * 现场环境用url创建FeatureLayer有各种问题,
398
+ * 改为图层到处未json,用json创建Graphic,再将Graphic添加到FeatureLayer
398
399
  */
399
400
  async loadDetachmentLayer() {
400
- const t = this.mapConfig.baseLayers;
401
- if (!t)
401
+ const e = this.mapConfig.baseLayers;
402
+ if (!e)
402
403
  return;
403
- const e = t.find(
404
- (a) => a.options.id === "shanghai_district"
404
+ const t = e.find(
405
+ (n) => n.options.id === "shanghai_district"
405
406
  );
406
- if (!e)
407
+ if (!t)
407
408
  return;
408
409
  const i = await (await fetch(
409
410
  "/GisViewerAssets/ShangHai/Layers/district.json"
410
- )).json(), r = [], { renderer: o, labelingInfo: h } = e.options;
411
- i.features.forEach((a) => {
412
- const n = a.attributes.ZD_NAME;
413
- if (n !== "高架支队") {
411
+ )).json(), r = [], { renderer: o, labelingInfo: h } = t.options;
412
+ i.features.forEach((n) => {
413
+ const a = n.attributes.ZD_NAME;
414
+ if (a !== "高架支队") {
414
415
  let l = new b({
415
- rings: a.geometry.rings
416
+ rings: n.geometry.rings
416
417
  });
417
418
  l = w(l);
418
419
  const u = new y({
419
420
  geometry: l,
420
- attributes: {
421
- ...a.attributes,
422
- ObjectID: a.attributes.OBJECTID || a.attributes.ESRI_OID
423
- }
421
+ attributes: n.attributes
424
422
  });
425
423
  if (o) {
426
424
  if (o.type === "simple")
427
425
  u.symbol = o.symbol;
428
426
  else if (o.type === "unique-value") {
429
- const p = u.getAttribute("ObjectID"), g = o.uniqueValueInfos.find(
430
- (f) => String(f.value) === String(p)
427
+ const p = u.getAttribute("OBJECTID"), g = o.uniqueValueInfos.find(
428
+ (f) => f.value == p
431
429
  );
432
430
  u.symbol = g ? g.symbol : o.defaultSymbol;
433
431
  }
@@ -440,10 +438,10 @@ class Q {
440
438
  width: 2
441
439
  }
442
440
  };
443
- if (r.push(u), h && n !== "边防港航支队" && n !== "机场支队") {
441
+ if (r.push(u), h && a !== "边防港航支队" && a !== "机场支队") {
444
442
  const p = new y({
445
443
  geometry: l.centroid,
446
- symbol: { ...h.symbol, text: n }
444
+ symbol: { ...h.symbol, text: a }
447
445
  });
448
446
  r.push(p);
449
447
  }
@@ -452,5 +450,5 @@ class Q {
452
450
  }
453
451
  }
454
452
  export {
455
- Q as default
453
+ V as default
456
454
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),M=require("@arcgis/core/geometry/support/webMercatorUtils.js"),S=require("@arcgis/core/layers/GraphicsLayer"),b=require("./signal-holo-flow.js");function g(f){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const n in f)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(f,n);Object.defineProperty(o,n,l.get?l:{enumerable:!0,get:()=>f[n]})}}return o.default=f,Object.freeze(o)}const v=g(L),u=g(M);class x extends b.default{constructor(o,n){super(o),this.stopLineLayer=new S,this.watchHandle=null,this.stopLineMap=new Map,this.countdownPanelProps=n,this.view.map.add(this.stopLineLayer)}async initializeLayer(){var p,c;console.time("初始化停止线图层");let o=(c=(p=this.mapConfig.holoFlow)==null?void 0:p.signal)==null?void 0:c.stopLineLayer;if(!o)return;o=this.mapConfig.assetsRoot+"/"+o,(await(await fetch(o)).json()).features.forEach(t=>{const{roadId:i,nodeId:e,angle:a}=t.properties;let{destinationPoint:s}=t.properties;const{coordinates:r}=t.geometry;if(!s){const w=r[0],P=r[r.length-1],m=(w[0]+P[0])/2,y=(w[1]+P[1])/2;s=[m,y]}const h=this.stopLineMap.get(e);h?h.set(i,{coord:r,panelPoint:s,angle:a}):this.stopLineMap.set(e,new Map([[i,{coord:r,panelPoint:s,angle:a}]]))}),console.timeEnd("初始化停止线图层")}getPanelScale(){const o=this.view.scale;let n=1;return o<1e3?n=1:o<2e3?n=.8:o<4e3?n=.4:n=0,n}async handleSignalData(o){this.watchHandle||(this.watchHandle=v.watch(()=>this.view.extent,()=>{const t=this.getPanelScale();for(const i of this.countdownPanelProps){t!==this.currentPanelScale&&(i.scale=t);const{mapPoint:e}=i;let a=new d.Point({x:e[0],y:e[1]});this.view.spatialReference.isWebMercator&&(a=u.geographicToWebMercator(a));const s=this.view.toScreen(a);if(i.position.left=s.x,i.position.top=s.y,this.view.type==="3d"){const r=this.getPanelRotation(i.stopLine);i.rotation=r}}this.currentPanelScale=t}));const n=o.crossId,l=this.stopLineMap.get(n);if(!l)return;const p=o.phaseCountDownList,c=new Map;for(const t of p){let i="";for(let r of t.roadIdList)if(r.startsWith("-")&&(r=r.slice(1)),l.has(r)){i=r;break}if(!i)continue;let e=c.get(i);if(e||(e={},c.set(i,e)),!t.direction){console.log(`没有找到对应的方向${n}--${JSON.stringify(t)}`);continue}const a=t.direction.toLowerCase(),s=t.color===1?"red":t.color===2?"yellow":"green";a==="u"?(e.uNumber=t.leftTime,e.uColor=s):a==="l"?(e.lNumber=t.leftTime,e.lColor=s):a==="s"?(e.sNumber=t.leftTime,e.sColor=s):a==="r"&&(e.rNumber=t.leftTime,e.rColor=s)}c.forEach((t,i)=>{const e=l.get(i);if(!e)return;const a=this.countdownPanelProps.find(s=>s.crossId===n&&s.roadId===i);if(a)a.lampStatus=t;else{let s=new d.Point({x:e.panelPoint[0],y:e.panelPoint[1]});this.view.spatialReference.isWebMercator&&(s=u.geographicToWebMercator(s));const r=this.view.toScreen(s),h=this.getPanelRotation(e.coord);this.countdownPanelProps.push({displayMode:"complex",crossId:n,roadId:i,mapPoint:e.panelPoint,stopLine:e.coord,position:{left:r.x,top:r.y},rotation:h,scale:this.getPanelScale(),lampStatus:t})}})}clearSignal(){var o;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(o=this.watchHandle)==null||o.remove(),this.watchHandle=null}getPanelRotation(o){const n=o[0];let l=new d.Point({x:n[0],y:n[1]});this.view.spatialReference.isWebMercator&&(l=u.geographicToWebMercator(l));const p=this.view.toScreen(l),c=o[o.length-1];let t=new d.Point({x:c[0],y:c[1]});this.view.spatialReference.isWebMercator&&(t=u.geographicToWebMercator(t));const i=this.view.toScreen(t),e=i.x-p.x,a=i.y-p.y;return Math.atan2(a,e)*(180/Math.PI)}}exports.default=x;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/core/reactiveUtils"),u=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/support/webMercatorUtils.js"),M=require("@arcgis/core/layers/GraphicsLayer"),S=require("./signal-holo-flow.js");function P(f){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const n in f)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(f,n);Object.defineProperty(o,n,l.get?l:{enumerable:!0,get:()=>f[n]})}}return o.default=f,Object.freeze(o)}const b=P(y),d=P(L);class v extends S.default{constructor(o,n){super(o),this.stopLineLayer=new M,this.watchHandle=null,this.stopLineMap=new Map,this.countdownPanelProps=n,this.view.map.add(this.stopLineLayer)}async initializeLayer(){var p,c;console.time("初始化停止线图层");let o=(c=(p=this.mapConfig.holoFlow)==null?void 0:p.signal)==null?void 0:c.stopLineLayer;if(!o)return;o=this.mapConfig.assetsRoot+"/"+o;const l=await(await fetch(o)).json();for(const t of l.features){const{roadId:i,nodeId:e}=t.properties;let{destinationPoint:s}=t.properties;const{coordinates:a}=t.geometry;if(s){if(typeof s=="string")try{s=JSON.parse(s)}catch(h){console.error("解析面板基准点失败",h);continue}}else{const h=a[0],w=a[a.length-1],g=(h[0]+w[0])/2,m=(h[1]+w[1])/2;s=[g,m]}const r=this.stopLineMap.get(e);r?r.set(i,{coord:a,panelPoint:s}):this.stopLineMap.set(e,new Map([[i,{coord:a,panelPoint:s}]]))}console.timeEnd("初始化停止线图层")}getPanelScale(){const o=this.view.scale;let n=1;return o<1e3?n=1:o<2e3?n=.8:o<4e3?n=.4:n=0,n}async handleSignalData(o){this.watchHandle||(this.watchHandle=b.watch(()=>this.view.extent,()=>{const t=this.getPanelScale();for(const i of this.countdownPanelProps){t!==this.currentPanelScale&&(i.scale=t);const{mapPoint:e}=i;let s=new u.Point({x:e[0],y:e[1]});this.view.spatialReference.isWebMercator&&(s=d.geographicToWebMercator(s));const a=this.view.toScreen(s);if(i.position.left=a.x,i.position.top=a.y,this.view.type==="3d"){const r=this.getPanelRotation(i.stopLine);i.rotation=r}}this.currentPanelScale=t}));const n=o.crossId,l=this.stopLineMap.get(n);if(!l)return;const p=o.phaseCountDownList,c=new Map;for(const t of p){let i="";for(let r of t.roadIdList)if(r.startsWith("-")&&(r=r.slice(1)),l.has(r)){i=r;break}if(!i)continue;let e=c.get(i);if(e||(e={},c.set(i,e)),!t.direction){console.log(`没有找到对应的方向${n}--${JSON.stringify(t)}`);continue}const s=t.direction.toLowerCase(),a=t.color===1?"red":t.color===2?"yellow":"green";s==="u"?(e.uNumber=t.leftTime,e.uColor=a):s==="l"?(e.lNumber=t.leftTime,e.lColor=a):s==="s"?(e.sNumber=t.leftTime,e.sColor=a):s==="r"&&(e.rNumber=t.leftTime,e.rColor=a)}c.forEach((t,i)=>{const e=l.get(i);if(!e)return;const s=this.countdownPanelProps.find(a=>a.crossId===n&&a.roadId===i);if(s)s.lampStatus=t;else{let a=new u.Point({x:e.panelPoint[0],y:e.panelPoint[1]});this.view.spatialReference.isWebMercator&&(a=d.geographicToWebMercator(a));const r=this.view.toScreen(a),h=this.getPanelRotation(e.coord);this.countdownPanelProps.push({displayMode:"complex",crossId:n,roadId:i,mapPoint:e.panelPoint,stopLine:e.coord,position:{left:r.x,top:r.y},rotation:h,scale:this.getPanelScale(),lampStatus:t})}})}clearSignal(){var o;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(o=this.watchHandle)==null||o.remove(),this.watchHandle=null}getPanelRotation(o){const n=o[0];let l=new u.Point({x:n[0],y:n[1]});this.view.spatialReference.isWebMercator&&(l=d.geographicToWebMercator(l));const p=this.view.toScreen(l),c=o[o.length-1];let t=new u.Point({x:c[0],y:c[1]});this.view.spatialReference.isWebMercator&&(t=d.geographicToWebMercator(t));const i=this.view.toScreen(t),e=i.x-p.x,s=i.y-p.y;return Math.atan2(s,e)*(180/Math.PI)}}exports.default=v;
@@ -84,7 +84,8 @@ export default class SignalControlAreaController1 {
84
84
  private resetSelectedSymbol;
85
85
  /**
86
86
  * 加载支队图层
87
- * 现场环境用url创建FeatureLayer有各种问题,改为用url创建Graphic,再将Graphic添加到FeatureLayer
87
+ * 现场环境用url创建FeatureLayer有各种问题,
88
+ * 改为图层到处未json,用json创建Graphic,再将Graphic添加到FeatureLayer
88
89
  */
89
90
  private loadDetachmentLayer;
90
91
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("@arcgis/core/core/reactiveUtils"),E=require("@arcgis/core/geometry"),D=require("@arcgis/core/geometry/support/webMercatorUtils"),g=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/FeatureLayer"),m=require("@arcgis/core/layers/GraphicsLayer"),k=require("@turf/buffer"),F=require("@turf/convex"),S=require("@turf/helpers"),v=require("concaveman"),G=require("../../stores/index.js"),q=require("./district-controller.js"),y=require("./layer-symbol.js");function L(h){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>h[t]})}}return e.default=h,Object.freeze(e)}const x=L(C),p=L(S);class I{constructor(e){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";const t=G.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.detachmentLayer=new m,this.districtControllerDashLayer=new d(y.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=e.spatialReference,this.districtControllerSolidLayer=new d(y.districtSolidLineLayerOptions),this.districtControllerSolidLayer.spatialReference=e.spatialReference,this.districtControllerSolidLayer.popupEnabled=this.popupEnabled,this.subDistrictControllerLayer=new d(y.subDistrictLayerOptions),this.subDistrictControllerLayer.spatialReference=e.spatialReference,this.subDistrictControllerLayer.popupEnabled=this.popupEnabled,this.signalMarkerLayer=new d(y.signalMarkerLayerOptions),this.signalMarkerLayer.spatialReference=e.spatialReference,this.signalMarkerLayer.popupEnabled=this.popupEnabled,this.signalPictureLayer=new d(y.signalPictureLayerOptions),this.signalPictureLayer.spatialReference=e.spatialReference,this.signalPictureLayer.popupEnabled=this.popupEnabled,this.signalClusterLayer=new d(y.signalClusterLayerOptions),this.signalClusterLayer.spatialReference=e.spatialReference,this.signalClusterLayer.popupEnabled=this.popupEnabled,this.view.map.addMany([this.detachmentLayer,this.districtControllerSolidLayer,this.districtControllerDashLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer,this.subDistrictControllerLayer]),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this))}async showSignalControlArea(e){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;for(const t of e.areaList){const s=new q.default(t,e.style||"");this.generateGraphic(s,!0,e.style)}return await this.districtControllerDashLayer.applyEdits({addFeatures:this.districtGraphics}),await this.districtControllerSolidLayer.applyEdits({addFeatures:this.districtGraphics}),this.view.goTo(this.districtGraphics),this.districtGraphics=[],await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[],await this.signalMarkerLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalPictureLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalClusterLayer.applyEdits({addFeatures:this.signalGraphics}),this.signalGraphics=[],{status:0,message:"ok"}}async clearSignalControlArea(){this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0;let e=await this.districtControllerDashLayer.queryFeatures();return await this.districtControllerDashLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerDashLayer.definitionExpression="1=1",e=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerSolidLayer.definitionExpression="1=1",e=await this.subDistrictControllerLayer.queryFeatures(),await this.subDistrictControllerLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictControllerLayer.definitionExpression="1=1",e=await this.signalMarkerLayer.queryFeatures(),await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),this.signalMarkerLayer.definitionExpression="1=1",e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),this.signalPictureLayer.definitionExpression="1=1",e=await this.signalClusterLayer.queryFeatures(),await this.signalClusterLayer.applyEdits({deleteFeatures:e.features}),this.signalClusterLayer.definitionExpression="1=1",{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtControllerDashLayer.visible=e.visible,this.districtControllerSolidLayer.visible=e.visible;break;case"subDistrict":this.subDistrictControllerLayer.visible=e.visible;break;case"signal":this.signalMarkerLayer.visible=e.visible,this.signalPictureLayer.visible=e.visible;break;case"signalCluster":this.signalClusterLayer.visible=e.visible;break;case"shanghai_district":this.detachmentLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":{const i=this.districtControllerDashLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.districtControllerDashLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":const t=this.subDistrictControllerLayer.createQuery();t.where=`id = '${e.id}'`,t.returnGeometry=!0,t.outFields=["*"];const s=await this.subDistrictControllerLayer.queryFeatures(t);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"};case"signal":{const i=this.signalMarkerLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.signalMarkerLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo({target:r.features[0],scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){var t;switch((t=this.view.popup)!=null&&t.visible&&this.view.popup.close(),e.type){case"district":{const s=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`;const i=await this.districtControllerDashLayer.queryFeatures();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,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):(this.districtControllerDashLayer.definitionExpression=s,{status:1,message:"未找到区控"})}case"subDistrict":{const s=this.subDistrictControllerLayer.definitionExpression;this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`;const i=await this.subDistrictControllerLayer.queryFeatures();if(i.features.length>0){this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalClusterLayer.definitionExpression=`subDistrictId = '${e.id}'`;const l=i.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${l}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${l}'`,await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.subDistrictControllerLayer.definitionExpression=s,{status:1,message:"未找到子区"}}case"signal":{const s=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`;const i=await this.signalMarkerLayer.queryFeatures();if(i.features.length>0){this.signalPictureLayer.definitionExpression=`id = '${e.id}'`,this.signalClusterLayer.definitionExpression=`id = '${e.id}'`;const r=i.features[0],{districtId:l,subDistrictId:c}=r.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${l}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${l}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${c}'`,await this.view.goTo({target:i.features,scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.signalMarkerLayer.definitionExpression=s,{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){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";const e=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(e.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}generateGraphic(e,t,s){const i=e.getAllSignalCoordinates();let r=null;if(i.length>=2)if(i.length===2)r=p.lineString(i);else{if(t){const a=p.featureCollection(i.map(n=>p.point(n)));r=F(a)}else{const a=v(i,.5);a.length>=4&&(r=p.polygon([a]))}r||(r=p.lineString(i))}else if(i.length===1)r=p.point(i[0]);else return;const l=k(r.geometry,t?200:30,{units:"meters"}),c=new g({geometry:{type:"polyline",paths:l.geometry.coordinates},attributes:{ObjectID:t?this.districtControllerOid++:this.subDistrictControllerOid++,id:e.id,name:e.name,subDistrictCount:e.subDistrictCount,signalCount:e.signalCount,parentId:e.parentId,parentName:e.parentName,selected:s,type:t?"district":"subDistrict"}});t?this.districtGraphics.push(c):this.subDistrictGraphics.push(c);for(const a of e.subDistricts)this.generateGraphic(a,!1,s);e.signals.forEach(a=>{const n=new g({geometry:{type:"point",x:a.longitude,y:a.latitude},attributes:{ObjectID:this.signalOid++,id:a.id,name:a.name,signalId:a.signalId,nodeId:a.nodeId,isKey:a.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,type:"signal",selected:!0}});this.signalGraphics.push(n)})}async viewHitTest(e){var a;const s=(a=(await this.view.hitTest(e,{include:[this.districtControllerSolidLayer,this.subDistrictControllerLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer]})).results)==null?void 0:a.filter(n=>n.type==="graphic");if(s.length===0)return;const i=s[0].graphic;let r=null;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});const l=i.getAttribute("type"),c=i.getAttribute("id");switch(l){case"district":{let n=await this.districtControllerSolidLayer.queryFeatures();n.features.forEach(o=>{o.attributes.selected=o.attributes.id===c}),await this.districtControllerSolidLayer.applyEdits({updateFeatures:n.features}),n=await this.districtControllerDashLayer.queryFeatures(),n.features.forEach(o=>{o.attributes.selected=o.attributes.id===c}),await this.districtControllerDashLayer.applyEdits({updateFeatures:n.features});break}case"subDistrict":{let n=await this.subDistrictControllerLayer.queryFeatures();n.features.forEach(u=>{u.attributes.selected=u.attributes.id===c}),await this.subDistrictControllerLayer.applyEdits({updateFeatures:n.features}),n=await this.signalMarkerLayer.queryFeatures(),n.features.forEach(u=>{u.attributes.selected=u.attributes.subDistrictId===c});let o=await this.signalMarkerLayer.applyEdits({updateFeatures:n.features});console.log(o),n=await this.signalPictureLayer.queryFeatures(),n.features.forEach(u=>{u.attributes.selected=u.attributes.subDistrictId===c}),o=await this.signalPictureLayer.applyEdits({updateFeatures:n.features}),console.log(o);break}}x.when(()=>this.view.popup.visible===!1,async()=>{await this.resetSelectedSymbol(l)},{once:!0})}async resetSelectedSymbol(e){switch(e){case"district":{let t=await this.districtControllerSolidLayer.queryFeatures();t.features.forEach(s=>{s.attributes.selected=!0}),await this.districtControllerSolidLayer.applyEdits({updateFeatures:t.features}),t=await this.districtControllerDashLayer.queryFeatures(),t.features.forEach(s=>{s.attributes.selected=!0}),await this.districtControllerDashLayer.applyEdits({updateFeatures:t.features});break}case"subDistrict":{let t=await this.subDistrictControllerLayer.queryFeatures();t.features.forEach(s=>{s.attributes.selected=!0}),await this.subDistrictControllerLayer.applyEdits({updateFeatures:t.features}),t=await this.signalMarkerLayer.queryFeatures(),console.log("marker count",t.features.length),t.features.forEach(s=>{s.attributes.selected=!0}),await this.signalMarkerLayer.applyEdits({updateFeatures:t.features}),t=await this.signalPictureLayer.queryFeatures(),console.log("picture count",t.features.length),t.features.forEach(s=>{s.attributes.selected=!0}),await this.signalPictureLayer.applyEdits({updateFeatures:t.features});break}}}async loadDetachmentLayer(){const e=this.mapConfig.baseLayers;if(!e)return;const t=e.find(a=>a.options.id==="shanghai_district");if(!t)return;const i=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),r=[],{renderer:l,labelingInfo:c}=t.options;i.features.forEach(a=>{const n=a.attributes.ZD_NAME;if(n!=="高架支队"){let o=new E.Polygon({rings:a.geometry.rings});o=D.webMercatorToGeographic(o);const u=new g({geometry:o,attributes:{...a.attributes,ObjectID:a.attributes.OBJECTID||a.attributes.ESRI_OID}});if(l){if(l.type==="simple")u.symbol=l.symbol;else if(l.type==="unique-value"){const f=u.getAttribute("ObjectID"),b=l.uniqueValueInfos.find(w=>String(w.value)===String(f));u.symbol=b?b.symbol:l.defaultSymbol}}else u.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(r.push(u),c&&n!=="边防港航支队"&&n!=="机场支队"){const f=new g({geometry:o.centroid,symbol:{...c.symbol,text:n}});r.push(f)}}}),this.detachmentLayer.addMany(r),this.detachmentLayerLoaded=!0}}exports.default=I;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("@arcgis/core/core/reactiveUtils"),E=require("@arcgis/core/geometry"),D=require("@arcgis/core/geometry/support/webMercatorUtils"),g=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/FeatureLayer"),m=require("@arcgis/core/layers/GraphicsLayer"),F=require("@turf/buffer"),k=require("@turf/convex"),v=require("@turf/helpers"),S=require("concaveman"),G=require("../../stores/index.js"),q=require("./district-controller.js"),y=require("./layer-symbol.js");function L(h){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>h[t]})}}return e.default=h,Object.freeze(e)}const x=L(C),p=L(v);class M{constructor(e){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";const t=G.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.detachmentLayer=new m,this.districtControllerDashLayer=new d(y.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=e.spatialReference,this.districtControllerSolidLayer=new d(y.districtSolidLineLayerOptions),this.districtControllerSolidLayer.spatialReference=e.spatialReference,this.districtControllerSolidLayer.popupEnabled=this.popupEnabled,this.subDistrictControllerLayer=new d(y.subDistrictLayerOptions),this.subDistrictControllerLayer.spatialReference=e.spatialReference,this.subDistrictControllerLayer.popupEnabled=this.popupEnabled,this.signalMarkerLayer=new d(y.signalMarkerLayerOptions),this.signalMarkerLayer.spatialReference=e.spatialReference,this.signalMarkerLayer.popupEnabled=this.popupEnabled,this.signalPictureLayer=new d(y.signalPictureLayerOptions),this.signalPictureLayer.spatialReference=e.spatialReference,this.signalPictureLayer.popupEnabled=this.popupEnabled,this.signalClusterLayer=new d(y.signalClusterLayerOptions),this.signalClusterLayer.spatialReference=e.spatialReference,this.signalClusterLayer.popupEnabled=this.popupEnabled,this.view.map.addMany([this.detachmentLayer,this.districtControllerSolidLayer,this.districtControllerDashLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer,this.subDistrictControllerLayer]),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this))}async showSignalControlArea(e){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;for(const t of e.areaList){const s=new q.default(t,e.style||"");this.generateGraphic(s,!0,e.style)}return await this.districtControllerDashLayer.applyEdits({addFeatures:this.districtGraphics}),await this.districtControllerSolidLayer.applyEdits({addFeatures:this.districtGraphics}),this.view.goTo(this.districtGraphics),this.districtGraphics=[],await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[],await this.signalMarkerLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalPictureLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalClusterLayer.applyEdits({addFeatures:this.signalGraphics}),this.signalGraphics=[],{status:0,message:"ok"}}async clearSignalControlArea(){this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0;let e=await this.districtControllerDashLayer.queryFeatures();return await this.districtControllerDashLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerDashLayer.definitionExpression="1=1",e=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerSolidLayer.definitionExpression="1=1",e=await this.subDistrictControllerLayer.queryFeatures(),await this.subDistrictControllerLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictControllerLayer.definitionExpression="1=1",e=await this.signalMarkerLayer.queryFeatures(),await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),this.signalMarkerLayer.definitionExpression="1=1",e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),this.signalPictureLayer.definitionExpression="1=1",e=await this.signalClusterLayer.queryFeatures(),await this.signalClusterLayer.applyEdits({deleteFeatures:e.features}),this.signalClusterLayer.definitionExpression="1=1",{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtControllerDashLayer.visible=e.visible,this.districtControllerSolidLayer.visible=e.visible;break;case"subDistrict":this.subDistrictControllerLayer.visible=e.visible;break;case"signal":this.signalMarkerLayer.visible=e.visible,this.signalPictureLayer.visible=e.visible;break;case"signalCluster":this.signalClusterLayer.visible=e.visible;break;case"shanghai_district":this.detachmentLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":{const i=this.districtControllerDashLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.districtControllerDashLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":const t=this.subDistrictControllerLayer.createQuery();t.where=`id = '${e.id}'`,t.returnGeometry=!0,t.outFields=["*"];const s=await this.subDistrictControllerLayer.queryFeatures(t);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"};case"signal":{const i=this.signalMarkerLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.signalMarkerLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo({target:r.features[0],scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){var t;switch((t=this.view.popup)!=null&&t.visible&&this.view.popup.close(),e.type){case"district":{const s=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`;const i=await this.districtControllerDashLayer.queryFeatures();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,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):(this.districtControllerDashLayer.definitionExpression=s,{status:1,message:"未找到区控"})}case"subDistrict":{const s=this.subDistrictControllerLayer.definitionExpression;this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`;const i=await this.subDistrictControllerLayer.queryFeatures();if(i.features.length>0){this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalClusterLayer.definitionExpression=`subDistrictId = '${e.id}'`;const l=i.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${l}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${l}'`,await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.subDistrictControllerLayer.definitionExpression=s,{status:1,message:"未找到子区"}}case"signal":{const s=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`;const i=await this.signalMarkerLayer.queryFeatures();if(i.features.length>0){this.signalPictureLayer.definitionExpression=`id = '${e.id}'`,this.signalClusterLayer.definitionExpression=`id = '${e.id}'`;const r=i.features[0],{districtId:l,subDistrictId:c}=r.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${l}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${l}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${c}'`,await this.view.goTo({target:i.features,scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.signalMarkerLayer.definitionExpression=s,{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){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";const e=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(e.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}generateGraphic(e,t,s){const i=e.getAllSignalCoordinates();let r=null;if(i.length>=2)if(i.length===2)r=p.lineString(i);else{if(t){const n=p.featureCollection(i.map(a=>p.point(a)));r=k(n)}else{const n=S(i,.5);n.length>=4&&(r=p.polygon([n]))}r||(r=p.lineString(i))}else if(i.length===1)r=p.point(i[0]);else return;const l=F(r.geometry,t?200:30,{units:"meters"}),c=new g({geometry:{type:"polyline",paths:l.geometry.coordinates},attributes:{ObjectID:t?this.districtControllerOid++:this.subDistrictControllerOid++,id:e.id,name:e.name,subDistrictCount:e.subDistrictCount,signalCount:e.signalCount,parentId:e.parentId,parentName:e.parentName,selected:s,type:t?"district":"subDistrict"}});t?this.districtGraphics.push(c):this.subDistrictGraphics.push(c);for(const n of e.subDistricts)this.generateGraphic(n,!1,s);e.signals.forEach(n=>{const a=new g({geometry:{type:"point",x:n.longitude,y:n.latitude},attributes:{ObjectID:this.signalOid++,id:n.id,name:n.name,signalId:n.signalId,nodeId:n.nodeId,isKey:n.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,type:"signal",selected:!0}});this.signalGraphics.push(a)})}async viewHitTest(e){var n;const s=(n=(await this.view.hitTest(e,{include:[this.districtControllerSolidLayer,this.subDistrictControllerLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer]})).results)==null?void 0:n.filter(a=>a.type==="graphic");if(s.length===0)return;const i=s[0].graphic;let r=null;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});const l=i.getAttribute("type"),c=i.getAttribute("id");switch(l){case"district":{let a=await this.districtControllerSolidLayer.queryFeatures();a.features.forEach(o=>{o.attributes.selected=o.attributes.id===c}),await this.districtControllerSolidLayer.applyEdits({updateFeatures:a.features}),a=await this.districtControllerDashLayer.queryFeatures(),a.features.forEach(o=>{o.attributes.selected=o.attributes.id===c}),await this.districtControllerDashLayer.applyEdits({updateFeatures:a.features});break}case"subDistrict":{let a=await this.subDistrictControllerLayer.queryFeatures();a.features.forEach(u=>{u.attributes.selected=u.attributes.id===c}),await this.subDistrictControllerLayer.applyEdits({updateFeatures:a.features}),a=await this.signalMarkerLayer.queryFeatures(),a.features.forEach(u=>{u.attributes.selected=u.attributes.subDistrictId===c});let o=await this.signalMarkerLayer.applyEdits({updateFeatures:a.features});console.log(o),a=await this.signalPictureLayer.queryFeatures(),a.features.forEach(u=>{u.attributes.selected=u.attributes.subDistrictId===c}),o=await this.signalPictureLayer.applyEdits({updateFeatures:a.features}),console.log(o);break}}x.when(()=>this.view.popup.visible===!1,async()=>{await this.resetSelectedSymbol(l)},{once:!0})}async resetSelectedSymbol(e){switch(e){case"district":{let t=await this.districtControllerSolidLayer.queryFeatures();t.features.forEach(s=>{s.attributes.selected=!0}),await this.districtControllerSolidLayer.applyEdits({updateFeatures:t.features}),t=await this.districtControllerDashLayer.queryFeatures(),t.features.forEach(s=>{s.attributes.selected=!0}),await this.districtControllerDashLayer.applyEdits({updateFeatures:t.features});break}case"subDistrict":{let t=await this.subDistrictControllerLayer.queryFeatures();t.features.forEach(s=>{s.attributes.selected=!0}),await this.subDistrictControllerLayer.applyEdits({updateFeatures:t.features}),t=await this.signalMarkerLayer.queryFeatures(),t.features.forEach(s=>{s.attributes.selected=!0}),await this.signalMarkerLayer.applyEdits({updateFeatures:t.features}),t=await this.signalPictureLayer.queryFeatures(),t.features.forEach(s=>{s.attributes.selected=!0}),await this.signalPictureLayer.applyEdits({updateFeatures:t.features});break}}}async loadDetachmentLayer(){const e=this.mapConfig.baseLayers;if(!e)return;const t=e.find(n=>n.options.id==="shanghai_district");if(!t)return;const i=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),r=[],{renderer:l,labelingInfo:c}=t.options;i.features.forEach(n=>{const a=n.attributes.ZD_NAME;if(a!=="高架支队"){let o=new E.Polygon({rings:n.geometry.rings});o=D.webMercatorToGeographic(o);const u=new g({geometry:o,attributes:n.attributes});if(l){if(l.type==="simple")u.symbol=l.symbol;else if(l.type==="unique-value"){const f=u.getAttribute("OBJECTID"),b=l.uniqueValueInfos.find(w=>w.value==f);u.symbol=b?b.symbol:l.defaultSymbol}}else u.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(r.push(u),c&&a!=="边防港航支队"&&a!=="机场支队"){const f=new g({geometry:o.centroid,symbol:{...c.symbol,text:a}});r.push(f)}}}),this.detachmentLayer.addMany(r),this.detachmentLayerLoaded=!0}}exports.default=M;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.219",
3
+ "version": "1.0.221",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [