=0){
continue;
}
if(this.isOverlapped(this.poiCollection[i],this.poiCollection[j])){
if(!_57){
_55[_56]=new Array();
_55[_56].push(i);
_54.push(i);
_57=true;
}
_55[_56].push(j);
_54.push(j);
}
}
if(_55[_56]&&_55[_56].length>0){
_56++;
}
}
return _55;
};
MQA.Declutter.prototype.doDeclutterM2=function(_5b){
var _5c={x:0,y:0,h:0,w:0};
var PI=3.14;
var _5e,_5f;
var nx,ny;
var n,_63;
var _64;
var _65;
var _66;
var _67;
var _68=false;
var _69;
if(_5b.length==1&&_5b[0].length==this.poiCollection.length){
_68=true;
_5e=360/_5b[0].length;
_5f=1350/_5e;
_5f=(_5f<75)?75:_5f;
}else{
_5e=10;
_5f=75;
}
var _6a;
var _6b,_6c;
var _6d=this.map.getDragOffset();
for(var i=0,p=_5b.length;i=180){
++_64;
_72-=360;
if(_64>2){
_6a+=30;
}
}
if(_64>4){
break;
}
nx=Math.round(_6a*Math.cos(PI*_72/180));
ny=Math.round(_6a*Math.sin(PI*_72/180));
_5c.x=_63.x+nx-_6b;
_5c.y=_63.y+ny-_6c;
_5c.h=_65.h;
_5c.w=_65.w;
if(_63.x>0&&_63.y>0&&_63.x=this.map.width||_5c.y+_5c.h>=this.map.height){
continue;
}
}
_66=false;
for(var m=0,r=this.poiCollection.length;m=0)&&(_69=xi)||(x1>=xi&&x2<=xi))&&((u1<=xi&&u2>=xi)||(u1>=xi&&u2<=xi))&&((y1<=yi&&y2>=yi)||(y1>=yi&&y2<=yi))&&((v1<=yi&&v2>=yi)||(v1>=yi&&v2<=yi))){
return (true);
}
}
return (false);
};
MQA.Declutter.prototype.checkLLIntersection=function(x1,y1,x2,y2,u1,v1,u2,v2){
var m1=(x2-x1==0)?(y2-y1)/1e-8:(y2-y1)/(x2-x1);
var a1=y1-m1*x1;
var m2=(u2-u1==0)?(v2-v1)/1e-8:(v2-v1)/(u2-u1);
var a2=v1-m2*u1;
var xi,yi;
xi=Math.round(0-(a1-a2)/(m1-m2));
yi=(Math.abs(m1)=xi)||(x1>=xi&&x2<=xi))&&((u1<=xi&&u2>=xi)||(u1>=xi&&u2<=xi))&&((y1<=yi&&y2>=yi)||(y1>=yi&&y2<=yi))&&((v1<=yi&&v2>=yi)||(v1>=yi&&v2<=yi))){
var _94=3;
if(((Math.abs(x1-xi)<=_94)&&(Math.abs(y1-yi)<=_94))||((Math.abs(u1-xi)<=_94)&&(Math.abs(v1-yi)<=_94))||((Math.abs(x2-xi)<=_94)&&(Math.abs(y2-yi)<=_94))||((Math.abs(u2-xi)<=_94)&&(Math.abs(v2-yi)<=_94))){
return (false);
}
return (true);
}
return (false);
};
MQA.Declutter.prototype.getDeclutCenterPt=function(_95){
var _96=0;
var _97=0;
var poi;
var _99=_95.length;
for(var i=0;i<_99;i++){
poi=this.poiCollection[_95[i]];
_96+=poi.ix+poi.w/2;
_97+=poi.iy+poi.h/2;
}
return (new MQA.PointXY(Math.round(_96/_99),Math.round(_97/_99)));
};
MQA.Declutter.prototype.isOverlapped=function(_9b,_9c){
var x1,x2,y1,y2,w1,w2,h1,h2;
x1=_9b.x;
y1=_9b.y;
h1=_9b.h;
w1=_9b.w;
x2=_9c.x;
y2=_9c.y;
h2=_9c.h;
w2=_9c.w;
if((((x1<=x2)&&((x1+w1)>=x2))&&(((y1<=y2)&&((y1+h1)>=y2))||((y1>=y2)&&((y2+h2)>=y1))))||(((x1>=x2)&&((x2+w2)>=x1))&&(((y1>=y2)&&((y2+h2)>=y1))||((y1<=y2)&&((y1+h1)>=y2))))){
return (true);
}
return (false);
};
MQA.Declutter.prototype.sortPois=function(a,b){
return (a[1]-b[1]);
};
MQA.Declutter.prototype.sortPoisRL=function(a,b){
return (b[1]-a[1]);
};
MQA.Declutter.prototype.isIntersected=function(_a9,_aa){
var _ab=(_a9.lr.x>_aa.ul.x)&&(_a9.ul.x<_aa.lr.x)&&(_a9.lr.y>_aa.ul.y)&&(_a9.ul.y<_aa.lr.y);
return _ab;
};
MQA.Declutter.prototype.setMap=function(map){
this.map=map;
};
MQA.Declutter.prototype.addDeclutterPoi=function(x,y,poi,_b0,_b1){
var _b2=new MQA.DeclutterPoi(this.map,poi,_b0);
this.dcCollection[_b1].push(_b2);
poi.isDecluttered=true;
var ll=this.map.pixToLL(new MQA.Point(x,y));
this.map._addPoi(ll,new MQA.PointXY(0,0),_b2.div);
};
MQA.Declutter.prototype.turnPage=function(_b4,_b5){
var i;
var _b7=this.stackHeight*this.stackWidth;
var _b8=this.dcCollection[_b5].length;
if(this.cpCollection[_b5]==1&&_b4==-1){
return;
}
if(((this.cpCollection[_b5]*_b7)>=_b8)&&_b4==1){
return;
}
this.cpCollection[_b5]=this.cpCollection[_b5]+_b4;
for(i=0;i<_b8;i++){
this.dcCollection[_b5][i].setVisible(false);
}
var _b9=(this.cpCollection[_b5]*_b7);
if(_b9>_b8){
_b9=_b8;
}
var _ba=(this.cpCollection[_b5]*_b7)-_b7;
for(i=_ba;i<_b9;i++){
this.dcCollection[_b5][i].setVisible(true);
}
if(_ba>0){
this.pnCollection[_b5][0].setVisible(true);
}else{
this.pnCollection[_b5][0].setVisible(false);
}
if(_b9<_b8){
this.pnCollection[_b5][1].setVisible(true);
}else{
this.pnCollection[_b5][1].setVisible(false);
}
var _bb=this.cpCollection[_b5]-1;
var _bc=parseInt(Math.ceil(_b8/_b7))-1;
var _bd=this.pageBarIcon.width-6;
this.pnCollection[_b5][2].div.mar.style.left=parseInt(_bd*(_bb/_bc))+"px";
};
MQA.Declutter.prototype.adjustLeaderLineSurface=function(){
var _be=false;
if(this.map.poisurface){
if(this.map.getDragOffset().x!=this.map.poiLineOffsetX||this.map.getDragOffset().y!=this.map.poiLineOffsetY){
this.map.poiLineOffsetX=this.map.getDragOffset().x;
this.map.poiLineOffsetY=this.map.getDragOffset().y;
if(this.map.poilinediv){
this.map.poilinediv.style.left=-(MQA.SURFACE_OFFSET+this.map.poiLineOffsetX)+"px";
this.map.poilinediv.style.top=-(MQA.SURFACE_OFFSET+this.map.poiLineOffsetY)+"px";
}
_be=true;
}
}
if(this.map.dcCanvasDiv){
if(this.map.getDragOffset().x!=this.map.canvasOffsetX||this.map.getDragOffset().y!=this.map.canvasOffsetY){
this.map.canvasOffsetX=this.map.getDragOffset().x;
this.map.canvasOffsetY=this.map.getDragOffset().y;
if(this.map.dcCanvasDiv){
this.map.dcCanvasDiv.style.left=-(MQA.SURFACE_OFFSET+this.map.canvasOffsetX)+"px";
this.map.dcCanvasDiv.style.top=-(MQA.SURFACE_OFFSET+this.map.canvasOffsetY)+"px";
}
_be=true;
}
}
return _be;
};
MQA.Declutter.prototype.drawLeaderLine=function(poi){
if(poi.shape.style.display=="none"){
return;
}
var xy=new Object;
var _c1=(MQA.browser.name=="safari");
if(!_c1){
if(!this.map.poisurface){
this.map.createPoiDrawingSurface();
}
}else{
if(!this.map.dcCanvasDiv){
this.map.createCanvas();
}
}
if(!_c1){
if(!poi.map.poisurface){
throw ("Leader line drawing surface does not exist.");
}
}else{
if(!this.map.dcCanvasDiv){
throw ("Leaderline drawing canvas does not exist.");
}
}
if(!this.adjustLeaderLineSurface()){
var _c2=this.map.getDragOffset();
var _c3=new Array();
_c3[0]=new Object;
_c3[0]=this.map.llToPix(poi.getValue("latLng"));
_c3[0].x+=(MQA.SURFACE_OFFSET);
_c3[0].y+=(MQA.SURFACE_OFFSET);
_c3[1]=new Object;
var _c4=parseInt(this.map.div1.style.left)+_c2.x;
var _c5=parseInt(this.map.div1.style.top)+_c2.y;
if(poi.getValue("altStateFlag")){
var _c6=poi.getValue("altIconOffset").x;
var _c7=poi.getValue("altIconOffset").y;
}else{
var _c6=poi.getValue("declutterIconOffset").x;
var _c7=poi.getValue("declutterIconOffset").y;
}
_c3[1].x=(parseInt(poi.shape.style.left)+MQA.SURFACE_OFFSET)-_c6+_c4;
_c3[1].y=(parseInt(poi.shape.style.top)+MQA.SURFACE_OFFSET)-_c7+_c5;
cpnts=new Array();
if(MQA.Util.isOverLimit(xy)){
if(!_c1){
var _c8=parseInt(this.map.poilinediv.style.height.substr(0,(this.map.poilinediv.style.height.length)-2));
var _c9=parseInt(this.map.poilinediv.style.width.substr(0,(this.map.poilinediv.style.width.length)-2));
}else{
var _c8=parseInt(this.map.dcCanvasDiv.style.height.substr(0,(this.map.dcCanvasDiv.style.height.length)-2));
var _c9=parseInt(this.map.dcCanvasDiv.style.width.substr(0,(this.map.dcCanvasDiv.style.width.length)-2));
}
cpnts=MQA.Clip(0,_c8,0,_c9,_c3,false);
}else{
cpnts=_c3;
}
var _ca=poi.getValue("leaderLineColor");
if(!_c1){
poi.leaderLine=MQA.Graphics.drawLine(cpnts,_ca,1,2,true,{x:MQA.Graphics.surfaceWidth,y:MQA.Graphics.surfaceHeight});
this.map.poisurface.appendChild(poi.leaderLine);
poi.leaderLine.setAttribute("zIndex",80);
}else{
this.map.dcCanvasContext.strokeStyle=_ca;
this.map.dcCanvasContext.lineWidth=2;
this.map.dcCanvasContext.beginPath();
this.map.dcCanvasContext.moveTo(cpnts[1].x,cpnts[1].y);
this.map.dcCanvasContext.lineTo(cpnts[0].x,cpnts[0].y);
this.map.dcCanvasContext.stroke();
}
var _cb=parseInt(this.getLeaderLineDotMode());
switch(_cb){
case 0:
break;
case 1:
if(!_c1){
var c=new Array({x:cpnts[0].x-3,y:cpnts[0].y-3},{x:cpnts[0].x+3,y:cpnts[0].y+3});
var _cd=this.map.llToPix(poi.getValue("latLng")).x;
var _ce=this.map.llToPix(poi.getValue("latLng")).y;
var _cf=-MQA.SURFACE_OFFSET;
var _d0=-MQA.SURFACE_OFFSET;
if(!((_cd<_cf)||(_cd>_cf+MQA.Graphics.surfaceWidth)||(_ce<_d0)||(_ce>_d0+MQA.Graphics.surfaceHeight))){
poi.leaderLineDot=MQA.Graphics.drawEllipse(c,_ca,1,1,_ca,1,true);
this.map.poisurface.appendChild(poi.leaderLineDot);
poi.leaderLineDot.setAttribute("zIndex",80);
}
}else{
this.map.dcCanvasContext.beginPath();
this.map.dcCanvasContext.arc(cpnts[0].x,cpnts[0].y,3,0,Math.PI*2,true);
this.map.dcCanvasContext.arc(cpnts[0].x,cpnts[0].y,2,0,Math.PI*2,true);
this.map.dcCanvasContext.arc(cpnts[0].x,cpnts[0].y,1,0,Math.PI*2,true);
this.map.dcCanvasContext.stroke();
}
break;
case 2:
var _d1=poi.getValue("leaderLineDotImage");
if(_d1){
poi._leaderLineDotIconDiv=document.createElement("div");
poi._leaderLineDotIconDiv.style.position="absolute";
poi._leaderLineDotIconDiv.style.display="block";
poi._leaderLineDotIconDiv.style.height=_d1.height;
poi._leaderLineDotIconDiv.style.width=_d1.width;
poi._leaderLineDotIconDiv.style.MozUserSelect="none";
poi._leaderLineDotIconDiv.unselectable="on";
var _d2=document.createElement("img");
_d2.src=_d1.imageURL;
_d2.unselectable="on";
_d2.style.height=_d1.height;
_d2.style.width=_d1.width;
poi._leaderLineDotIconDiv.appendChild(_d2);
poi.map._addPoi(poi.getValue("latLng"),new MQA.PointXY(-_d1.width/2,-_d1.height/2),poi._leaderLineDotIconDiv);
poi._leaderLineDotIconDiv.style.zIndex=85;
}
break;
default:
break;
}
}else{
this.redrawLeaderLines();
}
};
MQA.Declutter.prototype.redrawLeaderLines=function(){
var _d3=null;
var _d4=(MQA.browser.name=="safari");
if(arguments.length>0){
_d3=arguments[0];
}
if(this.map.dcCanvasContext){
this.map.dcCanvasContext.clearRect(0,0,parseInt(this.map.dcCanvasDiv.style.width),parseInt(this.map.dcCanvasDiv.style.height));
}
var _d5=this.getDeclutteredPois();
for(var i=0,x=_d5.getSize();i0)){
this.leaderLineDispose(_d8,true);
}
}
this.drawLeaderLine(_d8);
}
}
};
MQA.Declutter.prototype.removeLeaderLines=function(){
var _d9=this.getDeclutteredPois();
for(var i=0,x=_d9.getSize();i