gisviewer-vue3-arcgis 1.0.222 → 1.0.223

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 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=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 w(f){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const e in f)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(f,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>f[e]})}}return t.default=f,Object.freeze(t)}const b=w(m),d=w(L);class v extends S.default{constructor(t,e){var i,l;super(t),this.stopLineLayer=new M,this.watchHandle=null,this.trajectoryDelayTime=0,this.stopLineMap=new Map,this.countdownPanelProps=e,this.view.map.add(this.stopLineLayer),this.trajectoryDelayTime=((l=(i=this.mapConfig.holoFlow)==null?void 0:i.signal)==null?void 0:l.delay)||2}async initializeLayer(){var l,c;console.time("初始化停止线图层");let t=(c=(l=this.mapConfig.holoFlow)==null?void 0:l.signal)==null?void 0:c.stopLineLayer;if(!t)return;t=this.mapConfig.assetsRoot+"/"+t;const i=await(await fetch(t)).json();for(const n of i.features){const{roadId:r,nodeId:o}=n.properties;let{destinationPoint:a}=n.properties;const{coordinates:s}=n.geometry;if(a){if(typeof a=="string")try{a=JSON.parse(a)}catch(h){console.error("解析面板基准点失败",h);continue}}else{const h=s[0],P=s[s.length-1],g=(h[0]+P[0])/2,y=(h[1]+P[1])/2;a=[g,y]}const p=this.stopLineMap.get(o);p?p.set(r,{coord:s,panelPoint:a}):this.stopLineMap.set(o,new Map([[r,{coord:s,panelPoint:a}]]))}console.timeEnd("初始化停止线图层")}getPanelScale(){const t=this.view.scale;let e=1;return t<1e3?e=1:t<2e3?e=.8:t<4e3?e=.4:e=0,e}updatePanelPosition(){const t=this.getPanelScale();for(const e of this.countdownPanelProps){t!==this.currentPanelScale&&(e.scale=t);const{mapPoint:i}=e;let l=new u.Point({x:i[0],y:i[1]});this.view.spatialReference.isWebMercator&&(l=d.geographicToWebMercator(l));const c=this.view.toScreen(l);if(e.position.left=c.x,e.position.top=c.y,this.view.type==="3d"){const n=this.getPanelRotation(e.stopLine);e.rotation=n}}this.currentPanelScale=t}async handleHoloSignalData(t){this.watchHandle||(this.watchHandle=b.watch(()=>this.view.extent,()=>this.updatePanelPosition())),setTimeout(()=>{const e=t.crossId,i=this.stopLineMap.get(e);if(!i){console.log(`没有找到路口${e}`);return}const l=t.phaseCountDownList,c=new Map;for(const n of l){let r="";for(let p of n.roadIdList)if(p.startsWith("-")&&(p=p.slice(1)),i.has(p)){r=p;break}if(!r){console.log(`没有找到对应的进口道${e}--${r}`);continue}let o=c.get(r);if(o||(o={},c.set(r,o)),!n.direction)continue;const a=n.direction.toLowerCase(),s=n.color===1?"red":n.color===2?"yellow":"green";a==="u"?(o.uNumber=n.leftTime,o.uColor=s):a==="l"?(o.lNumber=n.leftTime,o.lColor=s):a==="s"?(o.sNumber=n.leftTime,o.sColor=s):a==="r"&&(o.rNumber=n.leftTime,o.rColor=s)}c.forEach((n,r)=>{const o=i.get(r);if(!o)return;const a=this.countdownPanelProps.find(s=>s.crossId===e&&s.roadId===r);if(a)a.lampStatus=n;else{let s=new u.Point({x:o.panelPoint[0],y:o.panelPoint[1]});this.view.spatialReference.isWebMercator&&(s=d.geographicToWebMercator(s));const p=this.view.toScreen(s),h=this.getPanelRotation(o.coord);this.countdownPanelProps.push({displayMode:"complex",crossId:e,roadId:r,mapPoint:o.panelPoint,stopLine:o.coord,position:{left:p.x,top:p.y},rotation:h,scale:this.getPanelScale(),lampStatus:n})}})},this.trajectoryDelayTime*1e3)}clearSignal(){var t;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(t=this.watchHandle)==null||t.remove(),this.watchHandle=null}getPanelRotation(t){const e=t[0];let i=new u.Point({x:e[0],y:e[1]});this.view.spatialReference.isWebMercator&&(i=d.geographicToWebMercator(i));const l=this.view.toScreen(i),c=t[t.length-1];let n=new u.Point({x:c[0],y:c[1]});this.view.spatialReference.isWebMercator&&(n=d.geographicToWebMercator(n));const r=this.view.toScreen(n),o=r.x-l.x,a=r.y-l.y;return Math.atan2(a,o)*(180/Math.PI)}}exports.default=v;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/core/reactiveUtils"),f=require("@arcgis/core/geometry"),y=require("@arcgis/core/geometry/support/webMercatorUtils.js"),S=require("@arcgis/core/layers/GraphicsLayer"),L=require("./signal-holo-flow.js");function g(h){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>h[t]})}}return e.default=h,Object.freeze(e)}const m=g(P),d=g(y);class b extends L.default{constructor(e,t){var a,i;super(e),this.stopLineLayer=new S,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=(a=this.mapConfig.holoFlow)==null?void 0:a.signal)==null?void 0:i.delay)||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 a=await(await fetch(e)).json();for(const s of a.features){const{roadId:n}=s.properties;let{destinationPoint:r}=s.properties;const{coordinates:l}=s.geometry;if(r){if(typeof r=="string")try{r=JSON.parse(r)}catch(c){console.error("解析面板基准点失败",c);continue}}else{const c=l[0],u=l[l.length-1],p=(c[0]+u[0])/2,w=(c[1]+u[1])/2;r=[p,w]}this.stopLineMap.set(n,{coord:l,panelPoint:r})}console.timeEnd("初始化停止线图层")}initializeLampGroup(e){const{sigId:t,lampGroupList:a}=e,i=[];a.forEach(o=>{const{lampGroupNo:s,lampGroupType:n,crossFlowList:r,pedList:l}=o;r.length>0&&r.forEach(c=>{const u=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}n===81&&(p="bl"),i.push({lampGroupId:s,roadId:u,dir:p})}),l.length>0}),this.lampGroupMap.set(t,i),console.log(i)}handleUniSignalData(e){this.watchHandle||(this.watchHandle=m.watch(()=>this.view.extent,()=>this.updatePanelPosition()));const{sigId:t}=e.data.basicInfo,a=this.lampGroupMap.get(t);if(!a)return{status:-1,message:"灯组未初始化"};const{curSigColorInfo:i}=e.data,o=new Map;return i.forEach(s=>{const n=String(s.lamgroupId),{color:r,leftTime:l}=s,c=a.find(u=>u.lampGroupId===n);if(c){const{roadId:u,dir:p}=c;o.set(u,{...o.get(u)||{},[`${p}Number`]:l,[`${p}Color`]:r===1?"red":r===2?"yellow":"green"})}}),this.updateLampGroupPanelStatus(t,o),{status:0,message:"ok"}}getPanelScale(){const e=this.view.scale;let t=1;return 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:a}=t;let i=new f.Point({x:a[0],y:a[1]});this.view.spatialReference.isWebMercator&&(i=d.geographicToWebMercator(i));const o=this.view.toScreen(i);if(t.position.left=o.x,t.position.top=o.y,this.view.type==="3d"){const s=this.getPanelRotation(t.stopLine);t.rotation=s}}this.currentPanelScale=e}doHoloSignalData(e){const t=e.crossId,a=e.phaseCountDownList,i=new Map;for(const o of a){let s="";for(let c of o.roadIdList)if(c.startsWith("-")&&(c=c.slice(1)),this.stopLineMap.has(c)){s=c;break}if(!s){console.log(`没有找到对应的进口道${t}--${s}`);continue}let n=i.get(s);if(n||(n={},i.set(s,n)),!o.direction)continue;const r=o.direction.toLowerCase(),l=o.color===1?"red":o.color===2?"yellow":"green";r==="u"?(n.uNumber=o.leftTime,n.uColor=l):r==="l"?(n.lNumber=o.leftTime,n.lColor=l):r==="s"?(n.sNumber=o.leftTime,n.sColor=l):r==="r"&&(n.rNumber=o.leftTime,n.rColor=l)}this.updateLampGroupPanelStatus(t,i)}updateLampGroupPanelStatus(e,t){t.forEach((a,i)=>{const o=this.stopLineMap.get(i);if(!o)return;const s=this.countdownPanelProps.find(n=>n.roadId===i);if(s)s.lampStatus=a;else{let n=new f.Point({x:o.panelPoint[0],y:o.panelPoint[1]});this.view.spatialReference.isWebMercator&&(n=d.geographicToWebMercator(n));const r=this.view.toScreen(n),l=this.getPanelRotation(o.coord);this.countdownPanelProps.push({displayMode:"complex",crossId:e,roadId:i,mapPoint:o.panelPoint,stopLine:o.coord,position:{left:r.x,top:r.y},rotation:l,scale:this.getPanelScale(),lampStatus:a})}})}async handleHoloSignalData(e){this.watchHandle||(this.watchHandle=m.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 a=new f.Point({x:t[0],y:t[1]});this.view.spatialReference.isWebMercator&&(a=d.geographicToWebMercator(a));const i=this.view.toScreen(a),o=e[e.length-1];let s=new f.Point({x:o[0],y:o[1]});this.view.spatialReference.isWebMercator&&(s=d.geographicToWebMercator(s));const n=this.view.toScreen(s),r=n.x-i.x,l=n.y-i.y;return Math.atan2(l,r)*(180/Math.PI)}}exports.default=b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.222",
3
+ "version": "1.0.223",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [