gisviewer-vue3-arcgis 1.0.225 → 1.0.226

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,12 +1,12 @@
1
- import * as g from "@arcgis/core/core/reactiveUtils";
2
- import { Point as d } from "@arcgis/core/geometry";
3
- import * as u from "@arcgis/core/geometry/support/webMercatorUtils.js";
4
- import w from "@arcgis/core/layers/GraphicsLayer";
1
+ import * as w from "@arcgis/core/core/reactiveUtils";
2
+ import { Point as u } from "@arcgis/core/geometry";
3
+ import * as d from "@arcgis/core/geometry/support/webMercatorUtils.js";
4
+ import g from "@arcgis/core/layers/GraphicsLayer";
5
5
  import P from "./signal-holo-flow.mjs";
6
6
  class M extends P {
7
- constructor(e, a) {
7
+ constructor(e, s) {
8
8
  var l, i;
9
- super(e), this.stopLineLayer = new w(), this.watchHandle = null, this.trajectoryDelayTime = 2, this.stopLineMap = /* @__PURE__ */ new Map(), this.lampGroupMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = a, this.view.map.add(this.stopLineLayer), this.trajectoryDelayTime = ((i = (l = this.mapConfig.holoFlow) == null ? void 0 : l.signal) == null ? void 0 : i.delay) || 2;
9
+ super(e), this.stopLineLayer = new g(), this.watchHandle = null, this.trajectoryDelayTime = 2, this.stopLineMap = /* @__PURE__ */ new Map(), this.lampGroupMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = s, this.view.map.add(this.stopLineLayer), this.trajectoryDelayTime = ((i = (l = this.mapConfig.holoFlow) == null ? void 0 : l.signal) == null ? void 0 : i.delay) || 2;
10
10
  }
11
11
  /**
12
12
  * 读取停止线图层,将灯组面板沿着停止线放置
@@ -23,7 +23,7 @@ class M extends P {
23
23
  e = this.mapConfig.assetsRoot + "/" + e;
24
24
  const l = await (await fetch(e)).json();
25
25
  for (const n of l.features) {
26
- const { roadId: s } = n.properties;
26
+ const { roadId: a } = n.properties;
27
27
  let { destinationPoint: o } = n.properties;
28
28
  const { coordinates: r } = n.geometry;
29
29
  if (o) {
@@ -38,7 +38,7 @@ class M extends P {
38
38
  const c = r[0], h = r[r.length - 1], p = (c[0] + h[0]) / 2, f = (c[1] + h[1]) / 2;
39
39
  o = [p, f];
40
40
  }
41
- this.stopLineMap.set(s, {
41
+ this.stopLineMap.set(a, {
42
42
  coord: r,
43
43
  panelPoint: o
44
44
  });
@@ -49,52 +49,56 @@ class M extends P {
49
49
  * 初始化灯组与进口道的关联关系
50
50
  */
51
51
  initializeLampGroup(e) {
52
- const { sigId: a, lampGroupList: l } = e, i = [];
52
+ const { sigId: s, lampGroupList: l } = e, i = [];
53
53
  l.forEach((t) => {
54
- const { lampGroupNo: n, lampGroupType: s, crossFlowList: o, pedList: r } = t;
55
- o.length > 0 && o.forEach((c) => {
56
- const h = c.upSectionId;
57
- let p = "s";
58
- switch (c.turn) {
59
- case 1:
60
- p = "s";
61
- break;
62
- case 2:
63
- p = "l";
64
- break;
65
- case 4:
66
- p = "r";
67
- break;
68
- case 8:
69
- p = "u";
70
- break;
54
+ const { lampGroupNo: n, lampGroupType: a, crossFlowList: o, pedList: r } = t;
55
+ if (o.length > 0)
56
+ for (const c of o) {
57
+ if (a === 81)
58
+ continue;
59
+ const h = c.upSectionId;
60
+ let p = "s";
61
+ switch (c.turn) {
62
+ case 1:
63
+ p = "s";
64
+ break;
65
+ case 2:
66
+ p = "l";
67
+ break;
68
+ case 4:
69
+ p = "r";
70
+ break;
71
+ case 8:
72
+ p = "u";
73
+ break;
74
+ }
75
+ i.push({
76
+ lampGroupId: n,
77
+ roadId: h,
78
+ dir: p
79
+ });
71
80
  }
72
- i.push({
73
- lampGroupId: n,
74
- roadId: h,
75
- dir: p
76
- });
77
- }), r.length > 0;
78
- }), this.lampGroupMap.set(a, i);
81
+ r.length > 0;
82
+ }), this.lampGroupMap.set(s, i);
79
83
  }
80
84
  /**
81
85
  * 处理统一信控平台信号灯数据
82
86
  * @param data
83
87
  */
84
88
  handleUniSignalData(e) {
85
- this.watchHandle || (this.watchHandle = g.watch(
89
+ this.watchHandle || (this.watchHandle = w.watch(
86
90
  () => this.view.extent,
87
91
  () => this.updatePanelPosition()
88
92
  ));
89
- const { sigId: a, runningStatus: l } = e.data.basicInfo, i = this.lampGroupMap.get(a);
93
+ const { sigId: s, runningStatus: l } = e.data.basicInfo, i = this.lampGroupMap.get(s);
90
94
  if (!i)
91
95
  return { status: -1, message: "灯组未初始化" };
92
96
  const t = /* @__PURE__ */ new Map();
93
97
  let n = !1;
94
98
  switch (String(l)) {
95
99
  case "4": {
96
- n = !0, i.forEach((s) => {
97
- const { roadId: o, dir: r } = s;
100
+ n = !0, i.forEach((a) => {
101
+ const { roadId: o, dir: r } = a;
98
102
  t.set(o, {
99
103
  ...t.get(o) || {},
100
104
  [`${r}Number`]: "",
@@ -104,8 +108,8 @@ class M extends P {
104
108
  break;
105
109
  }
106
110
  case "5": {
107
- i.forEach((s) => {
108
- const { roadId: o, dir: r } = s;
111
+ i.forEach((a) => {
112
+ const { roadId: o, dir: r } = a;
109
113
  t.set(o, {
110
114
  ...t.get(o) || {},
111
115
  [`${r}Number`]: "",
@@ -116,8 +120,8 @@ class M extends P {
116
120
  }
117
121
  case "6":
118
122
  case "9": {
119
- i.forEach((s) => {
120
- const { roadId: o, dir: r } = s;
123
+ i.forEach((a) => {
124
+ const { roadId: o, dir: r } = a;
121
125
  t.set(o, {
122
126
  ...t.get(o) || {},
123
127
  [`${r}Number`]: "",
@@ -127,8 +131,8 @@ class M extends P {
127
131
  break;
128
132
  }
129
133
  default: {
130
- const { curSigColorInfo: s } = e.data;
131
- s.forEach((o) => {
134
+ const { curSigColorInfo: a } = e.data;
135
+ a.forEach((o) => {
132
136
  const r = String(o.lamgroupId), { color: c, leftTime: h } = o, p = i.find(
133
137
  (f) => f.lampGroupId === r
134
138
  );
@@ -143,41 +147,41 @@ class M extends P {
143
147
  });
144
148
  }
145
149
  }
146
- return this.updateLampGroupPanelStatus(a, t, n), { status: 0, message: "ok" };
150
+ return this.updateLampGroupPanelStatus(s, t, n), { status: 0, message: "ok" };
147
151
  }
148
152
  /**
149
153
  * 根据地图比例尺计算灯组面板缩放比例
150
154
  */
151
155
  getPanelScale() {
152
156
  const e = this.view.scale;
153
- let a = 1;
154
- return e < 500 ? a = 1.2 : e < 1e3 ? a = 1 : e < 2e3 ? a = 0.8 : e < 4e3 ? a = 0.4 : a = 0, a;
157
+ let s = 1;
158
+ return e < 500 ? s = 1.2 : e < 1e3 ? s = 1 : e < 2e3 ? s = 0.8 : e < 4e3 ? s = 0.4 : s = 0, s;
155
159
  }
156
160
  /**
157
161
  * 地图移动时更新灯组面板位置
158
162
  */
159
163
  updatePanelPosition() {
160
164
  const e = this.getPanelScale();
161
- for (const a of this.countdownPanelProps) {
162
- e !== this.currentPanelScale && (a.scale = e);
163
- const { mapPoint: l } = a;
164
- let i = new d({
165
+ for (const s of this.countdownPanelProps) {
166
+ e !== this.currentPanelScale && (s.scale = e);
167
+ const { mapPoint: l } = s;
168
+ let i = new u({
165
169
  x: l[0],
166
170
  y: l[1]
167
171
  });
168
- this.view.spatialReference.isWebMercator && (i = u.geographicToWebMercator(
172
+ this.view.spatialReference.isWebMercator && (i = d.geographicToWebMercator(
169
173
  i
170
174
  ));
171
175
  const t = this.view.toScreen(i);
172
- if (a.position.left = t.x, a.position.top = t.y, this.view.type === "3d") {
173
- const n = this.getPanelRotation(a.stopLine);
174
- a.rotation = n;
176
+ if (s.position.left = t.x, s.position.top = t.y, this.view.type === "3d") {
177
+ const n = this.getPanelRotation(s.stopLine);
178
+ s.rotation = n;
175
179
  }
176
180
  }
177
181
  this.currentPanelScale = e;
178
182
  }
179
183
  doHoloSignalData(e) {
180
- const a = e.crossId, l = e.phaseCountDownList, i = /* @__PURE__ */ new Map();
184
+ const s = e.crossId, l = e.phaseCountDownList, i = /* @__PURE__ */ new Map();
181
185
  for (const t of l) {
182
186
  let n = "";
183
187
  for (let c of t.roadIdList)
@@ -186,33 +190,33 @@ class M extends P {
186
190
  break;
187
191
  }
188
192
  if (!n) {
189
- console.log(`没有找到对应的进口道${a}--${n}`);
193
+ console.log(`没有找到对应的进口道${s}--${n}`);
190
194
  continue;
191
195
  }
192
- let s = i.get(n);
193
- if (s || (s = {}, i.set(n, s)), !t.direction)
196
+ let a = i.get(n);
197
+ if (a || (a = {}, i.set(n, a)), !t.direction)
194
198
  continue;
195
199
  const o = t.direction.toLowerCase(), r = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
196
- o === "u" ? (s.uNumber = t.leftTime, s.uColor = r) : o === "l" ? (s.lNumber = t.leftTime, s.lColor = r) : o === "s" ? (s.sNumber = t.leftTime, s.sColor = r) : o === "r" && (s.rNumber = t.leftTime, s.rColor = r);
200
+ o === "u" ? (a.uNumber = t.leftTime, a.uColor = r) : o === "l" ? (a.lNumber = t.leftTime, a.lColor = r) : o === "s" ? (a.sNumber = t.leftTime, a.sColor = r) : o === "r" && (a.rNumber = t.leftTime, a.rColor = r);
197
201
  }
198
- this.updateLampGroupPanelStatus(a, i);
202
+ this.updateLampGroupPanelStatus(s, i);
199
203
  }
200
- updateLampGroupPanelStatus(e, a, l = !1) {
201
- a.forEach((i, t) => {
204
+ updateLampGroupPanelStatus(e, s, l = !1) {
205
+ s.forEach((i, t) => {
202
206
  const n = this.stopLineMap.get(t);
203
207
  if (!n)
204
208
  return;
205
- const s = this.countdownPanelProps.find(
209
+ const a = this.countdownPanelProps.find(
206
210
  (o) => o.roadId === t
207
211
  );
208
- if (s)
209
- s.lampStatus = i, s.flash = l;
212
+ if (a)
213
+ a.lampStatus = i, a.flash = l;
210
214
  else {
211
- let o = new d({
215
+ let o = new u({
212
216
  x: n.panelPoint[0],
213
217
  y: n.panelPoint[1]
214
218
  });
215
- this.view.spatialReference.isWebMercator && (o = u.geographicToWebMercator(
219
+ this.view.spatialReference.isWebMercator && (o = d.geographicToWebMercator(
216
220
  o
217
221
  ));
218
222
  const r = this.view.toScreen(o), c = this.getPanelRotation(n.coord);
@@ -242,7 +246,7 @@ class M extends P {
242
246
  * @returns
243
247
  */
244
248
  async handleHoloSignalData(e) {
245
- this.watchHandle || (this.watchHandle = g.watch(
249
+ this.watchHandle || (this.watchHandle = w.watch(
246
250
  () => this.view.extent,
247
251
  () => this.updatePanelPosition()
248
252
  )), this.trajectoryDelayTime === 0 ? this.doHoloSignalData(e) : setTimeout(
@@ -260,23 +264,23 @@ class M extends P {
260
264
  * @returns
261
265
  */
262
266
  getPanelRotation(e) {
263
- const a = e[0];
264
- let l = new d({
265
- x: a[0],
266
- y: a[1]
267
+ const s = e[0];
268
+ let l = new u({
269
+ x: s[0],
270
+ y: s[1]
267
271
  });
268
- this.view.spatialReference.isWebMercator && (l = u.geographicToWebMercator(
272
+ this.view.spatialReference.isWebMercator && (l = d.geographicToWebMercator(
269
273
  l
270
274
  ));
271
275
  const i = this.view.toScreen(l), t = e[e.length - 1];
272
- let n = new d({
276
+ let n = new u({
273
277
  x: t[0],
274
278
  y: t[1]
275
279
  });
276
- this.view.spatialReference.isWebMercator && (n = u.geographicToWebMercator(
280
+ this.view.spatialReference.isWebMercator && (n = d.geographicToWebMercator(
277
281
  n
278
282
  ));
279
- const s = this.view.toScreen(n), o = s.x - i.x, r = s.y - i.y;
283
+ const a = this.view.toScreen(n), o = a.x - i.x, r = a.y - i.y;
280
284
  return Math.atan2(r, o) * (180 / Math.PI);
281
285
  }
282
286
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),S=require("@arcgis/core/geometry/support/webMercatorUtils.js"),b=require("@arcgis/core/layers/GraphicsLayer"),L=require("./signal-holo-flow.js");function P(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(e,t,l.get?l:{enumerable:!0,get:()=>u[t]})}}return e.default=u,Object.freeze(e)}const w=P(y),m=P(S);class M extends L.default{constructor(e,t){var l,i;super(e),this.stopLineLayer=new b,this.watchHandle=null,this.trajectoryDelayTime=2,this.stopLineMap=new Map,this.lampGroupMap=new Map,this.countdownPanelProps=t,this.view.map.add(this.stopLineLayer),this.trajectoryDelayTime=((i=(l=this.mapConfig.holoFlow)==null?void 0:l.signal)==null?void 0:i.delay)||2}async initializeLayer(){var i,o;if(this.stopLineMap.size>0)return;console.time("初始化停止线图层");let e=(o=(i=this.mapConfig.holoFlow)==null?void 0:i.signal)==null?void 0:o.stopLineLayer;if(!e)return;e=this.mapConfig.assetsRoot+"/"+e;const l=await(await fetch(e)).json();for(const n of l.features){const{roadId:s}=n.properties;let{destinationPoint:a}=n.properties;const{coordinates:r}=n.geometry;if(a){if(typeof a=="string")try{a=JSON.parse(a)}catch(c){console.error("解析面板基准点失败",c);continue}}else{const c=r[0],h=r[r.length-1],p=(c[0]+h[0])/2,f=(c[1]+h[1])/2;a=[p,f]}this.stopLineMap.set(s,{coord:r,panelPoint:a})}console.timeEnd("初始化停止线图层")}initializeLampGroup(e){const{sigId:t,lampGroupList:l}=e,i=[];l.forEach(o=>{const{lampGroupNo:n,lampGroupType:s,crossFlowList:a,pedList:r}=o;a.length>0&&a.forEach(c=>{const h=c.upSectionId;let p="s";switch(c.turn){case 1:p="s";break;case 2:p="l";break;case 4:p="r";break;case 8:p="u";break}i.push({lampGroupId:n,roadId:h,dir:p})}),r.length>0}),this.lampGroupMap.set(t,i)}handleUniSignalData(e){this.watchHandle||(this.watchHandle=w.watch(()=>this.view.extent,()=>this.updatePanelPosition()));const{sigId:t,runningStatus:l}=e.data.basicInfo,i=this.lampGroupMap.get(t);if(!i)return{status:-1,message:"灯组未初始化"};const o=new Map;let n=!1;switch(String(l)){case"4":{n=!0,i.forEach(s=>{const{roadId:a,dir:r}=s;o.set(a,{...o.get(a)||{},[`${r}Number`]:"",[`${r}Color`]:"yellow"})});break}case"5":{i.forEach(s=>{const{roadId:a,dir:r}=s;o.set(a,{...o.get(a)||{},[`${r}Number`]:"",[`${r}Color`]:"red"})});break}case"6":case"9":{i.forEach(s=>{const{roadId:a,dir:r}=s;o.set(a,{...o.get(a)||{},[`${r}Number`]:"",[`${r}Color`]:"off"})});break}default:{const{curSigColorInfo:s}=e.data;s.forEach(a=>{const r=String(a.lamgroupId),{color:c,leftTime:h}=a,p=i.find(f=>f.lampGroupId===r);if(p){const{roadId:f,dir:g}=p;o.set(f,{...o.get(f)||{},[`${g}Number`]:h,[`${g}Color`]:c===1?"red":c===2?"yellow":"green"})}})}}return this.updateLampGroupPanelStatus(t,o,n),{status:0,message:"ok"}}getPanelScale(){const e=this.view.scale;let t=1;return e<500?t=1.2:e<1e3?t=1:e<2e3?t=.8:e<4e3?t=.4:t=0,t}updatePanelPosition(){const e=this.getPanelScale();for(const t of this.countdownPanelProps){e!==this.currentPanelScale&&(t.scale=e);const{mapPoint:l}=t;let i=new d.Point({x:l[0],y:l[1]});this.view.spatialReference.isWebMercator&&(i=m.geographicToWebMercator(i));const o=this.view.toScreen(i);if(t.position.left=o.x,t.position.top=o.y,this.view.type==="3d"){const n=this.getPanelRotation(t.stopLine);t.rotation=n}}this.currentPanelScale=e}doHoloSignalData(e){const t=e.crossId,l=e.phaseCountDownList,i=new Map;for(const o of l){let n="";for(let c of o.roadIdList)if(c.startsWith("-")&&(c=c.slice(1)),this.stopLineMap.has(c)){n=c;break}if(!n){console.log(`没有找到对应的进口道${t}--${n}`);continue}let s=i.get(n);if(s||(s={},i.set(n,s)),!o.direction)continue;const a=o.direction.toLowerCase(),r=o.color===1?"red":o.color===2?"yellow":"green";a==="u"?(s.uNumber=o.leftTime,s.uColor=r):a==="l"?(s.lNumber=o.leftTime,s.lColor=r):a==="s"?(s.sNumber=o.leftTime,s.sColor=r):a==="r"&&(s.rNumber=o.leftTime,s.rColor=r)}this.updateLampGroupPanelStatus(t,i)}updateLampGroupPanelStatus(e,t,l=!1){t.forEach((i,o)=>{const n=this.stopLineMap.get(o);if(!n)return;const s=this.countdownPanelProps.find(a=>a.roadId===o);if(s)s.lampStatus=i,s.flash=l;else{let a=new d.Point({x:n.panelPoint[0],y:n.panelPoint[1]});this.view.spatialReference.isWebMercator&&(a=m.geographicToWebMercator(a));const r=this.view.toScreen(a),c=this.getPanelRotation(n.coord);this.countdownPanelProps.push({displayMode:"complex",flash:l,crossId:e,roadId:o,mapPoint:n.panelPoint,stopLine:n.coord,position:{left:r.x,top:r.y},rotation:c,scale:this.getPanelScale(),lampStatus:i})}})}async handleHoloSignalData(e){this.watchHandle||(this.watchHandle=w.watch(()=>this.view.extent,()=>this.updatePanelPosition())),this.trajectoryDelayTime===0?this.doHoloSignalData(e):setTimeout(()=>this.doHoloSignalData(e),this.trajectoryDelayTime*1e3)}clearSignal(){var e;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(e=this.watchHandle)==null||e.remove(),this.watchHandle=null}getPanelRotation(e){const t=e[0];let l=new d.Point({x:t[0],y:t[1]});this.view.spatialReference.isWebMercator&&(l=m.geographicToWebMercator(l));const i=this.view.toScreen(l),o=e[e.length-1];let n=new d.Point({x:o[0],y:o[1]});this.view.spatialReference.isWebMercator&&(n=m.geographicToWebMercator(n));const s=this.view.toScreen(n),a=s.x-i.x,r=s.y-i.y;return Math.atan2(r,a)*(180/Math.PI)}}exports.default=M;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),S=require("@arcgis/core/geometry/support/webMercatorUtils.js"),b=require("@arcgis/core/layers/GraphicsLayer"),L=require("./signal-holo-flow.js");function P(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(e,t,l.get?l:{enumerable:!0,get:()=>u[t]})}}return e.default=u,Object.freeze(e)}const w=P(y),m=P(S);class M extends L.default{constructor(e,t){var l,i;super(e),this.stopLineLayer=new b,this.watchHandle=null,this.trajectoryDelayTime=2,this.stopLineMap=new Map,this.lampGroupMap=new Map,this.countdownPanelProps=t,this.view.map.add(this.stopLineLayer),this.trajectoryDelayTime=((i=(l=this.mapConfig.holoFlow)==null?void 0:l.signal)==null?void 0:i.delay)||2}async initializeLayer(){var i,o;if(this.stopLineMap.size>0)return;console.time("初始化停止线图层");let e=(o=(i=this.mapConfig.holoFlow)==null?void 0:i.signal)==null?void 0:o.stopLineLayer;if(!e)return;e=this.mapConfig.assetsRoot+"/"+e;const l=await(await fetch(e)).json();for(const n of l.features){const{roadId:a}=n.properties;let{destinationPoint:s}=n.properties;const{coordinates:r}=n.geometry;if(s){if(typeof s=="string")try{s=JSON.parse(s)}catch(c){console.error("解析面板基准点失败",c);continue}}else{const c=r[0],f=r[r.length-1],p=(c[0]+f[0])/2,h=(c[1]+f[1])/2;s=[p,h]}this.stopLineMap.set(a,{coord:r,panelPoint:s})}console.timeEnd("初始化停止线图层")}initializeLampGroup(e){const{sigId:t,lampGroupList:l}=e,i=[];l.forEach(o=>{const{lampGroupNo:n,lampGroupType:a,crossFlowList:s,pedList:r}=o;if(s.length>0)for(const c of s){if(a===81)continue;const f=c.upSectionId;let p="s";switch(c.turn){case 1:p="s";break;case 2:p="l";break;case 4:p="r";break;case 8:p="u";break}i.push({lampGroupId:n,roadId:f,dir:p})}r.length>0}),this.lampGroupMap.set(t,i)}handleUniSignalData(e){this.watchHandle||(this.watchHandle=w.watch(()=>this.view.extent,()=>this.updatePanelPosition()));const{sigId:t,runningStatus:l}=e.data.basicInfo,i=this.lampGroupMap.get(t);if(!i)return{status:-1,message:"灯组未初始化"};const o=new Map;let n=!1;switch(String(l)){case"4":{n=!0,i.forEach(a=>{const{roadId:s,dir:r}=a;o.set(s,{...o.get(s)||{},[`${r}Number`]:"",[`${r}Color`]:"yellow"})});break}case"5":{i.forEach(a=>{const{roadId:s,dir:r}=a;o.set(s,{...o.get(s)||{},[`${r}Number`]:"",[`${r}Color`]:"red"})});break}case"6":case"9":{i.forEach(a=>{const{roadId:s,dir:r}=a;o.set(s,{...o.get(s)||{},[`${r}Number`]:"",[`${r}Color`]:"off"})});break}default:{const{curSigColorInfo:a}=e.data;a.forEach(s=>{const r=String(s.lamgroupId),{color:c,leftTime:f}=s,p=i.find(h=>h.lampGroupId===r);if(p){const{roadId:h,dir:g}=p;o.set(h,{...o.get(h)||{},[`${g}Number`]:f,[`${g}Color`]:c===1?"red":c===2?"yellow":"green"})}})}}return this.updateLampGroupPanelStatus(t,o,n),{status:0,message:"ok"}}getPanelScale(){const e=this.view.scale;let t=1;return e<500?t=1.2:e<1e3?t=1:e<2e3?t=.8:e<4e3?t=.4:t=0,t}updatePanelPosition(){const e=this.getPanelScale();for(const t of this.countdownPanelProps){e!==this.currentPanelScale&&(t.scale=e);const{mapPoint:l}=t;let i=new d.Point({x:l[0],y:l[1]});this.view.spatialReference.isWebMercator&&(i=m.geographicToWebMercator(i));const o=this.view.toScreen(i);if(t.position.left=o.x,t.position.top=o.y,this.view.type==="3d"){const n=this.getPanelRotation(t.stopLine);t.rotation=n}}this.currentPanelScale=e}doHoloSignalData(e){const t=e.crossId,l=e.phaseCountDownList,i=new Map;for(const o of l){let n="";for(let c of o.roadIdList)if(c.startsWith("-")&&(c=c.slice(1)),this.stopLineMap.has(c)){n=c;break}if(!n){console.log(`没有找到对应的进口道${t}--${n}`);continue}let a=i.get(n);if(a||(a={},i.set(n,a)),!o.direction)continue;const s=o.direction.toLowerCase(),r=o.color===1?"red":o.color===2?"yellow":"green";s==="u"?(a.uNumber=o.leftTime,a.uColor=r):s==="l"?(a.lNumber=o.leftTime,a.lColor=r):s==="s"?(a.sNumber=o.leftTime,a.sColor=r):s==="r"&&(a.rNumber=o.leftTime,a.rColor=r)}this.updateLampGroupPanelStatus(t,i)}updateLampGroupPanelStatus(e,t,l=!1){t.forEach((i,o)=>{const n=this.stopLineMap.get(o);if(!n)return;const a=this.countdownPanelProps.find(s=>s.roadId===o);if(a)a.lampStatus=i,a.flash=l;else{let s=new d.Point({x:n.panelPoint[0],y:n.panelPoint[1]});this.view.spatialReference.isWebMercator&&(s=m.geographicToWebMercator(s));const r=this.view.toScreen(s),c=this.getPanelRotation(n.coord);this.countdownPanelProps.push({displayMode:"complex",flash:l,crossId:e,roadId:o,mapPoint:n.panelPoint,stopLine:n.coord,position:{left:r.x,top:r.y},rotation:c,scale:this.getPanelScale(),lampStatus:i})}})}async handleHoloSignalData(e){this.watchHandle||(this.watchHandle=w.watch(()=>this.view.extent,()=>this.updatePanelPosition())),this.trajectoryDelayTime===0?this.doHoloSignalData(e):setTimeout(()=>this.doHoloSignalData(e),this.trajectoryDelayTime*1e3)}clearSignal(){var e;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(e=this.watchHandle)==null||e.remove(),this.watchHandle=null}getPanelRotation(e){const t=e[0];let l=new d.Point({x:t[0],y:t[1]});this.view.spatialReference.isWebMercator&&(l=m.geographicToWebMercator(l));const i=this.view.toScreen(l),o=e[e.length-1];let n=new d.Point({x:o[0],y:o[1]});this.view.spatialReference.isWebMercator&&(n=m.geographicToWebMercator(n));const a=this.view.toScreen(n),s=a.x-i.x,r=a.y-i.y;return Math.atan2(r,s)*(180/Math.PI)}}exports.default=M;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.225",
3
+ "version": "1.0.226",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [