Files
hb_pqs_web/public/static/map/modules/canvablepath_f0ium1.js

2 lines
5.9 KiB
JavaScript
Raw Normal View History

2025-01-09 19:02:44 +08:00
/**/_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]<