gisviewer-vue3-arcgis 1.0.147 → 1.0.148

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.
@@ -55,7 +55,7 @@ class n {
55
55
  this.traceHoloFlow.updatePanelContent(o);
56
56
  }
57
57
  async handleSignalData(e) {
58
- this.signalHoloFlow || (this.signalHoloFlow = new a(this.view)), await this.signalHoloFlow.initializeLayer(), await this.signalHoloFlow.handleSignalData(e);
58
+ this.signalHoloFlow || (this.signalHoloFlow = new a(this.view), await this.signalHoloFlow.initializeLayer()), await this.signalHoloFlow.handleSignalData(e);
59
59
  }
60
60
  clearHoloSignal() {
61
61
  var e;
@@ -5,14 +5,19 @@ import u from "../../stores/index.mjs";
5
5
  class f {
6
6
  constructor(e) {
7
7
  this.currentPhaseMap = /* @__PURE__ */ new Map(), this.countdownCanvasMap = /* @__PURE__ */ new Map(), this.lastDataTime = 0, this.isDeletingCanvas = !1, this.canvasWidth = 80, this.canvasHeight = 40, this.view = (e.type === "2d", e);
8
- const a = u.useAppDataStore;
9
- this.mapConfig = JSON.parse(JSON.stringify(a.mapConfig));
8
+ const t = u.useAppDataStore;
9
+ this.mapConfig = JSON.parse(JSON.stringify(t.mapConfig));
10
10
  }
11
11
  /**
12
12
  * 初始化相位线图层
13
13
  * */
14
14
  async initializeLayer() {
15
- if (await this.initializePlateBackground(), !!this.mapConfig.phaseLineLayer)
15
+ try {
16
+ await this.initializePlateBackground();
17
+ } catch (e) {
18
+ console.log("倒计时背景图片加载失败", e);
19
+ }
20
+ if (this.mapConfig.phaseLineLayer)
16
21
  if (this.phaseLineLayer)
17
22
  this.phaseLineLayer.visible || (this.phaseLineLayer.visible = !0);
18
23
  else {
@@ -106,22 +111,22 @@ class f {
106
111
  }
107
112
  }
108
113
  async initializePlateBackground() {
109
- return new Promise((e, a) => {
110
- const t = new Image();
111
- t.src = `${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`, t.onload = () => {
112
- this.plateBackground = t, e();
113
- }, t.onerror = (s) => {
114
- a(s);
114
+ return new Promise((e, t) => {
115
+ const a = new Image();
116
+ a.src = `${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`, a.onload = () => {
117
+ this.plateBackground = a, e();
118
+ }, a.onerror = (s) => {
119
+ t(s);
115
120
  };
116
121
  });
117
122
  }
118
123
  async handleSignalData(e) {
119
- const { crossId: a, lat: t, lon: s, rtStage: n, channelsConfig: i } = e;
120
- await this.updateCountdown(a, t, s, n), !(!this.phaseLineLayer || !i) && ((!this.currentPhaseMap.has(a) || this.currentPhaseMap.get(a) !== n.stagePhase) && await this.updatePhaseLine(
121
- a,
124
+ const { crossId: t, lat: a, lon: s, rtStage: n, channelsConfig: i } = e;
125
+ await this.updateCountdown(t, a, s, n), !(!this.phaseLineLayer || !i) && ((!this.currentPhaseMap.has(t) || this.currentPhaseMap.get(t) !== n.stagePhase) && await this.updatePhaseLine(
126
+ t,
122
127
  n.channelsConfig,
123
128
  i
124
- ), this.currentPhaseMap.set(a, n.stagePhase));
129
+ ), this.currentPhaseMap.set(t, n.stagePhase));
125
130
  }
126
131
  /**
127
132
  * 清除实时信号相关图层
@@ -134,7 +139,7 @@ class f {
134
139
  /**
135
140
  * 获取显示倒计时的canvas
136
141
  * */
137
- async updateCountdown(e, a, t, s) {
142
+ async updateCountdown(e, t, a, s) {
138
143
  if (this.isDeletingCanvas)
139
144
  return;
140
145
  const n = this.countdownCanvasMap.get(e);
@@ -143,8 +148,8 @@ class f {
143
148
  else
144
149
  try {
145
150
  const i = new c({
146
- longitude: t,
147
- latitude: a,
151
+ longitude: a,
152
+ latitude: t,
148
153
  z: 10
149
154
  }), o = this.view.toScreen(i), l = this.createCountdownCanvas();
150
155
  if (!l)
@@ -177,19 +182,19 @@ class f {
177
182
  * @param rtStage.stageAllRedTime 全红时间
178
183
  * @param rtStage.stageYellowTime 黄灯时间
179
184
  */
180
- drawCountdownText(e, a) {
181
- const t = e.getContext("2d");
182
- t.clearRect(0, 0, e.width, e.height), t.font = "24px Digital", t.textBaseline = "middle", t.textAlign = "center", t.fillStyle = a.stageRemainingTime <= a.stageAllRedTime ? "red" : a.stageRemainingTime <= a.stageAllRedTime + a.stageYellowTime ? "yellow" : "lime", t.fillText(
183
- `${a.stageID} ${a.stageRemainingTime.toFixed(0)}`,
185
+ drawCountdownText(e, t) {
186
+ const a = e.getContext("2d");
187
+ 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(
188
+ `${t.stageID} ${t.stageRemainingTime.toFixed(0)}`,
184
189
  e.width / 2,
185
190
  e.height / 2
186
191
  );
187
192
  }
188
- drawCircle(e, a) {
189
- console.log(a);
190
- const t = e.getContext("2d");
191
- t.clearRect(0, 0, e.width, e.height), this.ctxDraw(
192
- t,
193
+ drawCircle(e, t) {
194
+ console.log(t);
195
+ const a = e.getContext("2d");
196
+ a.clearRect(0, 0, e.width, e.height), this.ctxDraw(
197
+ a,
193
198
  "lime",
194
199
  e.width / 2,
195
200
  e.height / 2,
@@ -198,16 +203,16 @@ class f {
198
203
  -Math.PI / 2 + 2 * 0.6 * Math.PI
199
204
  );
200
205
  }
201
- ctxDraw(e, a, t, s, n, i, o) {
202
- e.save, e.beginPath(), e.lineWidth = 4, e.strokeStyle = a, e.arc(t, s, n, i, o), e.stroke(), e.closePath(), e.font = "26px Digital", e.textBaseline = "middle", e.textAlign = "center", e.fillText("A", t, s), e.restore();
206
+ ctxDraw(e, t, a, s, n, i, o) {
207
+ 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();
203
208
  }
204
- async updatePhaseLine(e, a, t) {
209
+ async updatePhaseLine(e, t, a) {
205
210
  const s = this.phaseLineLayer.source.filter(
206
211
  (n) => n.getAttribute("id").includes(e)
207
212
  );
208
213
  s.forEach((n) => {
209
214
  const i = n.getAttribute("id");
210
- this.isLaneInChannels(i, a) ? n.setAttribute("color", "green") : this.isLaneInChannels(i, t) ? n.setAttribute("color", "red") : n.setAttribute("color", "green");
215
+ this.isLaneInChannels(i, t) ? n.setAttribute("color", "green") : this.isLaneInChannels(i, a) ? n.setAttribute("color", "red") : n.setAttribute("color", "green");
211
216
  }), await this.phaseLineLayer.applyEdits({ updateFeatures: s });
212
217
  }
213
218
  /**
@@ -216,29 +221,29 @@ class f {
216
221
  * @param channels 通道列表
217
222
  * @returns
218
223
  */
219
- isLaneInChannels(e, a) {
220
- const t = e.split("+"), s = t[1], n = t[2];
221
- for (let i = 0; i < a.length; i++)
222
- for (let o = 0; o < a[i].laneSnList.length; o++) {
223
- const l = a[i].laneSnList[o].toFixed(0);
224
+ isLaneInChannels(e, t) {
225
+ const a = e.split("+"), s = a[1], n = a[2];
226
+ for (let i = 0; i < t.length; i++)
227
+ for (let o = 0; o < t[i].laneSnList.length; o++) {
228
+ const l = t[i].laneSnList[o].toFixed(0);
224
229
  if (s === l[0] && n === l[1])
225
230
  return !0;
226
231
  }
227
232
  return !1;
228
233
  }
229
234
  createCountdownCanvas() {
230
- if (!this.plateBackground)
231
- return;
232
235
  const e = document.createElement("canvas");
233
- e.width = this.canvasWidth, e.height = this.canvasHeight, e.style.position = "absolute", e.style.transform = "translate(-50%, -50%)", e.getContext("2d").drawImage(
236
+ e.width = this.canvasWidth, e.height = this.canvasHeight, e.style.position = "absolute", e.style.transform = "translate(-50%, -50%)";
237
+ const t = e.getContext("2d");
238
+ this.plateBackground ? t.drawImage(
234
239
  this.plateBackground,
235
240
  0,
236
241
  0,
237
242
  this.canvasWidth,
238
243
  this.canvasHeight
239
- ), this.view.container.appendChild(e);
240
- const t = document.createElement("canvas");
241
- return t.width = this.canvasWidth - 10, t.height = this.canvasHeight - 10, t.style.position = "absolute", t.style.transform = "translate(-50%, -50%)", this.view.container.appendChild(t), [e, t];
244
+ ) : (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);
245
+ const a = document.createElement("canvas");
246
+ 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];
242
247
  }
243
248
  }
244
249
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../types/index.js"),a=require("./signal-holo-flow.js"),o=require("./trace-holo-flow.js");class i{constructor(e){this.view=e}async init(){this.traceHoloFlow=new o.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let l=t.EVehiclePlateState.None;switch(e){case"none":l=t.EVehiclePlateState.None;break;case"plateNumber":l=t.EVehiclePlateState.PlateNumber;break;case"vehicleId":l=t.EVehiclePlateState.Id;break;case"mix":l=t.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(l)}async handleSignalData(e){this.signalHoloFlow||(this.signalHoloFlow=new a.default(this.view)),await this.signalHoloFlow.initializeLayer(),await this.signalHoloFlow.handleSignalData(e)}clearHoloSignal(){var e;(e=this.signalHoloFlow)==null||e.clearSignal()}setInterpolate(e){this.traceHoloFlow.setInterpolate(e)}downloadTrackLog(){this.traceHoloFlow.downloadLog()}}exports.default=i;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../types/index.js"),a=require("./signal-holo-flow.js"),o=require("./trace-holo-flow.js");class i{constructor(e){this.view=e}async init(){this.traceHoloFlow=new o.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let l=t.EVehiclePlateState.None;switch(e){case"none":l=t.EVehiclePlateState.None;break;case"plateNumber":l=t.EVehiclePlateState.PlateNumber;break;case"vehicleId":l=t.EVehiclePlateState.Id;break;case"mix":l=t.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(l)}async handleSignalData(e){this.signalHoloFlow||(this.signalHoloFlow=new a.default(this.view),await this.signalHoloFlow.initializeLayer()),await this.signalHoloFlow.handleSignalData(e)}clearHoloSignal(){var e;(e=this.signalHoloFlow)==null||e.clearSignal()}setInterpolate(e){this.traceHoloFlow.setInterpolate(e)}downloadTrackLog(){this.traceHoloFlow.downloadLog()}}exports.default=i;
@@ -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("../../stores/index.js");function y(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(e,a,t.get?t:{enumerable:!0,get:()=>r[a]})}}return e.default=r,Object.freeze(e)}const w=y(d);class f{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 a=g.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(a.mapConfig))}async initializeLayer(){if(await this.initializePlateBackground(),!!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((i,n)=>({geometry:{type:"polyline",paths:[i.geometry.coordinates]},attributes:{ObjectID:n+1,id:i.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,a)=>{const t=new Image;t.src=`${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`,t.onload=()=>{this.plateBackground=t,e()},t.onerror=s=>{a(s)}})}async handleSignalData(e){const{crossId:a,lat:t,lon:s,rtStage:i,channelsConfig:n}=e;await this.updateCountdown(a,t,s,i),!(!this.phaseLineLayer||!n)&&((!this.currentPhaseMap.has(a)||this.currentPhaseMap.get(a)!==i.stagePhase)&&await this.updatePhaseLine(a,i.channelsConfig,n),this.currentPhaseMap.set(a,i.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,a,t,s){if(this.isDeletingCanvas)return;const i=this.countdownCanvasMap.get(e);if(i)this.drawCountdownText(i.countdownCanvas,s);else try{const n=new u.Point({longitude:t,latitude:a,z:10}),o=this.view.toScreen(n),l=this.createCountdownCanvas();if(!l)return;const c=l[0],h=l[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:n}),this.drawCountdownText(h,s)}catch(n){console.log("倒计时canvas创建失败",e,n)}this.countdownWatchHandel||(this.countdownWatchHandel=w.watch(()=>this.view.extent,()=>{this.countdownCanvasMap.forEach(n=>{const o=this.view.toScreen(n.mapPoint);n.backgroundCanvas.style.left=o.x+"px",n.backgroundCanvas.style.top=o.y+"px",n.countdownCanvas.style.left=o.x+"px",n.countdownCanvas.style.top=o.y+"px"})}))}drawCountdownText(e,a){const t=e.getContext("2d");t.clearRect(0,0,e.width,e.height),t.font="24px Digital",t.textBaseline="middle",t.textAlign="center",t.fillStyle=a.stageRemainingTime<=a.stageAllRedTime?"red":a.stageRemainingTime<=a.stageAllRedTime+a.stageYellowTime?"yellow":"lime",t.fillText(`${a.stageID} ${a.stageRemainingTime.toFixed(0)}`,e.width/2,e.height/2)}drawCircle(e,a){console.log(a);const t=e.getContext("2d");t.clearRect(0,0,e.width,e.height),this.ctxDraw(t,"lime",e.width/2,e.height/2,20,-Math.PI/2,-Math.PI/2+2*.6*Math.PI)}ctxDraw(e,a,t,s,i,n,o){e.save,e.beginPath(),e.lineWidth=4,e.strokeStyle=a,e.arc(t,s,i,n,o),e.stroke(),e.closePath(),e.font="26px Digital",e.textBaseline="middle",e.textAlign="center",e.fillText("A",t,s),e.restore()}async updatePhaseLine(e,a,t){const s=this.phaseLineLayer.source.filter(i=>i.getAttribute("id").includes(e));s.forEach(i=>{const n=i.getAttribute("id");this.isLaneInChannels(n,a)?i.setAttribute("color","green"):this.isLaneInChannels(n,t)?i.setAttribute("color","red"):i.setAttribute("color","green")}),await this.phaseLineLayer.applyEdits({updateFeatures:s})}isLaneInChannels(e,a){const t=e.split("+"),s=t[1],i=t[2];for(let n=0;n<a.length;n++)for(let o=0;o<a[n].laneSnList.length;o++){const l=a[n].laneSnList[o].toFixed(0);if(s===l[0]&&i===l[1])return!0}return!1}createCountdownCanvas(){if(!this.plateBackground)return;const e=document.createElement("canvas");e.width=this.canvasWidth,e.height=this.canvasHeight,e.style.position="absolute",e.style.transform="translate(-50%, -50%)",e.getContext("2d").drawImage(this.plateBackground,0,0,this.canvasWidth,this.canvasHeight),this.view.container.appendChild(e);const t=document.createElement("canvas");return t.width=this.canvasWidth-10,t.height=this.canvasHeight-10,t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.view.container.appendChild(t),[e,t]}}exports.default=f;
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("../../stores/index.js");function y(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 w=y(d);class f{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=g.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(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=w.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=f;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.147",
3
+ "version": "1.0.148",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [