Package mil.nga.mgrs.features
Class Bounds
- java.lang.Object
-
- mil.nga.mgrs.features.Bounds
-
public class Bounds extends Object
Zone Bounds- Author:
- osbornb
-
-
Constructor Summary
Constructors Constructor Description Bounds(double[] bounds)Constructor, inUnit.DEGREEunitsBounds(double[] bounds, Unit unit)ConstructorBounds(double west, double south, double east, double north)Constructor, inUnit.DEGREEunitsBounds(double west, double south, double east, double north, Unit unit)ConstructorBounds(Point southwest, Point northeast)ConstructorBounds(LongitudinalStrip strip, LatitudeBand band)Constructor, inUnit.DEGREEunits
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Boundsbounds(double[] bounds)Create bounds, inUnit.DEGREEunitsstatic Boundsbounds(double[] bounds, Unit unit)Create boundsstatic Boundsbounds(double west, double south, double east, double north, Unit unit)Create boundsstatic Boundsbounds(Point southwest, Point northeast)Create boundsstatic Boundsbounds(LongitudinalStrip strip, LatitudeBand band)Create bounds, inUnit.DEGREEunitsbooleancontains(Point point)Determine if contains the pointstatic Boundsdegrees(double[] bounds)Create bounds in degreesstatic Boundsdegrees(double west, double south, double east, double north)Create bounds in degreesBandLetterRangegetBandLetterRange()Get a band letter range between the southern and northern latitudesPointgetCenter()Get the center coordinatedoublegetCenterLatitude()Get the center latitudedoublegetCenterLongitude()Get the center longitudedoublegetEast()Get the eastern longitudeLinegetEastLine()Get the eastern lineGridRangegetGridRange()Get a grid range of the boundsdoublegetHeight()Get the heightList<Line>getLines()Get the four line bounds in metersdoublegetMaxLatitude()Get the northern latitudedoublegetMaxLongitude()Get the eastern longitudedoublegetMinLatitude()Get the southern latitudedoublegetMinLongitude()Get the western longitudedoublegetNorth()Get the northern latitudePointgetNortheast()Get the northeast coordinateLinegetNorthLine()Get the northern linePointgetNorthwest()Get the northwest coordinatePixelRangegetPixelRange(int width, int height, Bounds bounds)Get the pixel range where the bounds fit into the provided boundsPixelRangegetPixelRange(MGRSTile tile)Get the pixel range where the bounds fit into the tiledoublegetSouth()Get the southern latitudePointgetSoutheast()Get the southeast coordinateLinegetSouthLine()Get the southern linePointgetSouthwest()Get the southwest coordinateUnitgetUnit()Get the unitdoublegetWest()Get the western longitudeLinegetWestLine()Get the western linedoublegetWidth()Get the widthZoneNumberRangegetZoneNumberRange()Get a zone number range between the western and eastern longitudesbooleanisDegrees()Are bounds in degreesbooleanisEmpty()Determine if the bounds are emptybooleanisMeters()Are bounds in metersbooleanisUnit(Unit unit)Is in the provided unit typestatic Boundsmeters(double[] bounds)Create bounds in metersstatic Boundsmeters(double west, double south, double east, double north)Create bounds in degreesBoundsoverlap(Bounds bounds)Create a new bounds as the overlapping between this bounds and the providedvoidsetEast(double east)Set the eastern longitudevoidsetMaxLatitude(double north)Set the northern latitudevoidsetMaxLongitude(double east)Set the eastern longitudevoidsetMinLatitude(double south)Set the southern latitudevoidsetMinLongitude(double west)Set the western longitudevoidsetNorth(double north)Set the northern latitudevoidsetSouth(double south)Set the southern latitudevoidsetUnit(Unit unit)Set the unitvoidsetWest(double west)Set the western longitudeBoundstoDegrees()Convert to degreesBoundstoMeters()Convert to metersBoundstoUnit(Unit unit)Convert to the unitBoundsunion(Bounds bounds)Create a new bounds as the union between this bounds and the provided
-
-
-
Constructor Detail
-
Bounds
public Bounds(double west, double south, double east, double north)Constructor, inUnit.DEGREEunits- Parameters:
west- western longitudesouth- southern latitudeeast- eastern longitudenorth- northern latitude
-
Bounds
public Bounds(double west, double south, double east, double north, Unit unit)Constructor- Parameters:
west- western longitudesouth- southern latitudeeast- eastern longitudenorth- northern latitudeunit- unit
-
Bounds
public Bounds(Point southwest, Point northeast)
Constructor- Parameters:
southwest- southwest cornernortheast- northeast corner
-
Bounds
public Bounds(LongitudinalStrip strip, LatitudeBand band)
Constructor, inUnit.DEGREEunits- Parameters:
strip- longitudinal stripband- latitude band
-
Bounds
public Bounds(double[] bounds)
Constructor, inUnit.DEGREEunits- Parameters:
bounds- bounds array: [west, south, east, north] or [minLon, minLat, maxLon, maxLat]
-
Bounds
public Bounds(double[] bounds, Unit unit)Constructor- Parameters:
bounds- bounds array: [west, south, east, north] or [minLon, minLat, maxLon, maxLat]unit- unit
-
-
Method Detail
-
bounds
public static Bounds bounds(double west, double south, double east, double north, Unit unit)
Create bounds- Parameters:
west- western longitudesouth- southern latitudeeast- eastern longitudenorth- northern latitudeunit- unit- Returns:
- bounds
-
degrees
public static Bounds degrees(double west, double south, double east, double north)
Create bounds in degrees- Parameters:
west- western longitudesouth- southern latitudeeast- eastern longitudenorth- northern latitude- Returns:
- bounds
-
meters
public static Bounds meters(double west, double south, double east, double north)
Create bounds in degrees- Parameters:
west- western longitudesouth- southern latitudeeast- eastern longitudenorth- northern latitude- Returns:
- bounds
-
bounds
public static Bounds bounds(Point southwest, Point northeast)
Create bounds- Parameters:
southwest- southwest cornernortheast- northeast corner- Returns:
- bounds
-
bounds
public static Bounds bounds(LongitudinalStrip strip, LatitudeBand band)
Create bounds, inUnit.DEGREEunits- Parameters:
strip- longitudinal stripband- latitude band- Returns:
- bounds
-
bounds
public static Bounds bounds(double[] bounds)
Create bounds, inUnit.DEGREEunits- Parameters:
bounds- bounds array: [west, south, east, north] or [minLon, minLat, maxLon, maxLat]- Returns:
- bounds
-
bounds
public static Bounds bounds(double[] bounds, Unit unit)
Create bounds- Parameters:
bounds- bounds array: [west, south, east, north] or [minLon, minLat, maxLon, maxLat]unit- unit- Returns:
- bounds
-
degrees
public static Bounds degrees(double[] bounds)
Create bounds in degrees- Parameters:
bounds- bounds degrees array: [west, south, east, north] or [minLon, minLat, maxLon, maxLat]- Returns:
- bounds
-
meters
public static Bounds meters(double[] bounds)
Create bounds in meters- Parameters:
bounds- bounds meters array: [west, south, east, north] or [minLon, minLat, maxLon, maxLat]- Returns:
- bounds
-
getWest
public double getWest()
Get the western longitude- Returns:
- western longitude
-
setWest
public void setWest(double west)
Set the western longitude- Parameters:
west- western longitude
-
getSouth
public double getSouth()
Get the southern latitude- Returns:
- southern latitude
-
setSouth
public void setSouth(double south)
Set the southern latitude- Parameters:
south- southern latitude
-
getEast
public double getEast()
Get the eastern longitude- Returns:
- eastern longitude
-
setEast
public void setEast(double east)
Set the eastern longitude- Parameters:
east- eastern longitude
-
getNorth
public double getNorth()
Get the northern latitude- Returns:
- northern latitude
-
setNorth
public void setNorth(double north)
Set the northern latitude- Parameters:
north- northern latitude
-
getUnit
public Unit getUnit()
Get the unit- Returns:
- unit
-
setUnit
public void setUnit(Unit unit)
Set the unit- Parameters:
unit- unit
-
isUnit
public boolean isUnit(Unit unit)
Is in the provided unit type- Parameters:
unit- unit- Returns:
- true if in the unit
-
isDegrees
public boolean isDegrees()
Are bounds in degrees- Returns:
- true if degrees
-
isMeters
public boolean isMeters()
Are bounds in meters- Returns:
- true if meters
-
toUnit
public Bounds toUnit(Unit unit)
Convert to the unit- Parameters:
unit- unit- Returns:
- bounds in units, same bounds if equal units
-
toDegrees
public Bounds toDegrees()
Convert to degrees- Returns:
- bounds in degrees, same bounds if already in degrees
-
toMeters
public Bounds toMeters()
Convert to meters- Returns:
- bounds in meters, same bounds if already in meters
-
getMinLongitude
public double getMinLongitude()
Get the western longitude- Returns:
- western longitude
-
setMinLongitude
public void setMinLongitude(double west)
Set the western longitude- Parameters:
west- western longitude
-
getMinLatitude
public double getMinLatitude()
Get the southern latitude- Returns:
- southern latitude
-
setMinLatitude
public void setMinLatitude(double south)
Set the southern latitude- Parameters:
south- southern latitude
-
getMaxLongitude
public double getMaxLongitude()
Get the eastern longitude- Returns:
- eastern longitude
-
setMaxLongitude
public void setMaxLongitude(double east)
Set the eastern longitude- Parameters:
east- eastern longitude
-
getMaxLatitude
public double getMaxLatitude()
Get the northern latitude- Returns:
- northern latitude
-
setMaxLatitude
public void setMaxLatitude(double north)
Set the northern latitude- Parameters:
north- northern latitude
-
getCenterLongitude
public double getCenterLongitude()
Get the center longitude- Returns:
- center longitude
-
getCenterLatitude
public double getCenterLatitude()
Get the center latitude- Returns:
- center latitude
-
getCenter
public Point getCenter()
Get the center coordinate- Returns:
- center coordinate
-
getWidth
public double getWidth()
Get the width- Returns:
- width
-
getHeight
public double getHeight()
Get the height- Returns:
- height
-
isEmpty
public boolean isEmpty()
Determine if the bounds are empty- Returns:
- true if empty
-
getSouthwest
public Point getSouthwest()
Get the southwest coordinate- Returns:
- southwest coordinate
-
getNorthwest
public Point getNorthwest()
Get the northwest coordinate- Returns:
- northwest coordinate
-
getSoutheast
public Point getSoutheast()
Get the southeast coordinate- Returns:
- southeast coordinate
-
getNortheast
public Point getNortheast()
Get the northeast coordinate- Returns:
- northeast coordinate
-
union
public Bounds union(Bounds bounds)
Create a new bounds as the union between this bounds and the provided- Parameters:
bounds- bounds- Returns:
- union bounds
-
overlap
public Bounds overlap(Bounds bounds)
Create a new bounds as the overlapping between this bounds and the provided- Parameters:
bounds- bounds- Returns:
- overlap bounds
-
contains
public boolean contains(Point point)
Determine if contains the point- Parameters:
point- point- Returns:
- true if contains
-
getWestLine
public Line getWestLine()
Get the western line- Returns:
- west line
-
getSouthLine
public Line getSouthLine()
Get the southern line- Returns:
- south line
-
getEastLine
public Line getEastLine()
Get the eastern line- Returns:
- east line
-
getNorthLine
public Line getNorthLine()
Get the northern line- Returns:
- north line
-
getPixelRange
public PixelRange getPixelRange(MGRSTile tile)
Get the pixel range where the bounds fit into the tile- Parameters:
tile- tile- Returns:
- pixel range
-
getPixelRange
public PixelRange getPixelRange(int width, int height, Bounds bounds)
Get the pixel range where the bounds fit into the provided bounds- Parameters:
width- widthheight- heightbounds- bounds- Returns:
- pixel range
-
getGridRange
public GridRange getGridRange()
Get a grid range of the bounds- Returns:
- grid range
-
getZoneNumberRange
public ZoneNumberRange getZoneNumberRange()
Get a zone number range between the western and eastern longitudes- Returns:
- zone number range
-
getBandLetterRange
public BandLetterRange getBandLetterRange()
Get a band letter range between the southern and northern latitudes- Returns:
- band letter range
-
-