public class Sector
extends java.lang.Object
Constructor and Description |
---|
Sector()
Constructs an empty sector with minimum and maximum latitudes and longitudes all NaN.
|
Sector(double minLatitude,
double minLongitude,
double deltaLatitude,
double deltaLongitude)
Constructs a sector with the specified latitude and longitude values in degrees.
|
Sector(Sector sector)
Constructs a sector with the minimum and maximum latitudes and longitudes of a specified sector.
|
Modifier and Type | Method and Description |
---|---|
Location |
centroid(Location result)
Computes the location of the angular center of this sector, which is the mid-angle of each of this sector's
latitude and longitude dimensions.
|
double |
centroidLatitude()
Returns the angle midway between this sector's minimum and maximum latitudes.
|
double |
centroidLongitude()
Returns the angle midway between this sector's minimum and maximum longitudes.
|
boolean |
contains(double latitude,
double longitude)
Indicates whether this sector contains a specified geographic location.
|
boolean |
contains(double minLatitude,
double minLongitude,
double deltaLatitude,
double deltaLongitude)
Indicates whether this sector fully contains a specified sector.
|
boolean |
contains(Sector sector)
Indicates whether this sector fully contains a specified sector.
|
double |
deltaLatitude()
Returns the angle between this sector's minimum and maximum latitudes.
|
double |
deltaLongitude()
Returns the angle between this sector's minimum and maximum longitudes.
|
boolean |
equals(java.lang.Object o) |
static Sector |
fromDegrees(double latitudeDegrees,
double longitudeDegrees,
double deltaLatitudeDegrees,
double deltaLongitudeDegrees) |
static Sector |
fromRadians(double latitudeRadians,
double longitudeRadians,
double deltaLatitudeRadians,
double deltaLongitudeRadians) |
int |
hashCode() |
boolean |
intersect(double minLatitude,
double minLongitude,
double deltaLatitude,
double deltaLongitude)
Computes the intersection of this sector and a specified sector, storing the result in this sector and returning
whether or not the sectors intersect.
|
boolean |
intersect(Sector sector)
Computes the intersection of this sector and a specified sector, storing the result in this sector and returning
whether or not the sectors intersect.
|
boolean |
intersects(double minLatitude,
double minLongitude,
double deltaLatitude,
double deltaLongitude)
Indicates whether this sector intersects a specified sector.
|
boolean |
intersects(Sector sector)
Indicates whether this sector intersects a specified sector.
|
boolean |
isEmpty()
Indicates whether this sector has non-zero width and height.
|
double |
maxLatitude()
Returns this sector's maximum latitude.
|
double |
maxLongitude()
Returns this sector's maximum longitude.
|
double |
minLatitude()
Returns the this sector's minimum latitude.
|
double |
minLongitude()
Returns this sector's minimum longitude.
|
Sector |
set(double minLatitude,
double minLongitude,
double deltaLatitude,
double deltaLongitude)
Sets this sector to the specified latitude, longitude and dimension in degrees.
|
Sector |
set(Sector sector)
Sets this sector to the minimum and maximum latitudes and longitudes of a specified sector.
|
Sector |
setEmpty()
Sets this sector to an empty sector.
|
Sector |
setFullSphere()
Sets this sector to the full range of latitude [90 to +90] and longitude [-180 to +180].
|
java.lang.String |
toString() |
Sector |
union(double latitude,
double longitude)
Sets this sector to the union of itself and a specified location.
|
Sector |
union(double minLatitude,
double minLongitude,
double deltaLatitude,
double deltaLongitude)
Sets this sector to the union of itself and a specified sector.
|
Sector |
union(float[] array,
int count,
int stride)
Sets this sector to the union of itself and an array of specified locations.
|
Sector |
union(Sector sector)
Sets this sector to the union of itself and a specified sector.
|
public Sector()
public Sector(double minLatitude, double minLongitude, double deltaLatitude, double deltaLongitude)
minLatitude
- the minimum latitude, i.e., the latitude at the southwest corner of the sector.minLongitude
- the minimum longitude, i.e., the longitude at the southwest corner of the sector.deltaLatitude
- the width of the sector, specified in degrees; must equal to or greater than zero.deltaLongitude
- the height of the sector, specified in degrees; must equal to or greater than zero.public Sector(Sector sector)
sector
- the sector specifying the coordinatesjava.lang.IllegalArgumentException
- If the sector is nullpublic static Sector fromDegrees(double latitudeDegrees, double longitudeDegrees, double deltaLatitudeDegrees, double deltaLongitudeDegrees)
public static Sector fromRadians(double latitudeRadians, double longitudeRadians, double deltaLatitudeRadians, double deltaLongitudeRadians)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isEmpty()
public double minLatitude()
public double maxLatitude()
public double minLongitude()
public double maxLongitude()
public double deltaLatitude()
public double deltaLongitude()
public double centroidLatitude()
public double centroidLongitude()
public Location centroid(Location result)
result
- a pre-allocated Location
in which to return the computed centroidjava.lang.IllegalArgumentException
- If the result is nullpublic Sector set(double minLatitude, double minLongitude, double deltaLatitude, double deltaLongitude)
minLatitude
- the minimum latitude, i.e., the latitude at the southwest corner of the sector.minLongitude
- the minimum longitude, i.e., the longitude at the southwest corner of the sector.deltaLatitude
- the width of the sector, specified in degrees; must equal to or greater than zero.deltaLongitude
- the height of the sector, specified in degrees; must equal to or greater than zero.public Sector set(Sector sector)
sector
- the sector specifying the new coordinatesjava.lang.IllegalArgumentException
- If the sector is nullpublic Sector setEmpty()
public Sector setFullSphere()
public boolean intersects(double minLatitude, double minLongitude, double deltaLatitude, double deltaLongitude)
minLatitude
- the minimum latitude of the sector to test intersection with, in degreesminLongitude
- the minimum longitude of the sector to test intersection with, in degreesdeltaLatitude
- the width of the sector to test intersection with, in degreesdeltaLongitude
- the height of the sector to test intersection with, in degreespublic boolean intersects(Sector sector)
sector
- the sector to test intersection withjava.lang.IllegalArgumentException
- If the sector is nullpublic boolean intersect(double minLatitude, double minLongitude, double deltaLatitude, double deltaLongitude)
minLatitude
- the minimum latitude of the sector to intersect with, in degreesminLongitude
- the minimum longitude of the sector to intersect with, in degreesdeltaLatitude
- the width of the sector to intersect with, in degreesdeltaLongitude
- the height of the sector to intersect with, in degreespublic boolean intersect(Sector sector)
sector
- the sector to intersect withjava.lang.IllegalArgumentException
- If the sector is nullpublic boolean contains(double latitude, double longitude)
latitude
- the location's latitude in degreeslongitude
- the location's longitude in degreespublic boolean contains(double minLatitude, double minLongitude, double deltaLatitude, double deltaLongitude)
minLatitude
- the minimum latitude of the sector to test containment with, in degreesminLongitude
- the minimum longitude of the sector to test containment with, in degreesdeltaLatitude
- the width of the sector to test containment with, in degreesdeltaLongitude
- the height of the sector to test containment with, in degreespublic boolean contains(Sector sector)
sector
- the sector to test containment withjava.lang.IllegalArgumentException
- If the sector is nullpublic Sector union(double latitude, double longitude)
latitude
- the location's latitude in degreeslongitude
- the location's longitude in degreespublic Sector union(float[] array, int count, int stride)
array
- the array of locations to considercount
- the number of array elements to considerstride
- the number of coordinates between the first coordinate of adjacent locations - must be at least 2java.lang.IllegalArgumentException
- If the array is null or empty, if the count is less than 0, or if the stride is
less than 2public Sector union(double minLatitude, double minLongitude, double deltaLatitude, double deltaLongitude)
minLatitude
- the minimum latitude of the sector to union with, in degreesminLongitude
- the minimum longitude of the sector to union with, in degreesdeltaLatitude
- the width of the sector to union with, in degreesdeltaLongitude
- the height of the sector to union with, in degreespublic Sector union(Sector sector)
sector
- the sector to union withjava.lang.IllegalArgumentException
- If the sector is null