gisviewer-vue3-arcgis 1.0.224 → 1.0.225
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.
|
@@ -4,9 +4,9 @@ import * as u from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
|
4
4
|
import w from "@arcgis/core/layers/GraphicsLayer";
|
|
5
5
|
import P from "./signal-holo-flow.mjs";
|
|
6
6
|
class M extends P {
|
|
7
|
-
constructor(e,
|
|
7
|
+
constructor(e, a) {
|
|
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 =
|
|
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;
|
|
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:
|
|
26
|
+
const { roadId: s } = 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(
|
|
41
|
+
this.stopLineMap.set(s, {
|
|
42
42
|
coord: r,
|
|
43
43
|
panelPoint: o
|
|
44
44
|
});
|
|
@@ -49,9 +49,9 @@ class M extends P {
|
|
|
49
49
|
* 初始化灯组与进口道的关联关系
|
|
50
50
|
*/
|
|
51
51
|
initializeLampGroup(e) {
|
|
52
|
-
const { sigId:
|
|
52
|
+
const { sigId: a, lampGroupList: l } = e, i = [];
|
|
53
53
|
l.forEach((t) => {
|
|
54
|
-
const { lampGroupNo: n, lampGroupType:
|
|
54
|
+
const { lampGroupNo: n, lampGroupType: s, crossFlowList: o, pedList: r } = t;
|
|
55
55
|
o.length > 0 && o.forEach((c) => {
|
|
56
56
|
const h = c.upSectionId;
|
|
57
57
|
let p = "s";
|
|
@@ -69,13 +69,13 @@ class M extends P {
|
|
|
69
69
|
p = "u";
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
i.push({
|
|
73
73
|
lampGroupId: n,
|
|
74
74
|
roadId: h,
|
|
75
75
|
dir: p
|
|
76
76
|
});
|
|
77
77
|
}), r.length > 0;
|
|
78
|
-
}), this.lampGroupMap.set(
|
|
78
|
+
}), this.lampGroupMap.set(a, i);
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* 处理统一信控平台信号灯数据
|
|
@@ -86,15 +86,15 @@ class M extends P {
|
|
|
86
86
|
() => this.view.extent,
|
|
87
87
|
() => this.updatePanelPosition()
|
|
88
88
|
));
|
|
89
|
-
const { sigId:
|
|
89
|
+
const { sigId: a, runningStatus: l } = e.data.basicInfo, i = this.lampGroupMap.get(a);
|
|
90
90
|
if (!i)
|
|
91
91
|
return { status: -1, message: "灯组未初始化" };
|
|
92
92
|
const t = /* @__PURE__ */ new Map();
|
|
93
93
|
let n = !1;
|
|
94
94
|
switch (String(l)) {
|
|
95
95
|
case "4": {
|
|
96
|
-
n = !0, i.forEach((
|
|
97
|
-
const { roadId: o, dir: r } =
|
|
96
|
+
n = !0, i.forEach((s) => {
|
|
97
|
+
const { roadId: o, dir: r } = s;
|
|
98
98
|
t.set(o, {
|
|
99
99
|
...t.get(o) || {},
|
|
100
100
|
[`${r}Number`]: "",
|
|
@@ -104,8 +104,8 @@ class M extends P {
|
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
106
|
case "5": {
|
|
107
|
-
i.forEach((
|
|
108
|
-
const { roadId: o, dir: r } =
|
|
107
|
+
i.forEach((s) => {
|
|
108
|
+
const { roadId: o, dir: r } = s;
|
|
109
109
|
t.set(o, {
|
|
110
110
|
...t.get(o) || {},
|
|
111
111
|
[`${r}Number`]: "",
|
|
@@ -116,8 +116,8 @@ class M extends P {
|
|
|
116
116
|
}
|
|
117
117
|
case "6":
|
|
118
118
|
case "9": {
|
|
119
|
-
i.forEach((
|
|
120
|
-
const { roadId: o, dir: r } =
|
|
119
|
+
i.forEach((s) => {
|
|
120
|
+
const { roadId: o, dir: r } = s;
|
|
121
121
|
t.set(o, {
|
|
122
122
|
...t.get(o) || {},
|
|
123
123
|
[`${r}Number`]: "",
|
|
@@ -127,8 +127,8 @@ class M extends P {
|
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
129
|
default: {
|
|
130
|
-
const { curSigColorInfo:
|
|
131
|
-
|
|
130
|
+
const { curSigColorInfo: s } = e.data;
|
|
131
|
+
s.forEach((o) => {
|
|
132
132
|
const r = String(o.lamgroupId), { color: c, leftTime: h } = o, p = i.find(
|
|
133
133
|
(f) => f.lampGroupId === r
|
|
134
134
|
);
|
|
@@ -143,24 +143,24 @@ class M extends P {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
return this.updateLampGroupPanelStatus(
|
|
146
|
+
return this.updateLampGroupPanelStatus(a, t, n), { status: 0, message: "ok" };
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
149
|
* 根据地图比例尺计算灯组面板缩放比例
|
|
150
150
|
*/
|
|
151
151
|
getPanelScale() {
|
|
152
152
|
const e = this.view.scale;
|
|
153
|
-
let
|
|
154
|
-
return e < 1e3 ?
|
|
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;
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
157
|
* 地图移动时更新灯组面板位置
|
|
158
158
|
*/
|
|
159
159
|
updatePanelPosition() {
|
|
160
160
|
const e = this.getPanelScale();
|
|
161
|
-
for (const
|
|
162
|
-
e !== this.currentPanelScale && (
|
|
163
|
-
const { mapPoint: l } =
|
|
161
|
+
for (const a of this.countdownPanelProps) {
|
|
162
|
+
e !== this.currentPanelScale && (a.scale = e);
|
|
163
|
+
const { mapPoint: l } = a;
|
|
164
164
|
let i = new d({
|
|
165
165
|
x: l[0],
|
|
166
166
|
y: l[1]
|
|
@@ -169,15 +169,15 @@ class M extends P {
|
|
|
169
169
|
i
|
|
170
170
|
));
|
|
171
171
|
const t = this.view.toScreen(i);
|
|
172
|
-
if (
|
|
173
|
-
const n = this.getPanelRotation(
|
|
174
|
-
|
|
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;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
this.currentPanelScale = e;
|
|
178
178
|
}
|
|
179
179
|
doHoloSignalData(e) {
|
|
180
|
-
const
|
|
180
|
+
const a = e.crossId, l = e.phaseCountDownList, i = /* @__PURE__ */ new Map();
|
|
181
181
|
for (const t of l) {
|
|
182
182
|
let n = "";
|
|
183
183
|
for (let c of t.roadIdList)
|
|
@@ -186,27 +186,27 @@ class M extends P {
|
|
|
186
186
|
break;
|
|
187
187
|
}
|
|
188
188
|
if (!n) {
|
|
189
|
-
console.log(`没有找到对应的进口道${
|
|
189
|
+
console.log(`没有找到对应的进口道${a}--${n}`);
|
|
190
190
|
continue;
|
|
191
191
|
}
|
|
192
|
-
let
|
|
193
|
-
if (
|
|
192
|
+
let s = i.get(n);
|
|
193
|
+
if (s || (s = {}, i.set(n, s)), !t.direction)
|
|
194
194
|
continue;
|
|
195
195
|
const o = t.direction.toLowerCase(), r = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
|
|
196
|
-
o === "u" ? (
|
|
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);
|
|
197
197
|
}
|
|
198
|
-
this.updateLampGroupPanelStatus(
|
|
198
|
+
this.updateLampGroupPanelStatus(a, i);
|
|
199
199
|
}
|
|
200
|
-
updateLampGroupPanelStatus(e,
|
|
201
|
-
|
|
200
|
+
updateLampGroupPanelStatus(e, a, l = !1) {
|
|
201
|
+
a.forEach((i, t) => {
|
|
202
202
|
const n = this.stopLineMap.get(t);
|
|
203
203
|
if (!n)
|
|
204
204
|
return;
|
|
205
|
-
const
|
|
205
|
+
const s = this.countdownPanelProps.find(
|
|
206
206
|
(o) => o.roadId === t
|
|
207
207
|
);
|
|
208
|
-
if (
|
|
209
|
-
|
|
208
|
+
if (s)
|
|
209
|
+
s.lampStatus = i, s.flash = l;
|
|
210
210
|
else {
|
|
211
211
|
let o = new d({
|
|
212
212
|
x: n.panelPoint[0],
|
|
@@ -260,10 +260,10 @@ class M extends P {
|
|
|
260
260
|
* @returns
|
|
261
261
|
*/
|
|
262
262
|
getPanelRotation(e) {
|
|
263
|
-
const
|
|
263
|
+
const a = e[0];
|
|
264
264
|
let l = new d({
|
|
265
|
-
x:
|
|
266
|
-
y:
|
|
265
|
+
x: a[0],
|
|
266
|
+
y: a[1]
|
|
267
267
|
});
|
|
268
268
|
this.view.spatialReference.isWebMercator && (l = u.geographicToWebMercator(
|
|
269
269
|
l
|
|
@@ -276,7 +276,7 @@ class M extends P {
|
|
|
276
276
|
this.view.spatialReference.isWebMercator && (n = u.geographicToWebMercator(
|
|
277
277
|
n
|
|
278
278
|
));
|
|
279
|
-
const
|
|
279
|
+
const s = this.view.toScreen(n), o = s.x - i.x, r = s.y - i.y;
|
|
280
280
|
return Math.atan2(r, o) * (180 / Math.PI);
|
|
281
281
|
}
|
|
282
282
|
}
|
|
@@ -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: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;
|