Files
hb_pqs_web/public/static/map/modules/pointcollection_lx5y2g.js
2025-01-09 19:02:44 +08:00

2 lines
6.8 KiB
JavaScript

/**/_jsload2&&_jsload2('pointcollection', 'x.extend(vd.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().Jt.appendChild(b.xc);b.Wy=new Lg;b.ni();b.map.addEventListener("click",function(a){a=Mg(b.Wy,a.offsetX,a.offsetY);a!==p&&b.dispatchEvent("click",{point:a.point})});b.Vk=p;b.map.addEventListener("mousemove",function(a){for(var d=b.map.Mx(),e=d.length, f=p,g=0;g<e&&!(d[g]instanceof B.PointCollection&&(f=Mg(d[g].Wy,a.offsetX,a.offsetY),f!==p));g++);f===p?(b.Vk!==p&&(b.dispatchEvent("mouseout",{point:b.Vk.point}),b.Vk=p),b.xc.style.cursor=""):(b.Vk===p?(b.dispatchEvent("mouseover",{point:f.point}),b.Vk=f):b.Vk!==f&&(b.dispatchEvent("mouseout",{point:b.Vk.point}),b.dispatchEvent("mouseover",{point:f.point}),b.Vk=f),b.xc.style.cursor="pointer")});return b.xc},ni:function(){this.Wy.data.SF=[];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 Ng; break;case 2:e=new Og;break;case 4:e=new Pg;break;case 5:e=new Qg;break;case sd:e=new Rg;break;default:e=new Rg}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 td:("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.Sk(this.z.color);e.Wo(this.xc.getContext("2d"),d.x,d.y);e.point=c;this.Wy.data.SF.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")}},B_: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"))}});vd.prototype.initialize=vd.prototype.ra;vd.prototype.draw=vd.prototype.ni;vd.prototype.setPoints=vd.prototype.B_;vd.prototype.setStyles=vd.prototype.Di;vd.prototype.clear=vd.prototype.clear; vd.prototype.remove=vd.prototype.remove;function Lg(){this.data={SF:[]}}function Mg(a,b,c){for(var d=0,e;e=a.data.SF[d];d++)if(e.Ck(),b>e.position.x-e.qp()/2&&b<e.position.x+e.qp()/2&&c>e.position.y-e.Ck()/2&&c<e.position.y+e.Ck()/2)return e;return p}function Og(){this.type="waterdrop";this.position={x:0,y:0}}var Sg=document.createElement("img"),Tg=q;Sg.onload=function(){Tg=o};Sg.src=B.la+"images/point-collection/red-marker-10x13.png";var Ug=document.createElement("img");Ug.onload=t(); Ug.src=B.la+"images/point-collection/blue-marke-15x16.png";Og.prototype.Wo=function(a,b,c){var d=this;Tg===q?setTimeout(function(){d.Wo(a,b,c)},10):(d.j2=a,d.position.x=b,d.position.y=c,a.save(),a.translate(b-Sg.width/2,c-Sg.height/2),a.drawImage(Sg,0,0,Sg.width,Sg.height,0,0,Sg.width,Sg.height),a.restore())};Og.prototype.ia=v("position");Og.prototype.qp=function(){return Sg.width};Og.prototype.Ck=function(){return Sg.height}; function Rg(a){this.type="circle";a=a||{};this.B={xa:a.radius||10,color:a.color||"#fa937e"};this.position={x:0,y:0}}fa=Rg.prototype;fa.Wo=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.TL=function(){return this.B.xa};fa.Sk=function(a){this.B.color=a};fa.ia=v("position");fa.qp=function(){return 2*this.B.xa};fa.Ck=function(){return 2*this.B.xa}; function Ng(a){this.type="star";a=a||{};this.B={xa:a.radius||10,nF:a.pointsNumber||5,eX:a.fraction||0.4,color:a.color||"#fa937e"};this.position={x:0,y:0}}fa=Ng.prototype;fa.Wo=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.nF;b++)a.rotate(Math.PI/this.B.nF),a.lineTo(0,0-this.B.xa*this.B.eX),a.rotate(Math.PI/this.B.nF),a.lineTo(0,0-this.B.xa);a.fill();a.restore()}; fa.wf=function(a){this.B.xa=a};fa.Sk=function(a){this.B.color=a};fa.ia=v("position");fa.qp=function(){return 2*this.B.xa};fa.Ck=function(){return 2*this.B.xa};function Pg(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=Pg.prototype;fa.Wo=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.qp=function(){return this.B.width};fa.Ch=function(a){this.B.height=a};fa.Ck=function(){return this.B.height};fa.Sk=function(a){this.B.color=a};fa.ia=v("position");function Qg(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=Qg.prototype; fa.Wo=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.qp=function(){return this.B.width};fa.Ch=function(a){this.B.height=a};fa.Ck=function(){return this.B.height}; fa.Sk=function(a){this.B.color=a};fa.ia=v("position"); ');