com.javadocmd.simplelatlng.window
Class CircularWindow

java.lang.Object
  extended by com.javadocmd.simplelatlng.window.LatLngWindow<CircularWindow>
      extended by com.javadocmd.simplelatlng.window.CircularWindow

public class CircularWindow
extends LatLngWindow<CircularWindow>

A circular window. Has the benefit of performing well around poles and regardless of the size of the window. contains() checks are slower with a CircularWindow than with a RectangularWindow, however.

Author:
Tyler Coles

Constructor Summary
CircularWindow(LatLng center, double radiusInDegrees)
          Constructs a circular window.
CircularWindow(LatLng center, double radius, LengthUnit unit)
          Constructs a circular window that will contain all points within the specified radius.
 
Method Summary
 boolean contains(LatLng point)
          Tests to see if the given point falls within this window.
 LatLng getCenter()
          Returns the center point of the window.
 double getRadius()
          Gets the radius of this window in degrees.
 double getRadius(LengthUnit unit)
          Gets the radius of this window in a length unit.
 boolean overlaps(CircularWindow window)
          Test if this window overlaps the given window.
 void setCenter(LatLng center)
          Sets the center of this window.
 void setRadius(double radius)
          Sets the radius of this window.
 String toString()
           
 
Methods inherited from class com.javadocmd.simplelatlng.window.LatLngWindow
filter, filterCopy, latitudeDeltaToLength, lengthToLatitudeDelta, lengthToLongitudeDelta, longitudeDeltaToLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CircularWindow

public CircularWindow(LatLng center,
                      double radiusInDegrees)
Constructs a circular window.

Parameters:
center - the center point.
radiusInDegrees - the radius of the circle given in degrees of angle required to create the circle. This angle is measured from an axis that joins the center of the Earth to our circle's center point on the surface.

CircularWindow

public CircularWindow(LatLng center,
                      double radius,
                      LengthUnit unit)
Constructs a circular window that will contain all points within the specified radius.

Parameters:
center - the center point.
radius - the radius of the circle given in length units.
unit - the unit to use for the radius.
Method Detail

contains

public boolean contains(LatLng point)
Description copied from class: LatLngWindow
Tests to see if the given point falls within this window.

Specified by:
contains in class LatLngWindow<CircularWindow>
Parameters:
point - the point to test.
Returns:
true if the window contains the point, false otherwise or if we cannot determine because the point is ill-defined.

overlaps

public boolean overlaps(CircularWindow window)
Description copied from class: LatLngWindow
Test if this window overlaps the given window.

Specified by:
overlaps in class LatLngWindow<CircularWindow>
Parameters:
window - the window to test against this one.
Returns:
true if the windows overlap.

getCenter

public LatLng getCenter()
Description copied from class: LatLngWindow
Returns the center point of the window.

Specified by:
getCenter in class LatLngWindow<CircularWindow>
Returns:
the window's center point.

setCenter

public void setCenter(LatLng center)
Sets the center of this window.

Parameters:
center - the center point; may not be null.

getRadius

public double getRadius()
Gets the radius of this window in degrees.

Returns:
the radius in degrees.

getRadius

public double getRadius(LengthUnit unit)
Gets the radius of this window in a length unit.

Parameters:
unit - the unit in which to receive the result.
Returns:
the radius in the desired length unit.

setRadius

public void setRadius(double radius)
Sets the radius of this window.

Parameters:
radius - radius in degrees.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010-2013. All Rights Reserved.