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.
2 lines
6.8 KiB
2 lines
6.8 KiB
/**/_jsload2&&_jsload2('pointcollection', 'z.extend(zc.prototype,{xa:function(a){var b=this;b.map=this.M=a;b.xc=document.createElement("canvas");b.xc.style.cssText="position: absolute; left: 0; top: 0;";b.ba=b.xc;a=b.map.Hb();b.xc.width=a.width;b.xc.height=a.height;b.xc.id="myCanvasElement";b.map.Mf().Ps.appendChild(b.xc);b.Tx=new mg;b.Sh();b.map.addEventListener("click",function(a){a=ng(b.Tx,a.offsetX,a.offsetY);a!==s&&b.dispatchEvent("click",{point:a.point})});b.Ek=s;b.map.addEventListener("mousemove",function(a){for(var e=b.map.Mw(),f= e.length,g=s,i=0;i<f&&!(e[i]instanceof D.PointCollection&&(g=ng(e[i].Tx,a.offsetX,a.offsetY),g!==s));i++);g===s?(b.Ek!==s&&(b.dispatchEvent("mouseout",{point:b.Ek.point}),b.Ek=s),b.xc.style.cursor=""):(b.Ek===s?(b.dispatchEvent("mouseover",{point:g.point}),b.Ek=g):b.Ek!==g&&(b.dispatchEvent("mouseout",{point:b.Ek.point}),b.dispatchEvent("mouseover",{point:g.point}),b.Ek=g),b.xc.style.cursor="pointer")});return b.xc},Sh:function(){this.Tx.data.CE=[];var a=this.map.Hb();this.xc.width=a.width;this.xc.height= a.height;this.xc.style.left=this.map.xe.style.left;this.xc.style.top=this.map.xe.style.top;if(this.ia.na&&this.ia.na.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.ia.na[b];b++){var e=this.map.Rb(c);if(!(0>e.x||0>e.y||e.x>a.width||e.y>a.height)){var f;switch(this.K.shape){case 1:f=new og; break;case 2:f=new pg;break;case 4:f=new qg;break;case 5:f=new rg;break;case wc:f=new sg;break;default:f=new sg}switch(this.K.size){case 1:("circle"===f.type||"star"===f.type)&&f.qf(1);if("rectangle"===f.type||"rhombus"===f.type)f.nh(2),f.lh(2);break;case 2:("circle"===f.type||"star"===f.type)&&f.qf(2);if("rectangle"===f.type||"rhombus"===f.type)f.nh(4),f.lh(4);break;case 3:("circle"===f.type||"star"===f.type)&&f.qf(4);if("rectangle"===f.type||"rhombus"===f.type)f.nh(8),f.lh(8);break;case xc:("circle"=== f.type||"star"===f.type)&&f.qf(5);if("rectangle"===f.type||"rhombus"===f.type)f.nh(10),f.lh(10);break;case 5:("circle"===f.type||"star"===f.type)&&f.qf(8);if("rectangle"===f.type||"rhombus"===f.type)f.nh(16),f.lh(16);break;case 6:("circle"===f.type||"star"===f.type)&&f.qf(10);if("rectangle"===f.type||"rhombus"===f.type)f.nh(20),f.lh(20);break;case 7:("circle"===f.type||"star"===f.type)&&f.qf(15);if("rectangle"===f.type||"rhombus"===f.type)f.nh(30),f.lh(30);break;default:if(("circle"===f.type||"star"=== f.type)&&f.qf(5),"rectangle"===f.type||"rhombus"===f.type)f.nh(10),f.lh(10)}this.K.color&&("circle"===f.type||"star"===f.type||"rectangle"===f.type||"rhombus"===f.type)&&f.Ak(this.K.color);f.qo(this.xc.getContext("2d"),e.x,e.y);f.point=c;this.Tx.data.CE.push(f)}}this.xc.getContext("2d").fillStyle=this.K.color;this.xc.getContext("2d").fill();-1!==document.location.href.indexOf(".local")&&(console&&console.timeEnd)&&console.timeEnd("\\u904d\\u5386\\u7ed8\\u5236\\u9ebb\\u70b9")}},NZ:function(a){this.ia.na= a;this.Sh()},mi:function(a){a.color&&(this.K.color=a.color);a.size&&(this.K.size=a.size);a.shape&&(this.K.shape=a.shape);this.Sh()},clear:function(){this.ia.na=[];this.Sh()},remove:function(){this.clear();this.xc&&this.xc.parentNode&&this.xc.parentNode.removeChild(this.xc);this.dispatchEvent(new Q("onremove"))}});zc.prototype.initialize=zc.prototype.xa;zc.prototype.draw=zc.prototype.Sh;zc.prototype.setPoints=zc.prototype.NZ;zc.prototype.setStyles=zc.prototype.mi;zc.prototype.clear=zc.prototype.clear; zc.prototype.remove=zc.prototype.remove;function mg(){this.data={CE:[]}}function ng(a,b,c){for(var e=0,f;f=a.data.CE[e];e++)if(f.kk(),b>f.position.x-f.Lo()/2&&b<f.position.x+f.Lo()/2&&c>f.position.y-f.kk()/2&&c<f.position.y+f.kk()/2)return f;return s}function pg(){this.type="waterdrop";this.position={x:0,y:0}}var tg=document.createElement("img"),ug=t;tg.onload=function(){ug=p};tg.src=D.oa+"images/point-collection/red-marker-10x13.png";var vg=document.createElement("img");vg.onload=u(); vg.src=D.oa+"images/point-collection/blue-marke-15x16.png";pg.prototype.qo=function(a,b,c){var e=this;ug===t?setTimeout(function(){e.qo(a,b,c)},10):(e.I1=a,e.position.x=b,e.position.y=c,a.save(),a.translate(b-tg.width/2,c-tg.height/2),a.drawImage(tg,0,0,tg.width,tg.height,0,0,tg.width,tg.height),a.restore())};pg.prototype.ja=x("position");pg.prototype.Lo=function(){return tg.width};pg.prototype.kk=function(){return tg.height}; function sg(a){this.type="circle";a=a||{};this.U={Ca:a.radius||10,color:a.color||"#fa937e"};this.position={x:0,y:0}}fa=sg.prototype;fa.qo=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.translate(b,c);a.beginPath();a.fillStyle=this.U.color;a.arc(0,0,this.U.Ca,0,2*Math.PI,t);a.fill();a.restore()};fa.qf=function(a){this.U.Ca=a};fa.AK=function(){return this.U.Ca};fa.Ak=function(a){this.U.color=a};fa.ja=x("position");fa.Lo=function(){return 2*this.U.Ca};fa.kk=function(){return 2*this.U.Ca}; function og(a){this.type="star";a=a||{};this.U={Ca:a.radius||10,bE:a.pointsNumber||5,$V:a.fraction||0.4,color:a.color||"#fa937e"};this.position={x:0,y:0}}fa=og.prototype;fa.qo=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.fillStyle=this.U.color;a.beginPath();a.translate(b,c);a.moveTo(0,0-this.U.Ca);for(b=0;b<this.U.bE;b++)a.rotate(Math.PI/this.U.bE),a.lineTo(0,0-this.U.Ca*this.U.$V),a.rotate(Math.PI/this.U.bE),a.lineTo(0,0-this.U.Ca);a.fill();a.restore()}; fa.qf=function(a){this.U.Ca=a};fa.Ak=function(a){this.U.color=a};fa.ja=x("position");fa.Lo=function(){return 2*this.U.Ca};fa.kk=function(){return 2*this.U.Ca};function qg(a){this.type="rectangle";a=a||{};this.U={width:a.width||10,height:a.height||10,color:a.color||"#fa937e"};this.position={x:0,y:0}}fa=qg.prototype;fa.qo=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.translate(b-this.U.width/2,c-this.U.height/2);a.fillStyle=this.U.color;a.fillRect(0,0,this.U.width,this.U.height);a.restore()}; fa.nh=function(a){this.U.width=a};fa.Lo=function(){return this.U.width};fa.lh=function(a){this.U.height=a};fa.kk=function(){return this.U.height};fa.Ak=function(a){this.U.color=a};fa.ja=x("position");function rg(a){this.type="rhombus";a=a||{};this.U={width:a.width||10,height:a.height||10,color:a.color||"#fa937e"};this.position={x:0,y:0}}fa=rg.prototype; fa.qo=function(a,b,c){this.position.x=b;this.position.y=c;a.save();a.fillStyle=this.U.color;a.translate(b-this.U.width/2,c-this.U.height/2);a.beginPath();a.moveTo(0+0.5*this.U.width,0);a.lineTo(0,0+0.5*this.U.height);a.lineTo(0+0.5*this.U.width,0+this.U.height);a.lineTo(0+this.U.width,0+0.5*this.U.height);a.lineTo(0+0.5*this.U.width,0);a.closePath();a.fill();a.restore()};fa.nh=function(a){this.U.width=a};fa.Lo=function(){return this.U.width};fa.lh=function(a){this.U.height=a};fa.kk=function(){return this.U.height}; fa.Ak=function(a){this.U.color=a};fa.ja=x("position"); ');
|