gisviewer-vue3-arcgis 1.0.224 → 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
|
|
2
|
-
import { Point as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
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
7
|
constructor(e, s) {
|
|
8
8
|
var l, i;
|
|
9
|
-
super(e), this.stopLineLayer = new
|
|
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
|
* 读取停止线图层,将灯组面板沿着停止线放置
|
|
@@ -52,29 +52,33 @@ class M extends P {
|
|
|
52
52
|
const { sigId: s, lampGroupList: l } = e, i = [];
|
|
53
53
|
l.forEach((t) => {
|
|
54
54
|
const { lampGroupNo: n, lampGroupType: a, crossFlowList: o, pedList: r } = t;
|
|
55
|
-
o.length > 0
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
73
|
-
lampGroupId: n,
|
|
74
|
-
roadId: h,
|
|
75
|
-
dir: p
|
|
76
|
-
});
|
|
77
|
-
}), r.length > 0;
|
|
81
|
+
r.length > 0;
|
|
78
82
|
}), this.lampGroupMap.set(s, i);
|
|
79
83
|
}
|
|
80
84
|
/**
|
|
@@ -82,7 +86,7 @@ class M extends P {
|
|
|
82
86
|
* @param data
|
|
83
87
|
*/
|
|
84
88
|
handleUniSignalData(e) {
|
|
85
|
-
this.watchHandle || (this.watchHandle =
|
|
89
|
+
this.watchHandle || (this.watchHandle = w.watch(
|
|
86
90
|
() => this.view.extent,
|
|
87
91
|
() => this.updatePanelPosition()
|
|
88
92
|
));
|
|
@@ -151,7 +155,7 @@ class M extends P {
|
|
|
151
155
|
getPanelScale() {
|
|
152
156
|
const e = this.view.scale;
|
|
153
157
|
let s = 1;
|
|
154
|
-
return e < 1e3 ? s = 1 : e < 2e3 ? s = 0.8 : e < 4e3 ? s = 0.4 : s = 0, s;
|
|
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
|
* 地图移动时更新灯组面板位置
|
|
@@ -161,11 +165,11 @@ class M extends P {
|
|
|
161
165
|
for (const s of this.countdownPanelProps) {
|
|
162
166
|
e !== this.currentPanelScale && (s.scale = e);
|
|
163
167
|
const { mapPoint: l } = s;
|
|
164
|
-
let i = new
|
|
168
|
+
let i = new u({
|
|
165
169
|
x: l[0],
|
|
166
170
|
y: l[1]
|
|
167
171
|
});
|
|
168
|
-
this.view.spatialReference.isWebMercator && (i =
|
|
172
|
+
this.view.spatialReference.isWebMercator && (i = d.geographicToWebMercator(
|
|
169
173
|
i
|
|
170
174
|
));
|
|
171
175
|
const t = this.view.toScreen(i);
|
|
@@ -208,11 +212,11 @@ class M extends P {
|
|
|
208
212
|
if (a)
|
|
209
213
|
a.lampStatus = i, a.flash = l;
|
|
210
214
|
else {
|
|
211
|
-
let o = new
|
|
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 =
|
|
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 =
|
|
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(
|
|
@@ -261,19 +265,19 @@ class M extends P {
|
|
|
261
265
|
*/
|
|
262
266
|
getPanelRotation(e) {
|
|
263
267
|
const s = e[0];
|
|
264
|
-
let l = new
|
|
268
|
+
let l = new u({
|
|
265
269
|
x: s[0],
|
|
266
270
|
y: s[1]
|
|
267
271
|
});
|
|
268
|
-
this.view.spatialReference.isWebMercator && (l =
|
|
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
|
|
276
|
+
let n = new u({
|
|
273
277
|
x: t[0],
|
|
274
278
|
y: t[1]
|
|
275
279
|
});
|
|
276
|
-
this.view.spatialReference.isWebMercator && (n =
|
|
280
|
+
this.view.spatialReference.isWebMercator && (n = d.geographicToWebMercator(
|
|
277
281
|
n
|
|
278
282
|
));
|
|
279
283
|
const a = this.view.toScreen(n), o = a.x - i.x, r = a.y - i.y;
|
|
@@ -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
|
|
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;
|