You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
6.8 KiB

/**/_jsload2 && _jsload2('pointcollection', 'x.extend(zd.prototype,{ra:function(a){var b=this;b.map=this.D=a;b.xc=document.createElement("canvas");b.xc.style.cssText="position: absolute; left: 0; top: 0;";b.V=b.xc;a=b.map.vb();b.xc.width=a.width;b.xc.height=a.height;b.xc.id="myCanvasElement";b.map.Rf().Vt.appendChild(b.xc);b.iz=new Rg;b.ni();b.map.addEventListener("click",function(a){a=Sg(b.iz,a.offsetX,a.offsetY);a!==p&&b.dispatchEvent("click",{point:a.point})});b.Xk=p;b.map.addEventListener("mousemove",function(a){for(var d=b.map.Yx(),e=d.length, f=p,g=0;g<e&&!(d[g]instanceof B.PointCollection&&(f=Sg(d[g].iz,a.offsetX,a.offsetY),f!==p));g++);f===p?(b.Xk!==p&&(b.dispatchEvent("mouseout",{point:b.Xk.point}),b.Xk=p),b.xc.style.cursor=""):(b.Xk===p?(b.dispatchEvent("mouseover",{point:f.point}),b.Xk=f):b.Xk!==f&&(b.dispatchEvent("mouseout",{point:b.Xk.point}),b.dispatchEvent("mouseover",{point:f.point}),b.Xk=f),b.xc.style.cursor="pointer")});return b.xc},ni:function(){this.iz.data.gG=[];var a=this.map.vb();this.xc.width=a.width;this.xc.height= a.height;this.xc.style.left=this.map.Ae.style.left;this.xc.style.top=this.map.Ae.style.top;if(this.ea.ha&&this.ea.ha.length){this.xc.getContext("2d").clearRect(0,0,this.xc.width,this.xc.height);-1!==document.location.href.indexOf(".local")&&(console&&console.time)&&console.time("\\u904d\\u5386\\u7ed8\\u5236\\u9ebb\\u70b9");this.xc.getContext("2d").beginPath();for(var b=0,c;c=this.ea.ha[b];b++){var d=this.map.Cc(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 Tg; break;case 2:e=new Ug;break;case 4:e=new Vg;break;case 5:e=new Wg;break;case wd:e=new Xg;break;default:e=new Xg}switch(this.z.size){case 1:("circle"===e.type||"star"===e.type)&&e.wf(1);if("rectangle"===e.type||"rhombus"===e.type)e.Eh(2),e.Ch(2);break;case 2:("circle"===e.type||"star"===e.type)&&e.wf(2);if("rectangle"===e.type||"rhombus"===e.type)e.Eh(4),e.Ch(4);break;case 3:("circle"===e.type||"star"===e.type)&&e.wf(4);if("rectangle"===e.type||"rhombus"===e.type)e.Eh(8),e.Ch(8);break;case xd:("circle"=== e.type||"star"===e.type)&&e.wf(5);if("rectangle"===e.type||"rhombus"===e.type)e.Eh(10),e.Ch(10);break;case 5:("circle"===e.type||"star"===e.type)&&e.wf(8);if("rectangle"===e.type||"rhombus"===e.type)e.Eh(16),e.Ch(16);break;case 6:("circle"===e.type||"star"===e.type)&&e.wf(10);if("rectangle"===e.type||"rhombus"===e.type)e.Eh(20),e.Ch(20);break;case 7:("circle"===e.type||"star"===e.type)&&e.wf(15);if("rectangle"===e.type||"rhombus"===e.type)e.Eh(30),e.Ch(30);break;default:if(("circle"===e.type||"star"=== e.type)&&e.wf(5),"rectangle"===e.type||"rhombus"===e.type)e.Eh(10),e.Ch(10)}this.z.color&&("circle"===e.type||"star"===e.type||"rectangle"===e.type||"rhombus"===e.type)&&e.Uk(this.z.color);e.hp(this.xc.getContext("2d"),d.x,d.y);e.point=c;this.iz.data.gG.push(e)}}this.xc.getContext("2d").fillStyle=this.z.color;this.xc.getContext("2d").fill();-1!==document.location.href.indexOf(".local")&&(console&&console.timeEnd)&&console.timeEnd("\\u904d\\u5386\\u7ed8\\u5236\\u9ebb\\u70b9")}},W_:function(a){this.ea.ha= a;this.ni()},Di:function(a){a.color&&(this.z.color=a.color);a.size&&(this.z.size=a.size);a.shape&&(this.z.shape=a.shape);this.ni()},clear:function(){this.ea.ha=[];this.ni()},remove:function(){this.clear();this.xc&&this.xc.parentNode&&this.xc.parentNode.removeChild(this.xc);this.dispatchEvent(new N("onremove"))}});zd.prototype.initialize=zd.prototype.ra;zd.prototype.draw=zd.prototype.ni;zd.prototype.setPoints=zd.prototype.W_;zd.prototype.setStyles=zd.prototype.Di;zd.prototype.clear=zd.prototype.clear; zd.prototype.remove=zd.prototype.remove;function Rg(){this.data={gG:[]}}function Sg(a,b,c){for(var d=0,e;e=a.data.gG[d];d++)if(e.Ek(),b>e.position.x-e.Dp()/2&&b<e.position.x+e.Dp()/2&&c>e.position.y-e.Ek()/2&&c<e.position.y+e.Ek()/2)return e;return p}function Ug(){this.type="waterdrop";this.position={x:0,y:0}}var Yg=document.createElement("img"),Zg=q;Yg.onload=function(){Zg=o};Yg.src=B.la+"images/point-collection/red-marker-10x13.png";var $g=document.createElement("img");$g.onload=t(); $g.src=B.la+"images/point-collection/blue-marke-15x16.png";Ug.prototype.hp=function(a,b,c){var d=this;Zg===q?setTimeout(function(){d.hp(a,b,c)},10):(d.O2=a,d.position.x=b,d.position.y=c,a.save(),a.translate(b-Yg.width/2,c-Yg.height/2),a.drawImage(Yg,0,0,Yg.width,Yg.height,0,0,Yg.width,Yg.height),a.restore())};Ug.prototype.ia=v("position");Ug.prototype.Dp=function(){return Yg.width};Ug.prototype.Ek=function(){return Yg.height}; function Xg(a){this.type="circle";a=a||{};this.B={xa:a.radius||10,color:a.color||"#fa937e"};this.position={x:0,y:0}}fa=Xg.prototype;fa.hp=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.translate(b,c);a.beginPath();a.fillStyle=this.B.color;a.arc(0,0,this.B.xa,0,2*Math.PI,q);a.fill();a.restore()};fa.wf=function(a){this.B.xa=a};fa.hM=function(){return this.B.xa};fa.Uk=function(a){this.B.color=a};fa.ia=v("position");fa.Dp=function(){return 2*this.B.xa};fa.Ek=function(){return 2*this.B.xa}; function Tg(a){this.type="star";a=a||{};this.B={xa:a.radius||10,CF:a.pointsNumber||5,zX:a.fraction||0.4,color:a.color||"#fa937e"};this.position={x:0,y:0}}fa=Tg.prototype;fa.hp=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.fillStyle=this.B.color;a.beginPath();a.translate(b,c);a.moveTo(0,0-this.B.xa);for(b=0;b<this.B.CF;b++)a.rotate(Math.PI/this.B.CF),a.lineTo(0,0-this.B.xa*this.B.zX),a.rotate(Math.PI/this.B.CF),a.lineTo(0,0-this.B.xa);a.fill();a.restore()}; fa.wf=function(a){this.B.xa=a};fa.Uk=function(a){this.B.color=a};fa.ia=v("position");fa.Dp=function(){return 2*this.B.xa};fa.Ek=function(){return 2*this.B.xa};function Vg(a){this.type="rectangle";a=a||{};this.B={width:a.width||10,height:a.height||10,color:a.color||"#fa937e"};this.position={x:0,y:0}}fa=Vg.prototype;fa.hp=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.translate(b-this.B.width/2,c-this.B.height/2);a.fillStyle=this.B.color;a.fillRect(0,0,this.B.width,this.B.height);a.restore()}; fa.Eh=function(a){this.B.width=a};fa.Dp=function(){return this.B.width};fa.Ch=function(a){this.B.height=a};fa.Ek=function(){return this.B.height};fa.Uk=function(a){this.B.color=a};fa.ia=v("position");function Wg(a){this.type="rhombus";a=a||{};this.B={width:a.width||10,height:a.height||10,color:a.color||"#fa937e"};this.position={x:0,y:0}}fa=Wg.prototype; fa.hp=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.fillStyle=this.B.color;a.translate(b-this.B.width/2,c-this.B.height/2);a.beginPath();a.moveTo(0+0.5*this.B.width,0);a.lineTo(0,0+0.5*this.B.height);a.lineTo(0+0.5*this.B.width,0+this.B.height);a.lineTo(0+this.B.width,0+0.5*this.B.height);a.lineTo(0+0.5*this.B.width,0);a.closePath();a.fill();a.restore()};fa.Eh=function(a){this.B.width=a};fa.Dp=function(){return this.B.width};fa.Ch=function(a){this.B.height=a};fa.Ek=function(){return this.B.height}; fa.Uk=function(a){this.B.color=a};fa.ia=v("position"); ');