gisviewer-vue3-arcgis 1.0.284 → 1.0.285
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/index.mjs +6 -5
- package/es/src/gis-map/gis-map.vue.d.ts +124 -1
- package/es/src/gis-map/gis-map.vue.mjs +63 -63
- package/es/src/gis-map/index.d.ts +124 -1
- package/es/src/gis-map/utils/edpass-device-controller.mjs +278 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +362 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +101 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +153 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.mjs +4 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +336 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +236 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +106 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +576 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +386 -0
- package/es/src/gis-map/utils/index.mjs +2 -2
- package/es/src/gis-map/utils/police-jurisdiction.mjs +202 -0
- package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
- package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
- package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
- package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +593 -0
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +84 -0
- package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +122 -0
- package/es/src/gis-map/utils/signal-control-area/edit-area.mjs +550 -0
- package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +984 -0
- package/es/src/gis-map/utils/signal-control-area/signal-area-controller.mjs +140 -0
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +423 -0
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +123 -0
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +367 -0
- package/es/src/gis-map/utils/signal-system/signal-system-controller.mjs +137 -0
- package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
- package/es/src/gis-map-ol/gis-map-ol.vue.d.ts +50 -0
- package/es/src/gis-map-ol/gis-map-ol.vue.mjs +67 -0
- package/es/src/gis-map-ol/gis-map-ol.vue2.mjs +4 -0
- package/es/src/gis-map-ol/gis-map-ol.vue3.mjs +5 -0
- package/es/src/gis-map-ol/index.d.ts +44 -1
- package/es/src/gis-map-ol/index.mjs +8 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.d.ts +28 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.mjs +129 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +42 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.mjs +263 -0
- package/es/src/index.mjs +4 -4
- package/es/src/types/index.mjs +5 -0
- package/lib/index.js +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +124 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +124 -1
- package/lib/src/gis-map/utils/edpass-device-controller.js +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +2 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -0
- package/lib/src/gis-map/utils/index.js +1 -1
- package/lib/src/gis-map/utils/police-jurisdiction.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/edit-area.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-area-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-system/signal-system-controller.js +1 -0
- package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue.d.ts +50 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue2.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue3.js +1 -0
- package/lib/src/gis-map-ol/index.d.ts +44 -1
- package/lib/src/gis-map-ol/index.js +1 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.d.ts +28 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.js +1 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +42 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.js +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/types/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import * as b from "@arcgis/core/core/reactiveUtils.js";
|
|
2
|
+
import u from "@arcgis/core/Graphic";
|
|
3
|
+
import n from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
+
import { toRaw as y } from "vue";
|
|
5
|
+
import v from "../../stores/index.mjs";
|
|
6
|
+
class C {
|
|
7
|
+
constructor(e) {
|
|
8
|
+
this.clusterScaleThreshold = 1, this.watchHandle = null, this.currentShowParams = null, this.isCameraVisible = !1, this.isKkVisible = !1, this.esServer = "", this.clusterEnabled = {
|
|
9
|
+
cameraNormal: !1,
|
|
10
|
+
cameraAbnormal: !1,
|
|
11
|
+
kkNormal: !1,
|
|
12
|
+
kkAbnormal: !1
|
|
13
|
+
}, this.view = e;
|
|
14
|
+
const t = v.useAppDataStore;
|
|
15
|
+
this.mapInitializer = y(t.mapInitializer);
|
|
16
|
+
const i = y(t.mapConfig);
|
|
17
|
+
this.esServer = (i == null ? void 0 : i.esServer) || "", this.cameraNormalLayer = new n({
|
|
18
|
+
id: "cameraNormalLayer",
|
|
19
|
+
visible: !1
|
|
20
|
+
}), this.cameraAbnormalLayer = new n({
|
|
21
|
+
id: "cameraAbnormalLayer",
|
|
22
|
+
visible: !1
|
|
23
|
+
}), this.kkNormalLayer = new n({
|
|
24
|
+
id: "kkNormalLayer",
|
|
25
|
+
visible: !1
|
|
26
|
+
}), this.kkAbnormalLayer = new n({
|
|
27
|
+
id: "kkAbnormalLayer",
|
|
28
|
+
visible: !1
|
|
29
|
+
}), this.view.map.addMany([
|
|
30
|
+
this.cameraNormalLayer,
|
|
31
|
+
this.cameraAbnormalLayer,
|
|
32
|
+
this.kkNormalLayer,
|
|
33
|
+
this.kkAbnormalLayer
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
async setEdpassLayerVisibility(e) {
|
|
37
|
+
return this.currentShowParams = {
|
|
38
|
+
...this.currentShowParams ?? {},
|
|
39
|
+
...e
|
|
40
|
+
}, e.deviceType !== "camera" && e.deviceType !== "kk" ? { status: -1, message: "不支持的设备类型" } : (e.deviceType === "camera" && (this.isCameraVisible = e.visible), e.deviceType === "kk" && (this.isKkVisible = e.visible), this.updateClusterEnabled(e), (e.style ?? this.getAutoStyleByScale()) === "cluster" || e.style == null ? this.ensureStationaryWatch() : this.tryRemoveWatchIfNoVisible(), this.applyClusterMode(), { status: 0, message: "Success" });
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 控制散点图层显示隐藏
|
|
44
|
+
* @param visible
|
|
45
|
+
*/
|
|
46
|
+
showScatter(e) {
|
|
47
|
+
const t = e ?? this.isCameraVisible, i = e ?? this.isKkVisible;
|
|
48
|
+
this.mapInitializer.setLayerVisibility({
|
|
49
|
+
id: "camera-normal",
|
|
50
|
+
visible: t
|
|
51
|
+
}), this.mapInitializer.setLayerVisibility({
|
|
52
|
+
id: "camera-abnormal",
|
|
53
|
+
visible: t
|
|
54
|
+
}), this.mapInitializer.setLayerVisibility({
|
|
55
|
+
id: "kk-normal",
|
|
56
|
+
visible: i
|
|
57
|
+
}), this.mapInitializer.setLayerVisibility({
|
|
58
|
+
id: "kk-abnormal",
|
|
59
|
+
visible: i
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
getLayerConfig(e) {
|
|
63
|
+
let t, i, a;
|
|
64
|
+
return e.deviceType === "camera" ? e.deviceState === "normal" ? (t = "/GisViewerAssets/Images/gis/gis_sxj_map.png", i = [45, 108, 196], a = this.cameraNormalLayer) : (t = "/GisViewerAssets/Images/gis/gis_sxj_yc.png", i = [189, 49, 50], a = this.cameraAbnormalLayer) : e.deviceState === "normal" ? (t = "/GisViewerAssets/Images/gis/gis_kk_map.png", i = [45, 108, 196], a = this.kkNormalLayer) : (t = "/GisViewerAssets/Images/gis/gis_kk_yc.png", i = [189, 49, 50], a = this.kkAbnormalLayer), {
|
|
65
|
+
icon: t,
|
|
66
|
+
color: i,
|
|
67
|
+
deviceLayer: a
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
getAutoStyleByScale() {
|
|
71
|
+
return this.view.scale > this.clusterScaleThreshold ? "cluster" : "scatter";
|
|
72
|
+
}
|
|
73
|
+
updateClusterEnabled(e) {
|
|
74
|
+
const t = e.deviceState;
|
|
75
|
+
e.deviceType === "camera" ? t ? t === "normal" ? this.clusterEnabled.cameraNormal = e.visible : this.clusterEnabled.cameraAbnormal = e.visible : (this.clusterEnabled.cameraNormal = e.visible, this.clusterEnabled.cameraAbnormal = e.visible) : t ? t === "normal" ? this.clusterEnabled.kkNormal = e.visible : this.clusterEnabled.kkAbnormal = e.visible : (this.clusterEnabled.kkNormal = e.visible, this.clusterEnabled.kkAbnormal = e.visible);
|
|
76
|
+
}
|
|
77
|
+
ensureStationaryWatch() {
|
|
78
|
+
this.watchHandle || (this.watchHandle = b.when(
|
|
79
|
+
() => this.view.stationary,
|
|
80
|
+
async () => {
|
|
81
|
+
if (!this.currentShowParams)
|
|
82
|
+
return;
|
|
83
|
+
if ((this.currentShowParams.style ?? this.getAutoStyleByScale()) === "scatter") {
|
|
84
|
+
this.applyScatterMode();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
await this.applyClusterMode();
|
|
88
|
+
}
|
|
89
|
+
));
|
|
90
|
+
}
|
|
91
|
+
hasAnyClusterEnabled() {
|
|
92
|
+
return this.clusterEnabled.cameraNormal || this.clusterEnabled.cameraAbnormal || this.clusterEnabled.kkNormal || this.clusterEnabled.kkAbnormal;
|
|
93
|
+
}
|
|
94
|
+
tryRemoveWatchIfNoVisible() {
|
|
95
|
+
var i;
|
|
96
|
+
const e = this.isCameraVisible || this.isKkVisible, t = this.hasAnyClusterEnabled();
|
|
97
|
+
!e && !t && ((i = this.watchHandle) == null || i.remove(), this.watchHandle = null);
|
|
98
|
+
}
|
|
99
|
+
applyScatterMode() {
|
|
100
|
+
this.showScatter(), this.cameraNormalLayer.visible = !1, this.cameraAbnormalLayer.visible = !1, this.kkNormalLayer.visible = !1, this.kkAbnormalLayer.visible = !1, this.cameraNormalLayer.removeAll(), this.cameraAbnormalLayer.removeAll(), this.kkNormalLayer.removeAll(), this.kkAbnormalLayer.removeAll();
|
|
101
|
+
}
|
|
102
|
+
async applyClusterMode() {
|
|
103
|
+
var r, l;
|
|
104
|
+
this.showScatter(!1);
|
|
105
|
+
const e = ((r = this.currentShowParams) == null ? void 0 : r.ddCode) || "", t = ((l = this.currentShowParams) == null ? void 0 : l.zdCode) || "", i = this.view.extent, a = [];
|
|
106
|
+
this.cameraNormalLayer.visible = this.clusterEnabled.cameraNormal, this.clusterEnabled.cameraNormal ? a.push(
|
|
107
|
+
this.showClusterInExtent(
|
|
108
|
+
{
|
|
109
|
+
deviceType: "camera",
|
|
110
|
+
deviceState: "normal",
|
|
111
|
+
style: "cluster",
|
|
112
|
+
ddCode: e,
|
|
113
|
+
zdCode: t,
|
|
114
|
+
visible: !0
|
|
115
|
+
},
|
|
116
|
+
i
|
|
117
|
+
)
|
|
118
|
+
) : this.cameraNormalLayer.removeAll(), this.kkNormalLayer.visible = this.clusterEnabled.kkNormal, this.clusterEnabled.kkNormal ? a.push(
|
|
119
|
+
this.showClusterInExtent(
|
|
120
|
+
{
|
|
121
|
+
deviceType: "kk",
|
|
122
|
+
deviceState: "normal",
|
|
123
|
+
style: "cluster",
|
|
124
|
+
ddCode: e,
|
|
125
|
+
zdCode: t,
|
|
126
|
+
visible: !0
|
|
127
|
+
},
|
|
128
|
+
i
|
|
129
|
+
)
|
|
130
|
+
) : this.kkNormalLayer.removeAll(), await Promise.all(a), this.tryRemoveWatchIfNoVisible();
|
|
131
|
+
}
|
|
132
|
+
async showClusterInExtent(e, t) {
|
|
133
|
+
const i = await fetch(`${this.esServer}/queryGeoAggregation`, {
|
|
134
|
+
method: "POST",
|
|
135
|
+
headers: {
|
|
136
|
+
"Content-Type": "application/json"
|
|
137
|
+
},
|
|
138
|
+
body: JSON.stringify({
|
|
139
|
+
deviceType: e.deviceType,
|
|
140
|
+
topLeftLat: t.ymax,
|
|
141
|
+
topLeftLon: t.xmin,
|
|
142
|
+
bottomRightLat: t.ymin,
|
|
143
|
+
bottomRightLon: t.xmax,
|
|
144
|
+
devStateSet: e.deviceState ? [e.deviceState === "normal" ? "1" : "2"] : ["1", "2"],
|
|
145
|
+
zdCode: e.zdCode || "",
|
|
146
|
+
ddCode: e.ddCode || "",
|
|
147
|
+
mapLevel: this.view.zoom + 8,
|
|
148
|
+
meter: 1e3
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
if (i.status !== 200) {
|
|
152
|
+
console.error(i.statusText);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const a = await i.json();
|
|
156
|
+
if (a.code !== 200)
|
|
157
|
+
return;
|
|
158
|
+
const { icon: r, color: l, deviceLayer: h } = this.getLayerConfig(e);
|
|
159
|
+
h.removeAll();
|
|
160
|
+
const d = a.data.map((s) => {
|
|
161
|
+
var m;
|
|
162
|
+
const o = (s.count.toString().length * 6 + 6) / 2, c = new u({
|
|
163
|
+
geometry: {
|
|
164
|
+
type: "point",
|
|
165
|
+
x: s.lon,
|
|
166
|
+
y: s.lat
|
|
167
|
+
},
|
|
168
|
+
attributes: {
|
|
169
|
+
id: ((m = s.devInfo) == null ? void 0 : m.deviceId) || s.key,
|
|
170
|
+
type: e.deviceType,
|
|
171
|
+
count: s.count,
|
|
172
|
+
typeName: e.deviceType === "camera" ? "视频" : "卡口",
|
|
173
|
+
stateName: e.deviceState === "normal" ? "正常" : "异常",
|
|
174
|
+
...s.devInfo
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
return s.count > 1 ? c.symbol = {
|
|
178
|
+
type: "cim",
|
|
179
|
+
data: {
|
|
180
|
+
type: "CIMSymbolReference",
|
|
181
|
+
symbol: {
|
|
182
|
+
type: "CIMPointSymbol",
|
|
183
|
+
symbolLayers: [
|
|
184
|
+
{
|
|
185
|
+
type: "CIMVectorMarker",
|
|
186
|
+
size: 32,
|
|
187
|
+
colorLocked: !0,
|
|
188
|
+
anchorPointUnits: "Relative",
|
|
189
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
190
|
+
markerGraphics: [
|
|
191
|
+
{
|
|
192
|
+
type: "CIMMarkerGraphic",
|
|
193
|
+
geometry: {
|
|
194
|
+
rings: [
|
|
195
|
+
[
|
|
196
|
+
[-o, 30],
|
|
197
|
+
[o, 30],
|
|
198
|
+
[o, 15],
|
|
199
|
+
[-o, 15],
|
|
200
|
+
[-o, 30]
|
|
201
|
+
]
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
symbol: {
|
|
205
|
+
type: "CIMPolygonSymbol",
|
|
206
|
+
symbolLayers: [
|
|
207
|
+
{
|
|
208
|
+
type: "CIMSolidFill",
|
|
209
|
+
enable: !0,
|
|
210
|
+
color: l.concat([255])
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
type: "CIMSolidStroke",
|
|
214
|
+
enable: !0,
|
|
215
|
+
width: 3,
|
|
216
|
+
color: l.concat([128])
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
type: "CIMMarkerGraphic",
|
|
223
|
+
primitiveName: "textGraphic",
|
|
224
|
+
geometry: { x: 0, y: 0 },
|
|
225
|
+
symbol: {
|
|
226
|
+
type: "CIMTextSymbol",
|
|
227
|
+
fontFamilyName: "msyh",
|
|
228
|
+
height: 12,
|
|
229
|
+
horizontalAlignment: "Center",
|
|
230
|
+
offsetX: 0,
|
|
231
|
+
offsetY: 22,
|
|
232
|
+
symbol: {
|
|
233
|
+
type: "CIMPolygonSymbol",
|
|
234
|
+
symbolLayers: [
|
|
235
|
+
{
|
|
236
|
+
type: "CIMSolidFill",
|
|
237
|
+
enable: !0,
|
|
238
|
+
color: [255, 255, 255, 255]
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
verticalAlignment: "Center"
|
|
243
|
+
},
|
|
244
|
+
textString: s.count.toString()
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
scaleSymbolsProportionally: !0,
|
|
248
|
+
respectFrame: !0
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
type: "CIMPictureMarker",
|
|
252
|
+
enable: !0,
|
|
253
|
+
anchorPoint: {
|
|
254
|
+
x: 0,
|
|
255
|
+
y: 0
|
|
256
|
+
},
|
|
257
|
+
anchorPointUnits: "Relative",
|
|
258
|
+
size: 24,
|
|
259
|
+
rotateClockwise: !0,
|
|
260
|
+
textureFilter: "Picture",
|
|
261
|
+
url: r
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
} : c.symbol = {
|
|
267
|
+
type: "picture-marker",
|
|
268
|
+
url: r,
|
|
269
|
+
width: 18,
|
|
270
|
+
height: 18
|
|
271
|
+
}, c;
|
|
272
|
+
});
|
|
273
|
+
h.addMany(d);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
export {
|
|
277
|
+
C as default
|
|
278
|
+
};
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import * as y from "@arcgis/core/core/reactiveUtils.js";
|
|
2
|
+
import { Polyline as m } from "@arcgis/core/geometry";
|
|
3
|
+
import n from "@arcgis/core/Graphic";
|
|
4
|
+
import c from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
+
import b from "axios";
|
|
6
|
+
class w {
|
|
7
|
+
constructor(e) {
|
|
8
|
+
this.selectedNodeIds = [], this.nodeScale = 5e3, this.hasGpu = !1, this.hasGpu = localStorage.getItem("gpu") !== "Unknown", this.view = e, this.roadsectLayer = new c({
|
|
9
|
+
id: "roadsectLayer"
|
|
10
|
+
}), this.view.map.add(this.roadsectLayer), this.allNodesLayer = new c({
|
|
11
|
+
id: "allNodesLayer"
|
|
12
|
+
}), this.view.map.add(this.allNodesLayer), this.bandLayer = new c({
|
|
13
|
+
id: "bandLayer"
|
|
14
|
+
}), this.view.map.add(this.bandLayer);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 新增绿波带
|
|
18
|
+
* @param params
|
|
19
|
+
*/
|
|
20
|
+
addGreenWaveBand(e) {
|
|
21
|
+
this.addNodeCallback = e.addCrossCallback, this.removeNodeCallback = e.removeCrossCallback, e.removeAllCrossCallback && (this.removeAllNodeCallback = e.removeAllCrossCallback), this.selectedNodeIds = [], this.openDriveServer = e.odrServer, this.showAllNodes(e.crossesInArea), this.viewClickWatcher || (this.viewClickWatcher = this.view.on("click", (i) => {
|
|
22
|
+
this.handleViewClick(i);
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
stopAddGreenWaveBand() {
|
|
26
|
+
var e;
|
|
27
|
+
(e = this.viewClickWatcher) == null || e.remove(), this.viewClickWatcher = void 0, this.allNodesLayer.removeAll(), this.selectedNodeIds = [], this.roadsectLayer.removeAll(), this.bandLayer.removeAll();
|
|
28
|
+
}
|
|
29
|
+
async showGreenWaveBand(e) {
|
|
30
|
+
this.removeGreenWaveBand(e.bandId), this.scaleWatcher || (this.scaleWatcher = y.watch(
|
|
31
|
+
() => this.view.scale,
|
|
32
|
+
(s, o) => {
|
|
33
|
+
s > this.nodeScale && o <= this.nodeScale ? this.bandLayer.graphics.forEach((a) => {
|
|
34
|
+
a.geometry.type === "point" && (a.symbol = this.getShowNodeSymbol("marker"));
|
|
35
|
+
}) : s <= this.nodeScale && o > this.nodeScale && this.bandLayer.graphics.forEach((a) => {
|
|
36
|
+
a.geometry.type === "point" && (a.symbol = this.getShowNodeSymbol("picture"));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
));
|
|
40
|
+
const i = new m({
|
|
41
|
+
paths: [e.coordinates]
|
|
42
|
+
}), t = new n({
|
|
43
|
+
geometry: i,
|
|
44
|
+
symbol: this.getLineSymbol(!0, e),
|
|
45
|
+
attributes: {
|
|
46
|
+
bandId: e.bandId,
|
|
47
|
+
type: "greenWaveBand",
|
|
48
|
+
id: e.bandId
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
this.roadsectLayer.add(t), await this.view.goTo(t), e.nodeList && e.nodeList.forEach((s) => {
|
|
52
|
+
const o = new n({
|
|
53
|
+
geometry: {
|
|
54
|
+
type: "point",
|
|
55
|
+
x: s.longitude,
|
|
56
|
+
y: s.latitude
|
|
57
|
+
},
|
|
58
|
+
symbol: this.getShowNodeSymbol("picture"),
|
|
59
|
+
attributes: {
|
|
60
|
+
...s,
|
|
61
|
+
bandId: e.bandId,
|
|
62
|
+
type: "greenWaveBandNode"
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
this.bandLayer.add(o);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
removeGreenWaveBand(e) {
|
|
69
|
+
let i = this.bandLayer.graphics.filter(
|
|
70
|
+
(t) => t.getAttribute("bandId") === e
|
|
71
|
+
);
|
|
72
|
+
this.bandLayer.removeMany(i.toArray()), i = this.roadsectLayer.graphics.filter(
|
|
73
|
+
(t) => t.getAttribute("bandId") === e
|
|
74
|
+
), this.roadsectLayer.removeMany(i.toArray());
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 显示所有路口,进入待选状态
|
|
78
|
+
* @param nodeAttributes
|
|
79
|
+
*/
|
|
80
|
+
showAllNodes(e) {
|
|
81
|
+
const i = [];
|
|
82
|
+
e.forEach((t) => {
|
|
83
|
+
i.push(
|
|
84
|
+
new n({
|
|
85
|
+
geometry: {
|
|
86
|
+
type: "point",
|
|
87
|
+
x: t.longitude,
|
|
88
|
+
y: t.latitude
|
|
89
|
+
},
|
|
90
|
+
symbol: this.getEditableNodeSymbol(!1),
|
|
91
|
+
attributes: { ...t, selected: !1 }
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
}), this.allNodesLayer.addMany(i);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 点击待选/已选路口
|
|
98
|
+
* @param event
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
async handleViewClick(e) {
|
|
102
|
+
var a;
|
|
103
|
+
const t = (a = (await this.view.hitTest(e, {
|
|
104
|
+
include: [this.allNodesLayer]
|
|
105
|
+
})).results) == null ? void 0 : a.filter(
|
|
106
|
+
(d) => d.type === "graphic"
|
|
107
|
+
);
|
|
108
|
+
if (t.length === 0)
|
|
109
|
+
return;
|
|
110
|
+
const s = t[0].graphic, o = s.getAttribute("id");
|
|
111
|
+
if (this.selectedNodeIds.includes(o)) {
|
|
112
|
+
const d = this.selectedNodeIds.indexOf(o) + 1;
|
|
113
|
+
if (d === 1)
|
|
114
|
+
this.removeAllNodeCallback && this.removeAllNodeCallback(), this.selectedNodeIds = [], this.allNodesLayer.graphics.forEach((r) => {
|
|
115
|
+
r.setAttribute("selected", !1), r.symbol = this.getEditableNodeSymbol(!1), r.visible = !0;
|
|
116
|
+
}), this.roadsectLayer.removeAll();
|
|
117
|
+
else {
|
|
118
|
+
for (let r = d; r < this.selectedNodeIds.length; r++) {
|
|
119
|
+
this.removeNodeCallback && this.removeNodeCallback({
|
|
120
|
+
id: this.selectedNodeIds[r]
|
|
121
|
+
});
|
|
122
|
+
for (let l = 0; l < this.roadsectLayer.graphics.length; l++) {
|
|
123
|
+
const h = this.roadsectLayer.graphics.getItemAt(l);
|
|
124
|
+
(h.getAttribute("id") === this.selectedNodeIds[r] || !h.getAttribute("selected")) && (this.roadsectLayer.remove(h), l--);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
this.selectedNodeIds = this.selectedNodeIds.slice(0, d), this.allNodesLayer.graphics.forEach((r) => {
|
|
128
|
+
const l = this.selectedNodeIds.includes(
|
|
129
|
+
r.getAttribute("id")
|
|
130
|
+
);
|
|
131
|
+
r.setAttribute("selected", l), r.symbol = this.getEditableNodeSymbol(l), r.visible = l;
|
|
132
|
+
}), await this.showDownstreamNodes(o);
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
s.setAttribute("selected", !0), s.symbol = this.getEditableNodeSymbol(!0), this.selectedNodeIds.push(o), this.allNodesLayer.graphics.forEach((r) => {
|
|
136
|
+
r.visible = r.getAttribute("selected");
|
|
137
|
+
});
|
|
138
|
+
let d = [];
|
|
139
|
+
for (let r = 0; r < this.roadsectLayer.graphics.length; r++) {
|
|
140
|
+
const l = this.roadsectLayer.graphics.getItemAt(r);
|
|
141
|
+
l.getAttribute("id") === o ? (l.symbol = this.getLineSymbol(!0), l.setAttribute("selected", !0), d = l.geometry.paths[0]) : l.getAttribute("selected") || (this.roadsectLayer.remove(l), r--);
|
|
142
|
+
}
|
|
143
|
+
this.addNodeCallback && this.addNodeCallback({
|
|
144
|
+
...s.attributes,
|
|
145
|
+
roadsect: d
|
|
146
|
+
}), await this.showDownstreamNodes(o);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 显示下游节点
|
|
151
|
+
* @param nodeId
|
|
152
|
+
*/
|
|
153
|
+
async showDownstreamNodes(e) {
|
|
154
|
+
this.view.container.style.cursor = "progress";
|
|
155
|
+
const i = await b.get(
|
|
156
|
+
`http://${this.openDriveServer}/api/computable/getDownstreamNodes`,
|
|
157
|
+
{ params: { nodeId: e } }
|
|
158
|
+
);
|
|
159
|
+
if (i.status !== 200 || i.data.status !== 0) {
|
|
160
|
+
this.view.container.style.cursor = "default";
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
i.data.result.forEach((s) => {
|
|
164
|
+
this.allNodesLayer.graphics.forEach((o) => {
|
|
165
|
+
if (o.getAttribute("nodeId") === s.id && o.getAttribute("selected") === !1 && (o.visible = !0, s.coordinates)) {
|
|
166
|
+
const a = new n({
|
|
167
|
+
geometry: {
|
|
168
|
+
type: "polyline",
|
|
169
|
+
paths: [s.coordinates]
|
|
170
|
+
},
|
|
171
|
+
symbol: this.getLineSymbol(!1),
|
|
172
|
+
attributes: { ...s, selected: !1 }
|
|
173
|
+
});
|
|
174
|
+
this.roadsectLayer.add(a);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}), this.view.container.style.cursor = "default";
|
|
178
|
+
}
|
|
179
|
+
getLineSymbol(e, i) {
|
|
180
|
+
if (e) {
|
|
181
|
+
const t = (i == null ? void 0 : i.lineWidth) || 4, s = (i == null ? void 0 : i.lineColor) || [55, 125, 34, 255], o = (i == null ? void 0 : i.arrowColor) || [255, 255, 255, 255];
|
|
182
|
+
return Array.isArray(s) && s.length === 3 && s.push(255), Array.isArray(o) && o.length === 3 && o.push(255), {
|
|
183
|
+
type: "cim",
|
|
184
|
+
data: {
|
|
185
|
+
type: "CIMSymbolReference",
|
|
186
|
+
symbol: {
|
|
187
|
+
type: "CIMLineSymbol",
|
|
188
|
+
symbolLayers: [
|
|
189
|
+
{
|
|
190
|
+
type: "CIMVectorMarker",
|
|
191
|
+
enable: !0,
|
|
192
|
+
size: 4,
|
|
193
|
+
markerPlacement: {
|
|
194
|
+
type: "CIMMarkerPlacementAlongLineSameSize",
|
|
195
|
+
endings: "WithMarkers",
|
|
196
|
+
placementTemplate: [40],
|
|
197
|
+
angleToLine: !0
|
|
198
|
+
},
|
|
199
|
+
frame: {
|
|
200
|
+
xmin: -5,
|
|
201
|
+
ymin: -5,
|
|
202
|
+
xmax: 5,
|
|
203
|
+
ymax: 5
|
|
204
|
+
},
|
|
205
|
+
markerGraphics: [
|
|
206
|
+
{
|
|
207
|
+
type: "CIMMarkerGraphic",
|
|
208
|
+
geometry: {
|
|
209
|
+
paths: [
|
|
210
|
+
[
|
|
211
|
+
[t, -t],
|
|
212
|
+
[3 * t, 0],
|
|
213
|
+
[t, t]
|
|
214
|
+
],
|
|
215
|
+
[
|
|
216
|
+
[-t, t],
|
|
217
|
+
[-3 * t, 0],
|
|
218
|
+
[-t, -t]
|
|
219
|
+
]
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
symbol: {
|
|
223
|
+
type: "CIMLineSymbol",
|
|
224
|
+
symbolLayers: [
|
|
225
|
+
{
|
|
226
|
+
type: "CIMSolidStroke",
|
|
227
|
+
enable: !0,
|
|
228
|
+
width: 1.5,
|
|
229
|
+
color: o
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
type: "CIMSolidStroke",
|
|
238
|
+
enable: !0,
|
|
239
|
+
width: t,
|
|
240
|
+
color: s
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
} else
|
|
247
|
+
return {
|
|
248
|
+
type: "simple-line",
|
|
249
|
+
color: "gray",
|
|
250
|
+
width: 2
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
getShowNodeSymbol(e) {
|
|
254
|
+
return e === "marker" ? {
|
|
255
|
+
type: "simple-marker",
|
|
256
|
+
style: "circle",
|
|
257
|
+
color: [61, 139, 249],
|
|
258
|
+
size: 8,
|
|
259
|
+
outline: {
|
|
260
|
+
color: "white",
|
|
261
|
+
width: 1
|
|
262
|
+
}
|
|
263
|
+
} : this.getEditableNodeSymbol(!0);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* 编辑状态时的路口符号
|
|
267
|
+
* 全部用cim符号,是否选中用不同的图标
|
|
268
|
+
* @param selected 是否选中
|
|
269
|
+
* @returns
|
|
270
|
+
*/
|
|
271
|
+
getEditableNodeSymbol(e) {
|
|
272
|
+
return {
|
|
273
|
+
type: "cim",
|
|
274
|
+
data: {
|
|
275
|
+
type: "CIMSymbolReference",
|
|
276
|
+
primitiveOverrides: [
|
|
277
|
+
{
|
|
278
|
+
// 将textGraphic的TextString替换为graphic.attributes.name
|
|
279
|
+
type: "CIMPrimitiveOverride",
|
|
280
|
+
primitiveName: "textGraphic",
|
|
281
|
+
propertyName: "TextString",
|
|
282
|
+
valueExpressionInfo: {
|
|
283
|
+
type: "CIMExpressionInfo",
|
|
284
|
+
title: "Custom",
|
|
285
|
+
expression: 'Replace($feature.name, "与", "/") + " " + $feature.signalId',
|
|
286
|
+
returnType: "Default"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
symbol: {
|
|
291
|
+
type: "CIMPointSymbol",
|
|
292
|
+
symbolLayers: [
|
|
293
|
+
// 路口名称
|
|
294
|
+
{
|
|
295
|
+
type: "CIMVectorMarker",
|
|
296
|
+
size: 30,
|
|
297
|
+
colorLocked: !0,
|
|
298
|
+
anchorPointUnits: "Relative",
|
|
299
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
300
|
+
markerGraphics: [
|
|
301
|
+
{
|
|
302
|
+
type: "CIMMarkerGraphic",
|
|
303
|
+
primitiveName: "textGraphic",
|
|
304
|
+
geometry: { x: 0, y: 0 },
|
|
305
|
+
symbol: {
|
|
306
|
+
type: "CIMTextSymbol",
|
|
307
|
+
height: 12,
|
|
308
|
+
horizontalAlignment: "Center",
|
|
309
|
+
offsetX: 0,
|
|
310
|
+
offsetY: 20,
|
|
311
|
+
haloSize: 2,
|
|
312
|
+
haloSymbol: {
|
|
313
|
+
type: "CIMPolygonSymbol",
|
|
314
|
+
symbolLayers: [
|
|
315
|
+
{
|
|
316
|
+
type: "CIMSolidFill",
|
|
317
|
+
enable: !0,
|
|
318
|
+
color: [255, 255, 255, 255]
|
|
319
|
+
}
|
|
320
|
+
]
|
|
321
|
+
},
|
|
322
|
+
symbol: {
|
|
323
|
+
type: "CIMPolygonSymbol",
|
|
324
|
+
symbolLayers: [
|
|
325
|
+
{
|
|
326
|
+
type: "CIMSolidFill",
|
|
327
|
+
enable: !0,
|
|
328
|
+
color: [0, 0, 0, 255]
|
|
329
|
+
}
|
|
330
|
+
]
|
|
331
|
+
},
|
|
332
|
+
verticalAlignment: "Center"
|
|
333
|
+
},
|
|
334
|
+
textString: ""
|
|
335
|
+
}
|
|
336
|
+
],
|
|
337
|
+
scaleSymbolsProportionally: !0,
|
|
338
|
+
respectFrame: !0
|
|
339
|
+
},
|
|
340
|
+
// 路口图标
|
|
341
|
+
{
|
|
342
|
+
type: "CIMPictureMarker",
|
|
343
|
+
enable: !0,
|
|
344
|
+
anchorPoint: {
|
|
345
|
+
x: 0,
|
|
346
|
+
y: 0
|
|
347
|
+
},
|
|
348
|
+
anchorPointUnits: "Relative",
|
|
349
|
+
size: 25,
|
|
350
|
+
rotateClockwise: !0,
|
|
351
|
+
textureFilter: "Picture",
|
|
352
|
+
url: `/GisViewerAssets/Images/cross/${e ? "gis_xhj_blue" : "gis_xhj_gray"}.png`
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
export {
|
|
361
|
+
w as default
|
|
362
|
+
};
|