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.
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +78 -71
- package/es/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +2 -1
- package/es/src/gis-map/utils/signal-control-area-controller/show-area.mjs +140 -142
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +2 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/show-area.js +1 -1
- package/package.json +1 -1
|
@@ -1,63 +1,70 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Point as
|
|
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
|
|
5
|
-
import
|
|
6
|
-
class
|
|
7
|
-
constructor(
|
|
8
|
-
super(
|
|
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,
|
|
11
|
+
var p, c;
|
|
12
12
|
console.time("初始化停止线图层");
|
|
13
|
-
let
|
|
14
|
-
if (!
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
25
|
-
|
|
26
|
-
coord:
|
|
27
|
-
panelPoint:
|
|
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
|
-
}
|
|
44
|
+
}
|
|
45
|
+
console.timeEnd("初始化停止线图层");
|
|
39
46
|
}
|
|
40
47
|
getPanelScale() {
|
|
41
|
-
const
|
|
42
|
-
let
|
|
43
|
-
return
|
|
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(
|
|
46
|
-
this.watchHandle || (this.watchHandle =
|
|
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
|
|
60
|
+
let n = new h({
|
|
54
61
|
x: e[0],
|
|
55
62
|
y: e[1]
|
|
56
63
|
});
|
|
57
|
-
this.view.spatialReference.isWebMercator && (
|
|
58
|
-
|
|
64
|
+
this.view.spatialReference.isWebMercator && (n = d.geographicToWebMercator(
|
|
65
|
+
n
|
|
59
66
|
));
|
|
60
|
-
const i = this.view.toScreen(
|
|
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
|
|
70
|
-
if (!
|
|
76
|
+
const a = s.crossId, l = this.stopLineMap.get(a);
|
|
77
|
+
if (!l)
|
|
71
78
|
return;
|
|
72
|
-
const p =
|
|
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)),
|
|
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 =
|
|
83
|
-
if (e || (e = {},
|
|
84
|
-
console.log(`没有找到对应的方向${
|
|
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
|
|
88
|
-
|
|
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
|
-
|
|
91
|
-
const e =
|
|
97
|
+
c.forEach((t, o) => {
|
|
98
|
+
const e = l.get(o);
|
|
92
99
|
if (!e)
|
|
93
100
|
return;
|
|
94
|
-
const
|
|
95
|
-
(i) => i.crossId ===
|
|
101
|
+
const n = this.countdownPanelProps.find(
|
|
102
|
+
(i) => i.crossId === a && i.roadId === o
|
|
96
103
|
);
|
|
97
|
-
if (
|
|
98
|
-
|
|
104
|
+
if (n)
|
|
105
|
+
n.lampStatus = t;
|
|
99
106
|
else {
|
|
100
|
-
let i = new
|
|
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),
|
|
114
|
+
const r = this.view.toScreen(i), f = this.getPanelRotation(e.coord);
|
|
108
115
|
this.countdownPanelProps.push({
|
|
109
116
|
displayMode: "complex",
|
|
110
|
-
crossId:
|
|
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:
|
|
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
|
|
129
|
-
this.stopLineLayer.removeAll(), this.countdownPanelProps.length = 0, (
|
|
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(
|
|
137
|
-
const
|
|
138
|
-
let
|
|
139
|
-
x:
|
|
140
|
-
y:
|
|
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 && (
|
|
143
|
-
|
|
149
|
+
this.view.spatialReference.isWebMercator && (l = d.geographicToWebMercator(
|
|
150
|
+
l
|
|
144
151
|
));
|
|
145
|
-
const p = this.view.toScreen(
|
|
146
|
-
let t = new
|
|
147
|
-
x:
|
|
148
|
-
y:
|
|
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,
|
|
154
|
-
return Math.atan2(
|
|
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
|
-
|
|
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
|
|
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
|
|
14
|
-
class
|
|
15
|
-
constructor(
|
|
16
|
-
this.detachmentLayerLoaded = !1, this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0, this.popupEnabled = !0, this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.view =
|
|
17
|
-
const
|
|
18
|
-
this.mapConfig = JSON.parse(JSON.stringify(
|
|
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 =
|
|
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.
|
|
22
|
+
), this.districtControllerSolidLayer.spatialReference = e.spatialReference, this.districtControllerSolidLayer.popupEnabled = this.popupEnabled, this.subDistrictControllerLayer = new c(
|
|
25
23
|
x
|
|
26
|
-
), this.
|
|
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 =
|
|
28
|
+
), this.signalPictureLayer.spatialReference = e.spatialReference, this.signalPictureLayer.popupEnabled = this.popupEnabled, this.signalClusterLayer = new c(
|
|
29
29
|
M
|
|
30
|
-
), this.signalClusterLayer.spatialReference =
|
|
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(
|
|
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
|
|
47
|
+
for (const t of e.areaList) {
|
|
48
48
|
const s = new k(
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
t,
|
|
50
|
+
e.style || ""
|
|
51
51
|
);
|
|
52
|
-
this.generateGraphic(s, !0,
|
|
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
|
|
74
|
+
let e = await this.districtControllerDashLayer.queryFeatures();
|
|
75
75
|
return await this.districtControllerDashLayer.applyEdits({
|
|
76
|
-
deleteFeatures:
|
|
77
|
-
}), this.districtControllerDashLayer.definitionExpression = "1=1",
|
|
78
|
-
deleteFeatures:
|
|
79
|
-
}), this.districtControllerSolidLayer.definitionExpression = "1=1",
|
|
80
|
-
deleteFeatures:
|
|
81
|
-
}), this.subDistrictControllerLayer.definitionExpression = "1=1",
|
|
82
|
-
deleteFeatures:
|
|
83
|
-
}), this.signalMarkerLayer.definitionExpression = "1=1",
|
|
84
|
-
deleteFeatures:
|
|
85
|
-
}), this.signalPictureLayer.definitionExpression = "1=1",
|
|
86
|
-
deleteFeatures:
|
|
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(
|
|
95
|
-
switch (
|
|
94
|
+
setLayerVisibility(e) {
|
|
95
|
+
switch (e.visible === !1 && this.view.closePopup(), e.id) {
|
|
96
96
|
case "district":
|
|
97
|
-
this.districtControllerDashLayer.visible =
|
|
97
|
+
this.districtControllerDashLayer.visible = e.visible, this.districtControllerSolidLayer.visible = e.visible;
|
|
98
98
|
break;
|
|
99
99
|
case "subDistrict":
|
|
100
|
-
this.subDistrictControllerLayer.visible =
|
|
100
|
+
this.subDistrictControllerLayer.visible = e.visible;
|
|
101
101
|
break;
|
|
102
102
|
case "signal":
|
|
103
|
-
this.signalMarkerLayer.visible =
|
|
103
|
+
this.signalMarkerLayer.visible = e.visible, this.signalPictureLayer.visible = e.visible;
|
|
104
104
|
break;
|
|
105
105
|
case "signalCluster":
|
|
106
|
-
this.signalClusterLayer.visible =
|
|
106
|
+
this.signalClusterLayer.visible = e.visible;
|
|
107
107
|
break;
|
|
108
108
|
case "shanghai_district":
|
|
109
|
-
this.detachmentLayer.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(
|
|
120
|
-
switch (
|
|
119
|
+
async locateSignalControlArea(e) {
|
|
120
|
+
switch (e.type) {
|
|
121
121
|
case "district": {
|
|
122
122
|
const i = this.districtControllerDashLayer.createQuery();
|
|
123
|
-
i.where = `id = '${
|
|
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
|
|
133
|
-
|
|
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
|
-
|
|
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 = '${
|
|
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:
|
|
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(
|
|
161
|
-
var
|
|
162
|
-
switch ((
|
|
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 = '${
|
|
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 = '${
|
|
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 = '${
|
|
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 = '${
|
|
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 = '${
|
|
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 = '${
|
|
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:
|
|
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
|
|
211
|
-
return this.view.goTo(
|
|
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(
|
|
222
|
-
const i =
|
|
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 (
|
|
229
|
-
const
|
|
230
|
-
i.map((
|
|
228
|
+
if (t) {
|
|
229
|
+
const n = d.featureCollection(
|
|
230
|
+
i.map((a) => d.point(a))
|
|
231
231
|
);
|
|
232
|
-
r = D(
|
|
232
|
+
r = D(n);
|
|
233
233
|
} else {
|
|
234
|
-
const
|
|
235
|
-
|
|
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
|
-
|
|
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:
|
|
257
|
-
id:
|
|
258
|
-
name:
|
|
259
|
-
subDistrictCount:
|
|
260
|
-
signalCount:
|
|
261
|
-
parentId:
|
|
262
|
-
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:
|
|
264
|
+
type: t ? "district" : "subDistrict"
|
|
265
265
|
}
|
|
266
266
|
});
|
|
267
|
-
|
|
268
|
-
for (const
|
|
269
|
-
this.generateGraphic(
|
|
270
|
-
|
|
271
|
-
const
|
|
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:
|
|
275
|
-
y:
|
|
274
|
+
x: n.longitude,
|
|
275
|
+
y: n.latitude
|
|
276
276
|
},
|
|
277
277
|
attributes: {
|
|
278
278
|
ObjectID: this.signalOid++,
|
|
279
|
-
id:
|
|
280
|
-
name:
|
|
281
|
-
signalId:
|
|
282
|
-
nodeId:
|
|
283
|
-
isKey:
|
|
284
|
-
districtId:
|
|
285
|
-
districtName:
|
|
286
|
-
subDistrictId:
|
|
287
|
-
subDistrictName:
|
|
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(
|
|
292
|
+
this.signalGraphics.push(a);
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
|
-
async viewHitTest(
|
|
296
|
-
var
|
|
297
|
-
const s = (
|
|
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 :
|
|
306
|
-
(
|
|
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
|
|
317
|
-
|
|
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:
|
|
321
|
-
}),
|
|
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:
|
|
324
|
+
updateFeatures: a.features
|
|
325
325
|
});
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
328
|
case "subDistrict": {
|
|
329
|
-
let
|
|
330
|
-
|
|
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:
|
|
334
|
-
}),
|
|
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:
|
|
338
|
+
updateFeatures: a.features
|
|
339
339
|
});
|
|
340
|
-
console.log(l),
|
|
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:
|
|
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(
|
|
362
|
-
switch (
|
|
361
|
+
async resetSelectedSymbol(e) {
|
|
362
|
+
switch (e) {
|
|
363
363
|
case "district": {
|
|
364
|
-
let
|
|
365
|
-
|
|
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:
|
|
369
|
-
}),
|
|
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:
|
|
372
|
+
updateFeatures: t.features
|
|
373
373
|
});
|
|
374
374
|
break;
|
|
375
375
|
}
|
|
376
376
|
case "subDistrict": {
|
|
377
|
-
let
|
|
378
|
-
|
|
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:
|
|
382
|
-
}),
|
|
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:
|
|
386
|
-
}),
|
|
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:
|
|
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
|
|
397
|
+
* 现场环境用url创建FeatureLayer有各种问题,
|
|
398
|
+
* 改为图层到处未json,用json创建Graphic,再将Graphic添加到FeatureLayer
|
|
398
399
|
*/
|
|
399
400
|
async loadDetachmentLayer() {
|
|
400
|
-
const
|
|
401
|
-
if (!
|
|
401
|
+
const e = this.mapConfig.baseLayers;
|
|
402
|
+
if (!e)
|
|
402
403
|
return;
|
|
403
|
-
const
|
|
404
|
-
(
|
|
404
|
+
const t = e.find(
|
|
405
|
+
(n) => n.options.id === "shanghai_district"
|
|
405
406
|
);
|
|
406
|
-
if (!
|
|
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 } =
|
|
411
|
-
i.features.forEach((
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
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:
|
|
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("
|
|
430
|
-
(f) =>
|
|
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 &&
|
|
441
|
+
if (r.push(u), h && a !== "边防港航支队" && a !== "机场支队") {
|
|
444
442
|
const p = new y({
|
|
445
443
|
geometry: l.centroid,
|
|
446
|
-
symbol: { ...h.symbol, text:
|
|
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
|
-
|
|
453
|
+
V as default
|
|
456
454
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
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
|
|
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;
|