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('pointcollection', 'x.extend(wc.prototype,{qa:function(a){var b=this;b.map=this.C=a;b.wc=document.createElement("canvas");b.wc.style.cssText="position: absolute; left: 0; top: 0;";b.V=b.wc;a=b.map.yb();b.wc.width=a.width;b.wc.height=a.height;b.wc.id="myCanvasElement";b.map.Qf().ot.appendChild(b.wc);b.Ay=new Hf;b.hi();b.map.addEventListener("click",function(a){a=If(b.Ay,a.offsetX,a.offsetY);a!==p&&b.dispatchEvent("click",{point:a.point})});b.Ok=p;b.map.addEventListener("mousemove",function(a){for(var d=b.map.tx(),e=d.length, f=p,g=0;g<e&&!(d[g]instanceof z.PointCollection&&(f=If(d[g].Ay,a.offsetX,a.offsetY),f!==p));g++);f===p?(b.Ok!==p&&(b.dispatchEvent("mouseout",{point:b.Ok.point}),b.Ok=p),b.wc.style.cursor=""):(b.Ok===p?(b.dispatchEvent("mouseover",{point:f.point}),b.Ok=f):b.Ok!==f&&(b.dispatchEvent("mouseout",{point:b.Ok.point}),b.dispatchEvent("mouseover",{point:f.point}),b.Ok=f),b.wc.style.cursor="pointer")});return b.wc},hi:function(){this.Ay.data.zF=[];var a=this.map.yb();this.wc.width=a.width;this.wc.height= a.height;this.wc.style.left=this.map.ue.style.left;this.wc.style.top=this.map.ue.style.top;if(this.da.ia&&this.da.ia.length){this.wc.getContext("2d").clearRect(0,0,this.wc.width,this.wc.height);-1!==document.location.href.indexOf(".local")&&(console&&console.time)&&console.time("\\u904d\\u5386\\u7ed8\\u5236\\u9ebb\\u70b9");this.wc.getContext("2d").beginPath();for(var b=0,c;c=this.da.ia[b];b++){var d=this.map.ac(c);if(!(0>d.x||0>d.y||d.x>a.width||d.y>a.height)){var e;switch(this.z.shape){case 1:e=new Jf; break;case 2:e=new Kf;break;case 4:e=new Lf;break;case 5:e=new Mf;break;case tc:e=new Nf;break;default:e=new Nf}switch(this.z.size){case 1:("circle"===e.type||"star"===e.type)&&e.qf(1);if("rectangle"===e.type||"rhombus"===e.type)e.Ch(2),e.Ah(2);break;case 2:("circle"===e.type||"star"===e.type)&&e.qf(2);if("rectangle"===e.type||"rhombus"===e.type)e.Ch(4),e.Ah(4);break;case 3:("circle"===e.type||"star"===e.type)&&e.qf(4);if("rectangle"===e.type||"rhombus"===e.type)e.Ch(8),e.Ah(8);break;case uc:("circle"=== e.type||"star"===e.type)&&e.qf(5);if("rectangle"===e.type||"rhombus"===e.type)e.Ch(10),e.Ah(10);break;case 5:("circle"===e.type||"star"===e.type)&&e.qf(8);if("rectangle"===e.type||"rhombus"===e.type)e.Ch(16),e.Ah(16);break;case 6:("circle"===e.type||"star"===e.type)&&e.qf(10);if("rectangle"===e.type||"rhombus"===e.type)e.Ch(20),e.Ah(20);break;case 7:("circle"===e.type||"star"===e.type)&&e.qf(15);if("rectangle"===e.type||"rhombus"===e.type)e.Ch(30),e.Ah(30);break;default:if(("circle"===e.type||"star"=== e.type)&&e.qf(5),"rectangle"===e.type||"rhombus"===e.type)e.Ch(10),e.Ah(10)}this.z.color&&("circle"===e.type||"star"===e.type||"rectangle"===e.type||"rhombus"===e.type)&&e.Kk(this.z.color);e.Lo(this.wc.getContext("2d"),d.x,d.y);e.point=c;this.Ay.data.zF.push(e)}}this.wc.getContext("2d").fillStyle=this.z.color;this.wc.getContext("2d").fill();-1!==document.location.href.indexOf(".local")&&(console&&console.timeEnd)&&console.timeEnd("\\u904d\\u5386\\u7ed8\\u5236\\u9ebb\\u70b9")}},b_:function(a){this.da.ia= a;this.hi()},yi:function(a){a.color&&(this.z.color=a.color);a.size&&(this.z.size=a.size);a.shape&&(this.z.shape=a.shape);this.hi()},clear:function(){this.da.ia=[];this.hi()},remove:function(){this.clear();this.wc&&this.wc.parentNode&&this.wc.parentNode.removeChild(this.wc);this.dispatchEvent(new N("onremove"))}});wc.prototype.initialize=wc.prototype.qa;wc.prototype.draw=wc.prototype.hi;wc.prototype.setPoints=wc.prototype.b_;wc.prototype.setStyles=wc.prototype.yi;wc.prototype.clear=wc.prototype.clear; wc.prototype.remove=wc.prototype.remove;function Hf(){this.data={zF:[]}}function If(a,b,c){for(var d=0,e;e=a.data.zF[d];d++)if(e.vk(),b>e.position.x-e.gp()/2&&b<e.position.x+e.gp()/2&&c>e.position.y-e.vk()/2&&c<e.position.y+e.vk()/2)return e;return p}function Kf(){this.type="waterdrop";this.position={x:0,y:0}}var Of=document.createElement("img"),Pf=q;Of.onload=function(){Pf=o};Of.src=z.ma+"images/point-collection/red-marker-10x13.png";var Qf=document.createElement("img");Qf.onload=s(); Qf.src=z.ma+"images/point-collection/blue-marke-15x16.png";Kf.prototype.Lo=function(a,b,c){var d=this;Pf===q?setTimeout(function(){d.Lo(a,b,c)},10):(d.y1=a,d.position.x=b,d.position.y=c,a.save(),a.translate(b-Of.width/2,c-Of.height/2),a.drawImage(Of,0,0,Of.width,Of.height,0,0,Of.width,Of.height),a.restore())};Kf.prototype.ha=t("position");Kf.prototype.gp=function(){return Of.width};Kf.prototype.vk=function(){return Of.height}; function Nf(a){this.type="circle";a=a||{};this.K={wa:a.radius||10,color:a.color||"#fa937e"};this.position={x:0,y:0}}da=Nf.prototype;da.Lo=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.translate(b,c);a.beginPath();a.fillStyle=this.K.color;a.arc(0,0,this.K.wa,0,2*Math.PI,q);a.fill();a.restore()};da.qf=function(a){this.K.wa=a};da.wL=function(){return this.K.wa};da.Kk=function(a){this.K.color=a};da.ha=t("position");da.gp=function(){return 2*this.K.wa};da.vk=function(){return 2*this.K.wa}; function Jf(a){this.type="star";a=a||{};this.K={wa:a.radius||10,VE:a.pointsNumber||5,HW:a.fraction||0.4,color:a.color||"#fa937e"};this.position={x:0,y:0}}da=Jf.prototype;da.Lo=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.fillStyle=this.K.color;a.beginPath();a.translate(b,c);a.moveTo(0,0-this.K.wa);for(b=0;b<this.K.VE;b++)a.rotate(Math.PI/this.K.VE),a.lineTo(0,0-this.K.wa*this.K.HW),a.rotate(Math.PI/this.K.VE),a.lineTo(0,0-this.K.wa);a.fill();a.restore()}; da.qf=function(a){this.K.wa=a};da.Kk=function(a){this.K.color=a};da.ha=t("position");da.gp=function(){return 2*this.K.wa};da.vk=function(){return 2*this.K.wa};function Lf(a){this.type="rectangle";a=a||{};this.K={width:a.width||10,height:a.height||10,color:a.color||"#fa937e"};this.position={x:0,y:0}}da=Lf.prototype;da.Lo=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.translate(b-this.K.width/2,c-this.K.height/2);a.fillStyle=this.K.color;a.fillRect(0,0,this.K.width,this.K.height);a.restore()}; da.Ch=function(a){this.K.width=a};da.gp=function(){return this.K.width};da.Ah=function(a){this.K.height=a};da.vk=function(){return this.K.height};da.Kk=function(a){this.K.color=a};da.ha=t("position");function Mf(a){this.type="rhombus";a=a||{};this.K={width:a.width||10,height:a.height||10,color:a.color||"#fa937e"};this.position={x:0,y:0}}da=Mf.prototype; da.Lo=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.fillStyle=this.K.color;a.translate(b-this.K.width/2,c-this.K.height/2);a.beginPath();a.moveTo(0+0.5*this.K.width,0);a.lineTo(0,0+0.5*this.K.height);a.lineTo(0+0.5*this.K.width,0+this.K.height);a.lineTo(0+this.K.width,0+0.5*this.K.height);a.lineTo(0+0.5*this.K.width,0);a.closePath();a.fill();a.restore()};da.Ch=function(a){this.K.width=a};da.gp=function(){return this.K.width};da.Ah=function(a){this.K.height=a};da.vk=function(){return this.K.height}; da.Kk=function(a){this.K.color=a};da.ha=t("position"); ');
|