public class TLcdLonLatPointFormat extends 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 |
Format.Field
Modifier and Type | Field and Description |
---|---|
static String |
DEC_DEG_0
Decimal degrees pattern 0: xx°, xxx° .
|
static String |
DEC_DEG_1
Decimal degrees pattern 1: xx.x°, xxx.x° .
|
static String |
DEC_DEG_2
Decimal degrees pattern 2: xx.xx°, xxx.xx° .
|
static String |
DEC_DEG_3
Decimal degrees pattern 3: xx.xxx°, xxx.xxx° .
|
static String |
DEC_DEG_4
Decimal degrees pattern 4: xx.xxxx°, xxx.xxxx° .
|
static String |
DEC_DEG_5
Decimal degrees pattern 5: xx.xxxxx°, xxx.xxxxx° .
|
static String |
DEC_DEG_6
Decimal degrees pattern 6: xx.xxxxxx°, xxx.xxxxxx° .
|
static String |
DEC_MIN_0
Decimal minutes pattern 0: xx°xx', xxx°xx' .
|
static String |
DEC_MIN_1
Decimal minutes pattern 1: xx°xx.x', xxx°xx.x' .
|
static String |
DEC_MIN_2
Decimal minutes pattern 2: xx°xx.xx', xxx°xx.xx' .
|
static String |
DEFAULT
Default pattern: dd°mm'ss", ddd°mm'ss" .
|
static String |
DEFAULT1
Default pattern 1: dd°mm'ss.s", ddd°mm'ss.s" .
|
static String |
DEFAULT2
Default pattern 2: dd°mm'ss.ss", ddd°mm'ss.ss" .
|
static String |
NSWE
NSWE pattern: ddmmssNdddmmssE .
|
static String |
NSWE2
NSWE pattern 2: ddmmss.ssssNdddmmss.ssssE .
|
static 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(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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object aO) |
String |
format(double aLon,
double aLat)
Formats the given longitude/latitude coordinate pair as a String,
following the current pattern.
|
StringBuffer |
format(Object aObject,
StringBuffer aStringBuffer,
FieldPosition aFieldPosition) |
String |
formatLat(double aLat)
Formats the given latitude coordinate as a String, following the current pattern.
|
String |
formatLon(double aLon)
Formats the given longitude coordinate as a String, following the current pattern.
|
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(String aString)
Parses a given
String and creates a new Object
with the corresponding type/properties. |
ILcd2DEditablePoint |
parseObject(String aSource) |
ILcd2DEditablePoint |
parseObject(String aString,
ParsePosition aParsePosition) |
void |
setStrictMode(boolean aStrictMode)
Set whether or not the parser will only allow strictly valid characters or not.
|
clone, format, formatToCharacterIterator
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
format
public static final String DEFAULT
public static final 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 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 String NSWE
public static final 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 String WENS
public static final String DEC_DEG_0
public static final 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 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 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 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 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 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 String DEC_MIN_0
public static final 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 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(String aPattern)
new TLcdLonLatPointFormat( aPattern, null )
.aPattern
- a pattern string as defined in the class documentation.IllegalArgumentException
- if the formatting pattern is invalidpublic TLcdLonLatPointFormat(String aPattern, 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 usedIllegalArgumentException
- if the formatting pattern is invalidpublic 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 StringBuffer format(Object aObject, StringBuffer aStringBuffer, FieldPosition aFieldPosition)
public String format(double aLon, double aLat)
format
in interface ILcdLonLatFormatter
aLon
- the longitude, expressed in degrees.aLat
- the latitude, expressed in degrees.public String formatLat(double aLat)
formatLat
in interface ILcdLonLatFormatter
aLat
- the latitude, expressed in degrees.public String formatLon(double aLon)
formatLon
in interface ILcdLonLatFormatter
aLon
- the longitude, expressed in degrees.public ILcd2DEditablePoint parse(String aString) throws IllegalArgumentException
ILcdParser
String
and creates a new Object
with the corresponding type/properties.parse
in interface ILcdParser
aString
- the String
to be parsed.Object
.IllegalArgumentException
- if the String
can't be parsed.public ILcd2DEditablePoint parseObject(String aSource) throws ParseException
parseObject
in class Format
ParseException
public ILcd2DEditablePoint parseObject(String aString, ParsePosition aParsePosition)
parseObject
in class Format