Class TLcdLonLatPointFormat
- All Implemented Interfaces:
ILcdFormatter,ILcdLonLatFormatter,ILcdParser,Serializable,Cloneable
pattern = lon, separator, lat | lat, separator, lon
lon = "lon(", axiscoord, { precision } ")"
lat = "lat(", axiscoord, { precision } ")"
axiscoord = axis, coord | coord, axis | sign, coord | splitcoord
splitcoord = degrees axis minutes | degrees axis minutes seconds | degrees minutes axis seconds
coord = degrees | degrees, minutes | degrees, minutes, seconds
degrees = ( "d" | "D" )
minutes = ( "m" | "M" )
seconds = ( "s" | "S" )
sign = "+"
axis = "a" | white space, "a" | "a", white space
precision = digit
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
separator = { ? any character ? }
The table below details the meaning of each pattern character
| Symbol | Meaning | Example |
|---|---|---|
| d | Integer degrees | 354 |
| D | Integer degrees with degrees symbol | 354° |
| m | Integer minutes | 54 |
| M | Integer minutes with minutes symbol | 54' |
| s | Integer seconds | 54 |
| S | Integer seconds with seconds symbol | 54" |
| + | Coordinate sign. Results in a '-' if the coordinate is negative | - |
| a | Hemisphere indicator | N, S, E, W |
- Since:
- 11.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.Format
Format.Field -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDecimal degrees pattern 0: xx°, xxx° .static final StringDecimal degrees pattern 1: xx.x°, xxx.x° .static final StringDecimal degrees pattern 2: xx.xx°, xxx.xx° .static final StringDecimal degrees pattern 3: xx.xxx°, xxx.xxx° .static final StringDecimal degrees pattern 4: xx.xxxx°, xxx.xxxx° .static final StringDecimal degrees pattern 5: xx.xxxxx°, xxx.xxxxx° .static final StringDecimal degrees pattern 6: xx.xxxxxx°, xxx.xxxxxx° .static final StringDecimal minutes pattern 0: xx°xx', xxx°xx' .static final StringDecimal minutes pattern 1: xx°xx.x', xxx°xx.x' .static final StringDecimal minutes pattern 2: xx°xx.xx', xxx°xx.xx' .static final StringDefault pattern: dd°mm'ss", ddd°mm'ss" .static final StringDefault pattern 1: dd°mm'ss.s", ddd°mm'ss.s" .static final StringDefault pattern 2: dd°mm'ss.ss", ddd°mm'ss.ss" .static final StringNSWE pattern: ddmmssNdddmmssE .static final StringNSWE pattern 2: ddmmss.ssssNdddmmss.ssssE .static final StringWENS pattern: dddmmssEddmmssN. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TLcdLonLatPointFormat that will use theDEFAULTpattern, for example 30°32'45",-123°45'15".TLcdLonLatPointFormat(String aPattern) Creates a new TLcdLonLatPointFormat that will use the specified pattern.TLcdLonLatPointFormat(String aPattern, Locale aLocale) Creates a new TLcdLonLatPointFormat that will use the specified pattern. -
Method Summary
Modifier and TypeMethodDescriptionbooleanformat(double aLon, double aLat) Formats the given longitude/latitude coordinate pair as a String, following the current pattern.format(Object aObject, StringBuffer aStringBuffer, FieldPosition aFieldPosition) formatLat(double aLat) Formats the given latitude coordinate as a String, following the current pattern.formatLon(double aLon) Formats the given longitude coordinate as a String, following the current pattern.Returns the pattern used by this formatter to format Strings representing lon-lat points.inthashCode()booleanReturns whether or not the parser will act strictly with valid characters or not.Parses a givenStringand creates a newObjectwith the corresponding type/properties.parseObject(String aSource) parseObject(String aString, ParsePosition aParsePosition) voidsetStrictMode(boolean aStrictMode) Set whether or not the parser will only allow strictly valid characters or not.toString()Methods inherited from class java.text.Format
clone, format, formatToCharacterIteratorMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.luciad.util.ILcdFormatter
format
-
Field Details
-
DEFAULT
Default pattern: dd°mm'ss", ddd°mm'ss" .- See Also:
-
DEFAULT1
Default pattern 1: dd°mm'ss.s", ddd°mm'ss.s" .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
DEFAULT2
Default pattern 2: dd°mm'ss.ss", ddd°mm'ss.ss" .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
NSWE
NSWE pattern: ddmmssNdddmmssE .- See Also:
-
NSWE2
NSWE pattern 2: ddmmss.ssssNdddmmss.ssssE .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
WENS
WENS pattern: dddmmssEddmmssN.- See Also:
-
DEC_DEG_0
Decimal degrees pattern 0: xx°, xxx° .- See Also:
-
DEC_DEG_1
Decimal degrees pattern 1: xx.x°, xxx.x° .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
DEC_DEG_2
Decimal degrees pattern 2: xx.xx°, xxx.xx° .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
DEC_DEG_3
Decimal degrees pattern 3: xx.xxx°, xxx.xxx° .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
DEC_DEG_4
Decimal degrees pattern 4: xx.xxxx°, xxx.xxxx° .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
DEC_DEG_5
Decimal degrees pattern 5: xx.xxxxx°, xxx.xxxxx° .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
DEC_DEG_6
Decimal degrees pattern 6: xx.xxxxxx°, xxx.xxxxxx° .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
DEC_MIN_0
Decimal minutes pattern 0: xx°xx', xxx°xx' .- See Also:
-
DEC_MIN_1
Decimal minutes pattern 1: xx°xx.x', xxx°xx.x' .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
DEC_MIN_2
Decimal minutes pattern 2: xx°xx.xx', xxx°xx.xx' .
Note that the decimal separator depends on the default
Localeof the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocaleto have control over the decimal separator.- See Also:
-
-
Constructor Details
-
TLcdLonLatPointFormat
public TLcdLonLatPointFormat()Creates a new TLcdLonLatPointFormat that will use theDEFAULTpattern, for example 30°32'45",-123°45'15". This constructor is equivalent tonew TLcdLonLatPointFormat( TLcdLonLatPointFormat.DEFAULT ). -
TLcdLonLatPointFormat
Creates a new TLcdLonLatPointFormat that will use the specified pattern. This constructor is equivalent tonew TLcdLonLatPointFormat( aPattern, null ).- Parameters:
aPattern- a pattern string as defined in the class documentation.- Throws:
IllegalArgumentException- if the formatting pattern is invalid
-
TLcdLonLatPointFormat
Creates a new TLcdLonLatPointFormat that will use the specified pattern. The given locale will be used to lookup the decimal point character.- Parameters:
aPattern- a pattern string as defined in the class documentation.aLocale- the locale to use, ornullwhen the default locale should be used- Throws:
IllegalArgumentException- if the formatting pattern is invalid
-
-
Method Details
-
toString
-
getPattern
Returns the pattern used by this formatter to format Strings representing lon-lat points.- Returns:
- the pattern used by this formatter
-
isStrictMode
public boolean isStrictMode()Returns whether or not the parser will act strictly with valid characters or not.- Returns:
truewhen only valid characters will be parsed elsefalse- Since:
- 2019.1
- See Also:
-
setStrictMode
public void setStrictMode(boolean aStrictMode) Set whether or not the parser will only allow strictly valid characters or not.Valid characters include:
- numbers;
- axis indicators [wWeEnNsS];
- degree symbol [°];
- minutes symbol ['];
- seconds symbol ["];
- separation character (if used in the pattern)
- whitespace (as used in the pattern)
Example of valid input: 14°, 50°
Example of invalid input: 14°&invalid 50°
When strict mode is off invalid characters will be seen as a separation character.
By default strict mode is not enabled.
- Parameters:
aStrictMode- whether or not the parsers will only allow strictly valid characters or not.- Since:
- 2019.1
-
format
public StringBuffer format(Object aObject, StringBuffer aStringBuffer, FieldPosition aFieldPosition) -
format
Formats the given longitude/latitude coordinate pair as a String, following the current pattern.- Specified by:
formatin interfaceILcdLonLatFormatter- Parameters:
aLon- the longitude, expressed in degrees.aLat- the latitude, expressed in degrees.- Returns:
- the formatted String.
-
formatLat
Formats the given latitude coordinate as a String, following the current pattern.- Specified by:
formatLatin interfaceILcdLonLatFormatter- Parameters:
aLat- the latitude, expressed in degrees.- Returns:
- the formatted String.
-
formatLon
Formats the given longitude coordinate as a String, following the current pattern.- Specified by:
formatLonin interfaceILcdLonLatFormatter- Parameters:
aLon- the longitude, expressed in degrees.- Returns:
- the formatted String.
-
parse
Description copied from interface:ILcdParserParses a givenStringand creates a newObjectwith the corresponding type/properties.- Specified by:
parsein interfaceILcdParser- Parameters:
aString- theStringto be parsed.- Returns:
- the resulting new
Object. - Throws:
IllegalArgumentException- if theStringcan't be parsed.
-
parseObject
- Overrides:
parseObjectin classFormat- Throws:
ParseException
-
parseObject
- Specified by:
parseObjectin classFormat
-
equals
-
hashCode
public int hashCode()
-