ecologylab.sensor.gps.data
Class AngularCoord
java.lang.Object
ecologylab.generic.Debug
ecologylab.xml.ElementState
ecologylab.sensor.gps.data.AngularCoord
- All Implemented Interfaces:
- OptimizationTypes, XMLTranslationExceptionTypes, java.lang.Comparable<AngularCoord>
public class AngularCoord
- extends ElementState
- implements java.lang.Comparable<AngularCoord>
An object for representing a world coordinate (either latitude, or longitude), stored as a floating-point degree. Can
convert from deg/min/sec.
Also provides static methods for manipulating coordinates.
- Author:
- Zachary O. Toups (toupsz@cs.tamu.edu)
|
Field Summary |
protected double |
coord
|
| Fields inherited from interface ecologylab.xml.OptimizationTypes |
BAD_FIELD, COLLECTION_ELEMENT, COLLECTION_SCALAR, IGNORED_ATTRIBUTE, IGNORED_ELEMENT, LEAF_NODE_VALUE, MAP_ELEMENT, MAP_SCALAR, NAME_SPACE_ATTRIBUTE, NAME_SPACE_LEAF_NODE, NAME_SPACE_MASK, NAME_SPACE_NESTED_ELEMENT, NAMESPACE_IGNORED_ELEMENT, NAMESPACE_TRIAL_ELEMENT, OTHER_NESTED_ELEMENT, REGULAR_ATTRIBUTE, REGULAR_NESTED_ELEMENT, ROOT, UNSET_TYPE, XMLNS_ATTRIBUTE, XMLNS_IGNORED |
|
Constructor Summary |
AngularCoord()
|
AngularCoord(double coord)
Constructs a new WorldCoord with the specified coordinate value in factional degrees. |
AngularCoord(double deg,
double min,
double sec)
Specifies a new WorldCoord object in terms of degrees, minutes, and seconds. |
AngularCoord(double deg,
double min,
double sec,
char hemisphere)
As WorldCoord(double, double, double), but ensures that the final sign is set based on hemisphere. |
| Methods inherited from class ecologylab.xml.ElementState |
addNestedElement, addNestedElement, appendTextNodeString, buildDOM, buildDOM, buildDOM, buildDOM, buildDOM, buildDOMFromXMLCharSequence, buildDOMFromXMLString, checkAnnotation, convertNameStyles, createChildHook, fieldToXMLOptimizations, floatingPrecision, getCollection, getElementStateById, getMap, getNestedNameSpace, getTextNodeString, leafElementFieldNames, lookupNestedNameSpace, optimizations, parent, postTranslationProcessingHook, preTranslationProcessingHook, recycle, setDeclarationStyle, setFieldUsingTypeRegistry, setFloatingPrecision, setParent, setUseDOMForTranslateTo, translateFromXML, translateFromXML, translateFromXML, translateFromXML, translateFromXML, translateFromXMLCharSequence, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOM, translateFromXMLDOMCharSequence, translateFromXMLDOMCharSequence, translateFromXMLRootNode, translateFromXMLSAX, translateFromXMLSAX, translateFromXMLSAX, translateFromXMLSAX, translateFromXMLSAX, translateToDOM, translateToXML, translateToXML, translateToXML, translateToXML, writePrettyXML, writePrettyXML, writePrettyXML |
| Methods inherited from class ecologylab.generic.Debug |
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
coord
protected double coord
AngularCoord
public AngularCoord()
AngularCoord
public AngularCoord(double coord)
- Constructs a new WorldCoord with the specified coordinate value in factional degrees.
- Parameters:
coord -
AngularCoord
public AngularCoord(double deg,
double min,
double sec)
- Specifies a new WorldCoord object in terms of degrees, minutes, and seconds. To specify hemisphere, degrees MAY be
negative, minutes and seconds may not be. deg, min, and/or sec may be floating numbers, in which case they are
added (so 1.5 deg, 30 min will result in 2.0 deg).
- Parameters:
deg - min -
AngularCoord
public AngularCoord(double deg,
double min,
double sec,
char hemisphere)
- As WorldCoord(double, double, double), but ensures that the final sign is set based on hemisphere.
- Parameters:
deg - min - sec - hemisphere - -
a character indicating the hemisphere for the coordinate, North and East are positive, South and West
are negative.
fromDegMinSec
public static double fromDegMinSec(double deg,
double min,
double sec)
fromDegMinSecHemi
public static double fromDegMinSecHemi(double deg,
double min,
double sec,
char hemisphere)
main
public static void main(java.lang.String[] args)
signForHemisphere
public static double signForHemisphere(char h,
double origCoord)
compareTo
public int compareTo(AngularCoord that)
- Specified by:
compareTo in interface java.lang.Comparable<AngularCoord>
- See Also:
Comparable.compareTo(java.lang.Object)
getCoord
public double getCoord()
setHemisphere
public void setHemisphere(char h)
- Uses the specified hemisphere to ensure that the sign of deg is set correctly for this object.
The sign will be set to negative for S, s, W, or w, otherwise, it will be positive.