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,593 @@
|
|
|
1
|
+
import { Point as h } from "@arcgis/core/geometry";
|
|
2
|
+
import u from "@arcgis/core/Graphic";
|
|
3
|
+
import p from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
+
class x {
|
|
5
|
+
constructor(e) {
|
|
6
|
+
this.crossGraphicSymbol = {
|
|
7
|
+
type: "cim",
|
|
8
|
+
data: {
|
|
9
|
+
type: "CIMSymbolReference",
|
|
10
|
+
primitiveOverrides: [
|
|
11
|
+
{
|
|
12
|
+
type: "CIMPrimitiveOverride",
|
|
13
|
+
primitiveName: "textGraphic",
|
|
14
|
+
propertyName: "TextString",
|
|
15
|
+
valueExpressionInfo: {
|
|
16
|
+
type: "CIMExpressionInfo",
|
|
17
|
+
title: "Custom",
|
|
18
|
+
expression: 'Replace($feature.name, "与", "/") + " " + $feature.signalId',
|
|
19
|
+
returnType: "Default"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
symbol: {
|
|
24
|
+
type: "CIMPointSymbol",
|
|
25
|
+
symbolLayers: [
|
|
26
|
+
{
|
|
27
|
+
type: "CIMVectorMarker",
|
|
28
|
+
size: 32,
|
|
29
|
+
colorLocked: !0,
|
|
30
|
+
anchorPointUnits: "Relative",
|
|
31
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
32
|
+
markerGraphics: [
|
|
33
|
+
{
|
|
34
|
+
type: "CIMMarkerGraphic",
|
|
35
|
+
primitiveName: "textGraphic",
|
|
36
|
+
geometry: { x: 0, y: 0 },
|
|
37
|
+
symbol: {
|
|
38
|
+
type: "CIMTextSymbol",
|
|
39
|
+
height: 12,
|
|
40
|
+
horizontalAlignment: "Center",
|
|
41
|
+
offsetX: 0,
|
|
42
|
+
offsetY: 18,
|
|
43
|
+
haloSize: 1,
|
|
44
|
+
haloSymbol: {
|
|
45
|
+
type: "CIMPolygonSymbol",
|
|
46
|
+
symbolLayers: [
|
|
47
|
+
{
|
|
48
|
+
type: "CIMSolidFill",
|
|
49
|
+
enable: !0,
|
|
50
|
+
color: [255, 255, 255, 255]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
symbol: {
|
|
55
|
+
type: "CIMPolygonSymbol",
|
|
56
|
+
symbolLayers: [
|
|
57
|
+
{
|
|
58
|
+
type: "CIMSolidFill",
|
|
59
|
+
enable: !0,
|
|
60
|
+
color: [0, 0, 0, 255]
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
verticalAlignment: "Center"
|
|
65
|
+
},
|
|
66
|
+
textString: ""
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
scaleSymbolsProportionally: !0,
|
|
70
|
+
respectFrame: !0
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: "CIMPictureMarker",
|
|
74
|
+
enable: !0,
|
|
75
|
+
anchorPoint: {
|
|
76
|
+
x: 0,
|
|
77
|
+
y: 0
|
|
78
|
+
},
|
|
79
|
+
anchorPointUnits: "Relative",
|
|
80
|
+
size: 20,
|
|
81
|
+
rotateClockwise: !0,
|
|
82
|
+
textureFilter: "Picture",
|
|
83
|
+
url: "/GisViewerAssets/Images/cross/gis_xhj_blue.png"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, this.locations = [], this.clusteredLocations = [], this.filteredLocations = [], this.currentShowMode = "scatter", this.symbolScale = 5e3, this.oldScale = 0, this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.view = e, this.crossLayer = new p(), this.view.map.add(this.crossLayer), this.oldScale = e.scale;
|
|
89
|
+
}
|
|
90
|
+
async addCrosses(e) {
|
|
91
|
+
e.forEach((t) => {
|
|
92
|
+
t.signals.forEach((i) => {
|
|
93
|
+
i.longitude && i.latitude && !isNaN(i.longitude) && !isNaN(i.latitude) && this.locations.push({
|
|
94
|
+
id: i.id,
|
|
95
|
+
x: i.longitude,
|
|
96
|
+
y: i.latitude,
|
|
97
|
+
visited: !1,
|
|
98
|
+
filtered: !1,
|
|
99
|
+
clusterId: void 0,
|
|
100
|
+
properties: {
|
|
101
|
+
...i,
|
|
102
|
+
districtId: t.id,
|
|
103
|
+
districtName: t.name,
|
|
104
|
+
subDistrictId: "",
|
|
105
|
+
subDistrictName: ""
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}), t.subDistricts.forEach((i) => {
|
|
109
|
+
i.signals.forEach((s) => {
|
|
110
|
+
s.longitude && s.latitude && !isNaN(s.longitude) && !isNaN(s.latitude) && this.locations.push({
|
|
111
|
+
id: s.id,
|
|
112
|
+
x: s.longitude,
|
|
113
|
+
y: s.latitude,
|
|
114
|
+
visited: !1,
|
|
115
|
+
filtered: !1,
|
|
116
|
+
clusterId: void 0,
|
|
117
|
+
properties: {
|
|
118
|
+
...s,
|
|
119
|
+
districtId: t.id,
|
|
120
|
+
districtName: t.name,
|
|
121
|
+
subDistrictId: i.id,
|
|
122
|
+
subDistrictName: i.name
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
}), this.zoomWatchHandle = this.view.watch("stationary", () => {
|
|
128
|
+
if (this.view.stationary !== !1) {
|
|
129
|
+
if (this.currentShowMode === "scatter")
|
|
130
|
+
(this.oldScale < this.symbolScale && this.view.scale >= this.symbolScale || this.oldScale >= this.symbolScale && this.view.scale < this.symbolScale) && this.updateScatterSymbol(), this.oldScale = this.view.scale;
|
|
131
|
+
else if (this.currentShowMode === "cluster") {
|
|
132
|
+
this.locationToScreen(), console.time("cluster");
|
|
133
|
+
const t = this.doPixelCluster(this.clusterRadius);
|
|
134
|
+
console.timeEnd("cluster"), this.showClusterResult(t);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* 清除所有路口
|
|
141
|
+
*/
|
|
142
|
+
clearCrosses() {
|
|
143
|
+
var e;
|
|
144
|
+
this.crossLayer.removeAll(), this.locations = [], this.clusteredLocations = [], (e = this.zoomWatchHandle) == null || e.remove();
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* 更新散点符号
|
|
148
|
+
*/
|
|
149
|
+
updateScatterSymbol() {
|
|
150
|
+
this.crossLayer.graphics.forEach((e) => {
|
|
151
|
+
e.symbol = this.getCrossSymbol(e.attributes);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* 将地理位置转换为屏幕坐标
|
|
156
|
+
*/
|
|
157
|
+
locationToScreen() {
|
|
158
|
+
this.clusteredLocations = [], this.locations.forEach((e) => {
|
|
159
|
+
const t = this.view.toScreen(
|
|
160
|
+
new h({ x: e.x, y: e.y })
|
|
161
|
+
);
|
|
162
|
+
e.filtered === !1 && t.x > 0 && t.y > 0 && (e.properties.screenX = t.x, e.properties.screenY = t.y, e.visited = !1, e.clusterId = void 0, this.clusteredLocations.push(e));
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* 显示聚合点
|
|
167
|
+
*/
|
|
168
|
+
showCluster() {
|
|
169
|
+
this.crossLayer.removeAll(), this.currentShowMode = "cluster", this.locationToScreen();
|
|
170
|
+
const e = this.doPixelCluster(this.clusterRadius);
|
|
171
|
+
this.showClusterResult(e);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* 显示散点
|
|
175
|
+
*/
|
|
176
|
+
showScatter() {
|
|
177
|
+
this.crossLayer.removeAll(), this.currentShowMode = "scatter";
|
|
178
|
+
const e = [];
|
|
179
|
+
this.locations.forEach((t) => {
|
|
180
|
+
if (!t.filtered) {
|
|
181
|
+
const i = new u({
|
|
182
|
+
geometry: {
|
|
183
|
+
type: "point",
|
|
184
|
+
longitude: t.x,
|
|
185
|
+
latitude: t.y
|
|
186
|
+
},
|
|
187
|
+
symbol: this.getCrossSymbol(t.properties),
|
|
188
|
+
attributes: t.properties,
|
|
189
|
+
popupTemplate: {
|
|
190
|
+
title: "{name}信号机",
|
|
191
|
+
content: [
|
|
192
|
+
{
|
|
193
|
+
type: "fields",
|
|
194
|
+
fieldInfos: [
|
|
195
|
+
{
|
|
196
|
+
fieldName: "signalId",
|
|
197
|
+
label: "信号机编号"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
fieldName: "nodeId",
|
|
201
|
+
label: "路口编号"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
fieldName: "districtName",
|
|
205
|
+
label: "区控名称"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
fieldName: "subDistrictName",
|
|
209
|
+
label: "子区名称"
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
e.push(i);
|
|
217
|
+
}
|
|
218
|
+
}), this.crossLayer.addMany(e);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* 隐藏路口
|
|
222
|
+
*/
|
|
223
|
+
hideCrosses() {
|
|
224
|
+
this.crossLayer.removeAll();
|
|
225
|
+
}
|
|
226
|
+
filter(e) {
|
|
227
|
+
this.locations.forEach((t) => {
|
|
228
|
+
if (e.type === "district")
|
|
229
|
+
t.filtered = t.properties.districtId !== e.id;
|
|
230
|
+
else if (e.type === "subDistrict")
|
|
231
|
+
t.filtered = t.properties.subDistrictId !== e.id;
|
|
232
|
+
else if (e.type === "signal" && (t.filtered = t.id !== e.id, t.filtered))
|
|
233
|
+
return t.properties;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
resetFilter() {
|
|
237
|
+
this.locations.forEach((e) => {
|
|
238
|
+
e.filtered = !1;
|
|
239
|
+
}), this.currentShowMode === "scatter" ? this.showScatter() : this.currentShowMode === "cluster" && this.showCluster();
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* 根据当前比例尺更新路口符号
|
|
243
|
+
* @param attributes
|
|
244
|
+
* @returns
|
|
245
|
+
*/
|
|
246
|
+
getCrossSymbol(e) {
|
|
247
|
+
if (this.view.scale > this.symbolScale)
|
|
248
|
+
return e.isKey ? {
|
|
249
|
+
// 关键路口用星号图标
|
|
250
|
+
type: "picture-marker",
|
|
251
|
+
url: "/GisViewerAssets/Images/icon_star.png",
|
|
252
|
+
width: "20px",
|
|
253
|
+
height: "20px"
|
|
254
|
+
} : {
|
|
255
|
+
// 普通路口用圆点
|
|
256
|
+
type: "simple-marker",
|
|
257
|
+
style: "circle",
|
|
258
|
+
color: [5, 116, 255, 0.8],
|
|
259
|
+
size: 8,
|
|
260
|
+
outline: {
|
|
261
|
+
color: "white",
|
|
262
|
+
width: 0
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
{
|
|
266
|
+
const t = e.isKey ? "/GisViewerAssets/Images/cross/gis_gjxklk_orange.png" : "/GisViewerAssets/Images/cross/gis_xhj_blue.png";
|
|
267
|
+
return {
|
|
268
|
+
type: "cim",
|
|
269
|
+
data: {
|
|
270
|
+
type: "CIMSymbolReference",
|
|
271
|
+
primitiveOverrides: [
|
|
272
|
+
{
|
|
273
|
+
// 将textGraphic的TextString替换为graphic.attributes.name
|
|
274
|
+
type: "CIMPrimitiveOverride",
|
|
275
|
+
primitiveName: "textGraphic",
|
|
276
|
+
propertyName: "TextString",
|
|
277
|
+
valueExpressionInfo: {
|
|
278
|
+
type: "CIMExpressionInfo",
|
|
279
|
+
title: "Custom",
|
|
280
|
+
expression: 'Replace($feature.name, "与", "/") + " " + $feature.signalId',
|
|
281
|
+
returnType: "Default"
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
],
|
|
285
|
+
symbol: {
|
|
286
|
+
type: "CIMPointSymbol",
|
|
287
|
+
symbolLayers: [
|
|
288
|
+
// 路口名称
|
|
289
|
+
{
|
|
290
|
+
type: "CIMVectorMarker",
|
|
291
|
+
size: 32,
|
|
292
|
+
colorLocked: !0,
|
|
293
|
+
anchorPointUnits: "Relative",
|
|
294
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
295
|
+
markerGraphics: [
|
|
296
|
+
{
|
|
297
|
+
type: "CIMMarkerGraphic",
|
|
298
|
+
primitiveName: "textGraphic",
|
|
299
|
+
geometry: { x: 0, y: 0 },
|
|
300
|
+
symbol: {
|
|
301
|
+
type: "CIMTextSymbol",
|
|
302
|
+
height: 12,
|
|
303
|
+
horizontalAlignment: "Center",
|
|
304
|
+
offsetX: 0,
|
|
305
|
+
offsetY: 20,
|
|
306
|
+
haloSize: 1,
|
|
307
|
+
haloSymbol: {
|
|
308
|
+
type: "CIMPolygonSymbol",
|
|
309
|
+
symbolLayers: [
|
|
310
|
+
{
|
|
311
|
+
type: "CIMSolidFill",
|
|
312
|
+
enable: !0,
|
|
313
|
+
color: [255, 255, 255, 255]
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
},
|
|
317
|
+
symbol: {
|
|
318
|
+
type: "CIMPolygonSymbol",
|
|
319
|
+
symbolLayers: [
|
|
320
|
+
{
|
|
321
|
+
type: "CIMSolidFill",
|
|
322
|
+
enable: !0,
|
|
323
|
+
color: [0, 0, 0, 255]
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
verticalAlignment: "Center"
|
|
328
|
+
},
|
|
329
|
+
textString: ""
|
|
330
|
+
}
|
|
331
|
+
],
|
|
332
|
+
scaleSymbolsProportionally: !0,
|
|
333
|
+
respectFrame: !0
|
|
334
|
+
},
|
|
335
|
+
// 路口图标
|
|
336
|
+
{
|
|
337
|
+
type: "CIMPictureMarker",
|
|
338
|
+
enable: !0,
|
|
339
|
+
anchorPoint: {
|
|
340
|
+
x: 0,
|
|
341
|
+
y: 0
|
|
342
|
+
},
|
|
343
|
+
anchorPointUnits: "Relative",
|
|
344
|
+
size: 20,
|
|
345
|
+
rotateClockwise: !0,
|
|
346
|
+
textureFilter: "Picture",
|
|
347
|
+
url: t
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* 获取邻居点
|
|
357
|
+
* @param locations
|
|
358
|
+
* @param index
|
|
359
|
+
* @param eps
|
|
360
|
+
* @returns
|
|
361
|
+
*/
|
|
362
|
+
getNeighbors(e, t) {
|
|
363
|
+
return this.clusteredLocations.filter((i) => i.id === e.id || i.visited ? !1 : this.getDistance(e, i) <= t);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* 两点间的像素距离
|
|
367
|
+
* @param point1
|
|
368
|
+
* @param point2
|
|
369
|
+
* @returns
|
|
370
|
+
*/
|
|
371
|
+
getDistance(e, t) {
|
|
372
|
+
return Math.sqrt(
|
|
373
|
+
Math.pow(e.properties.screenX - t.properties.screenX, 2) + Math.pow(e.properties.screenY - t.properties.screenY, 2)
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* 从聚类结果中创建聚类对象
|
|
378
|
+
* @param locations
|
|
379
|
+
* @returns
|
|
380
|
+
*/
|
|
381
|
+
createClusters() {
|
|
382
|
+
const e = {}, t = [];
|
|
383
|
+
for (const s of this.clusteredLocations)
|
|
384
|
+
s.clusterId === void 0 || s.clusterId === -1 ? t.push(s) : (e[s.clusterId] || (e[s.clusterId] = []), e[s.clusterId].push(s));
|
|
385
|
+
const i = Object.keys(e).map((s, r) => {
|
|
386
|
+
const o = e[Number(s)], a = o.length, l = o.reduce((n, m) => n + m.x, 0), c = o.reduce((n, m) => n + m.y, 0), y = l / a, d = c / a;
|
|
387
|
+
return {
|
|
388
|
+
id: Number(s),
|
|
389
|
+
items: o,
|
|
390
|
+
count: a,
|
|
391
|
+
center: {
|
|
392
|
+
x: y,
|
|
393
|
+
y: d
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
});
|
|
397
|
+
return t.length > 0 && i.push({
|
|
398
|
+
id: -1,
|
|
399
|
+
items: t,
|
|
400
|
+
count: t.length,
|
|
401
|
+
center: null
|
|
402
|
+
}), i;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* 按照像素距离聚类
|
|
406
|
+
* @param locations
|
|
407
|
+
* @param eps
|
|
408
|
+
* @param minPoints
|
|
409
|
+
* @returns
|
|
410
|
+
*/
|
|
411
|
+
doPixelCluster(e) {
|
|
412
|
+
let t = 0;
|
|
413
|
+
for (let i = 0; i < this.clusteredLocations.length; i++) {
|
|
414
|
+
const s = this.clusteredLocations[i];
|
|
415
|
+
if (s.visited)
|
|
416
|
+
continue;
|
|
417
|
+
s.visited = !0;
|
|
418
|
+
const r = this.getNeighbors(s, e);
|
|
419
|
+
r.length < this.minClusterPoints ? s.clusterId = -1 : (r.forEach((o) => {
|
|
420
|
+
o.visited = !0, o.clusterId = t;
|
|
421
|
+
}), s.clusterId = t, t++);
|
|
422
|
+
}
|
|
423
|
+
return this.createClusters();
|
|
424
|
+
}
|
|
425
|
+
showClusterResult(e) {
|
|
426
|
+
this.crossLayer.removeAll();
|
|
427
|
+
let t = Number.MIN_VALUE, i = Number.MAX_VALUE;
|
|
428
|
+
e.forEach((s) => {
|
|
429
|
+
s.count > 1 && (i = Math.min(i, s.count), t = Math.max(t, s.count));
|
|
430
|
+
}), e.forEach((s) => {
|
|
431
|
+
if (s.id !== -1) {
|
|
432
|
+
let r = i === t ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (s.count - i) / (t - i) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
|
|
433
|
+
r *= 0.75;
|
|
434
|
+
const l = (s.count.toString().length * 8 + 6) / 2, c = new u({
|
|
435
|
+
geometry: new h({ x: s.center.x, y: s.center.y }),
|
|
436
|
+
attributes: {
|
|
437
|
+
count: s.count
|
|
438
|
+
},
|
|
439
|
+
symbol: {
|
|
440
|
+
type: "cim",
|
|
441
|
+
data: {
|
|
442
|
+
type: "CIMSymbolReference",
|
|
443
|
+
primitiveOverrides: [
|
|
444
|
+
{
|
|
445
|
+
// 将textGraphic的TextString替换为graphic.attributes.name
|
|
446
|
+
type: "CIMPrimitiveOverride",
|
|
447
|
+
primitiveName: "textGraphic",
|
|
448
|
+
propertyName: "TextString",
|
|
449
|
+
valueExpressionInfo: {
|
|
450
|
+
type: "CIMExpressionInfo",
|
|
451
|
+
title: "Custom",
|
|
452
|
+
expression: "$feature.count",
|
|
453
|
+
returnType: "Default"
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
],
|
|
457
|
+
symbol: {
|
|
458
|
+
type: "CIMPointSymbol",
|
|
459
|
+
symbolLayers: [
|
|
460
|
+
// 聚合数量
|
|
461
|
+
{
|
|
462
|
+
type: "CIMVectorMarker",
|
|
463
|
+
size: r,
|
|
464
|
+
colorLocked: !0,
|
|
465
|
+
anchorPointUnits: "Relative",
|
|
466
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
467
|
+
markerGraphics: [
|
|
468
|
+
// 数量文本框
|
|
469
|
+
{
|
|
470
|
+
type: "CIMMarkerGraphic",
|
|
471
|
+
geometry: {
|
|
472
|
+
rings: [
|
|
473
|
+
[
|
|
474
|
+
[-l, 40],
|
|
475
|
+
[l, 40],
|
|
476
|
+
[l, 20],
|
|
477
|
+
[-l, 20],
|
|
478
|
+
[-l, 40]
|
|
479
|
+
]
|
|
480
|
+
]
|
|
481
|
+
},
|
|
482
|
+
symbol: {
|
|
483
|
+
type: "CIMPolygonSymbol",
|
|
484
|
+
symbolLayers: [
|
|
485
|
+
{
|
|
486
|
+
type: "CIMSolidFill",
|
|
487
|
+
enable: !0,
|
|
488
|
+
color: [2, 72, 200, 255]
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
type: "CIMSolidStroke",
|
|
492
|
+
enable: !0,
|
|
493
|
+
width: 5,
|
|
494
|
+
color: [2, 72, 200, 128]
|
|
495
|
+
}
|
|
496
|
+
]
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
// 数量文字
|
|
500
|
+
{
|
|
501
|
+
type: "CIMMarkerGraphic",
|
|
502
|
+
primitiveName: "textGraphic",
|
|
503
|
+
geometry: { x: 0, y: 0 },
|
|
504
|
+
symbol: {
|
|
505
|
+
type: "CIMTextSymbol",
|
|
506
|
+
height: 16,
|
|
507
|
+
horizontalAlignment: "Center",
|
|
508
|
+
offsetX: 0,
|
|
509
|
+
offsetY: 30,
|
|
510
|
+
symbol: {
|
|
511
|
+
type: "CIMPolygonSymbol",
|
|
512
|
+
symbolLayers: [
|
|
513
|
+
{
|
|
514
|
+
type: "CIMSolidFill",
|
|
515
|
+
enable: !0,
|
|
516
|
+
color: [255, 255, 255, 255]
|
|
517
|
+
}
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
verticalAlignment: "Center"
|
|
521
|
+
},
|
|
522
|
+
textString: ""
|
|
523
|
+
}
|
|
524
|
+
],
|
|
525
|
+
scaleSymbolsProportionally: !0,
|
|
526
|
+
respectFrame: !0
|
|
527
|
+
},
|
|
528
|
+
// 聚合图标
|
|
529
|
+
{
|
|
530
|
+
type: "CIMPictureMarker",
|
|
531
|
+
enable: !0,
|
|
532
|
+
anchorPoint: {
|
|
533
|
+
x: 0,
|
|
534
|
+
y: 0
|
|
535
|
+
},
|
|
536
|
+
anchorPointUnits: "Relative",
|
|
537
|
+
size: r,
|
|
538
|
+
rotateClockwise: !0,
|
|
539
|
+
textureFilter: "Picture",
|
|
540
|
+
url: "/GisViewerAssets/Images/cross/gis_xhj_blue.png"
|
|
541
|
+
}
|
|
542
|
+
]
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
this.crossLayer.add(c);
|
|
548
|
+
} else
|
|
549
|
+
s.items.forEach((r) => {
|
|
550
|
+
const o = new u({
|
|
551
|
+
geometry: new h({ x: r.x, y: r.y }),
|
|
552
|
+
attributes: {
|
|
553
|
+
...r,
|
|
554
|
+
...r.properties,
|
|
555
|
+
type: "clusterPoint",
|
|
556
|
+
id: r.id
|
|
557
|
+
},
|
|
558
|
+
symbol: this.crossGraphicSymbol,
|
|
559
|
+
popupTemplate: {
|
|
560
|
+
title: "{name}信号机",
|
|
561
|
+
content: [
|
|
562
|
+
{
|
|
563
|
+
type: "fields",
|
|
564
|
+
fieldInfos: [
|
|
565
|
+
{
|
|
566
|
+
fieldName: "signalId",
|
|
567
|
+
label: "信号机编号"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
fieldName: "nodeId",
|
|
571
|
+
label: "路口编号"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
fieldName: "districtName",
|
|
575
|
+
label: "区控名称"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
fieldName: "subDistrictName",
|
|
579
|
+
label: "子区名称"
|
|
580
|
+
}
|
|
581
|
+
]
|
|
582
|
+
}
|
|
583
|
+
]
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
this.crossLayer.add(o);
|
|
587
|
+
});
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
export {
|
|
592
|
+
x as default
|
|
593
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import d from "pako";
|
|
2
|
+
import l from "../common-utils.mjs";
|
|
3
|
+
class c {
|
|
4
|
+
constructor(o, s) {
|
|
5
|
+
if (this.parentName = "", this.signals = [], this.subDistricts = [], this.areaColor = this.getDarkNonGrayColor(), this.signalCount = 0, this.subDistrictCount = 0, this.roadConnections = [], this.id = o.name, this.name = o.areaDesc, this.parentId = o.parentId, s === "alarm" && (this.areaColor = [255, 0, 0]), o.mapConnectList)
|
|
6
|
+
try {
|
|
7
|
+
const t = o.mapConnectList, i = new Uint8Array(
|
|
8
|
+
window.atob(t).split("").map((r) => r.charCodeAt(0))
|
|
9
|
+
), a = d.inflate(i, { to: "string" }), n = JSON.parse(a);
|
|
10
|
+
this.roadConnections.push(
|
|
11
|
+
...n.map((r) => ({
|
|
12
|
+
id: r.roadsectId,
|
|
13
|
+
coordinates: JSON.parse(r.geomData).coordinates,
|
|
14
|
+
districtId: this.parentId,
|
|
15
|
+
subDistrictId: this.id
|
|
16
|
+
}))
|
|
17
|
+
);
|
|
18
|
+
} catch (t) {
|
|
19
|
+
console.error("解压子区路段连接信息失败:", t);
|
|
20
|
+
}
|
|
21
|
+
for (const t of o.children)
|
|
22
|
+
if (t.children) {
|
|
23
|
+
const i = new c(t, s);
|
|
24
|
+
if (i.id = t.id, i.name = `SS ${t.name}`, i.parentId = this.id, i.parentName = this.name, i.areaColor = this.getDarkNonGrayColor(t.id), this.subDistricts.push(i), this.subDistrictCount++, this.signalCount += i.signalCount, t.mapConnectList)
|
|
25
|
+
try {
|
|
26
|
+
const a = t.mapConnectList, n = new Uint8Array(
|
|
27
|
+
window.atob(a).split("").map((e) => e.charCodeAt(0))
|
|
28
|
+
), r = d.inflate(n, { to: "string" }), h = JSON.parse(r);
|
|
29
|
+
i.roadConnections.push(
|
|
30
|
+
...h.map((e) => ({
|
|
31
|
+
id: e.roadsectId,
|
|
32
|
+
coordinates: JSON.parse(e.geomData).coordinates,
|
|
33
|
+
districtId: i.parentId,
|
|
34
|
+
subDistrictId: i.id
|
|
35
|
+
}))
|
|
36
|
+
);
|
|
37
|
+
} catch (a) {
|
|
38
|
+
console.error("解压子区路段连接信息失败:", a);
|
|
39
|
+
}
|
|
40
|
+
} else if (l.isCoordinateValid(t)) {
|
|
41
|
+
const i = {
|
|
42
|
+
id: t.id,
|
|
43
|
+
name: t.name,
|
|
44
|
+
parentId: t.parentId,
|
|
45
|
+
latitude: Number(t.latitude),
|
|
46
|
+
longitude: Number(t.longitude),
|
|
47
|
+
signalId: t.signalId,
|
|
48
|
+
nodeId: t.nodeId,
|
|
49
|
+
isKey: t.isKey === 1
|
|
50
|
+
};
|
|
51
|
+
this.signals.push(i), this.signalCount++;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 获取区控/子区下的所有信号机
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
getAllSignalCoordinates() {
|
|
59
|
+
const o = [];
|
|
60
|
+
for (const s of this.signals)
|
|
61
|
+
o.push([s.longitude, s.latitude]);
|
|
62
|
+
for (const s of this.subDistricts)
|
|
63
|
+
o.push(...s.getAllSignalCoordinates());
|
|
64
|
+
return o;
|
|
65
|
+
}
|
|
66
|
+
getDarkNonGrayColor(o) {
|
|
67
|
+
let s, t, i;
|
|
68
|
+
if (o) {
|
|
69
|
+
const a = this.cyrb53(o);
|
|
70
|
+
s = ((a & 16711680) >> 16) % 200, t = ((a & 65280) >> 8) % 200, i = (a & 255) % 200;
|
|
71
|
+
} else
|
|
72
|
+
s = Math.floor(Math.random() * 256), t = Math.floor(Math.random() * 256), i = Math.floor(Math.random() * 256);
|
|
73
|
+
return [s, t, i];
|
|
74
|
+
}
|
|
75
|
+
cyrb53(o, s = 0) {
|
|
76
|
+
let t = 3735928559 ^ s, i = 1103547991 ^ s;
|
|
77
|
+
for (let a = 0, n; a < o.length; a++)
|
|
78
|
+
n = o.charCodeAt(a), t = Math.imul(t ^ n, 2654435761), i = Math.imul(i ^ n, 1597334677);
|
|
79
|
+
return t = Math.imul(t ^ t >>> 16, 2246822507), t ^= Math.imul(i ^ i >>> 13, 3266489909), i = Math.imul(i ^ i >>> 16, 2246822507), i ^= Math.imul(t ^ t >>> 13, 3266489909), 4294967296 * (2097151 & i) + (t >>> 0);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
c as default
|
|
84
|
+
};
|