Class Point


  • public class Point
    extends Object
    Point
    Author:
    wnewman, osbornb
    • Constructor Detail

      • Point

        public Point​(double longitude,
                     double latitude)
        Constructor, in Unit.DEGREE units
        Parameters:
        longitude - longitude
        latitude - latitude
      • Point

        public Point​(double longitude,
                     double latitude,
                     Unit unit)
        Constructor
        Parameters:
        longitude - longitude
        latitude - latitude
        unit - unit
    • Method Detail

      • create

        public static Point create​(double longitude,
                                   double latitude)
        Create a point with default degree unit
        Parameters:
        longitude - longitude
        latitude - latitude
        Returns:
        point
      • create

        public static Point create​(double longitude,
                                   double latitude,
                                   Unit unit)
        Create a point
        Parameters:
        longitude - longitude
        latitude - latitude
        unit - unit
        Returns:
        point
      • degrees

        public static Point degrees​(double longitude,
                                    double latitude)
        Create a point in degrees
        Parameters:
        longitude - longitude in degrees
        latitude - latitude in degrees
        Returns:
        point in degrees
      • meters

        public static Point meters​(double longitude,
                                   double latitude)
        Create a point in meters
        Parameters:
        longitude - longitude in meters
        latitude - latitude in meters
        Returns:
        point in meters
      • toUnit

        public static Point toUnit​(Unit fromUnit,
                                   double longitude,
                                   double latitude,
                                   Unit toUnit)
        Create a point from a coordinate in a unit to another unit
        Parameters:
        fromUnit - unit of provided coordinate
        longitude - longitude
        latitude - latitude
        toUnit - desired unit
        Returns:
        point in unit
      • toUnit

        public static Point toUnit​(double longitude,
                                   double latitude,
                                   Unit unit)
        Create a point from a coordinate in an opposite unit to another unit
        Parameters:
        longitude - longitude
        latitude - latitude
        unit - desired unit
        Returns:
        point in unit
      • degreesToMeters

        public static Point degreesToMeters​(double longitude,
                                            double latitude)
        Create a point converting the degrees coordinate to meters
        Parameters:
        longitude - longitude in degrees
        latitude - latitude in degrees
        Returns:
        point in meters
      • metersToDegrees

        public static Point metersToDegrees​(double longitude,
                                            double latitude)
        Create a point converting the meters coordinate to degrees
        Parameters:
        longitude - longitude in meters
        latitude - latitude in meters
        Returns:
        point in degrees
      • create

        public static Point create​(int zoneNumber,
                                   Hemisphere hemisphere,
                                   double easting,
                                   double northing)
        Create a point from UTM values
        Parameters:
        zoneNumber - zone number
        hemisphere - hemisphere
        easting - easting
        northing - northing
        Returns:
        point
      • getLatitude

        public double getLatitude()
        Get the latitude
        Returns:
        latitude
      • setLatitude

        public void setLatitude​(double latitude)
        Set the latitude
        Parameters:
        latitude - latitude
      • getLongitude

        public double getLongitude()
        Get the longitude
        Returns:
        longitude
      • setLongitude

        public void setLongitude​(double longitude)
        Set the longitude
        Parameters:
        longitude - longitude
      • 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()
        Is this point in degrees
        Returns:
        true if degrees
      • isMeters

        public boolean isMeters()
        Is this point in meters
        Returns:
        true if meters
      • toUnit

        public Point toUnit​(Unit unit)
        Convert to the unit
        Parameters:
        unit - unit
        Returns:
        point in units, same point if equal units
      • toDegrees

        public Point toDegrees()
        Convert to degrees
        Returns:
        point in degrees, same point if already in degrees
      • toMeters

        public Point toMeters()
        Convert to meters
        Returns:
        point in meters, same point if already in meters
      • toMGRS

        public MGRS toMGRS()
        Convert to a MGRS coordinate
        Returns:
        MGRS
      • toUTM

        public UTM toUTM()
        Convert to UTM coordinate
        Returns:
        UTM
      • getPixel

        public Pixel getPixel​(MGRSTile tile)
        Get the pixel where the point fits into tile
        Parameters:
        tile - tile
        Returns:
        pixel
      • getPixel

        public Pixel getPixel​(int width,
                              int height,
                              Bounds bounds)
        Get the pixel where the point fits into the bounds
        Parameters:
        width - width
        height - height
        bounds - bounds
        Returns:
        pixel
      • getZoneNumber

        public int getZoneNumber()
        Get the point zone number
        Returns:
        zone number
      • getBandLetter

        public char getBandLetter()
        Get the point band letter
        Returns:
        band letter
      • getHemisphere

        public Hemisphere getHemisphere()
        Get the point hemisphere
        Returns:
        hemisphere
      • from

        public static Point from​(UTM utm)
        Create from a Universal Transverse Mercator Projection
        Parameters:
        utm - UTM
        Returns:
        coordinate
      • from

        public static Point from​(MGRS mgrs)
        Parse a MGRS value to a coordinate
        Parameters:
        mgrs - MGRS value
        Returns:
        coordinate
      • parse

        public static Point parse​(String mgrs)
                           throws ParseException
        Parse a MGRS string value to a coordinate
        Parameters:
        mgrs - MGRS string value
        Returns:
        coordinate
        Throws:
        ParseException - upon failure to parse the MGRS value