private int estimateDist(AreaPanel ap1,AreaPanel ap2){
  int yDist=Math.abs(ap1.getCenterY() - ap2.getCenterY());
  int xDist=Math.abs(ap1.getCenterX() - ap2.getCenterX());
  if (xDist < (yDist >> 1) || yDist < (xDist >> 1))   return xDist + yDist;
  return (int)((xDist + yDist) * 7l / 10);
}

private int estimateDist ( AreaPanel ap1 , AreaPanel ap2 ) { int yDist = Math . abs ( ap1 . getCenterY ( ) - ap2 . getCenterY ( ) ) ; int xDist = Math . abs ( ap1 . getCenterX ( ) - ap2 . getCenterX ( ) ) ; if ( xDist < ( yDist > > 1 ) || yDist < ( xDist > > 1 ) ) return xDist + yDist ; return ( int ) ( ( xDist + yDist ) * 7l / 10 ) ; }
this calculates a really cheap estimate of distance in meters between the center of the aps . it is only used to choose a proper size of the view node , so we really don ' t care much .
