gisviewer-vue3-arcgis 1.0.253 → 1.0.254

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.
@@ -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.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) => {
13
+ this.locations.forEach((t) => {
14
14
  const s = this.view.toScreen(
15
- new u({ x: e.x, y: e.y })
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 = s.x, t.properties.screenY = s.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,33 @@ 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(120, 3);
43
+ console.timeEnd("cluster"), this.showClusters(e);
44
+ }
41
45
  }
42
- )), this.locationToScreen(), console.time("cluster");
43
- const s = this.doPixelCluster(e.points, 120, 3);
44
- console.timeEnd("cluster"), this.showClusters(s);
46
+ )), this.locationToScreen();
47
+ const s = this.doPixelCluster(120, 3);
48
+ this.showClusters(s);
45
49
  }
46
50
  removeAllClusterPoints() {
47
- var e;
48
- (e = this.zoomWatchHandle) == null || e.remove(), this.zoomWatchHandle = null, this.clusterLayer.removeAll();
51
+ var t;
52
+ (t = this.zoomWatchHandle) == null || t.remove(), this.zoomWatchHandle = null, this.clusterLayer.removeAll();
49
53
  }
50
- showClusters(e) {
54
+ showClusters(t) {
55
+ this.clusterLayer.removeAll();
51
56
  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 }),
