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.
Files changed (33) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +3 -1
  2. package/es/src/gis-map/gis-map.vue.mjs +175 -173
  3. package/es/src/gis-map/index.d.ts +3 -1
  4. package/es/src/gis-map/utils/dbscan-cluster/index.d.ts +4 -2
  5. package/es/src/gis-map/utils/dbscan-cluster/index.mjs +89 -72
  6. package/es/src/gis-map/utils/map-initializer.d.ts +10 -1
  7. package/es/src/gis-map/utils/map-initializer.mjs +181 -111
  8. package/es/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +9 -0
  9. package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +145 -0
  10. package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +53 -37
  11. package/es/src/gis-map/utils/signal-control-area/show-area.d.ts +3 -8
  12. package/es/src/gis-map/utils/signal-control-area/show-area.mjs +63 -105
  13. package/es/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +1 -1
  14. package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +5 -5
  15. package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +84 -83
  16. package/es/src/types/index.d.ts +3 -3
  17. package/lib/src/gis-map/gis-map.vue.d.ts +3 -1
  18. package/lib/src/gis-map/gis-map.vue.js +1 -1
  19. package/lib/src/gis-map/index.d.ts +3 -1
  20. package/lib/src/gis-map/utils/dbscan-cluster/index.d.ts +4 -2
  21. package/lib/src/gis-map/utils/dbscan-cluster/index.js +1 -1
  22. package/lib/src/gis-map/utils/map-initializer.d.ts +10 -1
  23. package/lib/src/gis-map/utils/map-initializer.js +1 -1
  24. package/lib/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +9 -0
  25. package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -0
  26. package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -1
  27. package/lib/src/gis-map/utils/signal-control-area/show-area.d.ts +3 -8
  28. package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
  29. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +1 -1
  30. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -1
  31. package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
  32. package/lib/src/types/index.d.ts +3 -3
  33. package/package.json +1 -1
@@ -1,30 +1,30 @@
1
1
  import * as f from "@arcgis/core/core/reactiveUtils";
2
- import { Point as u } from "@arcgis/core/geometry";
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 M {
6
- constructor(e) {
7
- this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.zoomWatchHandle = null, this.locations = [], this.clusterMarkUrl = "", this.currentZoom = 0, this.view = e, this.currentZoom = e.zoom, this.clusterLayer = new b(), this.view.map.add(this.clusterLayer);
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((e) => {
14
- const s = this.view.toScreen(
15
- new u({ x: e.x, y: e.y })
13
+ this.locations.forEach((t) => {
14
+ const r = this.view.toScreen(
15
+ new h({ x: t.x, y: t.y })
16
16
  );
17
- e.properties.screenX = s.x, e.properties.screenY = s.y;
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(e) {
24
+ addClusterPoints(t) {
25
25
  var i;
26
- this.locations = e.points, this.clusterMarkUrl = ((i = e.clusterSymbol) == null ? void 0 : i.url) || "/GisViewerAssets/Images/cross/gis_xhj_blue.png", e.points.forEach((r) => {
27
- r.symbol || (r.symbol = e.pointSymbol || {
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 && (this.currentZoom = this.view.zoom, this.locationToScreen(), this.clusterLayer.removeAll(), this.addClusterPoints(e));
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(), console.time("cluster");
43
- const s = this.doPixelCluster(e.points, 120, 3);
44
- console.timeEnd("cluster"), this.showClusters(s);
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 e;
48
- (e = this.zoomWatchHandle) == null || e.remove(), this.zoomWatchHandle = null, this.clusterLayer.removeAll();
57
+ var t;
58
+ (t = this.zoomWatchHandle) == null || t.remove(), this.zoomWatchHandle = null, this.clusterLayer.removeAll();
49
59
  }
50
- showClusters(e) {
51
- let s = Number.MIN_VALUE, i = Number.MAX_VALUE;
52
- e.forEach((r) => {
53
- r.count > 1 && (i = Math.min(i, r.count), s = Math.max(s, r.count));
54
- }), e.forEach((r) => {
55
- if (r.id !== -1) {
56
- let t = i === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (r.count - i) / (s - i) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
57
- t *= 0.75;
58
- const o = new m({
59
- geometry: new u({ x: r.center.x, y: r.center.y }),
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: r.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: t,
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
- [-15, 40],
99
- [15, 40],
100
- [15, 20],
101
- [-15, 20],
102
- [-15, 40]
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: t,
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(o);
182
+ this.clusterLayer.add(c);
172
183
  } else
173
- r.items.forEach((t) => {
184
+ e.items.forEach((s) => {
174
185
  const o = new m({
175
- geometry: new u({ x: t.x, y: t.y }),
176
- attributes: t.properties,
177
- symbol: t.symbol
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(e, s, i) {
191
- const r = e[s];
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(e, s) {
215
+ getDistance(t, r) {
201
216
  return Math.sqrt(
202
- Math.pow(e.properties.screenX - s.properties.screenX, 2) + Math.pow(e.properties.screenY - s.properties.screenY, 2)
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(e) {
211
- const s = {}, i = [];
212
- for (let t = 0; t < e.length; t++) {
213
- const o = e[t];
214
- o.clusterId === void 0 || o.clusterId === -1 ? i.push(o) : (s[o.clusterId] || (s[o.clusterId] = []), s[o.clusterId].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 r = Object.keys(s).map((t, o) => {
217
- const l = s[Number(t)], n = l.length, h = l.reduce((c, a) => c + a.x, 0), y = l.reduce((c, a) => c + a.y, 0), p = h / n, d = y / n;
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(t),
220
- items: l,
221
- count: n,
234
+ id: Number(s),
235
+ items: n,
236
+ count: l,
222
237
  center: {
223
- x: p,
224
- y: d
238
+ x: d,
239
+ y: p
225
240
  }
226
241
  };
227
242
  });
228
- return i.length > 0 && r.push({
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
- }), r;
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(e, s, i) {
243
- let r = 0;
244
- e.forEach((t) => t.visited = !1);
245
- for (let t = 0; t < e.length; t++) {
246
- const o = e[t];
247
- if (o.visited)
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
- o.visited = !0;
250
- const l = this.getNeighbors(e, t, s);
251
- l.length < i ? o.clusterId = -1 : (l.forEach((n) => {
252
- n.visited = !0, n.clusterId = r;
253
- }), o.clusterId = r, r++);
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(e);
272
+ return this.createClusters(this.locations);
256
273
  }
257
274
  }
258
275
  export {
259
- M as default
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
  }