gisviewer-vue3-arcgis 1.0.245 → 1.0.246

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