57
+ t.forEach((e) => {
58
+ e.count > 1 && (i = Math.min(i, e.count), s = Math.max(s, e.count));
59
+ }), t.forEach((e) => {
60
+ if (e.id !== -1) {
61
+ let r = i === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (e.count - i) / (s - i) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
62
+ r *= 0.75;
63
+ const l = (e.count.toString().length * 8 + 6) / 2, c = new m({
64
+ geometry: new h({ x: e.center.x, y: e.center.y }),
60
65
  attributes: {
61
- count: r.count
66
+ count: e.count
62
67
  },
63
68
  symbol: {
64
69
  type: "cim",
@@ -84,7 +89,7 @@ class M {
84
89
  // 聚合数量
85
90
  {
86
91
  type: "CIMVectorMarker",
87
- size: t,
92
+ size: r,
88
93
  colorLocked: !0,
89
94
  anchorPointUnits: "Relative",
90
95
  frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
@@ -95,11 +100,11 @@ class M {
95
100
  geometry: {
96
101
  rings: [
97
102
  [
98
- [-15, 40],
99
- [15, 40],
100
- [15, 20],
101
- [-15, 20],
102
- [-15, 40]
103
+ [-l, 40],
104
+ [l, 40],
105
+ [l, 20],
106
+ [-l, 20],
107
+ [-l, 40]
103
108
  ]
104
109
  ]
105
110
  },
@@ -158,7 +163,7 @@ class M {
158
163
  y: 0
159
164
  },
160
165
  anchorPointUnits: "Relative",
161
- size: t,
166
+ size: r,
162
167
  rotateClockwise: !0,
163
168
  textureFilter: "Picture",
164
169
  url: this.clusterMarkUrl
@@ -168,13 +173,17 @@ class M {
168
173
  }
169
174
  }
170
175
  });
171
- this.clusterLayer.add(o);
176
+ this.clusterLayer.add(c);
172
177
  } else
173
- r.items.forEach((t) => {
178
+ e.items.forEach((r) => {
174
179
  const o = new m({
175
- geometry: new u({ x: t.x, y: t.y }),
176
- attributes: t.properties,
177
- symbol: t.symbol
180
+ geometry: new h({ x: r.x, y: r.y }),
181
+ attributes: {
182
+ ...r.properties,
183
+ type: "clusterPoint",
184
+ id: r.id
185
+ },
186
+ symbol: r.symbol
178
187
  });
179
188
  this.clusterLayer.add(o);
180
189
  });
@@ -187,9 +196,9 @@ class M {
187
196
  * @param eps
188
197
  * @returns
189
198
  */
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);
199
+ getNeighbors(t, s, i) {
200
+ const e = t[s];
201
+ return t.filter((r) => r.id === e.id || r.visited ? !1 : this.getDistance(e, r) <= i);
193
202
  }
194
203
  /**
195
204
  * 两点间的像素距离
@@ -197,9 +206,9 @@ class M {
197
206
  * @param point2
198
207
  * @returns
199
208
  */
200
- getDistance(e, s) {
209
+ getDistance(t, s) {
201
210
  return Math.sqrt(
202
- Math.pow(e.properties.screenX - s.properties.screenX, 2) + Math.pow(e.properties.screenY - s.properties.screenY, 2)
211
+ Math.pow(t.properties.screenX - s.properties.screenX, 2) + Math.pow(t.properties.screenY - s.properties.screenY, 2)
203
212
  );
204
213
  }
205
214
  /**
@@ -207,30 +216,30 @@ class M {
207
216
  * @param locations
208
217
  * @returns
209
218
  */
210
- createClusters(e) {
219
+ createClusters(t) {
211
220
  const s = {}, i = [];
212
- for (let t = 0; t < e.length; t++) {
213
- const o = e[t];
221
+ for (let r = 0; r < t.length; r++) {
222
+ const o = t[r];
214
223
  o.clusterId === void 0 || o.clusterId === -1 ? i.push(o) : (s[o.clusterId] || (s[o.clusterId] = []), s[o.clusterId].push(o));
215
224
  }
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;
225
+ const e = Object.keys(s).map((r, o) => {
226
+ const n = s[Number(r)], 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
227
  return {
219
- id: Number(t),
220
- items: l,
221
- count: n,
228
+ id: Number(r),
229
+ items: n,
230
+ count: l,
222
231
  center: {
223
- x: p,
224
- y: d
232
+ x: d,
233
+ y: p
225
234
  }
226
235
  };
227
236
  });
228
- return i.length > 0 && r.push({
237
+ return i.length > 0 && e.push({
229
238
  id: -1,
230
239
  items: i,
231
240
  count: i.length,
232
241
  center: null
233
- }), r;
242
+ }), e;
234
243
  }
235
244
  /**
236
245
  * 按照像素距离聚类
@@ -239,22 +248,24 @@ class M {
239
248
  * @param minPoints
240
249
  * @returns
241
250
  */
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)
251
+ doPixelCluster(t, s) {
252
+ let i = 0;
253
+ this.locations.forEach((e) => {
254
+ e.visited = !1, e.clusterId = void 0;
255
+ });
256
+ for (let e = 0; e < this.locations.length; e++) {
257
+ const r = this.locations[e];
258
+ if (r.visited)
248
259
  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++);
260
+ r.visited = !0;
261
+ const o = this.getNeighbors(this.locations, e, t);
262
+ o.length < s ? r.clusterId = -1 : (o.forEach((n) => {
263
+ n.visited = !0, n.clusterId = i;
264
+ }), r.clusterId = i, i++);
254
265
  }
255
- return this.createClusters(e);
266
+ return this.createClusters(this.locations);
256
267
  }
257
268
  }
258
269
  export {
259
- M as default
270
+ I as default
260
271
  };
@@ -1,4 +1,4 @@
1
- import h from "pako";
1
+ import d from "pako";
2
2
  import c from "../common-utils.mjs";
3
3
  class e {
4
4
  constructor(o, s) {
@@ -10,15 +10,15 @@ class e {
10
10
  try {
11
11
  const a = t.mapConnectList, n = new Uint8Array(
12
12
  window.atob(a).split("").map((r) => r.charCodeAt(0))
13
- ), l = h.inflate(n, { to: "string" }), d = JSON.parse(l);
13
+ ), l = d.inflate(n, { to: "string" }), h = JSON.parse(l);
14
14
  i.roadConnections.push(
15
- ...d.map((r) => ({
15
+ ...h.map((r) => ({
16
16
  id: r.roadsectId,
17
17
  coordinates: JSON.parse(r.geomData).coordinates,
18
18
  districtId: i.parentId,
19
19
  subDistrictId: i.id
20
20
  }))
21
- ), console.log(i.roadConnections);
21
+ );
22
22
  } catch (a) {
23
23
  console.error("解压子区路段连接信息失败:", a);
24
24
  }
@@ -146,8 +146,8 @@ export interface IOverlayParam {
146
146
  }
147
147
  export interface IClusterPointParams {
148
148
  type?: string;
149
- clusterSymbol?: IPointSymbol;
150
- pointSymbol?: IPointSymbol;
149
+ clusterSymbol?: any;
150
+ pointSymbol?: any;
151
151
  points: IClusterLocation[];
152
152
  }
153
153
  export interface IClusterLocation {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),h=require("@arcgis/core/Graphic"),S=require("@arcgis/core/layers/GraphicsLayer");function C(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const g=C(b);class x{constructor(e){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 S,this.view.map.add(this.clusterLayer)}locationToScreen(){this.locations.forEach(e=>{const t=this.view.toScreen(new m.Point({x:e.x,y:e.y}));e.properties.screenX=t.x,e.properties.screenY=t.y})}addClusterPoints(e){var o;this.locations=e.points,this.clusterMarkUrl=((o=e.clusterSymbol)==null?void 0:o.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",e.points.forEach(s=>{s.symbol||(s.symbol=e.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=g.watch(()=>this.view.zoom,()=>{Math.abs(this.currentZoom-this.view.zoom)>=1&&(this.currentZoom=this.view.zoom,this.locationToScreen(),this.clusterLayer.removeAll(),this.addClusterPoints(e))})),this.locationToScreen(),console.time("cluster");const t=this.doPixelCluster(e.points,120,3);console.timeEnd("cluster"),this.showClusters(t)}removeAllClusterPoints(){var e;(e=this.zoomWatchHandle)==null||e.remove(),this.zoomWatchHandle=null,this.clusterLayer.removeAll()}showClusters(e){let t=Number.MIN_VALUE,o=Number.MAX_VALUE;e.forEach(s=>{s.count>1&&(o=Math.min(o,s.count),t=Math.max(t,s.count))}),e.forEach(s=>{if(s.id!==-1){let r=o===t?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(s.count-o)/(t-o)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const i=new h({geometry:new m.Point({x:s.center.x,y:s.center.y}),attributes:{count:s.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:r,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-15,40],[15,40],[15,20],[-15,20],[-15,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r,rotateClockwise:!0,textureFilter:"Picture",url:this.clusterMarkUrl}]}}}});this.clusterLayer.add(i)}else s.items.forEach(r=>{const i=new h({geometry:new m.Point({x:r.x,y:r.y}),attributes:r.properties,symbol:r.symbol});this.clusterLayer.add(i)})})}getNeighbors(e,t,o){const s=e[t];return e.filter(r=>r.id===s.id||r.visited?!1:this.getDistance(s,r)<=o)}getDistance(e,t){return Math.sqrt(Math.pow(e.properties.screenX-t.properties.screenX,2)+Math.pow(e.properties.screenY-t.properties.screenY,2))}createClusters(e){const t={},o=[];for(let r=0;r<e.length;r++){const i=e[r];i.clusterId===void 0||i.clusterId===-1?o.push(i):(t[i.clusterId]||(t[i.clusterId]=[]),t[i.clusterId].push(i))}const s=Object.keys(t).map((r,i)=>{const l=t[Number(r)],c=l.length,y=l.reduce((u,a)=>u+a.x,0),d=l.reduce((u,a)=>u+a.y,0),p=y/c,f=d/c;return{id:Number(r),items:l,count:c,center:{x:p,y:f}}});return o.length>0&&s.push({id:-1,items:o,count:o.length,center:null}),s}doPixelCluster(e,t,o){let s=0;e.forEach(r=>r.visited=!1);for(let r=0;r<e.length;r++){const i=e[r];if(i.visited)continue;i.visited=!0;const l=this.getNeighbors(e,r,t);l.length<o?i.clusterId=-1:(l.forEach(c=>{c.visited=!0,c.clusterId=s}),i.clusterId=s,s++)}return this.createClusters(e)}}exports.default=x;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),g=require("@arcgis/core/layers/GraphicsLayer");function x(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const r in c)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(c,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>c[r]})}}return t.default=c,Object.freeze(t)}const S=x(b);class C{constructor(t){this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.zoomWatchHandle=null,this.locations=[],this.clusterMarkUrl="",this.currentZoom=0,this.view=t,this.currentZoom=t.zoom,this.clusterLayer=new g,this.view.map.add(this.clusterLayer)}locationToScreen(){this.locations.forEach(t=>{const r=this.view.toScreen(new m.Point({x:t.x,y:t.y}));t.properties.screenX=r.x,t.properties.screenY=r.y})}addClusterPoints(t){var i;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=>{e.x=Number(e.x),e.y=Number(e.y),e.symbol||(e.symbol=t.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=S.watch(()=>this.view.zoom,()=>{if(Math.abs(this.currentZoom-this.view.zoom)>=1){this.currentZoom=this.view.zoom,this.locationToScreen(),console.time("cluster");const e=this.doPixelCluster(120,3);console.timeEnd("cluster"),this.showClusters(e)}})),this.locationToScreen();const r=this.doPixelCluster(120,3);this.showClusters(r)}removeAllClusterPoints(){var t;(t=this.zoomWatchHandle)==null||t.remove(),this.zoomWatchHandle=null,this.clusterLayer.removeAll()}showClusters(t){this.clusterLayer.removeAll();let r=Number.MIN_VALUE,i=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(i=Math.min(i,e.count),r=Math.max(r,e.count))}),t.forEach(e=>{if(e.id!==-1){let s=i===r?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-i)/(r-i)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);s*=.75;const l=(e.count.toString().length*8+6)/2,a=new y({geometry:new m.Point({x:e.center.x,y:e.center.y}),attributes:{count:e.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:s,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-l,40],[l,40],[l,20],[-l,20],[-l,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:s,rotateClockwise:!0,textureFilter:"Picture",url:this.clusterMarkUrl}]}}}});this.clusterLayer.add(a)}else e.items.forEach(s=>{const o=new y({geometry:new m.Point({x:s.x,y:s.y}),attributes:{...s.properties,type:"clusterPoint",id:s.id},symbol:s.symbol});this.clusterLayer.add(o)})})}getNeighbors(t,r,i){const e=t[r];return t.filter(s=>s.id===e.id||s.visited?!1:this.getDistance(e,s)<=i)}getDistance(t,r){return Math.sqrt(Math.pow(t.properties.screenX-r.properties.screenX,2)+Math.pow(t.properties.screenY-r.properties.screenY,2))}createClusters(t){const r={},i=[];for(let s=0;s<t.length;s++){const o=t[s];o.clusterId===void 0||o.clusterId===-1?i.push(o):(r[o.clusterId]||(r[o.clusterId]=[]),r[o.clusterId].push(o))}const e=Object.keys(r).map((s,o)=>{const n=r[Number(s)],l=n.length,a=n.reduce((u,h)=>u+h.x,0),d=n.reduce((u,h)=>u+h.y,0),f=a/l,p=d/l;return{id:Number(s),items:n,count:l,center:{x:f,y:p}}});return i.length>0&&e.push({id:-1,items:i,count:i.length,center:null}),e}doPixelCluster(t,r){let i=0;this.locations.forEach(e=>{e.visited=!1,e.clusterId=void 0});for(let e=0;e<this.locations.length;e++){const s=this.locations[e];if(s.visited)continue;s.visited=!0;const o=this.getNeighbors(this.locations,e,t);o.length<r?s.clusterId=-1:(o.forEach(n=>{n.visited=!0,n.clusterId=i}),s.clusterId=i,i++)}return this.createClusters(this.locations)}}exports.default=C;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("pako"),c=require("../common-utils.js");class r{constructor(o,s){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]);for(const t of o.children)if(t.children){const i=new r(t,s);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)try{const a=t.mapConnectList,n=new Uint8Array(window.atob(a).split("").map(e=>e.charCodeAt(0))),l=h.inflate(n,{to:"string"}),d=JSON.parse(l);i.roadConnections.push(...d.map(e=>({id:e.roadsectId,coordinates:JSON.parse(e.geomData).coordinates,districtId:i.parentId,subDistrictId:i.id}))),console.log(i.roadConnections)}catch(a){console.error("解压子区路段连接信息失败:",a)}}else if(c.default.isCoordinateValid(t)){const i={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.nodeId,isKey:t.isKey===1};this.signals.push(i),this.signalCount++}}getAllSignalCoordinates(){const o=[];for(const s of this.signals)o.push([s.longitude,s.latitude]);for(const s of this.subDistricts)o.push(...s.getAllSignalCoordinates());return o}getDarkNonGrayColor(o){let s,t,i;if(o){const a=this.cyrb53(o);s=((a&16711680)>>16)%200,t=((a&65280)>>8)%200,i=(a&255)%200}else s=Math.floor(Math.random()*256),t=Math.floor(Math.random()*256),i=Math.floor(Math.random()*256);return[s,t,i]}cyrb53(o,s=0){let t=3735928559^s,i=1103547991^s;for(let a=0,n;a<o.length;a++)n=o.charCodeAt(a),t=Math.imul(t^n,2654435761),i=Math.imul(i^n,1597334677);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)}}exports.default=r;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("pako"),c=require("../common-utils.js");class r{constructor(s,o){this.parentName="",this.signals=[],this.subDistricts=[],this.areaColor=this.getDarkNonGrayColor(),this.signalCount=0,this.subDistrictCount=0,this.roadConnections=[],this.id=s.name,this.name=s.areaDesc,this.parentId=s.parentId,o==="alarm"&&(this.areaColor=[255,0,0]);for(const t of s.children)if(t.children){const i=new r(t,o);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)try{const a=t.mapConnectList,e=new Uint8Array(window.atob(a).split("").map(n=>n.charCodeAt(0))),l=h.inflate(e,{to:"string"}),d=JSON.parse(l);i.roadConnections.push(...d.map(n=>({id:n.roadsectId,coordinates:JSON.parse(n.geomData).coordinates,districtId:i.parentId,subDistrictId:i.id})))}catch(a){console.error("解压子区路段连接信息失败:",a)}}else if(c.default.isCoordinateValid(t)){const i={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.nodeId,isKey:t.isKey===1};this.signals.push(i),this.signalCount++}}getAllSignalCoordinates(){const s=[];for(const o of this.signals)s.push([o.longitude,o.latitude]);for(const o of this.subDistricts)s.push(...o.getAllSignalCoordinates());return s}getDarkNonGrayColor(s){let o,t,i;if(s){const a=this.cyrb53(s);o=((a&16711680)>>16)%200,t=((a&65280)>>8)%200,i=(a&255)%200}else o=Math.floor(Math.random()*256),t=Math.floor(Math.random()*256),i=Math.floor(Math.random()*256);return[o,t,i]}cyrb53(s,o=0){let t=3735928559^o,i=1103547991^o;for(let a=0,e;a<s.length;a++)e=s.charCodeAt(a),t=Math.imul(t^e,2654435761),i=Math.imul(i^e,1597334677);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)}}exports.default=r;
@@ -146,8 +146,8 @@ export interface IOverlayParam {
146
146
  }
147
147
  export interface IClusterPointParams {
148
148
  type?: string;
149
- clusterSymbol?: IPointSymbol;
150
- pointSymbol?: IPointSymbol;
149
+ clusterSymbol?: any;
150
+ pointSymbol?: any;
151
151
  points: IClusterLocation[];
152
152
  }
153
153
  export interface IClusterLocation {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.253",
3
+ "version": "1.0.254",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [