public class TLcdLonLatPointFormat extends java.text.Format implements ILcdFormatter, ILcdParser, ILcdLonLatFormatter
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 |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEC_DEG_0
Decimal degrees pattern 0: xx°, xxx° .
|
static java.lang.String |
DEC_DEG_1
Decimal degrees pattern 1: xx.x°, xxx.x° .
|
static java.lang.String |
DEC_DEG_2
Decimal degrees pattern 2: xx.xx°, xxx.xx° .
|
static java.lang.String |
DEC_DEG_3
Decimal degrees pattern 3: xx.xxx°, xxx.xxx° .
|
static java.lang.String |
DEC_DEG_4
Decimal degrees pattern 4: xx.xxxx°, xxx.xxxx° .
|
static java.lang.String |
DEC_DEG_5
Decimal degrees pattern 5: xx.xxxxx°, xxx.xxxxx° .
|
static java.lang.String |
DEC_DEG_6
Decimal degrees pattern 6: xx.xxxxxx°, xxx.xxxxxx° .
|
static java.lang.String |
DEC_MIN_0
Decimal minutes pattern 0: xx°xx', xxx°xx' .
|
static java.lang.String |
DEC_MIN_1
Decimal minutes pattern 1: xx°xx.x', xxx°xx.x' .
|
static java.lang.String |
DEC_MIN_2
Decimal minutes pattern 2: xx°xx.xx', xxx°xx.xx' .
|
static java.lang.String |
DEFAULT
Default pattern: dd°mm'ss", ddd°mm'ss" .
|
static java.lang.String |
DEFAULT1
Default pattern 1: dd°mm'ss.s", ddd°mm'ss.s" .
|
static java.lang.String |
DEFAULT2
Default pattern 2: dd°mm'ss.ss", ddd°mm'ss.ss" .
|
static java.lang.String |
NSWE
NSWE pattern: ddmmssNdddmmssE .
|
static java.lang.String |
NSWE2
NSWE pattern 2: ddmmss.ssssNdddmmss.ssssE .
|
static java.lang.String |
WENS
WENS pattern: dddmmssEddmmssN.
|
Constructor and Description |
---|
TLcdLonLatPointFormat()
Creates a new TLcdLonLatFormatter that will use the
DEFAULT pattern,
for example 30°32'45",-123°45'15". |
TLcdLonLatPointFormat(java.lang.String aPattern)
Creates a new TLcdLonLatFormatter that will use the specified pattern.
|
TLcdLonLatPointFormat(java.lang.String aPattern,
java.util.Locale aLocale)
Creates a new TLcdLonLatFormatter that will use the specified pattern.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object aO) |
java.lang.String |
format(double aLon,
double aLat)
Formats the given longitude/latitude coordinate pair as a String,
following the current pattern.
|
java.lang.StringBuffer |
format(java.lang.Object aObject,
java.lang.StringBuffer aStringBuffer,
java.text.FieldPosition aFieldPosition) |
java.lang.String |
formatLat(double aLat)
Formats the given latitude coordinate as a String, following the current pattern.
|
java.lang.String |
formatLon(double aLon)
Formats the given longitude coordinate as a String, following the current pattern.
|
java.lang.String |
getPattern()
Returns the pattern used by this formatter to format Strings representing lon-lat points.
|
int |
hashCode() |
boolean |
isStrictMode()
Returns whether or not the parser will act strictly with valid characters or not.
|
ILcd2DEditablePoint |
parse(java.lang.String aString)
Parses a given
String and creates a new Object
with the corresponding type/properties. |
ILcd2DEditablePoint |
parseObject(java.lang.String aSource) |
ILcd2DEditablePoint |
parseObject(java.lang.String aString,
java.text.ParsePosition aParsePosition) |
void |
setStrictMode(boolean aStrictMode)
Set whether or not the parser will only allow strictly valid characters or not.
|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
format
public static final java.lang.String DEFAULT
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public static final java.lang.String NSWE
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public static final java.lang.String WENS
public static final java.lang.String DEC_DEG_0
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public static final java.lang.String DEC_MIN_0
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public static final java.lang.String 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 the
Locale
to have control over the decimal separator.
public TLcdLonLatPointFormat()
DEFAULT
pattern,
for example 30°32'45",-123°45'15".
This constructor is equivalent to new TLcdLonLatPointFormat( TLcdLonLatPointFormat.DEFAULT )
.public TLcdLonLatPointFormat(java.lang.String aPattern)
new TLcdLonLatPointFormat( aPattern, null )
.aPattern
- a pattern string as defined in the class documentation.java.lang.IllegalArgumentException
- if the formatting pattern is invalidpublic TLcdLonLatPointFormat(java.lang.String aPattern, java.util.Locale aLocale)
aPattern
- a pattern string as defined in the class documentation.aLocale
- the locale to use, or null
when the default locale should be usedjava.lang.IllegalArgumentException
- if the formatting pattern is invalidpublic java.lang.String getPattern()
public boolean isStrictMode()
true
when only valid characters will be parsed else false
setStrictMode(boolean)
public void setStrictMode(boolean aStrictMode)
Valid characters include:
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.
aStrictMode
- whether or not the parsers will only allow strictly valid characters or not.public java.lang.StringBuffer format(java.lang.Object aObject, java.lang.StringBuffer aStringBuffer, java.text.FieldPosition aFieldPosition)
format
in class java.text.Format
public java.lang.String format(double aLon, double aLat)
format
in interface ILcdLonLatFormatter
aLon
- the longitude, expressed in degrees.aLat
- the latitude, expressed in degrees.public java.lang.String formatLat(double aLat)
formatLat
in interface ILcdLonLatFormatter
aLat
- the latitude, expressed in degrees.public java.lang.String formatLon(double aLon)
formatLon
in interface ILcdLonLatFormatter
aLon
- the longitude, expressed in degrees.public ILcd2DEditablePoint parse(java.lang.String aString) throws java.lang.IllegalArgumentException
ILcdParser
String
and creates a new Object
with the corresponding type/properties.parse
in interface ILcdParser
aString
- the String
to be parsed.Object
.java.lang.IllegalArgumentException
- if the String
can't be parsed.public ILcd2DEditablePoint parseObject(java.lang.String aSource) throws java.text.ParseException
parseObject
in class java.text.Format
java.text.ParseException
public ILcd2DEditablePoint parseObject(java.lang.String aString, java.text.ParsePosition aParsePosition)
parseObject
in class java.text.Format
public boolean equals(java.lang.Object aO)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object