gisviewer-vue3-arcgis 1.0.272 → 1.0.273

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.
@@ -2,21 +2,21 @@ import { Point as u } from "@arcgis/core/geometry";
2
2
  import y from "@arcgis/core/Graphic";
3
3
  import p from "@arcgis/core/layers/GraphicsLayer";
4
4
  class C {
5
- constructor(e) {
6
- this.iconSymbolScale = 1e4, this.largeMarkerScale = 4e4, this.oldScale = 0, this.showName = "detail", this.showStyle = "scatter", this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusteredLocations = [], this.locations = [], this.view = e, this.crossLayer = new p({
5
+ constructor(t) {
6
+ this.iconSymbolScale = 1e4, this.largeMarkerScale = 4e4, this.oldScale = 0, this.showName = "detail", this.showStyle = "scatter", this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusteredLocations = [], this.locations = [], this.view = t, this.crossLayer = new p({
7
7
  id: "signal-control-cross-layer",
8
8
  title: "信控路口图层"
9
9
  }), this.view.map.add(this.crossLayer);
10
10
  }
11
- didCrossScaleThreshold(e, s, t) {
12
- return e < t && s >= t || e >= t && s < t;
11
+ didCrossScaleThreshold(t, s, i) {
12
+ return t < i && s >= i || t >= i && s < i;
13
13
  }
14
14
  locationToScreen() {
15
- this.clusteredLocations = [], this.locations.forEach((e) => {
15
+ this.clusteredLocations = [], this.locations.forEach((t) => {
16
16
  const s = this.view.toScreen(
17
- new u({ x: e.x, y: e.y })
17
+ new u({ x: t.x, y: t.y })
18
18
  );
19
- s.x > 0 && s.y > 0 && (e.properties.screenX = s.x, e.properties.screenY = s.y, e.visited = !1, e.clusterId = void 0, this.clusteredLocations.push(e));
19
+ s.x > 0 && s.y > 0 && (t.properties.screenX = s.x, t.properties.screenY = s.y, t.visited = !1, t.clusterId = void 0, this.clusteredLocations.push(t));
20
20
  });
21
21
  }
22
22
  /**
@@ -24,55 +24,55 @@ class C {
24
24
  * @param params
25
25
  * @returns
26
26
  */
27
- showSignalCross(e) {
28
- if (this.crossLayer.removeAll(), this.showName = e.showName || "detail", this.showStyle = e.style || "scatter", this.oldScale = this.view.scale, this.scaleWatchHandle || (this.scaleWatchHandle = this.view.watch("stationary", () => {
27
+ showSignalCross(t) {
28
+ if (this.crossLayer.removeAll(), this.showName = t.showName || "detail", this.showStyle = t.style || "scatter", this.oldScale = this.view.scale, this.scaleWatchHandle || (this.scaleWatchHandle = this.view.watch("stationary", () => {
29
29
  if (this.showStyle === "scatter") {
30
- const s = this.view.scale, t = this.didCrossScaleThreshold(
30
+ const s = this.view.scale, i = this.didCrossScaleThreshold(
31
31
  this.oldScale,
32
32
  s,
33
33
  this.iconSymbolScale
34
- ), i = this.didCrossScaleThreshold(
34
+ ), e = this.didCrossScaleThreshold(
35
35
  this.oldScale,
36
36
  s,
37
37
  this.largeMarkerScale
38
38
  );
39
- (t || i) && this.updateScatterSymbol(), this.oldScale = s;
39
+ (i || e) && this.updateScatterSymbol(), this.oldScale = s;
40
40
  } else {
41
41
  this.locationToScreen();
42
42
  const s = this.doPixelCluster(this.clusterRadius);
43
43
  this.showClusterResult(s);
44
44
  }
45
45
  })), this.showStyle === "scatter") {
46
- const s = e.points.map((t) => {
47
- const i = this.getCrossSymbol(t), r = this.getBrandLabel(t.brand), o = this.getOnlineLabel(t.isOnline), a = this.getMalfunctionLabel(
48
- t.isMalfunction
49
- );
50
- return new y({
46
+ const s = [], i = [];
47
+ t.points.forEach((e) => {
48
+ const r = this.getCrossSymbol(e), o = this.getBrandLabel(e.brand), a = this.getOnlineLabel(e.isOnline), l = this.getMalfunctionLabel(
49
+ e.isMalfunction
50
+ ), n = new y({
51
51
  geometry: {
52
52
  type: "point",
53
- longitude: t.x,
54
- latitude: t.y
53
+ longitude: e.x,
54
+ latitude: e.y
55
55
  },
56
- symbol: i,
56
+ symbol: r,
57
57
  attributes: {
58
58
  type: "signal-cross",
59
- id: t.crossId,
60
- brandLabel: r,
61
- isOnlineLabel: o,
62
- isMalfunctionLabel: a,
63
- ...t
59
+ id: e.crossId,
60
+ brandLabel: o,
61
+ isOnlineLabel: a,
62
+ isMalfunctionLabel: l,
63
+ ...e
64
64
  }
65
65
  });
66
- });
67
- this.crossLayer.addMany(s);
66
+ e.isMalfunction === !0 || e.isOnline === !1 ? i.push(n) : s.push(n);
67
+ }), this.crossLayer.addMany(s), this.crossLayer.addMany(i);
68
68
  } else {
69
- this.locations = e.points.map((t) => ({
70
- id: t.crossId,
71
- x: t.x,
72
- y: t.y,
69
+ this.locations = t.points.map((i) => ({
70
+ id: i.crossId,
71
+ x: i.x,
72
+ y: i.y,
73
73
  visited: !1,
74
74
  clusterId: void 0,
75
- properties: t
75
+ properties: i
76
76
  })), this.locationToScreen();
77
77
  const s = this.doPixelCluster(this.clusterRadius);
78
78
  this.showClusterResult(s);
@@ -80,22 +80,22 @@ class C {
80
80
  return { status: 0, message: "ok" };
81
81
  }
82
82
  clearSignalCross() {
83
- var e;
84
- this.crossLayer.removeAll(), (e = this.scaleWatchHandle) == null || e.remove(), this.scaleWatchHandle = null;
83
+ var t;
84
+ this.crossLayer.removeAll(), (t = this.scaleWatchHandle) == null || t.remove(), this.scaleWatchHandle = null;
85
85
  }
86
86
  /**
87
87
  * 更改路口显示名称内容
88
88
  * @param showName
89
89
  */
90
- changeShowName(e) {
91
- this.showName = e, this.showStyle === "scatter" && this.updateScatterSymbol();
90
+ changeShowName(t) {
91
+ this.showName = t, this.showStyle === "scatter" && this.updateScatterSymbol();
92
92
  }
93
93
  /**
94
94
  * 更新散点符号
95
95
  */
96
96
  updateScatterSymbol() {
97
- this.crossLayer.graphics.forEach((e) => {
98
- e.symbol = this.getCrossSymbol(e.attributes);
97
+ this.crossLayer.graphics.forEach((t) => {
98
+ t.symbol = this.getCrossSymbol(t.attributes);
99
99
  });
100
100
  }
101
101
  /**
@@ -105,17 +105,17 @@ class C {
105
105
  * @param minPoints
106
106
  * @returns
107
107
  */
108
- doPixelCluster(e) {
108
+ doPixelCluster(t) {
109
109
  let s = 0;
110
- for (let t = 0; t < this.clusteredLocations.length; t++) {
111
- const i = this.clusteredLocations[t];
112
- if (i.visited)
110
+ for (let i = 0; i < this.clusteredLocations.length; i++) {
111
+ const e = this.clusteredLocations[i];
112
+ if (e.visited)
113
113
  continue;
114
- i.visited = !0;
115
- const r = this.getNeighbors(i, e);
116
- r.length < this.minClusterPoints ? i.clusterId = -1 : (r.forEach((o) => {
114
+ e.visited = !0;
115
+ const r = this.getNeighbors(e, t);
116
+ r.length < this.minClusterPoints ? e.clusterId = -1 : (r.forEach((o) => {
117
117
  o.visited = !0, o.clusterId = s;
118
- }), i.clusterId = s, s++);
118
+ }), e.clusterId = s, s++);
119
119
  }
120
120
  return this.createClusters();
121
121
  }
@@ -126,8 +126,8 @@ class C {
126
126
  * @param eps
127
127
  * @returns
128
128
  */
129
- getNeighbors(e, s) {
130
- return this.clusteredLocations.filter((t) => t.id === e.id || t.visited ? !1 : this.getDistance(e, t) <= s);
129
+ getNeighbors(t, s) {
130
+ return this.clusteredLocations.filter((i) => i.id === t.id || i.visited ? !1 : this.getDistance(t, i) <= s);
131
131
  }
132
132
  /**
133
133
  * 两点间的像素距离
@@ -135,9 +135,9 @@ class C {
135
135
  * @param point2
136
136
  * @returns
137
137
  */
138
- getDistance(e, s) {
138
+ getDistance(t, s) {
139
139
  return Math.sqrt(
140
- Math.pow(e.properties.screenX - s.properties.screenX, 2) + Math.pow(e.properties.screenY - s.properties.screenY, 2)
140
+ Math.pow(t.properties.screenX - s.properties.screenX, 2) + Math.pow(t.properties.screenY - s.properties.screenY, 2)
141
141
  );
142
142
  }
143
143
  /**
@@ -146,13 +146,13 @@ class C {
146
146
  * @returns
147
147
  */
148
148
  createClusters() {
149
- const e = {}, s = [];
150
- for (const i of this.clusteredLocations)
151
- i.clusterId === void 0 || i.clusterId === -1 ? s.push(i) : (e[i.clusterId] || (e[i.clusterId] = []), e[i.clusterId].push(i));
152
- const t = Object.keys(e).map((i, r) => {
153
- const o = e[Number(i)], a = o.length, l = o.reduce((c, h) => c + h.x, 0), n = o.reduce((c, h) => c + h.y, 0), m = l / a, d = n / a;
149
+ const t = {}, s = [];
150
+ for (const e of this.clusteredLocations)
151
+ e.clusterId === void 0 || e.clusterId === -1 ? s.push(e) : (t[e.clusterId] || (t[e.clusterId] = []), t[e.clusterId].push(e));
152
+ const i = Object.keys(t).map((e, r) => {
153
+ const o = t[Number(e)], a = o.length, l = o.reduce((c, h) => c + h.x, 0), n = o.reduce((c, h) => c + h.y, 0), m = l / a, d = n / a;
154
154
  return {
155
- id: Number(i),
155
+ id: Number(e),
156
156
  items: o,
157
157
  count: a,
158
158
  center: {
@@ -161,26 +161,26 @@ class C {
161
161
  }
162
162
  };
163
163
  });
164
- return s.length > 0 && t.push({
164
+ return s.length > 0 && i.push({
165
165
  id: -1,
166
166
  items: s,
167
167
  count: s.length,
168
168
  center: null
169
- }), t;
169
+ }), i;
170
170
  }
171
- showClusterResult(e) {
171
+ showClusterResult(t) {
172
172
  this.crossLayer.removeAll();
173
- let s = Number.MIN_VALUE, t = Number.MAX_VALUE;
174
- e.forEach((i) => {
175
- i.count > 1 && (t = Math.min(t, i.count), s = Math.max(s, i.count));
176
- }), e.forEach((i) => {
177
- if (i.id !== -1) {
178
- let r = t === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (i.count - t) / (s - t) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
173
+ let s = Number.MIN_VALUE, i = Number.MAX_VALUE;
174
+ t.forEach((e) => {
175
+ e.count > 1 && (i = Math.min(i, e.count), s = Math.max(s, e.count));
176
+ }), t.forEach((e) => {
177
+ if (e.id !== -1) {
178
+ let r = i === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (e.count - i) / (s - i) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
179
179
  r *= 0.75;
180
- const l = (i.count.toString().length * 8 + 6) / 2, n = new y({
181
- geometry: new u({ x: i.center.x, y: i.center.y }),
180
+ const l = (e.count.toString().length * 8 + 6) / 2, n = new y({
181
+ geometry: new u({ x: e.center.x, y: e.center.y }),
182
182
  attributes: {
183
- count: i.count
183
+ count: e.count
184
184
  },
185
185
  symbol: {
186
186
  type: "cim",
@@ -292,7 +292,7 @@ class C {
292
292
  });
293
293
  this.crossLayer.add(n);
294
294
  } else
295
- i.items.forEach((r) => {
295
+ e.items.forEach((r) => {
296
296
  const o = new y({
297
297
  geometry: new u({ x: r.x, y: r.y }),
298
298
  attributes: {
@@ -307,21 +307,21 @@ class C {
307
307
  });
308
308
  });
309
309
  }
310
- getBrandLabel(e) {
311
- const s = (e ?? "").toLowerCase();
312
- return s === "scats" ? "SCATS" : s === "gc" ? "国产" : e ?? "";
310
+ getBrandLabel(t) {
311
+ const s = (t ?? "").toLowerCase();
312
+ return s === "scats" ? "SCATS" : s === "gc" ? "国产" : t ?? "";
313
313
  }
314
- getOnlineLabel(e) {
315
- return e ? "在线" : "离线";
314
+ getOnlineLabel(t) {
315
+ return t ? "在线" : "离线";
316
316
  }
317
- getMalfunctionLabel(e) {
318
- return e ? "故障" : "正常";
317
+ getMalfunctionLabel(t) {
318
+ return t ? "故障" : "正常";
319
319
  }
320
- getCrossSymbol(e) {
321
- var s;
320
+ getCrossSymbol(t) {
321
+ var s, i;
322
322
  if (this.view.scale <= this.iconSymbolScale) {
323
- let t = "/GisViewerAssets/Images/cross/ic_";
324
- return t += e.brand === "scats" ? "scats_" : "gc_", t += e.isOnline ? "online_" : "offline_", t += e.isMalfunction ? "malfunction.png" : "normal.png", {
323
+ let e = "/GisViewerAssets/Images/cross/ic_";
324
+ return e += ((s = t.brand) == null ? void 0 : s.toLowerCase()) === "scats" ? "scats_" : "gc_", e += t.isOnline ? "online_" : "offline_", e += t.isMalfunction ? "malfunction.png" : "normal.png", {
325
325
  type: "cim",
326
326
  data: {
327
327
  type: "CIMSymbolReference",
@@ -401,20 +401,20 @@ class C {
401
401
  size: 20,
402
402
  rotateClockwise: !0,
403
403
  textureFilter: "Picture",
404
- url: t
404
+ url: e
405
405
  }
406
406
  ]
407
407
  }
408
408
  }
409
409
  };
410
410
  } else {
411
- const t = {
411
+ const e = {
412
412
  type: "simple-marker",
413
413
  style: "circle",
414
414
  size: this.view.scale > this.largeMarkerScale ? 3 : 6,
415
415
  outline: { width: 1 }
416
416
  };
417
- return ((s = e.brand) == null ? void 0 : s.toLowerCase()) === "scats" ? (e.isOnline ? t.color = [68, 203, 188] : t.color = [200, 200, 200], t.outline.color = [32, 97, 90]) : (e.isOnline ? t.color = [129, 226, 73] : t.color = [200, 200, 200], t.outline.color = [65, 115, 37]), t;
417
+ return ((i = t.brand) == null ? void 0 : i.toLowerCase()) === "scats" ? t.isOnline ? (e.color = [68, 203, 188], e.outline.color = [59, 176, 163]) : (e.color = [100, 100, 100], e.outline.color = [150, 150, 150]) : t.isOnline ? (e.color = [129, 226, 73], e.outline.color = [108, 189, 61]) : (e.color = [100, 100, 100], e.outline.color = [150, 150, 150]), e;
418
418
  }
419
419
  }
420
420
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class S{constructor(e){this.iconSymbolScale=1e4,this.largeMarkerScale=4e4,this.oldScale=0,this.showName="detail",this.showStyle="scatter",this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusteredLocations=[],this.locations=[],this.view=e,this.crossLayer=new p({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}didCrossScaleThreshold(e,s,t){return e<t&&s>=t||e>=t&&s<t}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(e=>{const s=this.view.toScreen(new u.Point({x:e.x,y:e.y}));s.x>0&&s.y>0&&(e.properties.screenX=s.x,e.properties.screenY=s.y,e.visited=!1,e.clusterId=void 0,this.clusteredLocations.push(e))})}showSignalCross(e){if(this.crossLayer.removeAll(),this.showName=e.showName||"detail",this.showStyle=e.style||"scatter",this.oldScale=this.view.scale,this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("stationary",()=>{if(this.showStyle==="scatter"){const s=this.view.scale,t=this.didCrossScaleThreshold(this.oldScale,s,this.iconSymbolScale),i=this.didCrossScaleThreshold(this.oldScale,s,this.largeMarkerScale);(t||i)&&this.updateScatterSymbol(),this.oldScale=s}else{this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}})),this.showStyle==="scatter"){const s=e.points.map(t=>{const i=this.getCrossSymbol(t),r=this.getBrandLabel(t.brand),o=this.getOnlineLabel(t.isOnline),n=this.getMalfunctionLabel(t.isMalfunction);return new y({geometry:{type:"point",longitude:t.x,latitude:t.y},symbol:i,attributes:{type:"signal-cross",id:t.crossId,brandLabel:r,isOnlineLabel:o,isMalfunctionLabel:n,...t}})});this.crossLayer.addMany(s)}else{this.locations=e.points.map(t=>({id:t.crossId,x:t.x,y:t.y,visited:!1,clusterId:void 0,properties:t})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}return{status:0,message:"ok"}}clearSignalCross(){var e;this.crossLayer.removeAll(),(e=this.scaleWatchHandle)==null||e.remove(),this.scaleWatchHandle=null}changeShowName(e){this.showName=e,this.showStyle==="scatter"&&this.updateScatterSymbol()}updateScatterSymbol(){this.crossLayer.graphics.forEach(e=>{e.symbol=this.getCrossSymbol(e.attributes)})}doPixelCluster(e){let s=0;for(let t=0;t<this.clusteredLocations.length;t++){const i=this.clusteredLocations[t];if(i.visited)continue;i.visited=!0;const r=this.getNeighbors(i,e);r.length<this.minClusterPoints?i.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=s}),i.clusterId=s,s++)}return this.createClusters()}getNeighbors(e,s){return this.clusteredLocations.filter(t=>t.id===e.id||t.visited?!1:this.getDistance(e,t)<=s)}getDistance(e,s){return Math.sqrt(Math.pow(e.properties.screenX-s.properties.screenX,2)+Math.pow(e.properties.screenY-s.properties.screenY,2))}createClusters(){const e={},s=[];for(const i of this.clusteredLocations)i.clusterId===void 0||i.clusterId===-1?s.push(i):(e[i.clusterId]||(e[i.clusterId]=[]),e[i.clusterId].push(i));const t=Object.keys(e).map((i,r)=>{const o=e[Number(i)],n=o.length,l=o.reduce((c,h)=>c+h.x,0),a=o.reduce((c,h)=>c+h.y,0),m=l/n,d=a/n;return{id:Number(i),items:o,count:n,center:{x:m,y:d}}});return s.length>0&&t.push({id:-1,items:s,count:s.length,center:null}),t}showClusterResult(e){this.crossLayer.removeAll();let s=Number.MIN_VALUE,t=Number.MAX_VALUE;e.forEach(i=>{i.count>1&&(t=Math.min(t,i.count),s=Math.max(s,i.count))}),e.forEach(i=>{if(i.id!==-1){let r=t===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(i.count-t)/(s-t)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const l=(i.count.toString().length*8+6)/2,a=new y({geometry:new u.Point({x:i.center.x,y:i.center.y}),attributes:{count:i.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:[[[-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:r,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}});this.crossLayer.add(a)}else i.items.forEach(r=>{const o=new y({geometry:new u.Point({x:r.x,y:r.y}),attributes:{...r,...r.properties,type:"signal-cross",id:r.id},symbol:this.getCrossSymbol(r.properties)});this.crossLayer.add(o)})})}getBrandLabel(e){const s=(e??"").toLowerCase();return s==="scats"?"SCATS":s==="gc"?"国产":e??""}getOnlineLabel(e){return e?"在线":"离线"}getMalfunctionLabel(e){return e?"故障":"正常"}getCrossSymbol(e){var s;if(this.view.scale<=this.iconSymbolScale){let t="/GisViewerAssets/Images/cross/ic_";return t+=e.brand==="scats"?"scats_":"gc_",t+=e.isOnline?"online_":"offline_",t+=e.isMalfunction?"malfunction.png":"normal.png",{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:this.showName==="crossName"?'Replace($feature.name, "与", "/")':this.showName==="signalId"?"$feature.signalId":'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:25,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:20,rotateClockwise:!0,textureFilter:"Picture",url:t}]}}}}else{const t={type:"simple-marker",style:"circle",size:this.view.scale>this.largeMarkerScale?3:6,outline:{width:1}};return((s=e.brand)==null?void 0:s.toLowerCase())==="scats"?(e.isOnline?t.color=[68,203,188]:t.color=[200,200,200],t.outline.color=[32,97,90]):(e.isOnline?t.color=[129,226,73]:t.color=[200,200,200],t.outline.color=[65,115,37]),t}}}exports.default=S;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class S{constructor(t){this.iconSymbolScale=1e4,this.largeMarkerScale=4e4,this.oldScale=0,this.showName="detail",this.showStyle="scatter",this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusteredLocations=[],this.locations=[],this.view=t,this.crossLayer=new p({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}didCrossScaleThreshold(t,s,i){return t<i&&s>=i||t>=i&&s<i}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(t=>{const s=this.view.toScreen(new u.Point({x:t.x,y:t.y}));s.x>0&&s.y>0&&(t.properties.screenX=s.x,t.properties.screenY=s.y,t.visited=!1,t.clusterId=void 0,this.clusteredLocations.push(t))})}showSignalCross(t){if(this.crossLayer.removeAll(),this.showName=t.showName||"detail",this.showStyle=t.style||"scatter",this.oldScale=this.view.scale,this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("stationary",()=>{if(this.showStyle==="scatter"){const s=this.view.scale,i=this.didCrossScaleThreshold(this.oldScale,s,this.iconSymbolScale),e=this.didCrossScaleThreshold(this.oldScale,s,this.largeMarkerScale);(i||e)&&this.updateScatterSymbol(),this.oldScale=s}else{this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}})),this.showStyle==="scatter"){const s=[],i=[];t.points.forEach(e=>{const r=this.getCrossSymbol(e),o=this.getBrandLabel(e.brand),n=this.getOnlineLabel(e.isOnline),l=this.getMalfunctionLabel(e.isMalfunction),a=new y({geometry:{type:"point",longitude:e.x,latitude:e.y},symbol:r,attributes:{type:"signal-cross",id:e.crossId,brandLabel:o,isOnlineLabel:n,isMalfunctionLabel:l,...e}});e.isMalfunction===!0||e.isOnline===!1?i.push(a):s.push(a)}),this.crossLayer.addMany(s),this.crossLayer.addMany(i)}else{this.locations=t.points.map(i=>({id:i.crossId,x:i.x,y:i.y,visited:!1,clusterId:void 0,properties:i})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}return{status:0,message:"ok"}}clearSignalCross(){var t;this.crossLayer.removeAll(),(t=this.scaleWatchHandle)==null||t.remove(),this.scaleWatchHandle=null}changeShowName(t){this.showName=t,this.showStyle==="scatter"&&this.updateScatterSymbol()}updateScatterSymbol(){this.crossLayer.graphics.forEach(t=>{t.symbol=this.getCrossSymbol(t.attributes)})}doPixelCluster(t){let s=0;for(let i=0;i<this.clusteredLocations.length;i++){const e=this.clusteredLocations[i];if(e.visited)continue;e.visited=!0;const r=this.getNeighbors(e,t);r.length<this.minClusterPoints?e.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=s}),e.clusterId=s,s++)}return this.createClusters()}getNeighbors(t,s){return this.clusteredLocations.filter(i=>i.id===t.id||i.visited?!1:this.getDistance(t,i)<=s)}getDistance(t,s){return Math.sqrt(Math.pow(t.properties.screenX-s.properties.screenX,2)+Math.pow(t.properties.screenY-s.properties.screenY,2))}createClusters(){const t={},s=[];for(const e of this.clusteredLocations)e.clusterId===void 0||e.clusterId===-1?s.push(e):(t[e.clusterId]||(t[e.clusterId]=[]),t[e.clusterId].push(e));const i=Object.keys(t).map((e,r)=>{const o=t[Number(e)],n=o.length,l=o.reduce((c,h)=>c+h.x,0),a=o.reduce((c,h)=>c+h.y,0),m=l/n,d=a/n;return{id:Number(e),items:o,count:n,center:{x:m,y:d}}});return s.length>0&&i.push({id:-1,items:s,count:s.length,center:null}),i}showClusterResult(t){this.crossLayer.removeAll();let s=Number.MIN_VALUE,i=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(i=Math.min(i,e.count),s=Math.max(s,e.count))}),t.forEach(e=>{if(e.id!==-1){let r=i===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-i)/(s-i)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const l=(e.count.toString().length*8+6)/2,a=new y({geometry:new u.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:r,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:r,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}});this.crossLayer.add(a)}else e.items.forEach(r=>{const o=new y({geometry:new u.Point({x:r.x,y:r.y}),attributes:{...r,...r.properties,type:"signal-cross",id:r.id},symbol:this.getCrossSymbol(r.properties)});this.crossLayer.add(o)})})}getBrandLabel(t){const s=(t??"").toLowerCase();return s==="scats"?"SCATS":s==="gc"?"国产":t??""}getOnlineLabel(t){return t?"在线":"离线"}getMalfunctionLabel(t){return t?"故障":"正常"}getCrossSymbol(t){var s,i;if(this.view.scale<=this.iconSymbolScale){let e="/GisViewerAssets/Images/cross/ic_";return e+=((s=t.brand)==null?void 0:s.toLowerCase())==="scats"?"scats_":"gc_",e+=t.isOnline?"online_":"offline_",e+=t.isMalfunction?"malfunction.png":"normal.png",{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:this.showName==="crossName"?'Replace($feature.name, "与", "/")':this.showName==="signalId"?"$feature.signalId":'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:25,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:20,rotateClockwise:!0,textureFilter:"Picture",url:e}]}}}}else{const e={type:"simple-marker",style:"circle",size:this.view.scale>this.largeMarkerScale?3:6,outline:{width:1}};return((i=t.brand)==null?void 0:i.toLowerCase())==="scats"?t.isOnline?(e.color=[68,203,188],e.outline.color=[59,176,163]):(e.color=[100,100,100],e.outline.color=[150,150,150]):t.isOnline?(e.color=[129,226,73],e.outline.color=[108,189,61]):(e.color=[100,100,100],e.outline.color=[150,150,150]),e}}}exports.default=S;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.272",
3
+ "version": "1.0.273",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [