gisviewer-vue3-arcgis 1.0.172 → 1.0.174

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,10 +2,10 @@ import * as w from "@arcgis/core/core/reactiveUtils";
2
2
  import { Point as f } from "@arcgis/core/geometry";
3
3
  import * as d from "@arcgis/core/geometry/support/webMercatorUtils.js";
4
4
  import P from "@arcgis/core/layers/GraphicsLayer";
5
- import g from "./signal-holo-flow.mjs";
6
- class S extends g {
7
- constructor(n, a) {
8
- super(n), this.stopLineLayer = new P(), this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = a, this.view.map.add(this.stopLineLayer);
5
+ import m from "./signal-holo-flow.mjs";
6
+ class M extends m {
7
+ constructor(n, s) {
8
+ super(n), this.stopLineLayer = new P(), this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = s, this.view.map.add(this.stopLineLayer);
9
9
  }
10
10
  async initializeLayer() {
11
11
  var p, l;
@@ -14,17 +14,17 @@ class S extends g {
14
14
  if (!n)
15
15
  return;
16
16
  n = this.mapConfig.assetsRoot + "/" + n, (await (await fetch(n)).json()).features.forEach((t) => {
17
- const { roadId: o, nodeId: e, angle: s, destinationPoint: i } = t.properties, { coordinates: r } = t.geometry, h = this.stopLineMap.get(e);
17
+ const { roadId: o, nodeId: e, angle: a, destinationPoint: i } = t.properties, { coordinates: r } = t.geometry, h = this.stopLineMap.get(e);
18
18
  h ? h.set(o, {
19
19
  coord: r,
20
20
  panelPoint: i,
21
- angle: s
21
+ angle: a
22
22
  }) : this.stopLineMap.set(
23
23
  e,
24
24
  /* @__PURE__ */ new Map([
25
25
  [
26
26
  o,
27
- { coord: r, panelPoint: i, angle: s }
27
+ { coord: r, panelPoint: i, angle: a }
28
28
  ]
29
29
  ])
30
30
  );
@@ -32,26 +32,25 @@ class S extends g {
32
32
  }
33
33
  getPanelScale() {
34
34
  const n = this.view.scale;
35
- let a = 1;
36
- return n < 1e3 ? a = 1 : n < 2e3 ? a = 0.8 : a = 0.4, a;
35
+ let s = 1;
36
+ return n < 1e3 ? s = 1 : n < 2e3 ? s = 0.8 : n < 4e3 ? s = 0.4 : s = 0, s;
37
37
  }
38
38
  async handleSignalData(n) {
39
39
  this.watchHandle || (this.watchHandle = w.watch(
40
40
  () => this.view.extent,
41
41
  () => {
42
- console.log("extent changed");
43
42
  const t = this.getPanelScale();
44
43
  for (const o of this.countdownPanelProps) {
45
44
  t !== this.currentPanelScale && (o.scale = t);
46
45
  const { mapPoint: e } = o;
47
- let s = new f({
46
+ let a = new f({
48
47
  x: e[0],
49
48
  y: e[1]
50
49
  });
51
- this.view.spatialReference.isWebMercator && (s = d.geographicToWebMercator(
52
- s
50
+ this.view.spatialReference.isWebMercator && (a = d.geographicToWebMercator(
51
+ a
53
52
  ));
54
- const i = this.view.toScreen(s);
53
+ const i = this.view.toScreen(a);
55
54
  if (o.position.left = i.x, o.position.top = i.y, this.view.type === "3d") {
56
55
  const r = this.getPanelRotation(o.stopLine);
57
56
  o.rotation = r;
@@ -60,7 +59,7 @@ class S extends g {
60
59
  this.currentPanelScale = t;
61
60
  }
62
61
  ));
63
- const a = n.crossId, c = this.stopLineMap.get(a);
62
+ const s = n.crossId, c = this.stopLineMap.get(s);
64
63
  if (!c)
65
64
  return;
66
65
  const p = n.phaseCountDownList, l = /* @__PURE__ */ new Map();
@@ -75,21 +74,21 @@ class S extends g {
75
74
  continue;
76
75
  let e = l.get(o);
77
76
  if (e || (e = {}, l.set(o, e)), !t.direction) {
78
- console.log(`没有找到对应的方向${a}--${JSON.stringify(t)}`);
77
+ console.log(`没有找到对应的方向${s}--${JSON.stringify(t)}`);
79
78
  continue;
80
79
  }
81
- const s = t.direction.toLowerCase(), i = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
82
- s === "u" ? (e.uNumber = t.leftTime, e.uColor = i) : s === "l" ? (e.lNumber = t.leftTime, e.lColor = i) : s === "s" ? (e.sNumber = t.leftTime, e.sColor = i) : s === "r" && (e.rNumber = t.leftTime, e.rColor = i);
80
+ const a = t.direction.toLowerCase(), i = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
81
+ a === "u" ? (e.uNumber = t.leftTime, e.uColor = i) : a === "l" ? (e.lNumber = t.leftTime, e.lColor = i) : a === "s" ? (e.sNumber = t.leftTime, e.sColor = i) : a === "r" && (e.rNumber = t.leftTime, e.rColor = i);
83
82
  }
84
83
  l.forEach((t, o) => {
85
84
  const e = c.get(o);
86
85
  if (!e)
87
86
  return;
88
- const s = this.countdownPanelProps.find(
89
- (i) => i.crossId === a && i.roadId === o
87
+ const a = this.countdownPanelProps.find(
88
+ (i) => i.crossId === s && i.roadId === o
90
89
  );
91
- if (s)
92
- s.lampStatus = t;
90
+ if (a)
91
+ a.lampStatus = t;
93
92
  else {
94
93
  let i = new f({
95
94
  x: e.panelPoint[0],
@@ -99,9 +98,9 @@ class S extends g {
99
98
  i
100
99
  ));
101
100
  const r = this.view.toScreen(i), h = this.getPanelRotation(e.coord);
102
- console.log(i.toJSON(), r), this.countdownPanelProps.push({
101
+ this.countdownPanelProps.push({
103
102
  displayMode: "complex",
104
- crossId: a,
103
+ crossId: s,
105
104
  roadId: o,
106
105
  mapPoint: e.panelPoint,
107
106
  // 定位点地理坐标
@@ -128,10 +127,10 @@ class S extends g {
128
127
  * @returns
129
128
  */
130
129
  getPanelRotation(n) {
131
- const a = n[0];
130
+ const s = n[0];
132
131
  let c = new f({
133
- x: a[0],
134
- y: a[1]
132
+ x: s[0],
133
+ y: s[1]
135
134
  });
136
135
  this.view.spatialReference.isWebMercator && (c = d.geographicToWebMercator(
137
136
  c
@@ -144,10 +143,10 @@ class S extends g {
144
143
  this.view.spatialReference.isWebMercator && (t = d.geographicToWebMercator(
145
144
  t
146
145
  ));
147
- const o = this.view.toScreen(t), e = o.x - p.x, s = o.y - p.y;
148
- return Math.atan2(s, e) * (180 / Math.PI);
146
+ const o = this.view.toScreen(t), e = o.x - p.x, a = o.y - p.y;
147
+ return Math.atan2(a, e) * (180 / Math.PI);
149
148
  }
150
149
  }
151
150
  export {
152
- S as default
151
+ M as default
153
152
  };
@@ -186,7 +186,7 @@ class v {
186
186
  drawCountdownText(e, t) {
187
187
  const a = e.getContext("2d");
188
188
  a.clearRect(0, 0, e.width, e.height), a.font = "24px Digital", a.textBaseline = "middle", a.textAlign = "center", a.fillStyle = t.stageRemainingTime <= t.stageAllRedTime ? "red" : t.stageRemainingTime <= t.stageAllRedTime + t.stageYellowTime ? "yellow" : "lime", a.fillText(
189
- `${t.stageID} ${t.stageRemainingTime.toFixed(0)}`,
189
+ `${t.stageRemainingTime.toFixed(0)}`,
190
190
  e.width / 2,
191
191
  e.height / 2
192
192
  );
@@ -2,9 +2,9 @@ import * as g from "@arcgis/core/core/reactiveUtils.js";
2
2
  import y from "@arcgis/core/Graphic";
3
3
  import h from "@arcgis/core/layers/GraphicsLayer";
4
4
  import u from "@turf/buffer";
5
- import d from "@turf/convex";
5
+ import b from "@turf/convex";
6
6
  import * as l from "@turf/helpers";
7
- import b from "concaveman";
7
+ import d from "concaveman";
8
8
  import f from "./district-controller.mjs";
9
9
  class x {
10
10
  constructor(e) {
@@ -30,7 +30,7 @@ class x {
30
30
  ]);
31
31
  }
32
32
  showSignalControlArea(e) {
33
- this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0;
33
+ this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1, this.districtControllerLayer.visible = !0;
34
34
  for (const t of e) {
35
35
  const i = new f(t);
36
36
  this.drawArea(i, !0);
@@ -106,9 +106,8 @@ class x {
106
106
  return this.highlightLayer.removeAll(), this.view.closePopup(), this.districtControllerLayer.visible = !0, { status: 0, message: "ok" };
107
107
  }
108
108
  showSubSignalControlArea(e) {
109
- const t = e.children;
110
- console.log(t);
111
- const i = t.map((s) => new y({
109
+ this.crossLayer.removeAll(), this.crossLayer.visible = !0;
110
+ const i = e.children.map((s) => new y({
112
111
  geometry: {
113
112
  type: "point",
114
113
  x: s.longitude,
@@ -156,9 +155,9 @@ class x {
156
155
  const n = l.featureCollection(
157
156
  i.map((p) => l.point(p))
158
157
  );
159
- r = d(n);
158
+ r = b(n);
160
159
  } else {
161
- const n = b(i, 0.5);
160
+ const n = d(i, 0.5);
162
161
  n.length >= 4 && (r = l.polygon([n]));
163
162
  }
164
163
  r || (r = l.lineString(i));
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),g=require("@arcgis/core/geometry/support/webMercatorUtils.js"),m=require("@arcgis/core/layers/GraphicsLayer"),y=require("./signal-holo-flow.js");function w(f){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const i in f)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(f,i);Object.defineProperty(o,i,l.get?l:{enumerable:!0,get:()=>f[i]})}}return o.default=f,Object.freeze(o)}const L=w(P),u=w(g);class M extends y.default{constructor(o,i){super(o),this.stopLineLayer=new m,this.watchHandle=null,this.stopLineMap=new Map,this.countdownPanelProps=i,this.view.map.add(this.stopLineLayer)}async initializeLayer(){var p,c;console.time("初始化停止线图层");let o=(c=(p=this.mapConfig.holoFlow)==null?void 0:p.signal)==null?void 0:c.stopLineLayer;if(!o)return;o=this.mapConfig.assetsRoot+"/"+o,(await(await fetch(o)).json()).features.forEach(t=>{const{roadId:n,nodeId:e,angle:a,destinationPoint:s}=t.properties,{coordinates:r}=t.geometry,h=this.stopLineMap.get(e);h?h.set(n,{coord:r,panelPoint:s,angle:a}):this.stopLineMap.set(e,new Map([[n,{coord:r,panelPoint:s,angle:a}]]))}),console.timeEnd("初始化停止线图层")}getPanelScale(){const o=this.view.scale;let i=1;return o<1e3?i=1:o<2e3?i=.8:i=.4,i}async handleSignalData(o){this.watchHandle||(this.watchHandle=L.watch(()=>this.view.extent,()=>{console.log("extent changed");const t=this.getPanelScale();for(const n of this.countdownPanelProps){t!==this.currentPanelScale&&(n.scale=t);const{mapPoint:e}=n;let a=new d.Point({x:e[0],y:e[1]});this.view.spatialReference.isWebMercator&&(a=u.geographicToWebMercator(a));const s=this.view.toScreen(a);if(n.position.left=s.x,n.position.top=s.y,this.view.type==="3d"){const r=this.getPanelRotation(n.stopLine);n.rotation=r}}this.currentPanelScale=t}));const i=o.crossId,l=this.stopLineMap.get(i);if(!l)return;const p=o.phaseCountDownList,c=new Map;for(const t of p){let n="";for(let r of t.roadIdList)if(r.startsWith("-")&&(r=r.slice(1)),l.has(r)){n=r;break}if(!n)continue;let e=c.get(n);if(e||(e={},c.set(n,e)),!t.direction){console.log(`没有找到对应的方向${i}--${JSON.stringify(t)}`);continue}const a=t.direction.toLowerCase(),s=t.color===1?"red":t.color===2?"yellow":"green";a==="u"?(e.uNumber=t.leftTime,e.uColor=s):a==="l"?(e.lNumber=t.leftTime,e.lColor=s):a==="s"?(e.sNumber=t.leftTime,e.sColor=s):a==="r"&&(e.rNumber=t.leftTime,e.rColor=s)}c.forEach((t,n)=>{const e=l.get(n);if(!e)return;const a=this.countdownPanelProps.find(s=>s.crossId===i&&s.roadId===n);if(a)a.lampStatus=t;else{let s=new d.Point({x:e.panelPoint[0],y:e.panelPoint[1]});this.view.spatialReference.isWebMercator&&(s=u.geographicToWebMercator(s));const r=this.view.toScreen(s),h=this.getPanelRotation(e.coord);console.log(s.toJSON(),r),this.countdownPanelProps.push({displayMode:"complex",crossId:i,roadId:n,mapPoint:e.panelPoint,stopLine:e.coord,position:{left:r.x,top:r.y},rotation:h,scale:this.getPanelScale(),lampStatus:t})}})}clearSignal(){var o;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(o=this.watchHandle)==null||o.remove(),this.watchHandle=null}getPanelRotation(o){const i=o[0];let l=new d.Point({x:i[0],y:i[1]});this.view.spatialReference.isWebMercator&&(l=u.geographicToWebMercator(l));const p=this.view.toScreen(l),c=o[o.length-1];let t=new d.Point({x:c[0],y:c[1]});this.view.spatialReference.isWebMercator&&(t=u.geographicToWebMercator(t));const n=this.view.toScreen(t),e=n.x-p.x,a=n.y-p.y;return Math.atan2(a,e)*(180/Math.PI)}}exports.default=M;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),g=require("@arcgis/core/geometry/support/webMercatorUtils.js"),m=require("@arcgis/core/layers/GraphicsLayer"),y=require("./signal-holo-flow.js");function w(f){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const n in f)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(f,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:()=>f[n]})}}return t.default=f,Object.freeze(t)}const L=w(P),u=w(g);class M extends y.default{constructor(t,n){super(t),this.stopLineLayer=new m,this.watchHandle=null,this.stopLineMap=new Map,this.countdownPanelProps=n,this.view.map.add(this.stopLineLayer)}async initializeLayer(){var p,c;console.time("初始化停止线图层");let t=(c=(p=this.mapConfig.holoFlow)==null?void 0:p.signal)==null?void 0:c.stopLineLayer;if(!t)return;t=this.mapConfig.assetsRoot+"/"+t,(await(await fetch(t)).json()).features.forEach(o=>{const{roadId:i,nodeId:e,angle:a,destinationPoint:s}=o.properties,{coordinates:r}=o.geometry,h=this.stopLineMap.get(e);h?h.set(i,{coord:r,panelPoint:s,angle:a}):this.stopLineMap.set(e,new Map([[i,{coord:r,panelPoint:s,angle:a}]]))}),console.timeEnd("初始化停止线图层")}getPanelScale(){const t=this.view.scale;let n=1;return t<1e3?n=1:t<2e3?n=.8:t<4e3?n=.4:n=0,n}async handleSignalData(t){this.watchHandle||(this.watchHandle=L.watch(()=>this.view.extent,()=>{const o=this.getPanelScale();for(const i of this.countdownPanelProps){o!==this.currentPanelScale&&(i.scale=o);const{mapPoint:e}=i;let a=new d.Point({x:e[0],y:e[1]});this.view.spatialReference.isWebMercator&&(a=u.geographicToWebMercator(a));const s=this.view.toScreen(a);if(i.position.left=s.x,i.position.top=s.y,this.view.type==="3d"){const r=this.getPanelRotation(i.stopLine);i.rotation=r}}this.currentPanelScale=o}));const n=t.crossId,l=this.stopLineMap.get(n);if(!l)return;const p=t.phaseCountDownList,c=new Map;for(const o of p){let i="";for(let r of o.roadIdList)if(r.startsWith("-")&&(r=r.slice(1)),l.has(r)){i=r;break}if(!i)continue;let e=c.get(i);if(e||(e={},c.set(i,e)),!o.direction){console.log(`没有找到对应的方向${n}--${JSON.stringify(o)}`);continue}const a=o.direction.toLowerCase(),s=o.color===1?"red":o.color===2?"yellow":"green";a==="u"?(e.uNumber=o.leftTime,e.uColor=s):a==="l"?(e.lNumber=o.leftTime,e.lColor=s):a==="s"?(e.sNumber=o.leftTime,e.sColor=s):a==="r"&&(e.rNumber=o.leftTime,e.rColor=s)}c.forEach((o,i)=>{const e=l.get(i);if(!e)return;const a=this.countdownPanelProps.find(s=>s.crossId===n&&s.roadId===i);if(a)a.lampStatus=o;else{let s=new d.Point({x:e.panelPoint[0],y:e.panelPoint[1]});this.view.spatialReference.isWebMercator&&(s=u.geographicToWebMercator(s));const r=this.view.toScreen(s),h=this.getPanelRotation(e.coord);this.countdownPanelProps.push({displayMode:"complex",crossId:n,roadId:i,mapPoint:e.panelPoint,stopLine:e.coord,position:{left:r.x,top:r.y},rotation:h,scale:this.getPanelScale(),lampStatus:o})}})}clearSignal(){var t;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(t=this.watchHandle)==null||t.remove(),this.watchHandle=null}getPanelRotation(t){const n=t[0];let l=new d.Point({x:n[0],y:n[1]});this.view.spatialReference.isWebMercator&&(l=u.geographicToWebMercator(l));const p=this.view.toScreen(l),c=t[t.length-1];let o=new d.Point({x:c[0],y:c[1]});this.view.spatialReference.isWebMercator&&(o=u.geographicToWebMercator(o));const i=this.view.toScreen(o),e=i.x-p.x,a=i.y-p.y;return Math.atan2(a,e)*(180/Math.PI)}}exports.default=M;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils"),u=require("@arcgis/core/geometry"),p=require("@arcgis/core/layers/FeatureLayer"),g=require("vue"),y=require("../../stores/index.js");function w(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const f=w(d);class m{constructor(e){this.currentPhaseMap=new Map,this.countdownCanvasMap=new Map,this.lastDataTime=0,this.isDeletingCanvas=!1,this.canvasWidth=80,this.canvasHeight=40,this.view=(e.type==="2d",e);const t=y.default.useAppDataStore;this.mapConfig=g.toRaw(t.mapConfig)}async initializeLayer(){try{await this.initializePlateBackground()}catch(e){console.log("倒计时背景图片加载失败",e)}if(this.mapConfig.phaseLineLayer)if(this.phaseLineLayer)this.phaseLineLayer.visible||(this.phaseLineLayer.visible=!0);else{const e=`${this.mapConfig.assetsRoot}/${this.mapConfig.phaseLineLayer}`,s=(await(await fetch(e)).json()).features.map((n,i)=>({geometry:{type:"polyline",paths:[n.geometry.coordinates]},attributes:{ObjectID:i+1,id:n.properties.id,color:"hide"}}));this.phaseLineLayer=new p({source:s,geometryType:"polyline",objectIdField:"ObjectID",outFields:["*"],fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"color",alias:"color",type:"string"}],renderer:{type:"unique-value",field:"color",defaultSymbol:{type:"simple-line",color:"lightblue",width:"2px",style:"none"},uniqueValueInfos:[{value:"green",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[19,255,69,.8]},width:1,height:.5}]}},{value:"red",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[254,5,9,.8]},width:1,height:.5}]}},{value:"yellow",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[255,215,0,.8]},width:1,height:.5}]}}]}}),this.view.map.add(this.phaseLineLayer)}}async initializePlateBackground(){return new Promise((e,t)=>{const a=new Image;a.src=`${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`,a.onload=()=>{this.plateBackground=a,e()},a.onerror=s=>{t(s)}})}async handleSignalData(e){const{crossId:t,lat:a,lon:s,rtStage:n,channelsConfig:i}=e;await this.updateCountdown(t,a,s,n),!(!this.phaseLineLayer||!i)&&((!this.currentPhaseMap.has(t)||this.currentPhaseMap.get(t)!==n.stagePhase)&&await this.updatePhaseLine(t,n.channelsConfig,i),this.currentPhaseMap.set(t,n.stagePhase))}clearSignal(){this.phaseLineLayer&&(this.phaseLineLayer.visible=!1),this.countdownWatchHandel&&(this.countdownWatchHandel.remove(),this.countdownWatchHandel=void 0),this.countdownCanvasMap.forEach(e=>{this.view.container.removeChild(e.backgroundCanvas),this.view.container.removeChild(e.countdownCanvas)}),this.countdownCanvasMap.clear()}async updateCountdown(e,t,a,s){if(this.isDeletingCanvas)return;const n=this.countdownCanvasMap.get(e);if(n)this.drawCountdownText(n.countdownCanvas,s);else try{const i=new u.Point({longitude:a,latitude:t,z:10}),o=this.view.toScreen(i),r=this.createCountdownCanvas();if(!r)return;const c=r[0],h=r[1];c.style.left=o.x+"px",c.style.top=o.y+"px",h.style.left=o.x+"px",h.style.top=o.y+"px",this.countdownCanvasMap.set(e,{backgroundCanvas:c,countdownCanvas:h,mapPoint:i}),this.drawCountdownText(h,s)}catch(i){console.log("倒计时canvas创建失败",e,i)}this.countdownWatchHandel||(this.countdownWatchHandel=f.watch(()=>this.view.extent,()=>{this.countdownCanvasMap.forEach(i=>{const o=this.view.toScreen(i.mapPoint);i.backgroundCanvas.style.left=o.x+"px",i.backgroundCanvas.style.top=o.y+"px",i.countdownCanvas.style.left=o.x+"px",i.countdownCanvas.style.top=o.y+"px"})}))}drawCountdownText(e,t){const a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),a.font="24px Digital",a.textBaseline="middle",a.textAlign="center",a.fillStyle=t.stageRemainingTime<=t.stageAllRedTime?"red":t.stageRemainingTime<=t.stageAllRedTime+t.stageYellowTime?"yellow":"lime",a.fillText(`${t.stageID} ${t.stageRemainingTime.toFixed(0)}`,e.width/2,e.height/2)}drawCircle(e,t){console.log(t);const a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),this.ctxDraw(a,"lime",e.width/2,e.height/2,20,-Math.PI/2,-Math.PI/2+2*.6*Math.PI)}ctxDraw(e,t,a,s,n,i,o){e.save,e.beginPath(),e.lineWidth=4,e.strokeStyle=t,e.arc(a,s,n,i,o),e.stroke(),e.closePath(),e.font="26px Digital",e.textBaseline="middle",e.textAlign="center",e.fillText("A",a,s),e.restore()}async updatePhaseLine(e,t,a){const s=this.phaseLineLayer.source.filter(n=>n.getAttribute("id").includes(e));s.forEach(n=>{const i=n.getAttribute("id");this.isLaneInChannels(i,t)?n.setAttribute("color","green"):this.isLaneInChannels(i,a)?n.setAttribute("color","red"):n.setAttribute("color","green")}),await this.phaseLineLayer.applyEdits({updateFeatures:s})}isLaneInChannels(e,t){const a=e.split("+"),s=a[1],n=a[2];for(let i=0;i<t.length;i++)for(let o=0;o<t[i].laneSnList.length;o++){const r=t[i].laneSnList[o].toFixed(0);if(s===r[0]&&n===r[1])return!0}return!1}createCountdownCanvas(){const e=document.createElement("canvas");e.width=this.canvasWidth,e.height=this.canvasHeight,e.style.position="absolute",e.style.transform="translate(-50%, -50%)";const t=e.getContext("2d");this.plateBackground?t.drawImage(this.plateBackground,0,0,this.canvasWidth,this.canvasHeight):(t.strokeStyle="rgba(0, 255, 0, 1)",t.lineWidth=1,t.strokeRect(0,0,this.canvasWidth,this.canvasHeight),t.fillStyle="rgba(0, 0, 0, 1)",t.fillRect(0,0,this.canvasWidth,this.canvasHeight)),this.view.container.appendChild(e);const a=document.createElement("canvas");return a.width=this.canvasWidth-10,a.height=this.canvasHeight-10,a.style.position="absolute",a.style.transform="translate(-50%, -50%)",this.view.container.appendChild(a),[e,a]}}exports.default=m;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils"),u=require("@arcgis/core/geometry"),p=require("@arcgis/core/layers/FeatureLayer"),g=require("vue"),y=require("../../stores/index.js");function w(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const f=w(d);class m{constructor(e){this.currentPhaseMap=new Map,this.countdownCanvasMap=new Map,this.lastDataTime=0,this.isDeletingCanvas=!1,this.canvasWidth=80,this.canvasHeight=40,this.view=(e.type==="2d",e);const t=y.default.useAppDataStore;this.mapConfig=g.toRaw(t.mapConfig)}async initializeLayer(){try{await this.initializePlateBackground()}catch(e){console.log("倒计时背景图片加载失败",e)}if(this.mapConfig.phaseLineLayer)if(this.phaseLineLayer)this.phaseLineLayer.visible||(this.phaseLineLayer.visible=!0);else{const e=`${this.mapConfig.assetsRoot}/${this.mapConfig.phaseLineLayer}`,s=(await(await fetch(e)).json()).features.map((n,i)=>({geometry:{type:"polyline",paths:[n.geometry.coordinates]},attributes:{ObjectID:i+1,id:n.properties.id,color:"hide"}}));this.phaseLineLayer=new p({source:s,geometryType:"polyline",objectIdField:"ObjectID",outFields:["*"],fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"color",alias:"color",type:"string"}],renderer:{type:"unique-value",field:"color",defaultSymbol:{type:"simple-line",color:"lightblue",width:"2px",style:"none"},uniqueValueInfos:[{value:"green",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[19,255,69,.8]},width:1,height:.5}]}},{value:"red",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[254,5,9,.8]},width:1,height:.5}]}},{value:"yellow",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[255,215,0,.8]},width:1,height:.5}]}}]}}),this.view.map.add(this.phaseLineLayer)}}async initializePlateBackground(){return new Promise((e,t)=>{const a=new Image;a.src=`${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`,a.onload=()=>{this.plateBackground=a,e()},a.onerror=s=>{t(s)}})}async handleSignalData(e){const{crossId:t,lat:a,lon:s,rtStage:n,channelsConfig:i}=e;await this.updateCountdown(t,a,s,n),!(!this.phaseLineLayer||!i)&&((!this.currentPhaseMap.has(t)||this.currentPhaseMap.get(t)!==n.stagePhase)&&await this.updatePhaseLine(t,n.channelsConfig,i),this.currentPhaseMap.set(t,n.stagePhase))}clearSignal(){this.phaseLineLayer&&(this.phaseLineLayer.visible=!1),this.countdownWatchHandel&&(this.countdownWatchHandel.remove(),this.countdownWatchHandel=void 0),this.countdownCanvasMap.forEach(e=>{this.view.container.removeChild(e.backgroundCanvas),this.view.container.removeChild(e.countdownCanvas)}),this.countdownCanvasMap.clear()}async updateCountdown(e,t,a,s){if(this.isDeletingCanvas)return;const n=this.countdownCanvasMap.get(e);if(n)this.drawCountdownText(n.countdownCanvas,s);else try{const i=new u.Point({longitude:a,latitude:t,z:10}),o=this.view.toScreen(i),r=this.createCountdownCanvas();if(!r)return;const c=r[0],h=r[1];c.style.left=o.x+"px",c.style.top=o.y+"px",h.style.left=o.x+"px",h.style.top=o.y+"px",this.countdownCanvasMap.set(e,{backgroundCanvas:c,countdownCanvas:h,mapPoint:i}),this.drawCountdownText(h,s)}catch(i){console.log("倒计时canvas创建失败",e,i)}this.countdownWatchHandel||(this.countdownWatchHandel=f.watch(()=>this.view.extent,()=>{this.countdownCanvasMap.forEach(i=>{const o=this.view.toScreen(i.mapPoint);i.backgroundCanvas.style.left=o.x+"px",i.backgroundCanvas.style.top=o.y+"px",i.countdownCanvas.style.left=o.x+"px",i.countdownCanvas.style.top=o.y+"px"})}))}drawCountdownText(e,t){const a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),a.font="24px Digital",a.textBaseline="middle",a.textAlign="center",a.fillStyle=t.stageRemainingTime<=t.stageAllRedTime?"red":t.stageRemainingTime<=t.stageAllRedTime+t.stageYellowTime?"yellow":"lime",a.fillText(`${t.stageRemainingTime.toFixed(0)}`,e.width/2,e.height/2)}drawCircle(e,t){console.log(t);const a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),this.ctxDraw(a,"lime",e.width/2,e.height/2,20,-Math.PI/2,-Math.PI/2+2*.6*Math.PI)}ctxDraw(e,t,a,s,n,i,o){e.save,e.beginPath(),e.lineWidth=4,e.strokeStyle=t,e.arc(a,s,n,i,o),e.stroke(),e.closePath(),e.font="26px Digital",e.textBaseline="middle",e.textAlign="center",e.fillText("A",a,s),e.restore()}async updatePhaseLine(e,t,a){const s=this.phaseLineLayer.source.filter(n=>n.getAttribute("id").includes(e));s.forEach(n=>{const i=n.getAttribute("id");this.isLaneInChannels(i,t)?n.setAttribute("color","green"):this.isLaneInChannels(i,a)?n.setAttribute("color","red"):n.setAttribute("color","green")}),await this.phaseLineLayer.applyEdits({updateFeatures:s})}isLaneInChannels(e,t){const a=e.split("+"),s=a[1],n=a[2];for(let i=0;i<t.length;i++)for(let o=0;o<t[i].laneSnList.length;o++){const r=t[i].laneSnList[o].toFixed(0);if(s===r[0]&&n===r[1])return!0}return!1}createCountdownCanvas(){const e=document.createElement("canvas");e.width=this.canvasWidth,e.height=this.canvasHeight,e.style.position="absolute",e.style.transform="translate(-50%, -50%)";const t=e.getContext("2d");this.plateBackground?t.drawImage(this.plateBackground,0,0,this.canvasWidth,this.canvasHeight):(t.strokeStyle="rgba(0, 255, 0, 1)",t.lineWidth=1,t.strokeRect(0,0,this.canvasWidth,this.canvasHeight),t.fillStyle="rgba(0, 0, 0, 1)",t.fillRect(0,0,this.canvasWidth,this.canvasHeight)),this.view.container.appendChild(e);const a=document.createElement("canvas");return a.width=this.canvasWidth-10,a.height=this.canvasHeight-10,a.style.position="absolute",a.style.transform="translate(-50%, -50%)",this.view.container.appendChild(a),[e,a]}}exports.default=m;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),h=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/buffer"),f=require("@turf/convex"),C=require("@turf/helpers"),v=require("concaveman"),L=require("./district-controller.js");function m(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const S=m(d),n=m(C);class I{constructor(e){this.crossScale=5e3,this.view=e,this.districtControllerLayer=new h({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new h({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new h({id:"crossLayer",visible:!1}),this.highlightLayer=new h({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0;for(const t of e){const r=new L.default(t);this.drawArea(r,!0)}return this.watchHandle=S.watch(()=>this.view.scale,(t,r)=>{t>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.watchHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id).toArray().map(i=>{const a=i.clone();return a.symbol.style="none",a}),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray().map(i=>i.clone());if(t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t);else if(r.length>0){const i=r[0].geometry.centroid;await this.view.goTo({target:i,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(e){const t=e.children;console.log(t);const r=t.map(s=>new y({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossGraphicInSubDistrict(),attributes:{id:s.id,name:s.name,signalId:s.signalId}}));return this.crossLayer.addMany(r),this.view.goTo(r),{status:0,message:"ok"}}editSubSignalArea(){return{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>=2){let i=null;if(r.length===2)i=n.lineString(r);else{if(t){const c=n.featureCollection(r.map(p=>n.point(p)));i=f(c)}else{const c=v(r,.5);c.length>=4&&(i=n.polygon([c]))}i||(i=n.lineString(r))}const a=b(i.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const g={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},u=new y({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.2],outline:{color:e.areaColor,width:3,style:t?"solid":"long-dash"}},attributes:g,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(u):this.subDistrictControllerLayer.add(u)}for(const i of e.subDistricts)this.drawArea(i,!1);const s=[];e.crosses.forEach(i=>{const a={type:"cross",id:i.id,name:i.name,color:e.areaColor,signalId:i.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:i.isKey},l=new y({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(l)}),this.crossLayer.addMany(s)}getCrossGraphicInSubDistrict(){return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,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:"/GisViewerAssets/Images/gis_lkcz_xz.png"}]}}}}getCrossGraphicSymbol(e,t){const{isKey:r,color:s}=e;if(t==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,size:8,outline:{color:"white",width:1}};if(t==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,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:r?50:40,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:r?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${r?4:1}.png`,offsetY:r?22:15}]}}}}}exports.default=I;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),h=require("@arcgis/core/layers/GraphicsLayer"),d=require("@turf/buffer"),f=require("@turf/convex"),C=require("@turf/helpers"),v=require("concaveman"),L=require("./district-controller.js");function m(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const S=m(b),n=m(C);class I{constructor(e){this.crossScale=5e3,this.view=e,this.districtControllerLayer=new h({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new h({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new h({id:"crossLayer",visible:!1}),this.highlightLayer=new h({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1,this.districtControllerLayer.visible=!0;for(const t of e){const r=new L.default(t);this.drawArea(r,!0)}return this.watchHandle=S.watch(()=>this.view.scale,(t,r)=>{t>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.watchHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id).toArray().map(i=>{const a=i.clone();return a.symbol.style="none",a}),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray().map(i=>i.clone());if(t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t);else if(r.length>0){const i=r[0].geometry.centroid;await this.view.goTo({target:i,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=e.children.map(s=>new y({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossGraphicInSubDistrict(),attributes:{id:s.id,name:s.name,signalId:s.signalId}}));return this.crossLayer.addMany(r),this.view.goTo(r),{status:0,message:"ok"}}editSubSignalArea(){return{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>=2){let i=null;if(r.length===2)i=n.lineString(r);else{if(t){const c=n.featureCollection(r.map(p=>n.point(p)));i=f(c)}else{const c=v(r,.5);c.length>=4&&(i=n.polygon([c]))}i||(i=n.lineString(r))}const a=d(i.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const g={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},u=new y({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.2],outline:{color:e.areaColor,width:3,style:t?"solid":"long-dash"}},attributes:g,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(u):this.subDistrictControllerLayer.add(u)}for(const i of e.subDistricts)this.drawArea(i,!1);const s=[];e.crosses.forEach(i=>{const a={type:"cross",id:i.id,name:i.name,color:e.areaColor,signalId:i.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:i.isKey},l=new y({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(l)}),this.crossLayer.addMany(s)}getCrossGraphicInSubDistrict(){return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,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:"/GisViewerAssets/Images/gis_lkcz_xz.png"}]}}}}getCrossGraphicSymbol(e,t){const{isKey:r,color:s}=e;if(t==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,size:8,outline:{color:"white",width:1}};if(t==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,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:r?50:40,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:r?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${r?4:1}.png`,offsetY:r?22:15}]}}}}}exports.default=I;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.172",
3
+ "version": "1.0.174",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [