12345678 |
- /* 百度地图API V2 模块
- * 此模块必须配套使用baidumap_offline_v2_20160822.js对
- * 获取模块的方法:
- * http://api0.map.bdimg.com/getmodules?v=2.0&mod=模块1,模块2
- * 模块名称就是文件名
- * www.xiaoguo123.com 整理
- */
- _jsload2&&_jsload2('drawbycanvas', 'function qg(a){this.C=a;this.nQ={strokeweight:"lineWidth",strokecolor:"strokeStyle",fillcolor:"fillStyle",strokeopacity:"globalAlpha",fillopacity:"globalAlpha"};this.Lb="canvas"}qg.prototype=new z.Xy;var rg=qg.prototype;rg.wo=function(){if(!this.canvas||this.canvas&&!yb(this.canvas)){var a=this.canvas=K("canvas");this.C.Qf().ot.appendChild(a);a.style.position="absolute";a=a.getContext("2d");a.lineCap="round";a.lineJoin="round";a.save();this.$T(this.canvas)}return this.canvas}; rg.ge=function(a,b,c){if(a&&0!==b[0].length){var d=a.getContext("2d");this.sa(a);var e=parseInt(a.style.top),f=parseInt(a.style.left);d.beginPath();x.jc.Fb(b,function(a){if(0!==a.length){d.moveTo(a[0].x-f,a[0].y-e);for(var b=1,c=a.length;b<c;b++)d.lineTo(a[b].x-f,a[b].y-e)}});this.fR(a,c);"dashed"===c.strokeStyle&&this.hR(d,b,f,e,c)}}; rg.hR=function(a,b,c,d,e){var f=this;a.beginPath();x.jc.Fb(b,function(b){if(0!==b.length){for(var i=[],k=0,l=b.length;k<l;k++)i.push({x:b[k].x-c,y:b[k].y-d});a.strokeStyle=e.strokeColor||"#3a6bdb";f.gR(a,i,{lineWidth:e.mc||5,interval:2*e.mc||10,lineLength:2*e.mc||10,strokeStyle:f.jS(a.strokeStyle,e.sd)})}})}; rg.gR=function(a,b,c){for(var c=c||{},d=c.Ix||10,e=c.lineWidth||5,f=c.b3||10,c=c.strokeStyle||"#3a6bdb",g=b.length-1,i=0,k=f+d,l=0,m=0;m<g;m++)var n=b[m].x,u=b[m].y,v=b[m+1].x,w=b[m+1].y,l=l+Math.sqrt((v-n)*(v-n)+(w-u)*(w-u));if(l<f)a.strokeStyle=c,a.lineWidth=e,a.lineJoin="round",a.lineCap="round",a.beginPath(),a.moveTo(b[0].x,b[0].y),a.lineTo(b[g].x,b[g].y),a.stroke();else for(l=0;l<g;l++){var n=b[l].x,u=b[l].y,v=b[l+1].x,w=b[l+1].y,m=Math.sqrt((v-n)*(v-n)+(w-u)*(w-u))+i+f,y=k-Math.abs(i);if(i<= k){var C=parseInt(m/k),A=d*(v-n)/m,B=d*(w-u)/m;xMove=f*(v-n)/m;yMove=f*(w-u)/m;startX=n+y*(v-n)/m;startY=u+y*(w-u)/m;tailX=n+(f-Math.abs(i))*(v-n)/m;tailY=u+(f-Math.abs(i))*(w-u)/m;a.beginPath();a.strokeStyle=c;a.lineJoin="round";a.lineCap="round";a.lineWidth=e;D?a.moveTo(D,E):a.moveTo(n,u);0>=i&&a.lineTo(n,u);a.lineTo(tailX,tailY);a.moveTo(startX,startY);D=0;for(E=2*C;D<E;D++)if(D%2)startX+=A,startY+=B,a.moveTo(startX,startY);else{startX+=xMove;startY+=yMove;if(0>(v-startX)*xMove)break;a.lineTo(startX, startY)}a.stroke()}var i=parseInt(m-k*C)-f,D=v-Math.abs(i)*(v-n)/m,E=w-Math.abs(i)*(w-u)/m;l===g-1&&0<i&&(a.beginPath(),a.strokeStyle=c,n=v-i*(v-n)/m,leftY=w-i*(w-u)/m,i<=f?(a.moveTo(n,leftY),a.lineTo(v,w)):(a.moveTo(n,leftY),a.moveTo(n+xMove,leftY+yMove)),a.stroke())}}; rg.jS=function(a,b){if(4===a.length)var c=parseInt(a.substr(1,1)+a.substr(1,1),16),d=parseInt(a.substr(2,1)+a.substr(2,1),16),e=parseInt(a.substr(3,1)+a.substr(3,1),16);else c=parseInt(a.substr(1,2),16),d=parseInt(a.substr(3,2),16),e=parseInt(a.substr(5,2),16);return c="rgba("+c+","+d+","+e+","+b+")"};rg.setAttribute=function(a,b,c){if(a){var d=a.getContext("2d"),e=this.Sq(b);try{d[e]=c}catch(f){}a.setAttribute("_"+b,c||"");d.save()}};rg.Sq=function(a){return this.nQ[a]||a}; rg.$T=function(a){var b=this.C,c=b.K.Vw,d=b.width+2*c,e=b.height+2*c,f=-b.offsetX-c,b=-b.offsetY-c,c=a.getContext("2d"),g={strokeStyle:c.strokeStyle,fillStyle:c.fillStyle,globalAlpha:c.globalAlpha,lineWidth:c.lineWidth,lineCap:"round",lineJoin:"round"};a.setAttribute("width",d);a.setAttribute("height",e);for(var i in g)c[i]=g[i];c.save();a=a.style;a.top=b+"px";a.left=f+"px"};rg.xQ=function(a){a.clearRect(0,0,9999,9999)}; rg.fR=function(a,b){var c=a.getContext("2d");c.globalAlpha=a.getAttribute("_fillopacity");0!==c.globalAlpha&&a.getAttribute("_fillcolor")&&c.fill();c.globalAlpha=a.getAttribute("_strokeopacity");0!==c.globalAlpha&&(a.getAttribute("_strokecolor")&&"dashed"!==b.strokeStyle)&&c.stroke()};rg.sa=function(a){var b=this.C,c=b.K.Vw,d=-b.offsetX-c,a=a.style;a.top=-b.offsetY-c+"px";a.left=d+"px"};z.bP=qg; ');
|