gisviewer-vue3-arcgis 1.0.253 → 1.0.255
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/gis-map.vue.d.ts +3 -1
- package/es/src/gis-map/gis-map.vue.mjs +175 -173
- package/es/src/gis-map/index.d.ts +3 -1
- package/es/src/gis-map/utils/dbscan-cluster/index.d.ts +4 -2
- package/es/src/gis-map/utils/dbscan-cluster/index.mjs +89 -72
- package/es/src/gis-map/utils/map-initializer.d.ts +10 -1
- package/es/src/gis-map/utils/map-initializer.mjs +181 -111
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +9 -0
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +145 -0
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +53 -37
- package/es/src/gis-map/utils/signal-control-area/show-area.d.ts +3 -8
- package/es/src/gis-map/utils/signal-control-area/show-area.mjs +63 -105
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +1 -1
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +5 -5
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +84 -83
- package/es/src/types/index.d.ts +3 -3
- package/lib/src/gis-map/gis-map.vue.d.ts +3 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +3 -1
- package/lib/src/gis-map/utils/dbscan-cluster/index.d.ts +4 -2
- package/lib/src/gis-map/utils/dbscan-cluster/index.js +1 -1
- package/lib/src/gis-map/utils/map-initializer.d.ts +10 -1
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +9 -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 -1
- package/lib/src/gis-map/utils/signal-control-area/show-area.d.ts +3 -8
- package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +1 -1
- package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
- package/lib/src/types/index.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import * as f from "@arcgis/core/core/reactiveUtils";
|
|
2
|
-
import { Point as
|
|
2
|
+
import { Point as h } from "@arcgis/core/geometry";
|
|
3
3
|
import m from "@arcgis/core/Graphic";
|
|
4
4
|
import b from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
-
class
|
|
6
|
-
constructor(
|
|
7
|
-
this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.zoomWatchHandle = null, this.locations = [], this.clusterMarkUrl = "", this.currentZoom = 0, this.view =
|
|
5
|
+
class I {
|
|
6
|
+
constructor(t) {
|
|
7
|
+
this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusterRadius = 120, this.minClusterPoints = 2, this.zoomWatchHandle = null, this.locations = [], this.clusterMarkUrl = "", this.currentZoom = 0, this.view = t, this.currentZoom = t.zoom, this.clusterLayer = new b(), this.view.map.add(this.clusterLayer);
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* 将地理位置转换为屏幕坐标
|
|
11
11
|
*/
|
|
12
12
|
locationToScreen() {
|
|
13
|
-
this.locations.forEach((
|
|
14
|
-
const
|
|
15
|
-
new
|
|
13
|
+
this.locations.forEach((t) => {
|
|
14
|
+
const r = this.view.toScreen(
|
|
15
|
+
new h({ x: t.x, y: t.y })
|
|
16
16
|
);
|
|
17
|
-
|
|
17
|
+
t.properties.screenX = r.x, t.properties.screenY = r.y;
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* 添加聚类点到视图
|
|
22
22
|
* @param params
|
|
23
23
|
*/
|
|
24
|
-
addClusterPoints(
|
|
24
|
+
addClusterPoints(t) {
|
|
25
25
|
var i;
|
|
26
|
-
this.locations =
|
|
27
|
-
|
|
26
|
+
this.locations = t.points, this.clusterMarkUrl = ((i = t.clusterSymbol) == null ? void 0 : i.url) || "/GisViewerAssets/Images/cross/gis_xhj_blue.png", this.locations = this.locations.filter((e) => e.x !== null && e.y !== null && !isNaN(e.x) && !isNaN(e.y)), this.locations.forEach((e) => {
|
|
27
|
+
e.x = Number(e.x), e.y = Number(e.y), e.symbol || (e.symbol = t.pointSymbol || {
|
|
28
28
|
type: "simple-marker",
|
|
29
29
|
style: "circle",
|
|
30
30
|
color: "#3388ff",
|
|
@@ -37,28 +37,39 @@ class M {
|
|
|
37
37
|
}), this.zoomWatchHandle || (this.zoomWatchHandle = f.watch(
|
|
38
38
|
() => this.view.zoom,
|
|
39
39
|
() => {
|
|
40
|
-
Math.abs(this.currentZoom - this.view.zoom) >= 1
|
|
40
|
+
if (Math.abs(this.currentZoom - this.view.zoom) >= 1) {
|
|
41
|
+
this.currentZoom = this.view.zoom, this.locationToScreen(), console.time("cluster");
|
|
42
|
+
const e = this.doPixelCluster(
|
|
43
|
+
this.clusterRadius,
|
|
44
|
+
this.minClusterPoints
|
|
45
|
+
);
|
|
46
|
+
console.timeEnd("cluster"), this.showClusters(e);
|
|
47
|
+
}
|
|
41
48
|
}
|
|
42
|
-
)), this.locationToScreen()
|
|
43
|
-
const
|
|
44
|
-
|
|
49
|
+
)), this.locationToScreen();
|
|
50
|
+
const r = this.doPixelCluster(
|
|
51
|
+
this.clusterRadius,
|
|
52
|
+
this.minClusterPoints
|
|
53
|
+
);
|
|
54
|
+
this.showClusters(r);
|
|
45
55
|
}
|
|
46
56
|
removeAllClusterPoints() {
|
|
47
|
-
var
|
|
48
|
-
(
|
|
57
|
+
var t;
|
|
58
|
+
(t = this.zoomWatchHandle) == null || t.remove(), this.zoomWatchHandle = null, this.clusterLayer.removeAll();
|
|
49
59
|
}
|
|
50
|
-
showClusters(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
showClusters(t) {
|
|
61
|
+
this.clusterLayer.removeAll();
|
|
62
|
+
let r = Number.MIN_VALUE, i = Number.MAX_VALUE;
|
|
63
|
+
t.forEach((e) => {
|
|
64
|
+
e.count > 1 && (i = Math.min(i, e.count), r = Math.max(r, e.count));
|
|
65
|
+
}), t.forEach((e) => {
|
|
66
|
+
if (e.id !== -1) {
|
|
67
|
+
let s = i === r ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (e.count - i) / (r - i) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
|
|
68
|
+
s *= 0.75;
|
|
69
|
+
const l = (e.count.toString().length * 8 + 6) / 2, c = new m({
|
|
70
|
+
geometry: new h({ x: e.center.x, y: e.center.y }),
|
|
60
71
|
attributes: {
|
|
61
|
-
count:
|
|
72
|
+
count: e.count
|
|
62
73
|
},
|
|
63
74
|
symbol: {
|
|
64
75
|
type: "cim",
|
|
@@ -84,7 +95,7 @@ class M {
|
|
|
84
95
|
// 聚合数量
|
|
85
96
|
{
|
|
86
97
|
type: "CIMVectorMarker",
|
|
87
|
-
size:
|
|
98
|
+
size: s,
|
|
88
99
|
colorLocked: !0,
|
|
89
100
|
anchorPointUnits: "Relative",
|
|
90
101
|
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
@@ -95,11 +106,11 @@ class M {
|
|
|
95
106
|
geometry: {
|
|
96
107
|
rings: [
|
|
97
108
|
[
|
|
98
|
-
[-
|
|
99
|
-
[
|
|
100
|
-
[
|
|
101
|
-
[-
|
|
102
|
-
[-
|
|
109
|
+
[-l, 40],
|
|
110
|
+
[l, 40],
|
|
111
|
+
[l, 20],
|
|
112
|
+
[-l, 20],
|
|
113
|
+
[-l, 40]
|
|
103
114
|
]
|
|
104
115
|
]
|
|
105
116
|
},
|
|
@@ -158,7 +169,7 @@ class M {
|
|
|
158
169
|
y: 0
|
|
159
170
|
},
|
|
160
171
|
anchorPointUnits: "Relative",
|
|
161
|
-
size:
|
|
172
|
+
size: s,
|
|
162
173
|
rotateClockwise: !0,
|
|
163
174
|
textureFilter: "Picture",
|
|
164
175
|
url: this.clusterMarkUrl
|
|
@@ -168,13 +179,18 @@ class M {
|
|
|
168
179
|
}
|
|
169
180
|
}
|
|
170
181
|
});
|
|
171
|
-
this.clusterLayer.add(
|
|
182
|
+
this.clusterLayer.add(c);
|
|
172
183
|
} else
|
|
173
|
-
|
|
184
|
+
e.items.forEach((s) => {
|
|
174
185
|
const o = new m({
|
|
175
|
-
geometry: new
|
|
176
|
-
attributes:
|
|
177
|
-
|
|
186
|
+
geometry: new h({ x: s.x, y: s.y }),
|
|
187
|
+
attributes: {
|
|
188
|
+
...s,
|
|
189
|
+
...s.properties,
|
|
190
|
+
type: "clusterPoint",
|
|
191
|
+
id: s.id
|
|
192
|
+
},
|
|
193
|
+
symbol: s.symbol
|
|
178
194
|
});
|
|
179
195
|
this.clusterLayer.add(o);
|
|
180
196
|
});
|
|
@@ -187,9 +203,8 @@ class M {
|
|
|
187
203
|
* @param eps
|
|
188
204
|
* @returns
|
|
189
205
|
*/
|
|
190
|
-
getNeighbors(
|
|
191
|
-
|
|
192
|
-
return e.filter((t) => t.id === r.id || t.visited ? !1 : this.getDistance(r, t) <= i);
|
|
206
|
+
getNeighbors(t, r) {
|
|
207
|
+
return this.locations.filter((i) => i.id === t.id || i.visited ? !1 : this.getDistance(t, i) <= r);
|
|
193
208
|
}
|
|
194
209
|
/**
|
|
195
210
|
* 两点间的像素距离
|
|
@@ -197,9 +212,9 @@ class M {
|
|
|
197
212
|
* @param point2
|
|
198
213
|
* @returns
|
|
199
214
|
*/
|
|
200
|
-
getDistance(
|
|
215
|
+
getDistance(t, r) {
|
|
201
216
|
return Math.sqrt(
|
|
202
|
-
Math.pow(
|
|
217
|
+
Math.pow(t.properties.screenX - r.properties.screenX, 2) + Math.pow(t.properties.screenY - r.properties.screenY, 2)
|
|
203
218
|
);
|
|
204
219
|
}
|
|
205
220
|
/**
|
|
@@ -207,30 +222,30 @@ class M {
|
|
|
207
222
|
* @param locations
|
|
208
223
|
* @returns
|
|
209
224
|
*/
|
|
210
|
-
createClusters(
|
|
211
|
-
const
|
|
212
|
-
for (let
|
|
213
|
-
const o =
|
|
214
|
-
o.clusterId === void 0 || o.clusterId === -1 ? i.push(o) : (
|
|
225
|
+
createClusters(t) {
|
|
226
|
+
const r = {}, i = [];
|
|
227
|
+
for (let s = 0; s < t.length; s++) {
|
|
228
|
+
const o = t[s];
|
|
229
|
+
o.clusterId === void 0 || o.clusterId === -1 ? i.push(o) : (r[o.clusterId] || (r[o.clusterId] = []), r[o.clusterId].push(o));
|
|
215
230
|
}
|
|
216
|
-
const
|
|
217
|
-
const
|
|
231
|
+
const e = Object.keys(r).map((s, o) => {
|
|
232
|
+
const n = r[Number(s)], l = n.length, c = n.reduce((a, u) => a + u.x, 0), y = n.reduce((a, u) => a + u.y, 0), d = c / l, p = y / l;
|
|
218
233
|
return {
|
|
219
|
-
id: Number(
|
|
220
|
-
items:
|
|
221
|
-
count:
|
|
234
|
+
id: Number(s),
|
|
235
|
+
items: n,
|
|
236
|
+
count: l,
|
|
222
237
|
center: {
|
|
223
|
-
x:
|
|
224
|
-
y:
|
|
238
|
+
x: d,
|
|
239
|
+
y: p
|
|
225
240
|
}
|
|
226
241
|
};
|
|
227
242
|
});
|
|
228
|
-
return i.length > 0 &&
|
|
243
|
+
return i.length > 0 && e.push({
|
|
229
244
|
id: -1,
|
|
230
245
|
items: i,
|
|
231
246
|
count: i.length,
|
|
232
247
|
center: null
|
|
233
|
-
}),
|
|
248
|
+
}), e;
|
|
234
249
|
}
|
|
235
250
|
/**
|
|
236
251
|
* 按照像素距离聚类
|
|
@@ -239,22 +254,24 @@ class M {
|
|
|
239
254
|
* @param minPoints
|
|
240
255
|
* @returns
|
|
241
256
|
*/
|
|
242
|
-
doPixelCluster(
|
|
243
|
-
let
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
257
|
+
doPixelCluster(t, r) {
|
|
258
|
+
let i = 0;
|
|
259
|
+
this.locations.forEach((e) => {
|
|
260
|
+
e.visited = !1, e.clusterId = void 0;
|
|
261
|
+
});
|
|
262
|
+
for (let e = 0; e < this.locations.length; e++) {
|
|
263
|
+
const s = this.locations[e];
|
|
264
|
+
if (s.visited)
|
|
248
265
|
continue;
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
n.visited = !0, n.clusterId =
|
|
253
|
-
}),
|
|
266
|
+
s.visited = !0;
|
|
267
|
+
const o = this.getNeighbors(s, t);
|
|
268
|
+
o.length < r ? s.clusterId = -1 : (o.forEach((n) => {
|
|
269
|
+
n.visited = !0, n.clusterId = i;
|
|
270
|
+
}), s.clusterId = i, i++);
|
|
254
271
|
}
|
|
255
|
-
return this.createClusters(
|
|
272
|
+
return this.createClusters(this.locations);
|
|
256
273
|
}
|
|
257
274
|
}
|
|
258
275
|
export {
|
|
259
|
-
|
|
276
|
+
I as default
|
|
260
277
|
};
|
|
@@ -16,7 +16,7 @@ export default class MapInitializer {
|
|
|
16
16
|
markerClickCallback?: (type: string, id: string, detail: any, event?: any) => void;
|
|
17
17
|
mapClickCallback?: (mapPoint: number[], screenPoint: number[], event?: any) => void;
|
|
18
18
|
}): Promise<MapView | SceneView>;
|
|
19
|
-
setLayerVisibility(params: ILayerVisibleParams): IResult
|
|
19
|
+
setLayerVisibility(params: ILayerVisibleParams): Promise<IResult>;
|
|
20
20
|
/**
|
|
21
21
|
* 设置地图中心点
|
|
22
22
|
* @param params
|
|
@@ -53,4 +53,13 @@ export default class MapInitializer {
|
|
|
53
53
|
min?: number;
|
|
54
54
|
max?: number;
|
|
55
55
|
}): void;
|
|
56
|
+
/** 支队图层 */
|
|
57
|
+
private detachmentLayer;
|
|
58
|
+
private detachmentLayerLoaded;
|
|
59
|
+
/**
|
|
60
|
+
* 加载支队图层
|
|
61
|
+
* 现场环境用url创建FeatureLayer有各种问题,
|
|
62
|
+
* 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
|
|
63
|
+
*/
|
|
64
|
+
private loadDetachmentLayer;
|
|
56
65
|
}
|