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 g from "./signal-holo-flow.mjs";
6
- class S extends g {
7
- constructor(n, a) {
8
- super(n), this.stopLineLayer = new P(), this.watchHandle = null, this.stopLineMap = /* @__PURE__ */ new Map(), this.countdownPanelProps = a, this.view.map.add(this.stopLineLayer);
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: s, destinationPoint: i } = t.properties, { coordinates: r } = t.geometry, h = this.stopLineMap.get(e);
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: s
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: s }
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 a = 1;
36
- return n < 1e3 ? a = 1 : n < 2e3 ? a = 0.8 : a = 0.4, a;
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 s = new f({
46
+ let a = new f({
48
47
  x: e[0],
49
48
  y: e[1]
50
49
  });
51
- this.view.spatialReference.isWebMercator && (s = d.geographicToWebMercator(
52
- s
50
+ this.view.spatialReference.isWebMercator && (a = d.geographicToWebMercator(
51
+ a
53
52
  ));
54
- const i = this.view.toScreen(s);
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 a = n.crossId, c = this.stopLineMap.get(a);
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(`没有找到对应的方向${a}--${JSON.stringify(t)}`);
77
+ console.log(`没有找到对应的方向${s}--${JSON.stringify(t)}`);
79
78
  continue;
80
79
  }
81
- const s = t.direction.toLowerCase(), i = t.color === 1 ? "red" : t.color === 2 ? "yellow" : "green";
82
- s === "u" ? (e.uNumber = t.leftTime, e.uColor = i) : s === "l" ? (e.lNumber = t.leftTime, e.lColor = i) : s === "s" ? (e.sNumber = t.leftTime, e.sColor = i) : s === "r" && (e.rNumber = t.leftTime, e.rColor = i);
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 s = this.countdownPanelProps.find(
89
- (i) => i.crossId === a && i.roadId === o
87
+ const a = this.countdownPanelProps.find(
88
+ (i) => i.crossId === s && i.roadId === o
90
89
  );
91
- if (s)
92
- s.lampStatus = t;
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
- console.log(i.toJSON(), r), this.countdownPanelProps.push({
101
+ this.countdownPanelProps.push({
103
102
  displayMode: "complex",
104
- crossId: a,
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 a = n[0];
130
+ const s = n[0];
132
131
  let c = new f({
133
- x: a[0],
134
- y: a[1]
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, s = o.y - p.y;
148
- return Math.atan2(s, e) * (180 / Math.PI);
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
- S as default
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 o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const i in f)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(f,i);Object.defineProperty(o,i,l.get?l:{enumerable:!0,get:()=>f[i]})}}return o.default=f,Object.freeze(o)}const L=w(P),u=w(g);class M extends y.default{constructor(o,i){super(o),this.stopLineLayer=new m,this.watchHandle=null,this.stopLineMap=new Map,this.countdownPanelProps=i,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,(await(await fetch(o)).json()).features.forEach(t=>{const{roadId:n,nodeId:e,angle:a,destinationPoint:s}=t.properties,{coordinates:r}=t.geometry,h=this.stopLineMap.get(e);h?h.set(n,{coord:r,panelPoint:s,angle:a}):this.stopLineMap.set(e,new Map([[n,{coord:r,panelPoint:s,angle:a}]]))}),console.timeEnd("初始化停止线图层")}getPanelScale(){const o=this.view.scale;let i=1;return o<1e3?i=1:o<2e3?i=.8:i=.4,i}async handleSignalData(o){this.watchHandle||(this.watchHandle=L.watch(()=>this.view.extent,()=>{console.log("extent changed");const t=this.getPanelScale();for(const n of this.countdownPanelProps){t!==this.currentPanelScale&&(n.scale=t);const{mapPoint:e}=n;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(n.position.left=s.x,n.position.top=s.y,this.view.type==="3d"){const r=this.getPanelRotation(n.stopLine);n.rotation=r}}this.currentPanelScale=t}));const i=o.crossId,l=this.stopLineMap.get(i);if(!l)return;const p=o.phaseCountDownList,c=new Map;for(const t of p){let n="";for(let r of t.roadIdList)if(r.startsWith("-")&&(r=r.slice(1)),l.has(r)){n=r;break}if(!n)continue;let e=c.get(n);if(e||(e={},c.set(n,e)),!t.direction){console.log(`没有找到对应的方向${i}--${JSON.stringify(t)}`);continue}const a=t.direction.toLowerCase(),s=t.color===1?"red":t.color===2?"yellow":"green";a==="u"?(e.uNumber=t.leftTime,e.uColor=s):a==="l"?(e.lNumber=t.leftTime,e.lColor=s):a==="s"?(e.sNumber=t.leftTime,e.sColor=s):a==="r"&&(e.rNumber=t.leftTime,e.rColor=s)}c.forEach((t,n)=>{const e=l.get(n);if(!e)return;const a=this.countdownPanelProps.find(s=>s.crossId===i&&s.roadId===n);if(a)a.lampStatus=t;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);console.log(s.toJSON(),r),this.countdownPanelProps.push({displayMode:"complex",crossId:i,roadId:n,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 i=o[0];let l=new d.Point({x:i[0],y:i[1]});this.view.spatialReference.isWebMercator&&(l=u.geographicToWebMercator(l));const p=this.view.toScreen(l),c=o[o.length-1];let t=new d.Point({x:c[0],y:c[1]});this.view.spatialReference.isWebMercator&&(t=u.geographicToWebMercator(t));const n=this.view.toScreen(t),e=n.x-p.x,a=n.y-p.y;return Math.atan2(a,e)*(180/Math.PI)}}exports.default=M;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.173",
3
+ "version": "1.0.174",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [