ow-eengine-power 2.2.0 → 2.2.1

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.
@@ -45625,7 +45625,7 @@ class UD {
45625
45625
  }
45626
45626
  //加载渲染电力线路
45627
45627
  loadFZModel() {
45628
- this.Keym == "OW_JPS_EEngin_001" && (this.viewer.dataSources.add(this.dataSource2), this.viewer.entities.show);
45628
+ this.Keym == "OW_JPS_EEngin_001" && (this.viewer.dataSources.add(this.dataSource2), this.viewer.dataSources.add(this.PointdataSource2), this.viewer.entities.show);
45629
45629
  }
45630
45630
  //设置显隐
45631
45631
  setFZModelVisible(t) {
@@ -6596,4 +6596,4 @@ void main()
6596
6596
  `},translucent:function(){return!0}})}setLineVisible(t){this.Keym=="OW_JPS_EEngin_001"&&(this.entityCollection2.show=t)}RemoveLineModel(){this.Keym=="OW_JPS_EEngin_001"&&(this.viewer.dataSources.remove(this.dataSource2),this.entityCollection2.show=!1)}}class Fx{constructor(){se(this,"id","");se(this,"name","");se(this,"towerFZinfo","");se(this,"towerDisFile","");se(this,"stressFileContent","");se(this,"TowerMemberColor","#FFFFFF");se(this,"TowerMembersWidth",2);se(this,"Longitude",0);se(this,"Latitude",0);se(this,"Altitude",0);se(this,"RollX",0);se(this,"RollY",90);se(this,"RollZ",0)}}function Mx(e){debugger;const t=e.split(`
6597
6597
  `),n=[],i=[],o=/^\s*(\d+)\s+([\d.-]+)\s+([\d.-]+)\s+([\d.-]+)\s+(-?\d+)/,a=/^\s*(\d+)\s+(\d+)\s+(\d+)\s*(?:#|$)/;for(const r of t){const f=r.trim();if(!f)continue;const c=f.match(o);if(c){n.push({id:parseInt(c[1]),x:parseFloat(c[2]),y:parseFloat(c[3]),z:parseFloat(c[4]),flag:parseInt(c[5])});continue}const h=f.match(a);h&&i.push({from:parseInt(h[1]),to:parseInt(h[2]),type:parseInt(h[3])})}return{TowerNodes:n,connections:i}}function Ux(e){const t=e.split(`
6598
6598
  `),n=[];for(const i of t){if(!i.trim())continue;const o=i.trim().split(/\s+/).filter(f=>f!==""),a=parseInt(o[0]);if(isNaN(a))continue;const r=[];for(let f=1;f<o.length;f+=3){const c=parseFloat(o[f]),h=parseFloat(o[f+1]),d=parseFloat(o[f+2]);if(!isNaN(c)&&!isNaN(h)&&!isNaN(d)){const p=Math.floor((f-1)/3)+1;r.push({timeStep:p,x:c,y:h,z:d})}}n.push({nodeId:a,displacements:r})}return n}function B0(e){const t={};return e.forEach(n=>{n.displacements.forEach(i=>{t[i.timeStep]||(t[i.timeStep]=[]),t[i.timeStep].push({nodeId:n.nodeId,...i})})}),t}function kx(e){const t=e.split(`
6599
- `),n=[];for(const o of t){if(!o.trim())continue;const a=o.match(/^\s*(\d+-\s*\d+)\s+((?:\d+\.\d+\s*)+)/);if(a){const r=a[1].replace(/\s+/g,""),f=a[2].trim().split(/\s+/).map(Number);n.push({elementId:r,stressRatios:f})}}const i=[];if(n.length>0){const o=n[0].stressRatios.length;for(let a=0;a<o;a++){const r={timeIndex:a,elements:[]};for(const f of n){let c="";const h=f.stressRatios[a];h>.01&&h<.02?c="#ffffff":h>.02&&h<.05?c="#d71345":c="#ff0000",r.elements.push({elementId:f.elementId,stressRatio:h,ylbColor:c})}i.push(r)}}return{byElement:n,byTime:i}}class Vx{constructor(t,n,i){se(this,"viewer");se(this,"TowerFZS");se(this,"Keym","");se(this,"dataSource2");se(this,"entityCollection2");se(this,"PointdataSource2");se(this,"PointentityCollection2");se(this,"TowerNodes",[]);se(this,"connections",[]);se(this,"displacementData",[]);se(this,"byElemens",[]);se(this,"byTimes",[]);se(this,"_animationInterval",null);this.Keym=i,this.viewer=t,this.TowerFZS=n,this.dataSource2=new go(this.TowerFZS.id+"tower"),this.entityCollection2=this.dataSource2.entities,this.PointdataSource2=new go(this.TowerFZS.id+"point"),this.PointentityCollection2=this.PointdataSource2.entities}loadfile(){if(this.Keym!="OW_JPS_EEngin_001")return;const{TowerNodes:t,connections:n}=Mx(this.TowerFZS.towerFZinfo);this.TowerNodes=t,this.connections=n,this.displacementData=Ux(this.TowerFZS.towerDisFile);const{byElement:i,byTime:o}=kx(this.TowerFZS.stressFileContent);this.byElemens=i,this.byTimes=o;debugger}loadFZTower(){if(this.Keym!="OW_JPS_EEngin_001")return;let t=new He(S.toRadians(this.TowerFZS.RollX),this.TowerFZS.RollY,this.TowerFZS.RollZ);const n=u.fromDegrees(this.TowerFZS.Longitude,this.TowerFZS.Latitude,this.TowerFZS.Altitude);this.connections.forEach(i=>{const o=this.TowerNodes.find(h=>h.id===i.from),a=this.TowerNodes.find(h=>h.id===i.to),r=[],f=new u(o==null?void 0:o.x,o==null?void 0:o.y,o==null?void 0:o.z);r.push(Q(n,f,t)),this.PointentityCollection2.add(Pa(r[0],(o==null?void 0:o.id)+""));const c=new u(a==null?void 0:a.x,a==null?void 0:a.y,a==null?void 0:a.z);r.push(Q(n,c,t)),this.PointentityCollection2.add(Pa(r[1],(a==null?void 0:a.id)+"")),this.entityCollection2.add(v(r,i.from+""+i.to,this.TowerFZS.TowerMembersWidth,this.TowerFZS.TowerMemberColor))})}loadFZDISTower(t){if(this.Keym!=="OW_JPS_EEngin_001")return;const i=B0(this.displacementData)[t],o=this.byTimes.find(f=>f.timeIndex===t);debugger;if(!i){console.warn(`未找到时间步 ${t} 的位移数据`);return}const a=new He(S.toRadians(this.TowerFZS.RollX),this.TowerFZS.RollY,this.TowerFZS.RollZ),r=u.fromDegrees(this.TowerFZS.Longitude,this.TowerFZS.Latitude,this.TowerFZS.Altitude);this.connections.forEach(f=>{const c=this.TowerNodes.find(I=>I.id===f.from),h=this.TowerNodes.find(I=>I.id===f.to);if(!c||!h){console.warn(`找不到连接 ${f.from}->${f.to} 的节点`);return}debugger;const d=i.find(I=>I.nodeId===f.from),p=i.find(I=>I.nodeId===f.to);if(!d||!p){console.warn(`找不到连接 ${f.from}->${f.to} 的位移数据`);return}const m=new u(c.x-d.x,c.y-d.y,c.z-d.z),T=new u(h.x-p.x,h.y-p.y,h.z-p.z),y=Q(r,m,a);this.entityCollection2.add(Pa(y,f.from+""));const w=Q(r,T,a);this.entityCollection2.add(Pa(w,f.to+""));const A=[y,w],E=`${f.from}_${f.to}`,b=f.from+"-"+f.to;o==null||o.elements.find(I=>I.elementId===b);debugger;this.entityCollection2.add(v(A,E+t,this.TowerFZS.TowerMembersWidth,"#ffffff"))})}loadFZDISTower1(t){if(this.Keym!="OW_JPS_EEngin_001")return;const n=B0(this.displacementData);let i=new He(S.toRadians(this.TowerFZS.RollX),this.TowerFZS.RollY,this.TowerFZS.RollZ);const o=u.fromDegrees(this.TowerFZS.Longitude,this.TowerFZS.Latitude,this.TowerFZS.Altitude);this.connections.forEach(a=>{const r=this.TowerNodes.find(T=>T.id===a.from),f=n[t].find(T=>T.nodeId===a.from),c=this.TowerNodes.find(T=>T.id===a.to),h=n[t].find(T=>T.nodeId===a.to),d=[],p=new u(r.x-f.x,r.y-f.y,r.z-f.z);d.push(Q(o,p,i));const m=new u(c.x-h.x,c.y-h.y,c.z-h.z);d.push(Q(o,m,i));debugger;this.entityCollection2.add(v(d,a.from+""+a.to,this.TowerFZS.TowerMembersWidth,this.TowerFZS.TowerMemberColor))})}loadAllFZDisTower(){if(this.Keym!=="OW_JPS_EEngin_001")return;if(!this.displacementData||this.displacementData.length===0){console.warn("没有可用的位移数据");return}let t=1;const n=this.displacementData.length;this._animationInterval&&(clearInterval(this._animationInterval),this._animationInterval=null);const i=()=>{if(this.viewer.dataSources.contains(this.dataSource2)&&this.viewer.dataSources.remove(this.dataSource2,!0),t>n){t=1;return}this.dataSource2=new go("fztower"),this.entityCollection2=this.dataSource2.entities;try{this.loadFZDISTower(t),this.loadFZModel(),console.log(`正在显示位移帧: ${t}/${n}`),t++}catch(o){console.error("加载位移帧时出错:",o),this._animationInterval&&(clearInterval(this._animationInterval),this._animationInterval=null)}};i(),this._animationInterval=setInterval(i,300)}stopDisplacementAnimation(){this._animationInterval&&(clearInterval(this._animationInterval),this._animationInterval=null)}toggleAnimation(t){t?this.stopDisplacementAnimation():this.loadAllFZDisTower()}loadFZModel(){this.Keym=="OW_JPS_EEngin_001"&&(this.viewer.dataSources.add(this.dataSource2),this.viewer.entities.show)}setFZModelVisible(t){this.Keym=="OW_JPS_EEngin_001"&&(this.entityCollection2.show=t)}RemoveFZModel(){this.Keym=="OW_JPS_EEngin_001"&&(this.viewer.dataSources.remove(this.dataSource2),this.entityCollection2.show=!1)}}ot.GUAPoint=Lx,ot.InsulatorInfo=zx,ot.InsulatorType=Ht,ot.LineNum=ar,ot.LineType=P0,ot.OWEEgineFZManager=Vx,ot.OWEEgineManager=Nx,ot.PhaseSType=nn,ot.TowerFZInfo=Fx,ot.TowerInfo=Rx,ot.TowerLineInfo=Bx,ot.TowerType=$i,ot.WairnumType=$,ot.drawModel=To,Object.defineProperty(ot,Symbol.toStringTag,{value:"Module"})});
6599
+ `),n=[];for(const o of t){if(!o.trim())continue;const a=o.match(/^\s*(\d+-\s*\d+)\s+((?:\d+\.\d+\s*)+)/);if(a){const r=a[1].replace(/\s+/g,""),f=a[2].trim().split(/\s+/).map(Number);n.push({elementId:r,stressRatios:f})}}const i=[];if(n.length>0){const o=n[0].stressRatios.length;for(let a=0;a<o;a++){const r={timeIndex:a,elements:[]};for(const f of n){let c="";const h=f.stressRatios[a];h>.01&&h<.02?c="#ffffff":h>.02&&h<.05?c="#d71345":c="#ff0000",r.elements.push({elementId:f.elementId,stressRatio:h,ylbColor:c})}i.push(r)}}return{byElement:n,byTime:i}}class Vx{constructor(t,n,i){se(this,"viewer");se(this,"TowerFZS");se(this,"Keym","");se(this,"dataSource2");se(this,"entityCollection2");se(this,"PointdataSource2");se(this,"PointentityCollection2");se(this,"TowerNodes",[]);se(this,"connections",[]);se(this,"displacementData",[]);se(this,"byElemens",[]);se(this,"byTimes",[]);se(this,"_animationInterval",null);this.Keym=i,this.viewer=t,this.TowerFZS=n,this.dataSource2=new go(this.TowerFZS.id+"tower"),this.entityCollection2=this.dataSource2.entities,this.PointdataSource2=new go(this.TowerFZS.id+"point"),this.PointentityCollection2=this.PointdataSource2.entities}loadfile(){if(this.Keym!="OW_JPS_EEngin_001")return;const{TowerNodes:t,connections:n}=Mx(this.TowerFZS.towerFZinfo);this.TowerNodes=t,this.connections=n,this.displacementData=Ux(this.TowerFZS.towerDisFile);const{byElement:i,byTime:o}=kx(this.TowerFZS.stressFileContent);this.byElemens=i,this.byTimes=o;debugger}loadFZTower(){if(this.Keym!="OW_JPS_EEngin_001")return;let t=new He(S.toRadians(this.TowerFZS.RollX),this.TowerFZS.RollY,this.TowerFZS.RollZ);const n=u.fromDegrees(this.TowerFZS.Longitude,this.TowerFZS.Latitude,this.TowerFZS.Altitude);this.connections.forEach(i=>{const o=this.TowerNodes.find(h=>h.id===i.from),a=this.TowerNodes.find(h=>h.id===i.to),r=[],f=new u(o==null?void 0:o.x,o==null?void 0:o.y,o==null?void 0:o.z);r.push(Q(n,f,t)),this.PointentityCollection2.add(Pa(r[0],(o==null?void 0:o.id)+""));const c=new u(a==null?void 0:a.x,a==null?void 0:a.y,a==null?void 0:a.z);r.push(Q(n,c,t)),this.PointentityCollection2.add(Pa(r[1],(a==null?void 0:a.id)+"")),this.entityCollection2.add(v(r,i.from+""+i.to,this.TowerFZS.TowerMembersWidth,this.TowerFZS.TowerMemberColor))})}loadFZDISTower(t){if(this.Keym!=="OW_JPS_EEngin_001")return;const i=B0(this.displacementData)[t],o=this.byTimes.find(f=>f.timeIndex===t);debugger;if(!i){console.warn(`未找到时间步 ${t} 的位移数据`);return}const a=new He(S.toRadians(this.TowerFZS.RollX),this.TowerFZS.RollY,this.TowerFZS.RollZ),r=u.fromDegrees(this.TowerFZS.Longitude,this.TowerFZS.Latitude,this.TowerFZS.Altitude);this.connections.forEach(f=>{const c=this.TowerNodes.find(I=>I.id===f.from),h=this.TowerNodes.find(I=>I.id===f.to);if(!c||!h){console.warn(`找不到连接 ${f.from}->${f.to} 的节点`);return}debugger;const d=i.find(I=>I.nodeId===f.from),p=i.find(I=>I.nodeId===f.to);if(!d||!p){console.warn(`找不到连接 ${f.from}->${f.to} 的位移数据`);return}const m=new u(c.x-d.x,c.y-d.y,c.z-d.z),T=new u(h.x-p.x,h.y-p.y,h.z-p.z),y=Q(r,m,a);this.entityCollection2.add(Pa(y,f.from+""));const w=Q(r,T,a);this.entityCollection2.add(Pa(w,f.to+""));const A=[y,w],E=`${f.from}_${f.to}`,b=f.from+"-"+f.to;o==null||o.elements.find(I=>I.elementId===b);debugger;this.entityCollection2.add(v(A,E+t,this.TowerFZS.TowerMembersWidth,"#ffffff"))})}loadFZDISTower1(t){if(this.Keym!="OW_JPS_EEngin_001")return;const n=B0(this.displacementData);let i=new He(S.toRadians(this.TowerFZS.RollX),this.TowerFZS.RollY,this.TowerFZS.RollZ);const o=u.fromDegrees(this.TowerFZS.Longitude,this.TowerFZS.Latitude,this.TowerFZS.Altitude);this.connections.forEach(a=>{const r=this.TowerNodes.find(T=>T.id===a.from),f=n[t].find(T=>T.nodeId===a.from),c=this.TowerNodes.find(T=>T.id===a.to),h=n[t].find(T=>T.nodeId===a.to),d=[],p=new u(r.x-f.x,r.y-f.y,r.z-f.z);d.push(Q(o,p,i));const m=new u(c.x-h.x,c.y-h.y,c.z-h.z);d.push(Q(o,m,i));debugger;this.entityCollection2.add(v(d,a.from+""+a.to,this.TowerFZS.TowerMembersWidth,this.TowerFZS.TowerMemberColor))})}loadAllFZDisTower(){if(this.Keym!=="OW_JPS_EEngin_001")return;if(!this.displacementData||this.displacementData.length===0){console.warn("没有可用的位移数据");return}let t=1;const n=this.displacementData.length;this._animationInterval&&(clearInterval(this._animationInterval),this._animationInterval=null);const i=()=>{if(this.viewer.dataSources.contains(this.dataSource2)&&this.viewer.dataSources.remove(this.dataSource2,!0),t>n){t=1;return}this.dataSource2=new go("fztower"),this.entityCollection2=this.dataSource2.entities;try{this.loadFZDISTower(t),this.loadFZModel(),console.log(`正在显示位移帧: ${t}/${n}`),t++}catch(o){console.error("加载位移帧时出错:",o),this._animationInterval&&(clearInterval(this._animationInterval),this._animationInterval=null)}};i(),this._animationInterval=setInterval(i,300)}stopDisplacementAnimation(){this._animationInterval&&(clearInterval(this._animationInterval),this._animationInterval=null)}toggleAnimation(t){t?this.stopDisplacementAnimation():this.loadAllFZDisTower()}loadFZModel(){this.Keym=="OW_JPS_EEngin_001"&&(this.viewer.dataSources.add(this.dataSource2),this.viewer.dataSources.add(this.PointdataSource2),this.viewer.entities.show)}setFZModelVisible(t){this.Keym=="OW_JPS_EEngin_001"&&(this.entityCollection2.show=t)}RemoveFZModel(){this.Keym=="OW_JPS_EEngin_001"&&(this.viewer.dataSources.remove(this.dataSource2),this.entityCollection2.show=!1)}}ot.GUAPoint=Lx,ot.InsulatorInfo=zx,ot.InsulatorType=Ht,ot.LineNum=ar,ot.LineType=P0,ot.OWEEgineFZManager=Vx,ot.OWEEgineManager=Nx,ot.PhaseSType=nn,ot.TowerFZInfo=Fx,ot.TowerInfo=Rx,ot.TowerLineInfo=Bx,ot.TowerType=$i,ot.WairnumType=$,ot.drawModel=To,Object.defineProperty(ot,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ow-eengine-power",
3
3
  "private": false,
4
- "version": "2.2.0",
4
+ "version": "2.2.1",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",