gisviewer-vue3-arcgis 1.0.218 → 1.0.220

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