1 |
- var t="./2.25.2/surface_img.5cb3b92d.jpg";const o=(t,o,n,s=1)=>{let a,e,r,h;const c=[],l=[];const i=t=>Math.pow(t/255,1),p=t=>4===t.length?t.substr(1).split("").map((function(t){return 17*parseInt(t,16)})):[t.substr(1,2),t.substr(3,2),t.substr(5,2)].map((function(t){return parseInt(t,16)})),u=p(t).map(i),g=p(o).map(i);for(a=0;a<n;a++){for(r=a/(n-1),h=1-r,e=0;e<3;e++)l[e]=1===(M=Math.round(255*Math.pow(u[e]*h+g[e]*r,1)).toString(16)).length?"0"+M:M;c.push("#"+l.join(""))}var M;return c},n=(t,n,s,a)=>{const e={};for(const o in t)e[t[o][2]]=0;const r=Object.keys(e);r.sort(((t,o)=>+t-+o));const h=Math.ceil(r.length/2),c=[...o(n,s,h),...o(s,a,h)],l={};for(const o in r)l[r[o]]=c[o];return l},s=(t,o)=>{const n=[];for(const s in t)n.push({value:t[s],itemStyle:{color:o[t[s][2]]}});return n},a={aMin:5,aMax:80,wMin:.5,wMax:20,healthColor:["#0000FA","#02555A","#75BA01"],unhealthColor:["#70AD47","#FFC000","#ED7D31"]},e=(t,o=2)=>+t.toFixed(o),r=(t,o,n,s,a)=>t*Math.exp(-Math.pow(a-s,2)/(2*Math.pow(o,2)))+n,h=(t,o,n,s)=>{o=o<=25?o:25;const a=(o*=s)/8;return e(n*Math.exp(-Math.pow(t,2)/(2*Math.pow(a,2))))},c=(t,o)=>t.includes("浮")?.15*o:t.includes("沉")?.75*o:.5*o,l=(t,o,n)=>{const s=[];for(let a=0;a<=t;a+=t)for(let t=0;t<=o;t+=.2){const o=n+Math.sin(.3*t-3);s.push([e(t),a,e(o)])}return s};class i{constructor(t=a){this.config=Object.assign(Object.assign({},a),t)}aRange(t){const{aMin:o,aMax:n}=this.config;return console.log(t,11),t<o?t<1.94?.1:o:t>n?n:t}wRange(t){const{wMin:o,wMax:n}=this.config;return t<o?o:t>n?n:t}getZ(t,o,n,s,a){const[h,c]=n,[l,i,p]=s,[u,g,M]=a;let f=0;if(o>=0&&o<h){const n=r(i-l,h/3,l,h,o),s=r(g-u,h/3,u,h,o);f=n*Math.exp(-4*Math.pow(t,2)*Math.log(n/.1)/Math.pow(s,2))}else if(o>=h&&o<=h+c){const n=r(i-p,(c-h)/3,p,h,o),s=r(g-M,(c-h)/3,M,h,o);f=n*Math.exp(-4*Math.pow(t,2)*Math.log(n/.1)/Math.pow(s,2))}return e(f)}getHealthData(t=0,o=!0){const a=[20,40],r=[14.1,15.2,12.9],h=[7.2,8,6.8],{healthColor:c}=this.config;t=0===t?0:t-r[1]/2;const l=[],i=[];for(let n=-100;n<=100;n+=2)for(let o=0;o<41;o++){const s=t+this.getZ(n/10,o,a,r,h),c=[o,e(n/10+30),e(s)];l.push(c),Math.abs(n)%10==0&&i.push(c)}let p=[];if(o){const t=n(l,...c);p=s(l,t)}return{plotData:l,plot3dDataColor:p,scatterData:i}}getFeaturePlotData(t,o,a,r=!0){let h=0;const{unhealthColor:c}=this.config,[l,i,p]=o,[u,g,M]=a;o=[this.aRange(l),this.aRange(i),this.aRange(p)],console.log(o),a=[this.wRange(u),this.wRange(g),this.wRange(M)];const f=[];for(let n=-10;n<=10;n+=.2)for(let s=0;s<41;s++){const r=this.getZ(n,s,t,o,a);f.push([s,e(n+10),r]),h=r>h?r:h}let w=[];if(r){const t=n(f,...c);w=s(f,t)}return{plotData:f,plotColorData:w,yLen:40,zMax:h}}getLinePlotData(t,o,a,r=!0){const c=[],l=this.aRange(o)/25;let i=0;const{unhealthColor:p}=this.config;for(let n=0;n<24;n++){const o=[];for(const s in t){const e=t[s];i=e>i?e:i,o.push(h(n-12,a,e*l,2))}c.push(o)}const u=[];for(let n=0;n<c.length;n++){const t=c[n];for(let o=0;o<t.length;o++)u.push([o,n,e(t[o])])}let g=[];if(r){const t=n(u,...p);g=s(u,t)}return{plotData:u,plotColorData:g,xLen:24,zMax:i*l}}}export{i as T,l as a,c as g,t as s};
|