Package com.luciad.util
Class TLcdLonLatParser
java.lang.Object
com.luciad.util.TLcdLonLatParser
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.The pattern property is not used.static final StringDeprecated.The pattern property is not used.static final StringDeprecated.The pattern property is not used.static final StringDeprecated.The pattern property is not used.static final StringDeprecated.The pattern property is not used.static final StringDeprecated.The pattern property is not used.static final StringDeprecated.The pattern property is not used.static final StringDeprecated.The pattern property is not used.static final intDeprecated.The mode property is not used.static final intDeprecated.The mode property is not used.static final StringDeprecated.The pattern property is not used.static final StringDeprecated.The pattern property is not used. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TLcdLonLatParser.TLcdLonLatParser(int aMode) Deprecated.Use the constructor without parameters.TLcdLonLatParser(String aPattern) Deprecated.Use the constructor without parameters. -
Method Summary
Modifier and TypeMethodDescriptionintgetMode()Deprecated.The mode property is not used.doublelatddmmssAsDouble(String aString) Parses the given String as a latitude ordinate.doublelonddmmssAsDouble(String aString) Parses the given String as a longitude ordinate.doublelonddmmssAsDouble(String aString, int aDegFieldSize) Deprecated.doubleordinateAsDouble(String aString) Parses the given String as a longitude or latitude ordinate.Parses the given String as a longitude or latitude ordinate.Deprecated.Use the methodparse(String).voidsetMode(int aNewMode) Deprecated.The mode property is not used.voidsetPattern(String aNewPattern) Deprecated.The pattern property is not used.
-
Field Details
-
LATCOORD
public static final int LATCOORDDeprecated.The mode property is not used.Mode property for latitude coordinates.- See Also:
-
LONCOORD
public static final int LONCOORDDeprecated.The mode property is not used.Mode property for longitude coordinates.- See Also:
-
DEFAULT
Deprecated.The pattern property is not used.Default pattern : dd°mm'ss",ddd°mm'ss" .- See Also:
-
DEFAULT2
Deprecated.The pattern property is not used.Default pattern 2: dd°mm'ss.ss",ddd°mm'ss.ss" .- See Also:
-
NSWE
Deprecated.The pattern property is not used.NSWE pattern: ddmmssNdddmmssE .- See Also:
-
NSWE2
Deprecated.The pattern property is not used.NSWE pattern 2: ddmmss.ssssNdddmmss.ssssE .- See Also:
-
DEC_DEG_1
Deprecated.The pattern property is not used.Decimal degrees pattern 1: xx.x°,xxx.x° .- See Also:
-
DEC_DEG_2
Deprecated.The pattern property is not used.Decimal degrees pattern 2: xx.xx°,xxx.xx° .- See Also:
-
DEC_DEG_3
Deprecated.The pattern property is not used.Decimal degrees pattern 3: xx.xxx°,xxx.xxx° .- See Also:
-
DEC_DEG_4
Deprecated.The pattern property is not used.Decimal degrees pattern 4: xx.xxxx°,xxx.xxxx° .- See Also:
-
DEC_DEG_5
Deprecated.The pattern property is not used.Decimal degrees pattern 5: xx.xxxxx°,xxx.xxxxx° .- See Also:
-
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 patternNSWEand the given mode.- Parameters:
aMode- the mode:LONCOORDorLATCOORD.
-
TLcdLonLatParser
Deprecated.Use the constructor without parameters.Creates a new TLcdLonLatParser with the given format pattern and modeLATCOORD.- Parameters:
aPattern- the pattern.
-
-
Method Details
-
setPattern
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:LONCOORDorLATCOORD.- 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
Parses the given String as a longitude or latitude ordinate.- Specified by:
parsein interfaceILcdParser- Parameters:
aString- theStringto be parsed.- Returns:
- the resulting ordinate, represented as a new
Double, ornull, when the String passed could not be interpreted as an ordinate.
-
parse
Deprecated.Use the methodparse(String).The mode parameter is disregarded. Use the methodparse(String).- Parameters:
aString- theStringto be parsed.aMode- not taken into account.- Returns:
- the resulting ordinate, represented as a new
Double, ornullif the parsing failed.
-
latddmmssAsDouble
Parses the given String as a latitude ordinate. This method callsordinateAsDouble(String).- Parameters:
aString- theStringto 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
Parses the given String as a longitude ordinate. This method callsordinateAsDouble(String).- Parameters:
aString- theStringto 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
Deprecated.Parses the given String as a longitude ordinate.- Parameters:
aString- theStringto 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
Parses the given String as a longitude or latitude ordinate.- Parameters:
aString- theStringto be parsed.- Returns:
- the parsed ordinate.
- Throws:
NumberFormatException- if the String is not in a longitude or latitude format that can be parsed.
-