gisviewer-vue3-arcgis 1.0.225 → 1.0.227
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
|
|
1
|
+
import * as w from "@arcgis/core/core/reactiveUtils";
|
|
2
2
|
import { Point as d } from "@arcgis/core/geometry";
|
|
3
3
|
import * as u from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
4
|
-
import
|
|
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,
|
|
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, this.trajectoryDelayTime === void 0 && (this.trajectoryDelayTime = 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: 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(
|
|
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:
|
|
52
|
+
const { sigId: s, lampGroupList: l } = e, i = [];
|
|
53
53
|
l.forEach((t) => {
|
|
54
|
-
const { lampGroupNo: n, lampGroupType:
|
|
55
|
-
o.length > 0
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
73
|
-
|
|
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 =
|
|
89
|
+
this.watchHandle || (this.watchHandle = w.watch(
|
|
86
90
|
() => this.view.extent,
|
|
87
91
|
() => this.updatePanelPosition()
|
|
88
92
|
));
|
|
89
|
-
const { sigId:
|
|
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((
|
|
97
|
-
const { roadId: o, dir: r } =
|
|
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((
|
|
108
|
-
const { roadId: o, dir: r } =
|
|
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((
|
|
120
|
-
const { roadId: o, dir: r } =
|
|
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:
|
|
131
|
-
|
|
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,24 +147,24 @@ class M extends P {
|
|
|
143
147
|
});
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
|
-
return this.updateLampGroupPanelStatus(
|
|
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
|
|
154
|
-
return e < 500 ?
|
|
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
|
|
162
|
-
e !== this.currentPanelScale && (
|
|
163
|
-
const { mapPoint: l } =
|
|
165
|
+
for (const s of this.countdownPanelProps) {
|
|
166
|
+
e !== this.currentPanelScale && (s.scale = e);
|
|
167
|
+
const { mapPoint: l } = s;
|
|
164
168
|
let i = new d({
|
|
165
169
|
x: l[0],
|
|
166
170
|
y: l[1]
|
|
@@ -169,15 +173,15 @@ class M extends P {
|
|
|
169
173
|
i
|
|
170
174
|
));
|
|
171
175
|
const t = this.view.toScreen(i);
|
|
172
|
-
if (
|
|
173
|
-
const n = this.getPanelRotation(
|
|
174
|
-
|
|
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
|
|
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,27 +190,27 @@ class M extends P {
|
|
|
186
190
|
break;
|
|
187
191
|
}
|
|
188
192
|
if (!n) {
|
|
189
|
-
console.log(`没有找到对应的进口道${
|
|
193
|
+
console.log(`没有找到对应的进口道${s}--${n}`);
|
|
190
194
|
continue;
|
|
191
195
|
}
|
|
192
|
-
let
|
|
193
|
-
if (
|
|
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" ? (
|
|
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(
|
|
202
|
+
this.updateLampGroupPanelStatus(s, i);
|
|
199
203
|
}
|
|
200
|
-
updateLampGroupPanelStatus(e,
|
|
201
|
-
|
|
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
|
|
209
|
+
const a = this.countdownPanelProps.find(
|
|
206
210
|
(o) => o.roadId === t
|
|
207
211
|
);
|
|
208
|
-
if (
|
|
209
|
-
|
|
212
|
+
if (a)
|
|
213
|
+
a.lampStatus = i, a.flash = l;
|
|
210
214
|
else {
|
|
211
215
|
let o = new d({
|
|
212
216
|
x: n.panelPoint[0],
|
|
@@ -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(
|
|
@@ -260,10 +264,10 @@ class M extends P {
|
|
|
260
264
|
* @returns
|
|
261
265
|
*/
|
|
262
266
|
getPanelRotation(e) {
|
|
263
|
-
const
|
|
267
|
+
const s = e[0];
|
|
264
268
|
let l = new d({
|
|
265
|
-
x:
|
|
266
|
-
y:
|
|
269
|
+
x: s[0],
|
|
270
|
+
y: s[1]
|
|
267
271
|
});
|
|
268
272
|
this.view.spatialReference.isWebMercator && (l = u.geographicToWebMercator(
|
|
269
273
|
l
|
|
@@ -276,7 +280,7 @@ class M extends P {
|
|
|
276
280
|
this.view.spatialReference.isWebMercator && (n = u.geographicToWebMercator(
|
|
277
281
|
n
|
|
278
282
|
));
|
|
279
|
-
const
|
|
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=(
|
|
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,this.trajectoryDelayTime===void 0&&(this.trajectoryDelayTime=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;if(a.length>0)for(const c of a){if(s===81)continue;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;
|