ecologylab.xml.library.kml.geometry
Class Coordinates

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.xml.ElementState
          extended by ecologylab.xml.library.kml.geometry.Coordinates
All Implemented Interfaces:
OptimizationTypes, XMLTranslationExceptionTypes

public class Coordinates
extends ElementState

The Coordinates object is a special case specifically for KML. Because KML nests a list of coordinates as comma-delimited values within an XML element, we need this special, hybrid object. The Coordinates object stores TWO representations of its data: one in the String, comma-delimited form (field:coords) for going to/from KML and the other in the form of an ArrayList for use by programmers (field:coordinateList). When a Coordinates object is translated FROM KML, the coordinateList is automatically filled in using the the coords String. When it is translated TO KML, the values in the coordinateList are serialized to the coords String.

Author:
Zach

Nested Class Summary
 
Nested classes/interfaces inherited from class ecologylab.xml.ElementState
ElementState.ClassToCollectionMap, ElementState.DeclarationStyle, ElementState.xml_attribute, ElementState.xml_class, ElementState.xml_classes, ElementState.xml_collection, ElementState.xml_leaf, ElementState.xml_map, ElementState.xml_nested, ElementState.xml_tag
 
Field Summary
 
Fields inherited from class ecologylab.xml.ElementState
CDATA, ESTIMATE_CHARS_PER_FIELD, FLOATING_PRECISION_OFF, MARSHALLING_PARAMS, NORMAL, UTF16, UTF16_LE, UTF8, XML_FILE_HEADER
 
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
 
Fields inherited from interface ecologylab.xml.XMLTranslationExceptionTypes
FILE_NOT_FOUND, IO_EXCEPTION, NULL_PURL, UNKNOWN
 
Constructor Summary
Coordinates()
           
Coordinates(java.lang.String coords)
          Initialize with a string of coordinates, which should be comma-delimited triples (latitude, longitude, altitude).
 
Method Summary
protected  void appendStringRepresentation(java.lang.String coords)
          Parses a String of coordinates, expressed as comma-delimited triples (longitude, latitude, altitude).
 java.util.ArrayList<GeoCoordinate> getCoordinateList()
           
 java.lang.String getCoords()
           
protected  void postTranslationProcessingHook()
          Parses and adds the geographic coordinates in coords to the coordinateList; called automatically immediately after translating FROM KML.
protected  void preTranslationProcessingHook()
          Loads coords with the current values from coordinateList; called automatically immediately before translating this TO KML.
 void setCoords(java.lang.String coords)
           
 java.lang.String toString()
           
 
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, 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, warning, warning, weird, weird
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Coordinates

public Coordinates()

Coordinates

public Coordinates(java.lang.String coords)
Initialize with a string of coordinates, which should be comma-delimited triples (latitude, longitude, altitude).

Parameters:
coords -
Method Detail

appendStringRepresentation

protected void appendStringRepresentation(java.lang.String coords)
Parses a String of coordinates, expressed as comma-delimited triples (longitude, latitude, altitude). If the last triple in the list is incomplete, it is not appended unless it is a special case of having exactly two, in which case the altitude is assumed to be 0.

Parameters:
coords -

getCoordinateList

public java.util.ArrayList<GeoCoordinate> getCoordinateList()

getCoords

public java.lang.String getCoords()

postTranslationProcessingHook

protected void postTranslationProcessingHook()
Parses and adds the geographic coordinates in coords to the coordinateList; called automatically immediately after translating FROM KML.

Overrides:
postTranslationProcessingHook in class ElementState

preTranslationProcessingHook

protected void preTranslationProcessingHook()
Loads coords with the current values from coordinateList; called automatically immediately before translating this TO KML.

Overrides:
preTranslationProcessingHook in class ElementState

setCoords

public void setCoords(java.lang.String coords)

toString

public java.lang.String toString()
Overrides:
toString in class Debug