public class TLcdLonLatFormatter extends Object implements Serializable, ILcdCloneable, ILcdLonLatFormatter
setLonLatSeparatorChar(char)
.
This class is not thread safe, but an instance of this class can be shared by separate threads at the same time as
long as the pattern and the separator character are not being modified in the process.TLcdLonLatPointFormat
,
Serialized FormModifier 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 |
SHORT_DEC_DEG_0
Short decimal degrees pattern 0: x°,x° .
|
static String |
SHORT_DEC_DEG_1
Short decimal degrees pattern 1: x.x°,x.x° .
|
static String |
SHORT_DEC_DEG_2
Short decimal degrees pattern 2: x.xx°,x.xx° .
|
static String |
SHORT_DEC_MIN_0
Short decimal minutes pattern 0: x',x' .
|
static String |
SHORT_DEC_MIN_1
Short decimal minutes pattern 1: x.x',x.x' .
|
static String |
SHORT_DEC_MIN_2
Short decimal minutes pattern 2: x.xx',x.xx' .
|
static String |
SHORT_DEC_SEC_0
Short decimal seconds pattern 0: x",x" .
|
static String |
SHORT_DEC_SEC_1
Short decimal seconds pattern 1: x.x",x.x" .
|
static String |
SHORT_DEC_SEC_2
Short decimal seconds pattern 2: x.xx",x.xx" .
|
static String |
WENS
WENS pattern: dddmmssEddmmssN .
|
Constructor and Description |
---|
TLcdLonLatFormatter()
Creates a new TLcdLonLatFormatter that will use the
DEFAULT pattern,
for example 30°32'45",-123°45'15". |
TLcdLonLatFormatter(String aPattern)
Creates a new TLcdLonLatFormatter that will use the specified pattern.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Makes
Object.clone() public. |
String |
format(double aLon,
double aLat)
Formats the given longitude/latitude coordinate pair as a String,
following the current pattern.
|
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 pair as a String,
following the current pattern.
|
static char |
getLonLatSeparator() |
String |
getPattern() |
static void |
setLonLatSeparatorChar(char aLonLatSeparatorChar)
Sets the character to separate longitudes and latitudes.
|
void |
setPattern(String aPattern)
Sets the pattern following which Strings will be formatted.
|
public static final String DEFAULT
public static final String DEFAULT1
public static final String DEFAULT2
public static final String NSWE
public static final String NSWE2
public static final String WENS
public static final String DEC_DEG_0
public static final String DEC_DEG_1
public static final String DEC_DEG_2
public static final String DEC_DEG_3
public static final String DEC_DEG_4
public static final String DEC_DEG_5
public static final String DEC_DEG_6
public static final String DEC_MIN_0
public static final String DEC_MIN_1
public static final String DEC_MIN_2
public static final String SHORT_DEC_DEG_0
public static final String SHORT_DEC_DEG_1
public static final String SHORT_DEC_DEG_2
public static final String SHORT_DEC_MIN_0
public static final String SHORT_DEC_MIN_1
public static final String SHORT_DEC_MIN_2
public static final String SHORT_DEC_SEC_0
public static final String SHORT_DEC_SEC_1
public static final String SHORT_DEC_SEC_2
public TLcdLonLatFormatter()
DEFAULT
pattern,
for example 30°32'45",-123°45'15".public TLcdLonLatFormatter(String aPattern)
aPattern
- one of the pattern String constants defined in this class.public static void setLonLatSeparatorChar(char aLonLatSeparatorChar)
format(double, double)
.aLonLatSeparatorChar
- public static char getLonLatSeparator()
public void setPattern(String aPattern)
aPattern
- one of the pattern String constants defined in this class.public String getPattern()
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 Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()