Package mil.nga.grid.features
Class Bounds
- java.lang.Object
-
- mil.nga.sf.GeometryEnvelope
-
- mil.nga.grid.features.Bounds
-
- All Implemented Interfaces:
Serializable
public class Bounds extends GeometryEnvelope
Grid Bounds- Author:
- osbornb
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Bounds(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)
ConstructorBounds(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude, Unit unit)
ConstructorBounds(Bounds bounds)
Copy constructorBounds(Point southwest, Point northeast)
ConstructorBounds(GeometryEnvelope envelope, Unit unit)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Bounds
bounds(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude, Unit unit)
Create boundsstatic Bounds
bounds(Bounds bounds)
Copy boundsstatic Bounds
bounds(Point southwest, Point northeast)
Create boundsstatic Bounds
bounds(GeometryEnvelope envelope, Unit unit)
Create boundsBounds
copy()
Copy the boundsstatic Bounds
degrees(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)
Create bounds in degreesboolean
equals(Object obj)
Point
getCentroid()
double
getCentroidLatitude()
Get the centroid latitudedouble
getCentroidLongitude()
Get the centroid longitudedouble
getEast()
Get the eastern longitudeLine
getEastLine()
Get the eastern linedouble
getHeight()
Get the heightList<Line>
getLines()
Get the four line bounds in metersdouble
getMaxLatitude()
Get the max latitudedouble
getMaxLongitude()
Get the max longitudedouble
getMinLatitude()
Get the min latitudedouble
getMinLongitude()
Get the min longitudedouble
getNorth()
Get the northern latitudePoint
getNortheast()
Get the northeast coordinateLine
getNorthLine()
Get the northern linePoint
getNorthwest()
Get the northwest coordinatePixelRange
getPixelRange(int width, int height, Bounds bounds)
Get the pixel range where the bounds fit into the provided boundsPixelRange
getPixelRange(GridTile tile)
Get the pixel range where the bounds fit into the tiledouble
getSouth()
Get the southern latitudePoint
getSoutheast()
Get the southeast coordinateLine
getSouthLine()
Get the southern linePoint
getSouthwest()
Get the southwest coordinateUnit
getUnit()
Get the unitdouble
getWest()
Get the western longitudeLine
getWestLine()
Get the western linedouble
getWidth()
Get the widthint
hashCode()
boolean
isDegrees()
Are bounds in degreesboolean
isMeters()
Are bounds in metersboolean
isUnit(Unit unit)
Is in the provided unit typestatic Bounds
meters(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)
Create bounds in metersBounds
overlap(Bounds bounds)
Create a new bounds as the overlapping between this bounds and the providedvoid
setEast(double east)
Set the eastern longitudevoid
setMaxLatitude(double maxLatitude)
Set the max latitudevoid
setMaxLongitude(double maxLongitude)
Set the max longitudevoid
setMinLatitude(double minLatitude)
Set the min latitudevoid
setMinLongitude(double minLongitude)
Set the min longitudevoid
setNorth(double north)
Set the northern latitudevoid
setSouth(double south)
Set the southern latitudevoid
setUnit(Unit unit)
Set the unitvoid
setWest(double west)
Set the western longitudeBounds
toDegrees()
Convert to degreesBounds
toMeters()
Convert to metersBounds
toPrecision(double precision)
Convert the bounds to be precision accurate minimally containing the bounds.Bounds
toUnit(Unit unit)
Convert to the unitBounds
union(Bounds bounds)
Create a new bounds as the union between this bounds and the provided-
Methods inherited from class mil.nga.sf.GeometryEnvelope
buildGeometry, contains, contains, contains, contains, contains, contains, getBottom, getBottomLeft, getBottomMid, getBottomRight, getLeft, getLeftMid, getMaxM, getMaxX, getMaxY, getMaxZ, getMidX, getMidY, getMinM, getMinX, getMinY, getMinZ, getMRange, getRight, getRightMid, getTop, getTopLeft, getTopMid, getTopRight, getXRange, getYRange, getZRange, hasM, hasZ, intersects, intersects, is3D, isEmpty, isHasM, isHasZ, isMeasured, isPoint, overlap, overlap, setHasM, setHasZ, setMaxM, setMaxX, setMaxY, setMaxZ, setMinM, setMinX, setMinY, setMinZ, union
-
-
-
-
Constructor Detail
-
Bounds
public Bounds(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)
Constructor- Parameters:
minLongitude
- min longitudeminLatitude
- min latitudemaxLongitude
- max longitudemaxLatitude
- max latitude
-
Bounds
public Bounds(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude, Unit unit)
Constructor- Parameters:
minLongitude
- min longitudeminLatitude
- min latitudemaxLongitude
- max longitudemaxLatitude
- max latitudeunit
- unit
-
Bounds
public Bounds(Point southwest, Point northeast)
Constructor- Parameters:
southwest
- southwest cornernortheast
- northeast corner
-
Bounds
public Bounds(Bounds bounds)
Copy constructor- Parameters:
bounds
- bounds to copy
-
Bounds
public Bounds(GeometryEnvelope envelope, Unit unit)
Constructor- Parameters:
envelope
- geometry envelopeunit
- unit
-
-
Method Detail
-
bounds
public static Bounds bounds(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude, Unit unit)
Create bounds- Parameters:
minLongitude
- min longitudeminLatitude
- min latitudemaxLongitude
- max longitudemaxLatitude
- max latitudeunit
- unit- Returns:
- bounds
-
degrees
public static Bounds degrees(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)
Create bounds in degrees- Parameters:
minLongitude
- min longitudeminLatitude
- min latitudemaxLongitude
- max longitudemaxLatitude
- max latitude- Returns:
- bounds
-
meters
public static Bounds meters(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)
Create bounds in meters- Parameters:
minLongitude
- min longitudeminLatitude
- min latitudemaxLongitude
- max longitudemaxLatitude
- max 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(Bounds bounds)
Copy bounds- Parameters:
bounds
- bounds to copy- Returns:
- bounds
-
bounds
public static Bounds bounds(GeometryEnvelope envelope, Unit unit)
Create bounds- Parameters:
envelope
- geometry envelopeunit
- unit- Returns:
- bounds
-
getMinLongitude
public double getMinLongitude()
Get the min longitude- Returns:
- min longitude
-
setMinLongitude
public void setMinLongitude(double minLongitude)
Set the min longitude- Parameters:
minLongitude
- min longitude
-
getMinLatitude
public double getMinLatitude()
Get the min latitude- Returns:
- min latitude
-
setMinLatitude
public void setMinLatitude(double minLatitude)
Set the min latitude- Parameters:
minLatitude
- min latitude
-
getMaxLongitude
public double getMaxLongitude()
Get the max longitude- Returns:
- max longitude
-
setMaxLongitude
public void setMaxLongitude(double maxLongitude)
Set the max longitude- Parameters:
maxLongitude
- max longitude
-
getMaxLatitude
public double getMaxLatitude()
Get the max latitude- Returns:
- max latitude
-
setMaxLatitude
public void setMaxLatitude(double maxLatitude)
Set the max latitude- Parameters:
maxLatitude
- max latitude
-
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
-
getCentroidLongitude
public double getCentroidLongitude()
Get the centroid longitude- Returns:
- centroid longitude
-
getCentroidLatitude
public double getCentroidLatitude()
Get the centroid latitude- Returns:
- centroid latitude
-
getCentroid
public Point getCentroid()
- Overrides:
getCentroid
in classGeometryEnvelope
-
getWidth
public double getWidth()
Get the width- Returns:
- width
-
getHeight
public double getHeight()
Get the height- Returns:
- height
-
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
-
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
-
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
-
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
-
toPrecision
public Bounds toPrecision(double precision)
Convert the bounds to be precision accurate minimally containing the bounds. Each bound is equal to or larger by the precision degree amount.- Parameters:
precision
- precision in degrees- Returns:
- precision bounds
-
getPixelRange
public PixelRange getPixelRange(GridTile 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
-
copy
public Bounds copy()
Copy the bounds- Overrides:
copy
in classGeometryEnvelope
- Returns:
- bounds copy
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classGeometryEnvelope
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classGeometryEnvelope
-
-