Package mil.nga.gars

Class GARS


  • public class GARS
    extends Object
    Global Area Reference System Coordinate
    Author:
    osbornb
    • Constructor Detail

      • GARS

        public GARS​(int longitude,
                    String latitude,
                    int quadrant,
                    int keypad)
        Constructor
        Parameters:
        longitude - longitudinal band number
        latitude - latitudinal band letters
        quadrant - 15 minute quadrant
        keypad - 5 minute keypad
    • Method Detail

      • create

        public static GARS create​(int longitude,
                                  String latitude,
                                  int quadrant,
                                  int keypad)
        Create
        Parameters:
        longitude - longitudinal band number
        latitude - latitudinal band letters
        quadrant - 15 minute quadrant
        keypad - 5 minute keypad
        Returns:
        GARS
      • getLongitude

        public int getLongitude()
        Get the longitudinal band number
        Returns:
        longitude band number
      • getLatitude

        public String getLatitude()
        Get the latitudinal band letters
        Returns:
        latitude band letters
      • getQuadrant

        public int getQuadrant()
        Get the 15 minute quadrant
        Returns:
        quadrant
      • getKeypad

        public int getKeypad()
        Get the 5 minute keypad
        Returns:
        keypad
      • coordinate

        public String coordinate()
        Get the GARS coordinate with five minute precision
        Returns:
        GARS coordinate
      • coordinate

        public String coordinate​(GridType type)
        Get the GARS coordinate with specified grid precision
        Parameters:
        type - grid type precision
        Returns:
        GARS coordinate
      • toPoint

        public Point toPoint()
        Convert to a point
        Returns:
        point
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isGARS

        public static boolean isGARS​(String gars)
        Return whether the given string is valid GARS string
        Parameters:
        gars - potential GARS string
        Returns:
        true if GARS string is valid, false otherwise
      • from

        public static GARS from​(Point point)
        Encodes a point as a GARS string
        Parameters:
        point - point
        Returns:
        GARS
      • from

        public static GARS from​(double longitude,
                                double latitude)
        Convert the coordinate to GARS
        Parameters:
        longitude - longitude
        latitude - latitude
        Returns:
        GARS
      • parse

        public static GARS parse​(String gars)
                          throws ParseException
        Parse a GARS string
        Parameters:
        gars - GARS string
        Returns:
        GARS
        Throws:
        ParseException - upon failure to parse the GARS string
      • precision

        public static GridType precision​(String gars)
                                  throws ParseException
        Parse the GARS string for the precision
        Parameters:
        gars - GARS string
        Returns:
        grid type precision
        Throws:
        ParseException - upon failure to parse the GARS string