gisviewer-vue3-arcgis 1.0.220 → 1.0.221
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.
|
@@ -3,23 +3,31 @@ import { Point as h } from "@arcgis/core/geometry";
|
|
|
3
3
|
import * as d from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
4
4
|
import u from "@arcgis/core/layers/GraphicsLayer";
|
|
5
5
|
import y from "./signal-holo-flow.mjs";
|
|
6
|
-
class
|
|
6
|
+
class b extends y {
|
|
7
7
|
constructor(s, a) {
|
|
8
8
|
super(s), this.stopLineLayer = new u(), this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = a, this.view.map.add(this.stopLineLayer);
|
|
9
9
|
}
|
|
10
10
|
async initializeLayer() {
|
|
11
|
-
var p,
|
|
11
|
+
var p, c;
|
|
12
12
|
console.time("初始化停止线图层");
|
|
13
|
-
let s = (
|
|
13
|
+
let s = (c = (p = this.mapConfig.holoFlow) == null ? void 0 : p.signal) == null ? void 0 : c.stopLineLayer;
|
|
14
14
|
if (!s)
|
|
15
15
|
return;
|
|
16
|
-
s = this.mapConfig.assetsRoot + "/" + s
|
|
16
|
+
s = this.mapConfig.assetsRoot + "/" + s;
|
|
17
|
+
const l = await (await fetch(s)).json();
|
|
18
|
+
for (const t of l.features) {
|
|
17
19
|
const { roadId: o, nodeId: e } = t.properties;
|
|
18
20
|
let { destinationPoint: n } = t.properties;
|
|
19
21
|
const { coordinates: i } = t.geometry;
|
|
20
|
-
if (n)
|
|
21
|
-
typeof n == "string"
|
|
22
|
-
|
|
22
|
+
if (n) {
|
|
23
|
+
if (typeof n == "string")
|
|
24
|
+
try {
|
|
25
|
+
n = JSON.parse(n);
|
|
26
|
+
} catch (f) {
|
|
27
|
+
console.error("解析面板基准点失败", f);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
23
31
|
const f = i[0], w = i[i.length - 1], P = (f[0] + w[0]) / 2, m = (f[1] + w[1]) / 2;
|
|
24
32
|
n = [P, m];
|
|
25
33
|
}
|
|
@@ -33,7 +41,8 @@ class v extends y {
|
|
|
33
41
|
[o, { coord: i, panelPoint: n }]
|
|
34
42
|
])
|
|
35
43
|
);
|
|
36
|
-
}
|
|
44
|
+
}
|
|
45
|
+
console.timeEnd("初始化停止线图层");
|
|
37
46
|
}
|
|
38
47
|
getPanelScale() {
|
|
39
48
|
const s = this.view.scale;
|
|
@@ -64,29 +73,29 @@ class v extends y {
|
|
|
64
73
|
this.currentPanelScale = t;
|
|
65
74
|
}
|
|
66
75
|
));
|
|
67
|
-
const a = s.crossId,
|
|
68
|
-
if (!
|
|
76
|
+
const a = s.crossId, l = this.stopLineMap.get(a);
|
|
77
|
+
if (!l)
|
|
69
78
|
return;
|
|
70
|
-
const p = s.phaseCountDownList,
|
|
79
|
+
const p = s.phaseCountDownList, c = /* @__PURE__ */ new Map();
|
|
71
80
|
for (const t of p) {
|
|
72
81
|
let o = "";
|
|
73
82
|
for (let r of t.roadIdList)
|
|
74
|
-
if (r.startsWith("-") && (r = r.slice(1)),
|
|
83
|
+
if (r.startsWith("-") && (r = r.slice(1)), l.has(r)) {
|
|
75
84
|
o = r;
|
|
76
85
|
break;
|
|
77
86
|
}
|
|
78
87
|
if (!o)
|
|
79
88
|
continue;
|
|
80
|
-
let e =
|
|
81
|
-
if (e || (e = {},
|
|
89
|
+
let e = c.get(o);
|
|
90
|
+
if (e || (e = {}, c.set(o, e)), !t.direction) {
|
|
82
91
|
console.log(`没有找到对应的方向${a}--${JSON.stringify(t)}`);
|
|
83
92
|
continue;
|
|
84
93
|
}
|
|
85
94
|
const n = t.direction.toLowerCase(), i = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
|
|
86
95
|
n === "u" ? (e.uNumber = t.leftTime, e.uColor = i) : n === "l" ? (e.lNumber = t.leftTime, e.lColor = i) : n === "s" ? (e.sNumber = t.leftTime, e.sColor = i) : n === "r" && (e.rNumber = t.leftTime, e.rColor = i);
|
|
87
96
|
}
|
|
88
|
-
|
|
89
|
-
const e =
|
|
97
|
+
c.forEach((t, o) => {
|
|
98
|
+
const e = l.get(o);
|
|
90
99
|
if (!e)
|
|
91
100
|
return;
|
|
92
101
|
const n = this.countdownPanelProps.find(
|
|
@@ -133,17 +142,17 @@ class v extends y {
|
|
|
133
142
|
*/
|
|
134
143
|
getPanelRotation(s) {
|
|
135
144
|
const a = s[0];
|
|
136
|
-
let
|
|
145
|
+
let l = new h({
|
|
137
146
|
x: a[0],
|
|
138
147
|
y: a[1]
|
|
139
148
|
});
|
|
140
|
-
this.view.spatialReference.isWebMercator && (
|
|
141
|
-
|
|
149
|
+
this.view.spatialReference.isWebMercator && (l = d.geographicToWebMercator(
|
|
150
|
+
l
|
|
142
151
|
));
|
|
143
|
-
const p = this.view.toScreen(
|
|
152
|
+
const p = this.view.toScreen(l), c = s[s.length - 1];
|
|
144
153
|
let t = new h({
|
|
145
|
-
x:
|
|
146
|
-
y:
|
|
154
|
+
x: c[0],
|
|
155
|
+
y: c[1]
|
|
147
156
|
});
|
|
148
157
|
this.view.spatialReference.isWebMercator && (t = d.geographicToWebMercator(
|
|
149
158
|
t
|
|
@@ -153,5 +162,5 @@ class v extends y {
|
|
|
153
162
|
}
|
|
154
163
|
}
|
|
155
164
|
export {
|
|
156
|
-
|
|
165
|
+
b as default
|
|
157
166
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/core/reactiveUtils"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/core/reactiveUtils"),u=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/support/webMercatorUtils.js"),M=require("@arcgis/core/layers/GraphicsLayer"),S=require("./signal-holo-flow.js");function P(f){const o=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(o,n,l.get?l:{enumerable:!0,get:()=>f[n]})}}return o.default=f,Object.freeze(o)}const b=P(y),d=P(L);class v extends S.default{constructor(o,n){super(o),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 o=(c=(p=this.mapConfig.holoFlow)==null?void 0:p.signal)==null?void 0:c.stopLineLayer;if(!o)return;o=this.mapConfig.assetsRoot+"/"+o;const l=await(await fetch(o)).json();for(const t of l.features){const{roadId:i,nodeId:e}=t.properties;let{destinationPoint:s}=t.properties;const{coordinates:a}=t.geometry;if(s){if(typeof s=="string")try{s=JSON.parse(s)}catch(h){console.error("解析面板基准点失败",h);continue}}else{const h=a[0],w=a[a.length-1],g=(h[0]+w[0])/2,m=(h[1]+w[1])/2;s=[g,m]}const r=this.stopLineMap.get(e);r?r.set(i,{coord:a,panelPoint:s}):this.stopLineMap.set(e,new Map([[i,{coord:a,panelPoint:s}]]))}console.timeEnd("初始化停止线图层")}getPanelScale(){const o=this.view.scale;let n=1;return o<1e3?n=1:o<2e3?n=.8:o<4e3?n=.4:n=0,n}async handleSignalData(o){this.watchHandle||(this.watchHandle=b.watch(()=>this.view.extent,()=>{const t=this.getPanelScale();for(const i of this.countdownPanelProps){t!==this.currentPanelScale&&(i.scale=t);const{mapPoint:e}=i;let s=new u.Point({x:e[0],y:e[1]});this.view.spatialReference.isWebMercator&&(s=d.geographicToWebMercator(s));const a=this.view.toScreen(s);if(i.position.left=a.x,i.position.top=a.y,this.view.type==="3d"){const r=this.getPanelRotation(i.stopLine);i.rotation=r}}this.currentPanelScale=t}));const n=o.crossId,l=this.stopLineMap.get(n);if(!l)return;const p=o.phaseCountDownList,c=new Map;for(const t of p){let i="";for(let r of t.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)),!t.direction){console.log(`没有找到对应的方向${n}--${JSON.stringify(t)}`);continue}const s=t.direction.toLowerCase(),a=t.color===1?"red":t.color===2?"yellow":"green";s==="u"?(e.uNumber=t.leftTime,e.uColor=a):s==="l"?(e.lNumber=t.leftTime,e.lColor=a):s==="s"?(e.sNumber=t.leftTime,e.sColor=a):s==="r"&&(e.rNumber=t.leftTime,e.rColor=a)}c.forEach((t,i)=>{const e=l.get(i);if(!e)return;const s=this.countdownPanelProps.find(a=>a.crossId===n&&a.roadId===i);if(s)s.lampStatus=t;else{let a=new u.Point({x:e.panelPoint[0],y:e.panelPoint[1]});this.view.spatialReference.isWebMercator&&(a=d.geographicToWebMercator(a));const r=this.view.toScreen(a),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:t})}})}clearSignal(){var o;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(o=this.watchHandle)==null||o.remove(),this.watchHandle=null}getPanelRotation(o){const n=o[0];let l=new u.Point({x:n[0],y:n[1]});this.view.spatialReference.isWebMercator&&(l=d.geographicToWebMercator(l));const p=this.view.toScreen(l),c=o[o.length-1];let t=new u.Point({x:c[0],y:c[1]});this.view.spatialReference.isWebMercator&&(t=d.geographicToWebMercator(t));const i=this.view.toScreen(t),e=i.x-p.x,s=i.y-p.y;return Math.atan2(s,e)*(180/Math.PI)}}exports.default=v;
|