gisviewer-vue3-arcgis 1.0.173 → 1.0.174
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.
|
@@ -2,10 +2,10 @@ import * as w from "@arcgis/core/core/reactiveUtils";
|
|
|
2
2
|
import { Point as f } from "@arcgis/core/geometry";
|
|
3
3
|
import * as d from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
4
4
|
import P from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
-
import
|
|
6
|
-
class
|
|
7
|
-
constructor(n,
|
|
8
|
-
super(n), this.stopLineLayer = new P(), this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.countdownPanelProps =
|
|
5
|
+
import m from "./signal-holo-flow.mjs";
|
|
6
|
+
class M extends m {
|
|
7
|
+
constructor(n, s) {
|
|
8
|
+
super(n), this.stopLineLayer = new P(), this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = s, this.view.map.add(this.stopLineLayer);
|
|
9
9
|
}
|
|
10
10
|
async initializeLayer() {
|
|
11
11
|
var p, l;
|
|
@@ -14,17 +14,17 @@ class S extends g {
|
|
|
14
14
|
if (!n)
|
|
15
15
|
return;
|
|
16
16
|
n = this.mapConfig.assetsRoot + "/" + n, (await (await fetch(n)).json()).features.forEach((t) => {
|
|
17
|
-
const { roadId: o, nodeId: e, angle:
|
|
17
|
+
const { roadId: o, nodeId: e, angle: a, destinationPoint: i } = t.properties, { coordinates: r } = t.geometry, h = this.stopLineMap.get(e);
|
|
18
18
|
h ? h.set(o, {
|
|
19
19
|
coord: r,
|
|
20
20
|
panelPoint: i,
|
|
21
|
-
angle:
|
|
21
|
+
angle: a
|
|
22
22
|
}) : this.stopLineMap.set(
|
|
23
23
|
e,
|
|
24
24
|
/* @__PURE__ */ new Map([
|
|
25
25
|
[
|
|
26
26
|
o,
|
|
27
|
-
{ coord: r, panelPoint: i, angle:
|
|
27
|
+
{ coord: r, panelPoint: i, angle: a }
|
|
28
28
|
]
|
|
29
29
|
])
|
|
30
30
|
);
|
|
@@ -32,26 +32,25 @@ class S extends g {
|
|
|
32
32
|
}
|
|
33
33
|
getPanelScale() {
|
|
34
34
|
const n = this.view.scale;
|
|
35
|
-
let
|
|
36
|
-
return n < 1e3 ?
|
|
35
|
+
let s = 1;
|
|
36
|
+
return n < 1e3 ? s = 1 : n < 2e3 ? s = 0.8 : n < 4e3 ? s = 0.4 : s = 0, s;
|
|
37
37
|
}
|
|
38
38
|
async handleSignalData(n) {
|
|
39
39
|
this.watchHandle || (this.watchHandle = w.watch(
|
|
40
40
|
() => this.view.extent,
|
|
41
41
|
() => {
|
|
42
|
-
console.log("extent changed");
|
|
43
42
|
const t = this.getPanelScale();
|
|
44
43
|
for (const o of this.countdownPanelProps) {
|
|
45
44
|
t !== this.currentPanelScale && (o.scale = t);
|
|
46
45
|
const { mapPoint: e } = o;
|
|
47
|
-
let
|
|
46
|
+
let a = new f({
|
|
48
47
|
x: e[0],
|
|
49
48
|
y: e[1]
|
|
50
49
|
});
|
|
51
|
-
this.view.spatialReference.isWebMercator && (
|
|
52
|
-
|
|
50
|
+
this.view.spatialReference.isWebMercator && (a = d.geographicToWebMercator(
|
|
51
|
+
a
|
|
53
52
|
));
|
|
54
|
-
const i = this.view.toScreen(
|
|
53
|
+
const i = this.view.toScreen(a);
|
|
55
54
|
if (o.position.left = i.x, o.position.top = i.y, this.view.type === "3d") {
|
|
56
55
|
const r = this.getPanelRotation(o.stopLine);
|
|
57
56
|
o.rotation = r;
|
|
@@ -60,7 +59,7 @@ class S extends g {
|
|
|
60
59
|
this.currentPanelScale = t;
|
|
61
60
|
}
|
|
62
61
|
));
|
|
63
|
-
const
|
|
62
|
+
const s = n.crossId, c = this.stopLineMap.get(s);
|
|
64
63
|
if (!c)
|
|
65
64
|
return;
|
|
66
65
|
const p = n.phaseCountDownList, l = /* @__PURE__ */ new Map();
|
|
@@ -75,21 +74,21 @@ class S extends g {
|
|
|
75
74
|
continue;
|
|
76
75
|
let e = l.get(o);
|
|
77
76
|
if (e || (e = {}, l.set(o, e)), !t.direction) {
|
|
78
|
-
console.log(`没有找到对应的方向${
|
|
77
|
+
console.log(`没有找到对应的方向${s}--${JSON.stringify(t)}`);
|
|
79
78
|
continue;
|
|
80
79
|
}
|
|
81
|
-
const
|
|
82
|
-
|
|
80
|
+
const a = t.direction.toLowerCase(), i = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
|
|
81
|
+
a === "u" ? (e.uNumber = t.leftTime, e.uColor = i) : a === "l" ? (e.lNumber = t.leftTime, e.lColor = i) : a === "s" ? (e.sNumber = t.leftTime, e.sColor = i) : a === "r" && (e.rNumber = t.leftTime, e.rColor = i);
|
|
83
82
|
}
|
|
84
83
|
l.forEach((t, o) => {
|
|
85
84
|
const e = c.get(o);
|
|
86
85
|
if (!e)
|
|
87
86
|
return;
|
|
88
|
-
const
|
|
89
|
-
(i) => i.crossId ===
|
|
87
|
+
const a = this.countdownPanelProps.find(
|
|
88
|
+
(i) => i.crossId === s && i.roadId === o
|
|
90
89
|
);
|
|
91
|
-
if (
|
|
92
|
-
|
|
90
|
+
if (a)
|
|
91
|
+
a.lampStatus = t;
|
|
93
92
|
else {
|
|
94
93
|
let i = new f({
|
|
95
94
|
x: e.panelPoint[0],
|
|
@@ -99,9 +98,9 @@ class S extends g {
|
|
|
99
98
|
i
|
|
100
99
|
));
|
|
101
100
|
const r = this.view.toScreen(i), h = this.getPanelRotation(e.coord);
|
|
102
|
-
|
|
101
|
+
this.countdownPanelProps.push({
|
|
103
102
|
displayMode: "complex",
|
|
104
|
-
crossId:
|
|
103
|
+
crossId: s,
|
|
105
104
|
roadId: o,
|
|
106
105
|
mapPoint: e.panelPoint,
|
|
107
106
|
// 定位点地理坐标
|
|
@@ -128,10 +127,10 @@ class S extends g {
|
|
|
128
127
|
* @returns
|
|
129
128
|
*/
|
|
130
129
|
getPanelRotation(n) {
|
|
131
|
-
const
|
|
130
|
+
const s = n[0];
|
|
132
131
|
let c = new f({
|
|
133
|
-
x:
|
|
134
|
-
y:
|
|
132
|
+
x: s[0],
|
|
133
|
+
y: s[1]
|
|
135
134
|
});
|
|
136
135
|
this.view.spatialReference.isWebMercator && (c = d.geographicToWebMercator(
|
|
137
136
|
c
|
|
@@ -144,10 +143,10 @@ class S extends g {
|
|
|
144
143
|
this.view.spatialReference.isWebMercator && (t = d.geographicToWebMercator(
|
|
145
144
|
t
|
|
146
145
|
));
|
|
147
|
-
const o = this.view.toScreen(t), e = o.x - p.x,
|
|
148
|
-
return Math.atan2(
|
|
146
|
+
const o = this.view.toScreen(t), e = o.x - p.x, a = o.y - p.y;
|
|
147
|
+
return Math.atan2(a, e) * (180 / Math.PI);
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
150
|
export {
|
|
152
|
-
|
|
151
|
+
M as default
|
|
153
152
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),g=require("@arcgis/core/geometry/support/webMercatorUtils.js"),m=require("@arcgis/core/layers/GraphicsLayer"),y=require("./signal-holo-flow.js");function w(f){const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),g=require("@arcgis/core/geometry/support/webMercatorUtils.js"),m=require("@arcgis/core/layers/GraphicsLayer"),y=require("./signal-holo-flow.js");function w(f){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const n in f)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(f,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:()=>f[n]})}}return t.default=f,Object.freeze(t)}const L=w(P),u=w(g);class M extends y.default{constructor(t,n){super(t),this.stopLineLayer=new m,this.watchHandle=null,this.stopLineMap=new Map,this.countdownPanelProps=n,this.view.map.add(this.stopLineLayer)}async initializeLayer(){var p,c;console.time("初始化停止线图层");let t=(c=(p=this.mapConfig.holoFlow)==null?void 0:p.signal)==null?void 0:c.stopLineLayer;if(!t)return;t=this.mapConfig.assetsRoot+"/"+t,(await(await fetch(t)).json()).features.forEach(o=>{const{roadId:i,nodeId:e,angle:a,destinationPoint:s}=o.properties,{coordinates:r}=o.geometry,h=this.stopLineMap.get(e);h?h.set(i,{coord:r,panelPoint:s,angle:a}):this.stopLineMap.set(e,new Map([[i,{coord:r,panelPoint:s,angle:a}]]))}),console.timeEnd("初始化停止线图层")}getPanelScale(){const t=this.view.scale;let n=1;return t<1e3?n=1:t<2e3?n=.8:t<4e3?n=.4:n=0,n}async handleSignalData(t){this.watchHandle||(this.watchHandle=L.watch(()=>this.view.extent,()=>{const o=this.getPanelScale();for(const i of this.countdownPanelProps){o!==this.currentPanelScale&&(i.scale=o);const{mapPoint:e}=i;let a=new d.Point({x:e[0],y:e[1]});this.view.spatialReference.isWebMercator&&(a=u.geographicToWebMercator(a));const s=this.view.toScreen(a);if(i.position.left=s.x,i.position.top=s.y,this.view.type==="3d"){const r=this.getPanelRotation(i.stopLine);i.rotation=r}}this.currentPanelScale=o}));const n=t.crossId,l=this.stopLineMap.get(n);if(!l)return;const p=t.phaseCountDownList,c=new Map;for(const o of p){let i="";for(let r of o.roadIdList)if(r.startsWith("-")&&(r=r.slice(1)),l.has(r)){i=r;break}if(!i)continue;let e=c.get(i);if(e||(e={},c.set(i,e)),!o.direction){console.log(`没有找到对应的方向${n}--${JSON.stringify(o)}`);continue}const a=o.direction.toLowerCase(),s=o.color===1?"red":o.color===2?"yellow":"green";a==="u"?(e.uNumber=o.leftTime,e.uColor=s):a==="l"?(e.lNumber=o.leftTime,e.lColor=s):a==="s"?(e.sNumber=o.leftTime,e.sColor=s):a==="r"&&(e.rNumber=o.leftTime,e.rColor=s)}c.forEach((o,i)=>{const e=l.get(i);if(!e)return;const a=this.countdownPanelProps.find(s=>s.crossId===n&&s.roadId===i);if(a)a.lampStatus=o;else{let s=new d.Point({x:e.panelPoint[0],y:e.panelPoint[1]});this.view.spatialReference.isWebMercator&&(s=u.geographicToWebMercator(s));const r=this.view.toScreen(s),h=this.getPanelRotation(e.coord);this.countdownPanelProps.push({displayMode:"complex",crossId:n,roadId:i,mapPoint:e.panelPoint,stopLine:e.coord,position:{left:r.x,top:r.y},rotation:h,scale:this.getPanelScale(),lampStatus:o})}})}clearSignal(){var t;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(t=this.watchHandle)==null||t.remove(),this.watchHandle=null}getPanelRotation(t){const n=t[0];let l=new d.Point({x:n[0],y:n[1]});this.view.spatialReference.isWebMercator&&(l=u.geographicToWebMercator(l));const p=this.view.toScreen(l),c=t[t.length-1];let o=new d.Point({x:c[0],y:c[1]});this.view.spatialReference.isWebMercator&&(o=u.geographicToWebMercator(o));const i=this.view.toScreen(o),e=i.x-p.x,a=i.y-p.y;return Math.atan2(a,e)*(180/Math.PI)}}exports.default=M;
|