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 v extends y {
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, l;
11
+ var p, c;
12
12
  console.time("初始化停止线图层");
13
- let s = (l = (p = this.mapConfig.holoFlow) == null ? void 0 : p.signal) == null ? void 0 : l.stopLineLayer;
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, (await (await fetch(s)).json()).features.forEach((t) => {
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" && (n = n.split(",").map(Number));
22
- else {
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
- }), console.timeEnd("初始化停止线图层");
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, c = this.stopLineMap.get(a);
68
- if (!c)
76
+ const a = s.crossId, l = this.stopLineMap.get(a);
77
+ if (!l)
69
78
  return;
70
- const p = s.phaseCountDownList, l = /* @__PURE__ */ new Map();
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)), c.has(r)) {
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 = l.get(o);
81
- if (e || (e = {}, l.set(o, e)), !t.direction) {
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
- l.forEach((t, o) => {
89
- const e = c.get(o);
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 c = new h({
145
+ let l = new h({
137
146
  x: a[0],
138
147
  y: a[1]
139
148
  });
140
- this.view.spatialReference.isWebMercator && (c = d.geographicToWebMercator(
141
- c
149
+ this.view.spatialReference.isWebMercator && (l = d.geographicToWebMercator(
150
+ l
142
151
  ));
143
- const p = this.view.toScreen(c), l = s[s.length - 1];
152
+ const p = this.view.toScreen(l), c = s[s.length - 1];
144
153
  let t = new h({
145
- x: l[0],
146
- y: l[1]
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
- v as default
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"),d=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/support/webMercatorUtils.js"),M=require("@arcgis/core/layers/GraphicsLayer"),b=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 S=P(y),u=P(L);class v extends b.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,(await(await fetch(o)).json()).features.forEach(t=>{const{roadId:i,nodeId:e}=t.properties;let{destinationPoint:s}=t.properties;const{coordinates:a}=t.geometry;if(s)typeof s=="string"&&(s=s.split(",").map(Number));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=S.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 d.Point({x:e[0],y:e[1]});this.view.spatialReference.isWebMercator&&(s=u.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 d.Point({x:e.panelPoint[0],y:e.panelPoint[1]});this.view.spatialReference.isWebMercator&&(a=u.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 d.Point({x:n[0],y:n[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 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;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.220",
3
+ "version": "1.0.221",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [