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.
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(LatLng point)
Tests to see if the given point falls within this window.
|
<E> void |
filterCopySort(Collection<E> source,
Collection<E> destination,
FilterHelper<E> helper)
A specialized extension of
LatLngWindow.filterCopy(Collection, Collection, FilterHelper)
which returns the filtered results in sorted order from the center of the
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() |
filter, filterCopy, latitudeDeltaToLength, lengthToLatitudeDelta, lengthToLongitudeDelta, longitudeDeltaToLengthpublic CircularWindow(LatLng center, double radiusInDegrees)
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.public CircularWindow(LatLng center, double radius, LengthUnit unit)
center - the center point.radius - the radius of the circle given in length units.unit - the unit to use for the radius.public <E> void filterCopySort(Collection<E> source, Collection<E> destination, FilterHelper<E> helper)
LatLngWindow.filterCopy(Collection, Collection, FilterHelper)
which returns the filtered results in sorted order from the center of the
window. This method re-uses the distance calculation used for filtering
to do the sorting, so that the number of distance calculations done is
halved (at most).E - the type of elements in the collection.source - the source collection of elements.destination - the destination collection; after this method runs,
destination contains all items that fit within this window.helper - the instance of FilterHelper that gives this method access to
E's LatLng value that we will test against this window.public boolean contains(LatLng point)
LatLngWindowcontains in class LatLngWindow<CircularWindow>point - the point to test.public boolean overlaps(CircularWindow window)
LatLngWindowoverlaps in class LatLngWindow<CircularWindow>window - the window to test against this one.public LatLng getCenter()
LatLngWindowgetCenter in class LatLngWindow<CircularWindow>public void setCenter(LatLng center)
center - the center point; may not be null.public double getRadius()
public double getRadius(LengthUnit unit)
unit - the unit in which to receive the result.public void setRadius(double radius)
radius - radius in degrees.Copyright © 2010-2015. All Rights Reserved.