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
Modifier and TypeFieldDescriptionstatic final String
Decimal degrees pattern 0: xx°, xxx° .static final String
Decimal degrees pattern 1: xx.x°, xxx.x° .static final String
Decimal degrees pattern 2: xx.xx°, xxx.xx° .static final String
Decimal degrees pattern 3: xx.xxx°, xxx.xxx° .static final String
Decimal degrees pattern 4: xx.xxxx°, xxx.xxxx° .static final String
Decimal degrees pattern 5: xx.xxxxx°, xxx.xxxxx° .static final String
Decimal degrees pattern 6: xx.xxxxxx°, xxx.xxxxxx° .static final String
Decimal minutes pattern 0: xx°xx', xxx°xx' .static final String
Decimal minutes pattern 1: xx°xx.x', xxx°xx.x' .static final String
Decimal minutes pattern 2: xx°xx.xx', xxx°xx.xx' .static final String
Default pattern: dd°mm'ss", ddd°mm'ss" .static final String
Default pattern 1: dd°mm'ss.s", ddd°mm'ss.s" .static final String
Default pattern 2: dd°mm'ss.ss", ddd°mm'ss.ss" .static final String
NSWE pattern: ddmmssNdddmmssE .static final String
NSWE pattern 2: ddmmss.ssssNdddmmss.ssssE .static final String
WENS pattern: dddmmssEddmmssN. -
Constructor Summary
ConstructorDescriptionCreates a new TLcdLonLatFormatter that will use theDEFAULT
pattern, for example 30°32'45",-123°45'15".TLcdLonLatPointFormat
(String aPattern) Creates a new TLcdLonLatFormatter that will use the specified pattern.TLcdLonLatPointFormat
(String aPattern, Locale aLocale) Creates a new TLcdLonLatFormatter that will use the specified pattern. -
Method Summary
Modifier and TypeMethodDescriptionboolean
format
(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.int
hashCode()
boolean
Returns whether or not the parser will act strictly with valid characters or not.Parses a givenString
and creates a newObject
with the corresponding type/properties.parseObject
(String aSource) parseObject
(String aString, ParsePosition aParsePosition) void
setStrictMode
(boolean aStrictMode) Set whether or not the parser will only allow strictly valid characters or not.Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to 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
Locale
of the JVM when using the constructor which only specifies the pattern. Use the constructor which also specifies theLocale
to have control over the decimal separator.- See Also:
-
-
Constructor Details
-
TLcdLonLatPointFormat
public TLcdLonLatPointFormat()Creates a new TLcdLonLatFormatter that will use theDEFAULT
pattern, for example 30°32'45",-123°45'15". This constructor is equivalent tonew TLcdLonLatPointFormat( TLcdLonLatPointFormat.DEFAULT )
. -
TLcdLonLatPointFormat
Creates a new TLcdLonLatFormatter 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 TLcdLonLatFormatter 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, ornull
when the default locale should be used- Throws:
IllegalArgumentException
- if the formatting pattern is invalid
-
-
Method Details
-
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:
true
when 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:
format
in 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:
formatLat
in 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:
formatLon
in interfaceILcdLonLatFormatter
- Parameters:
aLon
- the longitude, expressed in degrees.- Returns:
- the formatted String.
-
parse
Description copied from interface:ILcdParser
Parses a givenString
and creates a newObject
with the corresponding type/properties.- Specified by:
parse
in interfaceILcdParser
- Parameters:
aString
- theString
to be parsed.- Returns:
- the resulting new
Object
. - Throws:
IllegalArgumentException
- if theString
can't be parsed.
-
parseObject
- Overrides:
parseObject
in classFormat
- Throws:
ParseException
-
parseObject
- Specified by:
parseObject
in classFormat
-
equals
-
hashCode
public int hashCode()
-