Package gov.nasa.worldwind.geom
Class Sector
- java.lang.Object
-
- gov.nasa.worldwind.geom.Sector
-
- Direct Known Subclasses:
MercatorSector
public class Sector extends java.lang.Object implements Cacheable, java.lang.Comparable<Sector>, java.lang.Iterable<LatLon>
Sectorrepresents a rectangular region of latitude and longitude. The region is defined by four angles: its minimum and maximum latitude, its minimum and maximum longitude. The angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude. The minimums and maximums are relative to these ranges, e.g., -80 is less than 20. Behavior of the class is undefined for angles outside these ranges. Normalization is not performed on the angles by this class, nor is it verified by the class' methods. SeeAnglefor a description of specifying angles.Sectorinstances are immutable.- See Also:
Angle
-
-
Field Summary
Fields Modifier and Type Field Description static SectorEMPTY_SECTORstatic SectorFULL_SPHEREASectorof latitude [-90 degrees, + 90 degrees] and longitude [-180 degrees, + 180 degrees].
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]asDegreesArray()Returns the coordinates of the sector as an array of values in degrees, in the order minLat, maxLat, minLon, maxLon.java.util.List<LatLon>asList()Returns the coordinates of the sector as a list, in the order minLat, maxLat, minLon, maxLon.double[]asRadiansArray()Returns the coordinates of the sector as an array of values in radians, in the order minLat, maxLat, minLon, maxLon.static SectorboundingSector(LatLon pA, LatLon pB)static SectorboundingSector(Globe globe, LatLon center, double radius)Returns a newSectorencompassing a circle centered at a given position, with a given radius in meter.static SectorboundingSector(java.lang.Iterable<? extends LatLon> locations)static SectorboundingSector(java.util.Iterator<TrackPoint> positions)intcompareTo(Sector that)Compares this sector to a specified sector according to their minimum latitude, minimum longitude, maximum latitude, and maximum longitude, respectively.static BoxcomputeBoundingBox(Globe globe, double verticalExaggeration, Sector sector)static BoxcomputeBoundingBox(Globe globe, double verticalExaggeration, Sector sector, double minElevation, double maxElevation)static CylindercomputeBoundingCylinder(Globe globe, double verticalExaggeration, Sector sector)Returns a cylinder that minimally surrounds the specified sector at a specified vertical exaggeration.static CylindercomputeBoundingCylinder(Globe globe, double verticalExaggeration, Sector sector, double minElevation, double maxElevation)Returns a cylinder that minimally surrounds the specified sector at a specified vertical exaggeration and minimum and maximum elevations for the sector.static CylindercomputeBoundingCylinderOrig(Globe globe, double verticalExaggeration, Sector sector)static CylindercomputeBoundingCylinderOrig(Globe globe, double verticalExaggeration, Sector sector, double minElevation, double maxElevation)Returns a cylinder that minimally surrounds the specified minimum and maximum elevations in the sector at a specified vertical exaggeration.static SpherecomputeBoundingSphere(Globe globe, double verticalExaggeration, Sector sector)Returns a sphere that minimally surrounds the sector at a specified vertical exaggeration.Vec4computeCenterPoint(Globe globe, double exaggeration)Computes the Cartesian coordinates of a Sector's center.Vec4[]computeCornerPoints(Globe globe, double exaggeration)Computes the Cartesian coordinates of a Sector's corners.booleancontains(Angle latitude, Angle longitude)booleancontains(LatLon latLon)Determines whether a latitude/longitude position is within the sector.booleancontains(Sector that)Determines whether another sector is fully contained within this one.booleancontainsDegrees(double degreesLatitude, double degreesLongitude)booleancontainsRadians(double radiansLatitude, double radiansLongitude)Determines whether a latitude/longitude postion expressed in radians is within the sector.doubledistanceTo(DrawContext dc, Vec4 point)Returns an approximation of the distance in model coordinates between the surface geometry defined by this sector and the specified model coordinate point.booleanequals(java.lang.Object o)Tests the equality of the sectors' angles.static SectorfromDegrees(double[] array)Creates a newSectorand initializes it to angles in the specified array.static SectorfromDegrees(double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)Creates a newSectorand initializes it to the specified angles.static SectorfromDegrees(java.awt.geom.Rectangle2D rectangle)Creates a newSectorand initializes it to the angles resulting from the givenRectangle2Din degrees lat-lon coordinates where x corresponds to longitude and y to latitude.static SectorfromDegreesAndClamp(double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)Creates a newSectorand initializes it to the specified angles.static SectorfromRadians(double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)Creates a newSectorand initializes it to the specified angles.static SectorfromUTMRectangle(int zone, java.lang.String hemisphere, double minEasting, double maxEasting, double minNorthing, double maxNorthing)Returns a geographic Sector which bounds the specified UTM rectangle.LatLongetCentroid()Returns the latitude and longitude of the sector's angular center: (minimum latitude + maximum latitude) / 2, (minimum longitude + maximum longitude) / 2.LatLon[]getCorners()Returns a list of the Lat/Lon coordinates of a Sector's corners.AnglegetDeltaLat()Returns the angular difference between the sector's minimum and maximum latitudes: max - mindoublegetDeltaLatDegrees()doublegetDeltaLatRadians()AnglegetDeltaLon()Returns the angular difference between the sector's minimum and maximum longitudes: max - min.doublegetDeltaLonDegrees()doublegetDeltaLonRadians()AnglegetMaxLatitude()Returns the sector's maximum latitude.AnglegetMaxLongitude()Returns the sector's maximum longitude.AnglegetMinLatitude()Returns the sector's minimum latitude.AnglegetMinLongitude()Returns the sector's minimum longitude.longgetSizeInBytes()Retrieve the size of this object in bytes.inthashCode()Computes a hash code from the sector's four angles.Sectorintersection(Angle latitude, Angle longitude)Sectorintersection(Sector that)static Sectorintersection(java.lang.Iterable<? extends Sector> sectors)Returns the intersection of all sectors in the specified iterable.booleanintersects(Sector that)Determines whether this sector intersects another sector's range of latitude and longitude.booleanintersectsAny(java.lang.Iterable<? extends Sector> sectors)Determines whether this sector intersects any one of the sectors in the specified iterable.booleanintersectsInterior(Sector that)Determines whether the interiors of this sector and another sector intersect.booleanintersectsSegment(LatLon begin, LatLon end)Determines whether this sector intersects the specified geographic line segment.booleanisSameSector(java.lang.Iterable<? extends LatLon> corners)static booleanisSector(java.lang.Iterable<? extends LatLon> corners)booleanisWithinLatLonLimits()java.util.Iterator<LatLon>iterator()Creates an iterator over the four corners of the sector, starting with the southwest position and continuing counter-clockwise.static Sector[]splitBoundingSectors(Globe globe, LatLon center, double radius)Returns an array of Sectors encompassing a circle centered at a given position, with a given radius in meters.static Sector[]splitBoundingSectors(java.lang.Iterable<? extends LatLon> locations)Sector[]subdivide()Sector[]subdivide(int div)double[]toArrayDegrees()Returns a four element array containing the Sector's angles in degrees.java.awt.geom.Rectangle2DtoRectangleDegrees()Returns aRectangle2Dcorresponding to this Sector in degrees lat-lon coordinates where x corresponds to longitude and y to latitude.java.lang.StringtoString()Returns a string indicating the sector's angles.Sectorunion(Angle latitude, Angle longitude)Sectorunion(Sector that)Returns a new sector whose angles are the extremes of the this sector and another.static Sectorunion(Sector sectorA, Sector sectorB)static Sectorunion(java.lang.Iterable<? extends Sector> sectors)
-
-
-
Constructor Detail
-
Sector
public Sector(Angle minLatitude, Angle maxLatitude, Angle minLongitude, Angle maxLongitude)
Creates a newSectorand initializes it to the specified angles. The angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude, but this method does not verify that.- Parameters:
minLatitude- the sector's minimum latitude.maxLatitude- the sector's maximum latitude.minLongitude- the sector's minimum longitude.maxLongitude- the sector's maximum longitude.- Throws:
java.lang.IllegalArgumentException- if any of the angles are null
-
Sector
public Sector(Sector sector)
-
-
Method Detail
-
fromDegrees
public static Sector fromDegrees(double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)
Creates a newSectorand initializes it to the specified angles. The angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude, but this method does not verify that.- Parameters:
minLatitude- the sector's minimum latitude in degrees.maxLatitude- the sector's maximum latitude in degrees.minLongitude- the sector's minimum longitude in degrees.maxLongitude- the sector's maximum longitude in degrees.- Returns:
- the new
Sector
-
fromDegreesAndClamp
public static Sector fromDegreesAndClamp(double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)
Creates a newSectorand initializes it to the specified angles. The angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude, but this method does not verify that.- Parameters:
minLatitude- the sector's minimum latitude in degrees.maxLatitude- the sector's maximum latitude in degrees.minLongitude- the sector's minimum longitude in degrees.maxLongitude- the sector's maximum longitude in degrees.- Returns:
- the new
Sector
-
fromDegrees
public static Sector fromDegrees(double[] array)
Creates a newSectorand initializes it to angles in the specified array. The array is assumed to hold four elements containing the Sector's angles, and must be ordered as follows: minimum latitude, maximum latitude, minimum longitude, and maximum longitude. Additionally, the angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude, but this method does not verify that.- Parameters:
array- the array of angles in degrees.- Returns:
- he new
Sector - Throws:
java.lang.IllegalArgumentException- ifarrayis null or if its length is less than 4.
-
fromDegrees
public static Sector fromDegrees(java.awt.geom.Rectangle2D rectangle)
Creates a newSectorand initializes it to the angles resulting from the givenRectangle2Din degrees lat-lon coordinates where x corresponds to longitude and y to latitude. The resulting geographic angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude, but this method does not verify that.- Parameters:
rectangle- the sector's rectangle in degrees lat-lon coordinates.- Returns:
- the new
Sector
-
fromRadians
public static Sector fromRadians(double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)
Creates a newSectorand initializes it to the specified angles. The angles are assumed to be normalized to +/- π/2 radians latitude and +/- π radians longitude, but this method does not verify that.- Parameters:
minLatitude- the sector's minimum latitude in radians.maxLatitude- the sector's maximum latitude in radians.minLongitude- the sector's minimum longitude in radians.maxLongitude- the sector's maximum longitude in radians.- Returns:
- the new
Sector
-
fromUTMRectangle
public static Sector fromUTMRectangle(int zone, java.lang.String hemisphere, double minEasting, double maxEasting, double minNorthing, double maxNorthing)
Returns a geographic Sector which bounds the specified UTM rectangle. The UTM rectangle is located in specified UTM zone and hemisphere.- Parameters:
zone- the UTM zone.hemisphere- the UTM hemisphere, eitherAVKey.NORTHorAVKey.SOUTH.minEasting- the minimum UTM easting, in meters.maxEasting- the maximum UTM easting, in meters.minNorthing- the minimum UTM northing, in meters.maxNorthing- the maximum UTM northing, in meters.- Returns:
- a Sector that bounds the specified UTM rectangle.
- Throws:
java.lang.IllegalArgumentException- ifzoneis outside the range 1-60, ifhemisphereis null, or ifhemisphereis not one ofAVKey.NORTHorAVKey.SOUTH.
-
boundingSector
public static Sector boundingSector(java.util.Iterator<TrackPoint> positions)
-
splitBoundingSectors
public static Sector[] splitBoundingSectors(java.lang.Iterable<? extends LatLon> locations)
-
boundingSector
public static Sector boundingSector(Globe globe, LatLon center, double radius)
Returns a newSectorencompassing a circle centered at a given position, with a given radius in meter.- Parameters:
globe- a Globe instance.center- the circle center position.radius- the circle radius in meter.- Returns:
- the circle bounding sector.
-
splitBoundingSectors
public static Sector[] splitBoundingSectors(Globe globe, LatLon center, double radius)
Returns an array of Sectors encompassing a circle centered at a given position, with a given radius in meters. If the geometry defined by the circle and radius spans the international dateline, this will return two sectors, one for each side of the dateline. Otherwise, this will return a single bounding sector. This returns null if the radius is zero.- Parameters:
globe- a Globe instance.center- the circle center location.radius- the circle radius in meters.- Returns:
- the circle's bounding sectors, or null if the radius is zero.
- Throws:
java.lang.IllegalArgumentException- if either the globe or center is null, or if the radius is less than zero.
-
getMinLatitude
public final Angle getMinLatitude()
Returns the sector's minimum latitude.- Returns:
- The sector's minimum latitude.
-
getMinLongitude
public final Angle getMinLongitude()
Returns the sector's minimum longitude.- Returns:
- The sector's minimum longitude.
-
getMaxLatitude
public final Angle getMaxLatitude()
Returns the sector's maximum latitude.- Returns:
- The sector's maximum latitude.
-
getMaxLongitude
public final Angle getMaxLongitude()
Returns the sector's maximum longitude.- Returns:
- The sector's maximum longitude.
-
getDeltaLat
public final Angle getDeltaLat()
Returns the angular difference between the sector's minimum and maximum latitudes: max - min- Returns:
- The angular difference between the sector's minimum and maximum latitudes.
-
getDeltaLatDegrees
public final double getDeltaLatDegrees()
-
getDeltaLatRadians
public final double getDeltaLatRadians()
-
getDeltaLon
public final Angle getDeltaLon()
Returns the angular difference between the sector's minimum and maximum longitudes: max - min.- Returns:
- The angular difference between the sector's minimum and maximum longitudes
-
getDeltaLonDegrees
public final double getDeltaLonDegrees()
-
getDeltaLonRadians
public final double getDeltaLonRadians()
-
isWithinLatLonLimits
public boolean isWithinLatLonLimits()
-
isSameSector
public boolean isSameSector(java.lang.Iterable<? extends LatLon> corners)
-
isSector
public static boolean isSector(java.lang.Iterable<? extends LatLon> corners)
-
getCentroid
public LatLon getCentroid()
Returns the latitude and longitude of the sector's angular center: (minimum latitude + maximum latitude) / 2, (minimum longitude + maximum longitude) / 2.- Returns:
- The latitude and longitude of the sector's angular center
-
computeCenterPoint
public Vec4 computeCenterPoint(Globe globe, double exaggeration)
Computes the Cartesian coordinates of a Sector's center.- Parameters:
globe- The globe associated with the sector.exaggeration- The vertical exaggeration to apply.- Returns:
- the Cartesian coordinates of the sector's center.
- Throws:
java.lang.IllegalArgumentException- ifglobeis null.
-
computeCornerPoints
public Vec4[] computeCornerPoints(Globe globe, double exaggeration)
Computes the Cartesian coordinates of a Sector's corners.- Parameters:
globe- The globe associated with the sector.exaggeration- The vertical exaggeration to apply.- Returns:
- an array of four Cartesian points.
- Throws:
java.lang.IllegalArgumentException- ifglobeis null.
-
computeBoundingSphere
public static Sphere computeBoundingSphere(Globe globe, double verticalExaggeration, Sector sector)
Returns a sphere that minimally surrounds the sector at a specified vertical exaggeration.- Parameters:
globe- the globe the sector is associated withverticalExaggeration- the vertical exaggeration to apply to the globe's elevations when computing the sphere.sector- the sector to return the bounding sphere for.- Returns:
- The minimal bounding sphere in Cartesian coordinates.
- Throws:
java.lang.IllegalArgumentException- ifglobeorsectoris null
-
computeBoundingBox
public static Box computeBoundingBox(Globe globe, double verticalExaggeration, Sector sector)
Returns aBoxthat bounds the specified sector on the surface of the specifiedGlobe. The returned box encloses the globe's surface terrain in the sector, according to the specified vertical exaggeration and the globe's minimum and maximum elevations in the sector. If the minimum and maximum elevation are equal, this assumes a maximum elevation of 10 + the minimum. If this fails to compute a box enclosing the sector, this returns a unit box enclosing one of the boxes corners.- Parameters:
globe- the globe the extent relates to.verticalExaggeration- the globe's vertical surface exaggeration.sector- a sector on the globe's surface to compute a bounding box for.- Returns:
- a box enclosing the globe's surface on the specified sector.
- Throws:
java.lang.IllegalArgumentException- if either the globe or sector is null.
-
computeBoundingBox
public static Box computeBoundingBox(Globe globe, double verticalExaggeration, Sector sector, double minElevation, double maxElevation)
Returns aBoxthat bounds the specified sector on the surface of the specifiedGlobe. The returned box encloses the globe's surface terrain in the sector, according to the specified vertical exaggeration, minimum elevation, and maximum elevation. If the minimum and maximum elevation are equal, this assumes a maximum elevation of 10 + the minimum. If this fails to compute a box enclosing the sector, this returns a unit box enclosing one of the boxes corners.- Parameters:
globe- the globe the extent relates to.verticalExaggeration- the globe's vertical surface exaggeration.sector- a sector on the globe's surface to compute a bounding box for.minElevation- the globe's minimum elevation in the sector.maxElevation- the globe's maximum elevation in the sector.- Returns:
- a box enclosing the globe's surface on the specified sector.
- Throws:
java.lang.IllegalArgumentException- if either the globe or sector is null.
-
computeBoundingCylinder
public static Cylinder computeBoundingCylinder(Globe globe, double verticalExaggeration, Sector sector)
Returns a cylinder that minimally surrounds the specified sector at a specified vertical exaggeration.- Parameters:
globe- The globe associated with the sector.verticalExaggeration- the vertical exaggeration to apply to the minimum and maximum elevations when computing the cylinder.sector- the sector to return the bounding cylinder for.- Returns:
- The minimal bounding cylinder in Cartesian coordinates.
- Throws:
java.lang.IllegalArgumentException- ifsectoris null
-
computeBoundingCylinder
public static Cylinder computeBoundingCylinder(Globe globe, double verticalExaggeration, Sector sector, double minElevation, double maxElevation)
Returns a cylinder that minimally surrounds the specified sector at a specified vertical exaggeration and minimum and maximum elevations for the sector.- Parameters:
globe- The globe associated with the sector.verticalExaggeration- the vertical exaggeration to apply to the minimum and maximum elevations when computing the cylinder.sector- the sector to return the bounding cylinder for.minElevation- the minimum elevation of the bounding cylinder.maxElevation- the maximum elevation of the bounding cylinder.- Returns:
- The minimal bounding cylinder in Cartesian coordinates.
- Throws:
java.lang.IllegalArgumentException- ifsectoris null
-
computeBoundingCylinderOrig
public static Cylinder computeBoundingCylinderOrig(Globe globe, double verticalExaggeration, Sector sector)
-
computeBoundingCylinderOrig
public static Cylinder computeBoundingCylinderOrig(Globe globe, double verticalExaggeration, Sector sector, double minElevation, double maxElevation)
Returns a cylinder that minimally surrounds the specified minimum and maximum elevations in the sector at a specified vertical exaggeration.- Parameters:
globe- The globe associated with the sector.verticalExaggeration- the vertical exaggeration to apply to the minimum and maximum elevations when computing the cylinder.sector- the sector to return the bounding cylinder for.minElevation- the minimum elevation of the bounding cylinder.maxElevation- the maximum elevation of the bounding cylinder.- Returns:
- The minimal bounding cylinder in Cartesian coordinates.
- Throws:
java.lang.IllegalArgumentException- ifsectoris null
-
contains
public final boolean contains(LatLon latLon)
Determines whether a latitude/longitude position is within the sector. The sector's angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude. The result of the operation is undefined if they are not.- Parameters:
latLon- the position to test, with angles normalized to +/- π latitude and +/- 2π longitude.- Returns:
trueif the position is within the sector,falseotherwise.- Throws:
java.lang.IllegalArgumentException- iflatlonis null.
-
containsRadians
public boolean containsRadians(double radiansLatitude, double radiansLongitude)Determines whether a latitude/longitude postion expressed in radians is within the sector. The sector's angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude. The result of the operation is undefined if they are not.- Parameters:
radiansLatitude- the latitude in radians of the position to test, normalized +/- π.radiansLongitude- the longitude in radians of the position to test, normalized +/- 2π.- Returns:
trueif the position is within the sector,falseotherwise.
-
containsDegrees
public boolean containsDegrees(double degreesLatitude, double degreesLongitude)
-
contains
public boolean contains(Sector that)
Determines whether another sector is fully contained within this one. The sector's angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude. The result of the operation is undefined if they are not.- Parameters:
that- the sector to test for containment.- Returns:
trueif this sector fully contains the input sector, otherwisefalse.
-
intersects
public boolean intersects(Sector that)
Determines whether this sector intersects another sector's range of latitude and longitude. The sector's angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude. The result of the operation is undefined if they are not.- Parameters:
that- the sector to test for intersection.- Returns:
trueif the sectors intersect, otherwisefalse.
-
intersectsInterior
public boolean intersectsInterior(Sector that)
Determines whether the interiors of this sector and another sector intersect. The sector's angles are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude. The result of the operation is undefined if they are not.- Parameters:
that- the sector to test for intersection.- Returns:
trueif the sectors' interiors intersect, otherwisefalse.- See Also:
intersects(Sector)
-
intersectsSegment
public boolean intersectsSegment(LatLon begin, LatLon end)
Determines whether this sector intersects the specified geographic line segment. The line segment is specified by a begin location and an end location. The locations are are assumed to be connected by a linear path in geographic space. This returns true if any location along that linear path intersects this sector, including the begin and end locations.- Parameters:
begin- the line segment begin location.end- the line segment end location.- Returns:
- true
trueif this sector intersects the line segment, otherwisefalse. - Throws:
java.lang.IllegalArgumentException- if either the begin location or the end location is null.
-
intersectsAny
public boolean intersectsAny(java.lang.Iterable<? extends Sector> sectors)
Determines whether this sector intersects any one of the sectors in the specified iterable. This returns true if at least one of the sectors is non-null and intersects this sector.- Parameters:
sectors- the sectors to test for intersection.- Returns:
- true if at least one of the sectors is non-null and intersects this sector, otherwise false.
- Throws:
java.lang.IllegalArgumentException- if the iterable is null.
-
union
public final Sector union(Sector that)
Returns a new sector whose angles are the extremes of the this sector and another. The new sector's minimum latitude and longitude will be the minimum of the two sectors. The new sector's maximum latitude and longitude will be the maximum of the two sectors. The sectors are assumed to be normalized to +/- 90 degrees latitude and +/- 180 degrees longitude. The result of the operation is undefined if they are not.- Parameters:
that- the sector to join withthis.- Returns:
- A new sector formed from the extremes of the two sectors, or
thisif the incoming sector isnull.
-
intersection
public static Sector intersection(java.lang.Iterable<? extends Sector> sectors)
Returns the intersection of all sectors in the specified iterable. This returns a non-null sector if the iterable contains at least one non-null entry and all non-null entries intersect. The returned sector represents the geographic region in which all sectors intersect. This returns null if at least one of the sectors does not intersect the others.- Parameters:
sectors- the sectors to intersect.- Returns:
- the intersection of all sectors in the specified iterable, or null if at least one of the sectors does not intersect the others.
- Throws:
java.lang.IllegalArgumentException- if the iterable is null.
-
subdivide
public Sector[] subdivide()
-
subdivide
public Sector[] subdivide(int div)
-
distanceTo
public double distanceTo(DrawContext dc, Vec4 point)
Returns an approximation of the distance in model coordinates between the surface geometry defined by this sector and the specified model coordinate point. The returned value represents the shortest distance between the specified point and this sector's corner points or its center point. The draw context defines the globe and the elevations that are used to compute the corner points and the center point.- Parameters:
dc- The draw context defining the surface geometry.point- The model coordinate point to compute a distance to.- Returns:
- The distance between this sector's surface geometry and the specified point, in model coordinates.
- Throws:
java.lang.IllegalArgumentException- if any argument is null.
-
toArrayDegrees
public double[] toArrayDegrees()
Returns a four element array containing the Sector's angles in degrees. The returned array is ordered as follows: minimum latitude, maximum latitude, minimum longitude, and maximum longitude.- Returns:
- four-element array containing the Sector's angles.
-
toRectangleDegrees
public java.awt.geom.Rectangle2D toRectangleDegrees()
Returns aRectangle2Dcorresponding to this Sector in degrees lat-lon coordinates where x corresponds to longitude and y to latitude.- Returns:
- a
Rectangle2Dcorresponding to this Sector in degrees lat-lon coordinates.
-
toString
public java.lang.String toString()
Returns a string indicating the sector's angles.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string indicating the sector's angles.
-
getSizeInBytes
public long getSizeInBytes()
Retrieve the size of this object in bytes. This implementation returns an exact value of the object's size.- Specified by:
getSizeInBytesin interfaceCacheable- Returns:
- the size of this object in bytes
-
compareTo
public int compareTo(Sector that)
Compares this sector to a specified sector according to their minimum latitude, minimum longitude, maximum latitude, and maximum longitude, respectively.- Specified by:
compareToin interfacejava.lang.Comparable<Sector>- Parameters:
that- theSectorto compareTo withthis.- Returns:
- -1 if this sector compares less than that specified, 0 if they're equal, and 1 if it compares greater.
- Throws:
java.lang.IllegalArgumentException- ifthatis null
-
iterator
public java.util.Iterator<LatLon> iterator()
Creates an iterator over the four corners of the sector, starting with the southwest position and continuing counter-clockwise.- Specified by:
iteratorin interfacejava.lang.Iterable<LatLon>- Returns:
- an iterator for the sector.
-
asList
public java.util.List<LatLon> asList()
Returns the coordinates of the sector as a list, in the order minLat, maxLat, minLon, maxLon.- Returns:
- the list of sector coordinates.
-
asDegreesArray
public double[] asDegreesArray()
Returns the coordinates of the sector as an array of values in degrees, in the order minLat, maxLat, minLon, maxLon.- Returns:
- the array of sector coordinates.
-
asRadiansArray
public double[] asRadiansArray()
Returns the coordinates of the sector as an array of values in radians, in the order minLat, maxLat, minLon, maxLon.- Returns:
- the array of sector coordinates.
-
getCorners
public LatLon[] getCorners()
Returns a list of the Lat/Lon coordinates of a Sector's corners.- Returns:
- an array of the four corner locations, in the order SW, SE, NE, NW
-
equals
public boolean equals(java.lang.Object o)
Tests the equality of the sectors' angles. Sectors are equal if all of their corresponding angles are equal.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the sector to compareTo withthis.- Returns:
trueif the four corresponding angles of each sector are equal,falseotherwise.
-
hashCode
public int hashCode()
Computes a hash code from the sector's four angles.- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code incorporating the sector's four angles.
-
-