Class TLcdLonLatParser

java.lang.Object
com.luciad.util.TLcdLonLatParser
All Implemented Interfaces:
ILcdParser

public class TLcdLonLatParser extends Object implements ILcdParser
This ILcdParser parses various string formats for longitude/latitude ordinates. The following formats are recognized:
  • dd°mm'ss",ddd°mm'ss"
  • dd°mm'ss.ss",ddd°mm'ss.ss"
  • ddNdddE
  • ddmmNdddmmE
  • ddmmssNdddmmssE
  • dd.ddddNdd.dddddE
  • ddmm.mmmmNdddmm.mmmmE
  • ddmmss.ssssNdddmmss.ssssE
  • xx.x°,xxx.x°
  • xx.xx°,xxx.xx°
  • xx.xxx°,xxx.xxx°
  • xx.xxxx°,xxx.xxxx°
  • xx.xxxxx°,xxx.xxxxx°
  • xx.xxxxxx°,xxx.xxxxxx°

In these formats, 'd' and 'x' stand for a digit of the degrees, 'm' stands for a digit of the minutes, and 's' stands for a digit of the seconds. Parts of the numbers may be left out, as long as they remain unambiguous. The latitude hemisphere qualifications can be 'N' or 'S', and the longitude hemisphere qualifications can be 'E' or 'W' (all case-insensitive). If the an input strings contains just a single double, it is interpreted as degrees.

The ranges of the input strings are not validated. Input like 306075N will be converted to 31 degrees, 1 minute, and 15 seconds North.

See Also:
  • Field Details

    • LATCOORD

      public static final int LATCOORD
      Deprecated.
      The mode property is not used.
      Mode property for latitude coordinates.
      See Also:
    • LONCOORD

      public static final int LONCOORD
      Deprecated.
      The mode property is not used.
      Mode property for longitude coordinates.
      See Also:
    • DEFAULT

      public static final String DEFAULT
      Deprecated.
      The pattern property is not used.
      Default pattern : dd°mm'ss",ddd°mm'ss" .
      See Also:
    • DEFAULT2

      public static final String DEFAULT2
      Deprecated.
      The pattern property is not used.
      Default pattern 2: dd°mm'ss.ss",ddd°mm'ss.ss" .
      See Also:
    • NSWE

      public static final String NSWE
      Deprecated.
      The pattern property is not used.
      NSWE pattern: ddmmssNdddmmssE .
      See Also:
    • NSWE2

      public static final String NSWE2
      Deprecated.
      The pattern property is not used.
      NSWE pattern 2: ddmmss.ssssNdddmmss.ssssE .
      See Also:
    • DEC_DEG_1

      public static final String DEC_DEG_1
      Deprecated.
      The pattern property is not used.
      Decimal degrees pattern 1: xx.x°,xxx.x° .
      See Also:
    • DEC_DEG_2

      public static final String DEC_DEG_2
      Deprecated.
      The pattern property is not used.
      Decimal degrees pattern 2: xx.xx°,xxx.xx° .
      See Also:
    • DEC_DEG_3

      public static final String DEC_DEG_3
      Deprecated.
      The pattern property is not used.
      Decimal degrees pattern 3: xx.xxx°,xxx.xxx° .
      See Also:
    • DEC_DEG_4

      public static final String DEC_DEG_4
      Deprecated.
      The pattern property is not used.
      Decimal degrees pattern 4: xx.xxxx°,xxx.xxxx° .
      See Also:
    • DEC_DEG_5

      public static final String DEC_DEG_5
      Deprecated.
      The pattern property is not used.
      Decimal degrees pattern 5: xx.xxxxx°,xxx.xxxxx° .
      See Also:
    • DEC_DEG_6

      public static final String DEC_DEG_6
      Deprecated.
      The pattern property is not used.
      Decimal degrees pattern 6: xx.xxxxxx°,xxx.xxxxxx° .
      See Also:
  • Constructor Details

    • TLcdLonLatParser

      public TLcdLonLatParser()
      Creates a new TLcdLonLatParser.
    • TLcdLonLatParser

      public TLcdLonLatParser(int aMode)
      Deprecated.
      Use the constructor without parameters.
      Creates a new TLcdLonLatParser with format pattern NSWE and the given mode.
      Parameters:
      aMode - the mode: LONCOORD or LATCOORD.
    • TLcdLonLatParser

      public TLcdLonLatParser(String aPattern)
      Deprecated.
      Use the constructor without parameters.
      Creates a new TLcdLonLatParser with the given format pattern and mode LATCOORD.
      Parameters:
      aPattern - the pattern.
  • Method Details

    • setPattern

      public void setPattern(String aNewPattern)
      Deprecated.
      The pattern property is not used.
      The pattern property is not used. This method has an empty implementation.
      Parameters:
      aNewPattern - the new pattern.
    • setMode

      public void setMode(int aNewMode)
      Deprecated.
      The mode property is not used. This method has an empty implementation.
      The property mode is not used. This method has an empty implementation.
      Parameters:
      aNewMode - the new mode: LONCOORD or LATCOORD.
      See Also:
    • getMode

      public int getMode()
      Deprecated.
      The mode property is not used. This method always returns -1.
      Returns -1. The property mode is not used.
      Returns:
      always -1
      See Also:
    • parse

      public Object parse(String aString)
      Parses the given String as a longitude or latitude ordinate.
      Specified by:
      parse in interface ILcdParser
      Parameters:
      aString - the String to be parsed.
      Returns:
      the resulting ordinate, represented as a new Double, or null, when the String passed could not be interpreted as an ordinate.
    • parse

      public Object parse(String aString, int aMode)
      Deprecated.
      Use the method parse(String).
      The mode parameter is disregarded. Use the method parse(String).
      Parameters:
      aString - the String to be parsed.
      aMode - not taken into account.
      Returns:
      the resulting ordinate, represented as a new Double, or null if the parsing failed.
    • latddmmssAsDouble

      public double latddmmssAsDouble(String aString)
      Parses the given String as a latitude ordinate. This method calls ordinateAsDouble(String).
      Parameters:
      aString - the String to be parsed.
      Returns:
      the resulting latitude ordinate.
      Throws:
      NumberFormatException - if the String is not in a longitude or latitude format that can be parsed.
    • londdmmssAsDouble

      public double londdmmssAsDouble(String aString)
      Parses the given String as a longitude ordinate. This method calls ordinateAsDouble(String).
      Parameters:
      aString - the String to be parsed.
      Returns:
      the resulting longitude ordinate.
      Throws:
      NumberFormatException - if the String is not in a longitude or latitude format that can be parsed.
    • londdmmssAsDouble

      public double londdmmssAsDouble(String aString, int aDegFieldSize)
      Deprecated.
      Parses the given String as a longitude ordinate.
      Parameters:
      aString - the String to be parsed.
      aDegFieldSize - value in [1,2,3]: 3 means the pattern is dddmmss[EW] (e.g. 0031645E), 2 means the pattern is ddmmss[EW] (e.g. 031645E), 1 means the pattern is dmmss[EW] (e.g. 31645E).
      Returns:
      the resulting longitude ordinate.
    • ordinateAsDouble

      public double ordinateAsDouble(String aString) throws NumberFormatException
      Parses the given String as a longitude or latitude ordinate.
      Parameters:
      aString - the String to be parsed.
      Returns:
      the parsed ordinate.
      Throws:
      NumberFormatException - if the String is not in a longitude or latitude format that can be parsed.