|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.gps.AngularDistance
This class wraps a double
to represent an angular distance in
degrees used for global positioning.
Additionally, AngularDistance
provides functions to convert
values into various measures commonly used for angular distances such as
degrees, minutes or seconds.
Field Summary | |
protected double |
deg_
Geo-position in decimal degrees. |
static int |
FORMAT_DEG
Format flag indicating that the degree value of this AngularDistance should be formated as decimal degrees. |
static int |
FORMAT_DEG_MIN
Format flag indicating that the degree value of this AngularDistance should be formated as degrees and minutes. |
static int |
FORMAT_DEG_MIN_SEC
Format flag indicating that the degree value of this AngularDistance should be formated as degrees, minutes and
seconds. |
static int |
FORMAT_SIGNED
Format flag indicating that an algebraic sign precedes the degree value. |
protected int |
MAX_VALUE
The largest positive value. |
protected char |
NEG_CHAR
Suffix for negative values. |
protected char |
POS_CHAR
Suffix for positive values. |
Constructor Summary | |
AngularDistance(int max,
char pos,
char neg)
Constructs a new AngularDistance with the maximum absolute
value max and the suffix pos and
neg . |
Method Summary | |
double |
getDegrees()
Returns the degree value of this AngularDistance . |
static double |
minuteToDegree(double minute)
Converts a minute value into its degree representation. |
void |
normalize()
|
void |
parse(String str)
Parses the AngularDistance specified by str
according to the internal presentation, which is compatible to the output
of toString() . |
void |
parseGpsField(String str)
Parses the AngularDistance specified by str
according to the internal NMEA0183-Format and sets the internal degree
value to the parsed data. |
void |
setDegrees(double value)
Sets the degree value of this AngularDistance to
value . |
String |
toString()
Returns the string representation of this AngularDistance . |
String |
toString(int format)
Returns a string representation of this AngularDistance ,
according to the specified format argument. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int FORMAT_SIGNED
POS_CHAR
or NEG_CHAR
is appended to
the degree value instead.
public static final int FORMAT_DEG
AngularDistance
should be formated as decimal degrees.
public static final int FORMAT_DEG_MIN
AngularDistance
should be formated as degrees and minutes.
public static final int FORMAT_DEG_MIN_SEC
AngularDistance
should be formated as degrees, minutes and
seconds.
protected char POS_CHAR
protected char NEG_CHAR
protected int MAX_VALUE
protected double deg_
Constructor Detail |
public AngularDistance(int max, char pos, char neg)
AngularDistance
with the maximum absolute
value max
and the suffix pos
and
neg
.
max
- the absolute value of the largest positive value as well as
the smallest negative valuepos
- the suffix for positive valuesneg
- the suffix for negative valuesMethod Detail |
public void parse(String str) throws AngularDistanceFormatException
AngularDistance
specified by str
according to the internal presentation, which is compatible to the output
of toString()
.
double
›[°][‹character
›]"
str
- the String
to parse
AngularDistance
according to the given
String
AngularDistanceFormatException
- if str
does not have
the appropriate formatpublic void parseGpsField(String str) throws AngularDistanceFormatException
AngularDistance
specified by str
according to the internal NMEA0183-Format and sets the internal degree
value to the parsed data.
str
- the String
to parse
AngularDistanceFormatException
- if str
does not have
the appropriate formatpublic void normalize()
public void setDegrees(double value)
AngularDistance
to
value
. The value
argument is expected to be
equal to or less than MAX_VALUE
and equal to or more than
-MAX_VALUE
and will be normalized if not within the expected
range.
value
- the new degree valuenormalize()
public double getDegrees()
AngularDistance
.
AngularDistance
public static double minuteToDegree(double minute)
minute
- the minute value to convert
public String toString(int format)
AngularDistance
,
according to the specified format
argument.
AngularDistance
FORMAT_DEG
,
FORMAT_DEG_MIN
,
FORMAT_DEG_MIN_SEC
,
FORMAT_SIGNED
public String toString()
AngularDistance
.
AngularDistance
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |