Class Bounds


  • public class Bounds
    extends Object
    Zone Bounds
    Author:
    osbornb
    • Constructor Detail

      • Bounds

        public Bounds​(double west,
                      double south,
                      double east,
                      double north)
        Constructor, in Unit.DEGREE units
        Parameters:
        west - western longitude
        south - southern latitude
        east - eastern longitude
        north - northern latitude
      • Bounds

        public Bounds​(double west,
                      double south,
                      double east,
                      double north,
                      Unit unit)
        Constructor
        Parameters:
        west - western longitude
        south - southern latitude
        east - eastern longitude
        north - northern latitude
        unit - unit
      • Bounds

        public Bounds​(Point southwest,
                      Point northeast)
        Constructor
        Parameters:
        southwest - southwest corner
        northeast - northeast corner
      • Bounds

        public Bounds​(double[] bounds)
        Constructor, in Unit.DEGREE units
        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 longitude
        south - southern latitude
        east - eastern longitude
        north - northern latitude
        unit - unit
        Returns:
        bounds
      • degrees

        public static Bounds degrees​(double west,
                                     double south,
                                     double east,
                                     double north)
        Create bounds in degrees
        Parameters:
        west - western longitude
        south - southern latitude
        east - eastern longitude
        north - northern latitude
        Returns:
        bounds
      • meters

        public static Bounds meters​(double west,
                                    double south,
                                    double east,
                                    double north)
        Create bounds in degrees
        Parameters:
        west - western longitude
        south - southern latitude
        east - eastern longitude
        north - northern latitude
        Returns:
        bounds
      • bounds

        public static Bounds bounds​(Point southwest,
                                    Point northeast)
        Create bounds
        Parameters:
        southwest - southwest corner
        northeast - northeast corner
        Returns:
        bounds
      • bounds

        public static Bounds bounds​(double[] bounds)
        Create bounds, in Unit.DEGREE units
        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 - width
        height - height
        bounds - bounds
        Returns:
        pixel range
      • getLines

        public List<Line> getLines()
        Get the four line bounds in meters
        Returns:
        lines
      • 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