Files
hb_pqs_web/public/static/map/modules/canvablepath_f0ium1.js
2025-01-09 19:02:44 +08:00

2 lines
5.9 KiB
JavaScript

/**/_jsload2&&_jsload2('canvablepath', 'function bh(a){a=a.replace(/,/gm," ");a=a.replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2");a=a.replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2");a=a.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\\s])/gm,"$1 $2");a=a.replace(/([^\\s])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2");a=a.replace(/([0-9])([+\\-])/gm,"$1 $2");a=a.replace(/(\\.[0-9]*)(\\.)/gm,"$1 $2");a=a.replace(/([Aa](\\s+[0-9]+){3})\\s+([01])\\s*([01])/gm,"$1 $3 $4 ");a=bh.bW(a);a=bh.trim(a);this.TP=new function(a){this.eG= a.split(" ");this.reset=function(){this.nh=-1;this.Wt=this.Yw="";this.start=new bh.Zf(0,0);this.$w=new bh.Zf(0,0);this.kb=new bh.Zf(0,0);this.ha=[];this.Jo=[]};this.vM=function(){return this.nh>=this.eG.length-1};this.Aj=function(){return this.vM()?o:this.eG[this.nh+1].match(/^[A-Za-z]$/)!=p};this.KE=function(){switch(this.Yw){case "m":case "l":case "h":case "v":case "c":case "s":case "q":case "t":case "a":case "z":return o}return q};this.aM=function(){this.nh++;return this.eG[this.nh]};this.uj=function(){return parseFloat(this.aM())}; this.oZ=function(){this.Wt=this.Yw;this.Yw=this.aM()};this.Gm=function(){return this.aZ(new bh.Zf(this.uj(),this.uj()))};this.SD=function(){var a=this.Gm();return this.$w=a};this.zk=function(){var a=this.Gm();return this.kb=a};this.UL=function(){return"c"!=this.Wt.toLowerCase()&&"s"!=this.Wt.toLowerCase()&&"q"!=this.Wt.toLowerCase()&&"t"!=this.Wt.toLowerCase()?this.kb:new bh.Zf(2*this.kb.x-this.$w.x,2*this.kb.y-this.$w.y)};this.aZ=function(a){this.KE()&&(a.x+=this.kb.x,a.y+=this.kb.y);return a};this.fj= function(a,b,e){e!=p&&(0<this.Jo.length&&this.Jo[this.Jo.length-1]==p)&&(this.Jo[this.Jo.length-1]=Math.atan2(e.y-this.ha[this.ha.length-1].y,e.x-this.ha[this.ha.length-1].x));this.gC(a,b==p?p:Math.atan2(a.y-b.y,a.x-b.x))};this.gC=function(a,b){this.ha.push(a);this.Jo.push(b)}}(a);this.$a=function(){return this.ni(p)};this.ni=function(a){var c=this.TP;c.reset();var d=new bh.zP;for(a!=p&&a.beginPath();!c.vM();)switch(c.oZ(),c.Yw){case "M":case "m":var e=c.zk();c.fj(e);d.pg(e.x,e.y);a!=p&&a.moveTo(e.x, e.y);for(c.start=c.kb;!c.Aj();)e=c.zk(),c.fj(e,c.start),d.pg(e.x,e.y),a!=p&&a.lineTo(e.x,e.y);break;case "L":case "l":for(;!c.Aj();){var f=c.kb,e=c.zk();c.fj(e,f);d.pg(e.x,e.y);a!=p&&a.lineTo(e.x,e.y)}break;case "H":case "h":for(;!c.Aj();)e=new bh.Zf((c.KE()?c.kb.x:0)+c.uj(),c.kb.y),c.fj(e,c.kb),c.kb=e,d.pg(c.kb.x,c.kb.y),a!=p&&a.lineTo(c.kb.x,c.kb.y);break;case "V":case "v":for(;!c.Aj();)e=new bh.Zf(c.kb.x,(c.KE()?c.kb.y:0)+c.uj()),c.fj(e,c.kb),c.kb=e,d.pg(c.kb.x,c.kb.y),a!=p&&a.lineTo(c.kb.x,c.kb.y); break;case "C":case "c":for(;!c.Aj();){var g=c.kb,f=c.Gm(),i=c.SD(),e=c.zk();c.fj(e,i,f);d.fC(g.x,g.y,f.x,f.y,i.x,i.y,e.x,e.y);a!=p&&a.bezierCurveTo(f.x,f.y,i.x,i.y,e.x,e.y)}break;case "S":case "s":for(;!c.Aj();)g=c.kb,f=c.UL(),i=c.SD(),e=c.zk(),c.fj(e,i,f),d.fC(g.x,g.y,f.x,f.y,i.x,i.y,e.x,e.y),a!=p&&a.bezierCurveTo(f.x,f.y,i.x,i.y,e.x,e.y);break;case "Q":case "q":for(;!c.Aj();)g=c.kb,i=c.SD(),e=c.zk(),c.fj(e,i,i),d.aK(g.x,g.y,i.x,i.y,e.x,e.y),a!=p&&a.quadraticCurveTo(i.x,i.y,e.x,e.y);break;case "T":case "t":for(;!c.Aj();)g= c.kb,i=c.UL(),c.$w=i,e=c.zk(),c.fj(e,i,i),d.aK(g.x,g.y,i.x,i.y,e.x,e.y),a!=p&&a.quadraticCurveTo(i.x,i.y,e.x,e.y);break;case "A":case "a":for(;!c.Aj();){var g=c.kb,k=c.uj(),l=c.uj(),f=c.uj()*(Math.PI/180),m=c.uj(),i=c.uj(),e=c.zk(),n=new bh.Zf(Math.cos(f)*(g.x-e.x)/2+Math.sin(f)*(g.y-e.y)/2,-Math.sin(f)*(g.x-e.x)/2+Math.cos(f)*(g.y-e.y)/2),s=Math.pow(n.x,2)/Math.pow(k,2)+Math.pow(n.y,2)/Math.pow(l,2);1<s&&(k*=Math.sqrt(s),l*=Math.sqrt(s));m=(m==i?-1:1)*Math.sqrt((Math.pow(k,2)*Math.pow(l,2)-Math.pow(k, 2)*Math.pow(n.y,2)-Math.pow(l,2)*Math.pow(n.x,2))/(Math.pow(k,2)*Math.pow(n.y,2)+Math.pow(l,2)*Math.pow(n.x,2)));isNaN(m)&&(m=0);var u=new bh.Zf(m*k*n.y/l,m*-l*n.x/k),g=new bh.Zf((g.x+e.x)/2+Math.cos(f)*u.x-Math.sin(f)*u.y,(g.y+e.y)/2+Math.sin(f)*u.x+Math.cos(f)*u.y),w=function(a,b){return(a[0]*b[0]+a[1]*b[1])/(Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2))*Math.sqrt(Math.pow(b[0],2)+Math.pow(b[1],2)))},y=function(a,b){return(a[0]*b[1]<a[1]*b[0]?-1:1)*Math.acos(w(a,b))},m=y([1,0],[(n.x-u.x)/k,(n.y- u.y)/l]),s=[(n.x-u.x)/k,(n.y-u.y)/l],u=[(-n.x-u.x)/k,(-n.y-u.y)/l],n=y(s,u);-1>=w(s,u)&&(n=Math.PI);1<=w(s,u)&&(n=0);s=1-i?1:-1;u=m+s*(n/2);c.gC(new bh.Zf(g.x+k*Math.cos(u),g.y+l*Math.sin(u)),u-s*Math.PI/2);c.gC(e,u-s*Math.PI);d.pg(e.x,e.y);a!=p&&(w=k>l?k:l,e=k>l?1:k/l,k=k>l?l/k:1,a.translate(g.x,g.y),a.rotate(f),a.scale(e,k),a.arc(0,0,w,m,m+n,1-i),a.scale(1/e,1/k),a.rotate(-f),a.translate(-g.x,-g.y))}break;case "Z":case "z":a!=p&&a.closePath(),c.kb=c.start}return d}} bh.trim=function(a){return a.replace(/^\\s+|\\s+$/g,"")};bh.bW=function(a){return a.replace(/[\\s\\r\\t\\n]+/gm," ")};bh.Zf=function(a,b){this.x=a;this.y=b}; bh.zP=function(){this.In=this.Hn=this.Ij=this.Hj=Number.NaN;this.x=v("Hj");this.y=v("Ij");this.width=function(){return this.Hn-this.Hj};this.height=function(){return this.In-this.Ij};this.pg=function(a,b){if(a!=p){if(isNaN(this.Hj)||isNaN(this.Hn))this.Hn=this.Hj=a;a<this.Hj&&(this.Hj=a);a>this.Hn&&(this.Hn=a)}if(b!=p){if(isNaN(this.Ij)||isNaN(this.In))this.In=this.Ij=b;b<this.Ij&&(this.Ij=b);b>this.In&&(this.In=b)}};this.kC=function(a){this.pg(a,p)};this.lC=function(a){this.pg(p,a)};this.aK=function(a, b,c,d,e,f){c=a+2/3*(c-a);d=b+2/3*(d-b);this.fC(a,b,c,c+1/3*(e-a),d,d+1/3*(f-b),e,f)};this.fC=function(a,b,c,d,e,f,g,i){var k=[a,b],l=[c,d],m=[e,f],n=[g,i];this.pg(k[0],k[1]);this.pg(n[0],n[1]);for(ch=0;1>=ch;ch++)if(a=function(a){return Math.pow(1-a,3)*k[ch]+3*Math.pow(1-a,2)*a*l[ch]+3*(1-a)*Math.pow(a,2)*m[ch]+Math.pow(a,3)*n[ch]},b=6*k[ch]-12*l[ch]+6*m[ch],c=-3*k[ch]+9*l[ch]-9*m[ch]+3*n[ch],d=3*l[ch]-3*k[ch],0==c)0!=b&&(b=-d/b,0<b&&1>b&&(0==ch&&this.kC(a(b)),1==ch&&this.lC(a(b))));else if(d=Math.pow(b, 2)-4*d*c,!(0>d)&&(e=(-b+Math.sqrt(d))/(2*c),0<e&&1>e&&(0==ch&&this.kC(a(e)),1==ch&&this.lC(a(e))),b=(-b-Math.sqrt(d))/(2*c),0<b&&1>b))0==ch&&this.kC(a(b)),1==ch&&this.lC(a(b))};this.pg(j,j);this.pg(j,j)};B.AP=bh; ');