Package com.luciad.util
Class TLcdLonLatFormatter
java.lang.Object
com.luciad.util.TLcdLonLatFormatter
- All Implemented Interfaces:
ILcdCloneable
,ILcdLonLatFormatter
,Serializable
,Cloneable
public class TLcdLonLatFormatter
extends Object
implements Serializable, ILcdCloneable, ILcdLonLatFormatter
This class provides various methods for formatting longitude/latitude coordinate
pairs as String objects. The pattern property determines the format.
The following patterns are provided:
- dd°mm'ss",ddd°mm'ss"
- dd°mm'ss.s",ddd°mm's.ss"
- dd°mm'ss.ss",ddd°mm'ss.ss"
- ddmmssNdddmmssE
- ddmmss.ssssNdddmmss.ssssE
- dddmmssEddmmssN
- xx°,xxx°
- xx.x°,xxx.x°
- xx.xx°,xxx.xx°
- xx.xxx°,xxx.xxx°
- xx.xxxx°,xxx.xxxx°
- xx.xxxxx°,xxx.xxxxx°
- xx.xxxxxx°,xxx.xxxxxx°
- xx°xx',xxx°xx'
- xx°xx.x',xxx°xx.x'
- xx°xx.xx',xxx°xx.xx'
- x°,x°
- x.x°,x.x°
- x.xx°,x.xx°
- x',x'
- x.x',x.x'
- x.xx',x.xx'
- x",x"
- x.x",x.x"
- x.xx",x.xx"
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.- See Also:
-
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
Short decimal degrees pattern 0: x°,x° .static final String
Short decimal degrees pattern 1: x.x°,x.x° .static final String
Short decimal degrees pattern 2: x.xx°,x.xx° .static final String
Short decimal minutes pattern 0: x',x' .static final String
Short decimal minutes pattern 1: x.x',x.x' .static final String
Short decimal minutes pattern 2: x.xx',x.xx' .static final String
Short decimal seconds pattern 0: x",x" .static final String
Short decimal seconds pattern 1: x.x",x.x" .static final String
Short decimal seconds pattern 2: x.xx",x.xx" .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".TLcdLonLatFormatter
(String aPattern) Creates a new TLcdLonLatFormatter that will use the specified pattern. -
Method Summary
Modifier and TypeMethodDescriptionclone()
MakesObject.clone()
public.format
(double aLon, double aLat) Formats the given longitude/latitude coordinate pair as a String, following the current pattern.formatLat
(double aLat) Formats the given latitude coordinate as a String, following the current pattern.formatLon
(double aLon) Formats the given longitude coordinate pair as a String, following the current pattern.static char
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.
-
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" .- See Also:
-
DEFAULT2
Default pattern 2: dd°mm'ss.ss",ddd°mm'ss.ss" .- See Also:
-
NSWE
NSWE pattern: ddmmssNdddmmssE .- See Also:
-
NSWE2
NSWE pattern 2: ddmmss.ssssNdddmmss.ssssE .- 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° .- See Also:
-
DEC_DEG_2
Decimal degrees pattern 2: xx.xx°,xxx.xx° .- See Also:
-
DEC_DEG_3
Decimal degrees pattern 3: xx.xxx°,xxx.xxx° .- See Also:
-
DEC_DEG_4
Decimal degrees pattern 4: xx.xxxx°,xxx.xxxx° .- See Also:
-
DEC_DEG_5
Decimal degrees pattern 5: xx.xxxxx°,xxx.xxxxx° .- See Also:
-
DEC_DEG_6
Decimal degrees pattern 6: xx.xxxxxx°,xxx.xxxxxx° .- 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' .- See Also:
-
DEC_MIN_2
Decimal minutes pattern 2: xx°xx.xx',xxx°xx.xx' .- See Also:
-
SHORT_DEC_DEG_0
Short decimal degrees pattern 0: x°,x° .- See Also:
-
SHORT_DEC_DEG_1
Short decimal degrees pattern 1: x.x°,x.x° .- See Also:
-
SHORT_DEC_DEG_2
Short decimal degrees pattern 2: x.xx°,x.xx° .- See Also:
-
SHORT_DEC_MIN_0
Short decimal minutes pattern 0: x',x' .- See Also:
-
SHORT_DEC_MIN_1
Short decimal minutes pattern 1: x.x',x.x' .- See Also:
-
SHORT_DEC_MIN_2
Short decimal minutes pattern 2: x.xx',x.xx' .- See Also:
-
SHORT_DEC_SEC_0
Short decimal seconds pattern 0: x",x" .- See Also:
-
SHORT_DEC_SEC_1
Short decimal seconds pattern 1: x.x",x.x" .- See Also:
-
SHORT_DEC_SEC_2
Short decimal seconds pattern 2: x.xx",x.xx" .- See Also:
-
-
Constructor Details
-
TLcdLonLatFormatter
public TLcdLonLatFormatter()Creates a new TLcdLonLatFormatter that will use theDEFAULT
pattern, for example 30°32'45",-123°45'15". -
TLcdLonLatFormatter
Creates a new TLcdLonLatFormatter that will use the specified pattern.- Parameters:
aPattern
- one of the pattern String constants defined in this class.
-
-
Method Details
-
setLonLatSeparatorChar
public static void setLonLatSeparatorChar(char aLonLatSeparatorChar) Sets the character to separate longitudes and latitudes. This character is used in the methodformat(double, double)
.- Parameters:
aLonLatSeparatorChar
-
-
getLonLatSeparator
public static char getLonLatSeparator() -
setPattern
Sets the pattern following which Strings will be formatted.- Parameters:
aPattern
- one of the pattern String constants defined in this class.
-
getPattern
-
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 pair as a String, following the current pattern.- Specified by:
formatLon
in interfaceILcdLonLatFormatter
- Parameters:
aLon
- the longitude, expressed in degrees.- Returns:
- the formatted String.
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.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 ); } }
- Specified by:
clone
in interfaceILcdCloneable
- Overrides:
clone
in classObject
- See Also:
-