com.mapquest
Class LatLngCollection

java.lang.Object
  extended bycom.mapquest.MQObject
      extended bycom.mapquest.MQObjectCollection
          extended bycom.mapquest.LatLngCollection
All Implemented Interfaces:
java.lang.Cloneable

public class LatLngCollection
extends MQObjectCollection

Contains a collection of LatLng objects.

See Also:
LatLng, DistanceUnits

Field Summary
static int CLASS_ID
           
static java.lang.String CLASS_NAME
           
 
Fields inherited from class com.mapquest.MQObject
DEFAULT_ID, DEFAULT_NAME, DEFAULT_VERSION, FORMAT_NUMERIC_ID, FORMAT_TEXT_NAME, INVALID_ID, INVALID_NAME, INVALID_VERSION
 
Constructor Summary
LatLngCollection()
          Default constructor.
 
Method Summary
 void addLatLng(double latitude, double longitude)
          Creates a new LatLng object from the two inputs, and adds it to the collection.
 double arcDistance()
          Calculates the actual distance in miles of a line, by from the lat/longs that are part of this collection.
 double arcDistance(DistanceUnits lUnits)
          Calculates the actual distance in miles of a line, by from the lat/longs that are part of this collection.
 boolean expandBoundingRect(LatLng UL, LatLng LR)
          Expands the given lat/lng bounding rectangle, if necessary, to encompass all points in the latlng collection.
 void generalize(double dDeviance)
          Reduce the points in the lat/lng collection.
 LatLng getAt(int index)
          Returns the element at the specified position in this collection.
 boolean getBoundingRect(LatLng UL, LatLng LR)
          Returns lat/lng bounding rectangle of all points in the latlng collection.
 int getClassId()
          Returns the numeric id of this class.
 java.lang.String getClassName()
          Returns the text name of this class.
 void init()
          Initializes object.
 
Methods inherited from class com.mapquest.MQObjectCollection
add, append, equals, get, getSize, hashCode, remove, removeAll, removeAt
 
Methods inherited from class com.mapquest.MQObject
clone, getFormat, getIdWithVersion, getNameWithVersion, getObjectVersion, getTypeId, getTypeName, getVerboseConsoleOutput, setFormat, setObjectVersion, setVerboseConsoleOutput, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_ID

public static final int CLASS_ID
See Also:
Constant Field Values

CLASS_NAME

public static final java.lang.String CLASS_NAME
See Also:
Constant Field Values
Constructor Detail

LatLngCollection

public LatLngCollection()
Default constructor.

Method Detail

init

public void init()
Initializes object.

Overrides:
init in class MQObjectCollection

getClassId

public int getClassId()
Returns the numeric id of this class.

Overrides:
getClassId in class MQObject
Returns:
the numeric id of this class.

getClassName

public java.lang.String getClassName()
Returns the text name of this class.

Overrides:
getClassName in class MQObject
Returns:
the text name of this class.

getAt

public LatLng getAt(int index)
Returns the element at the specified position in this collection. Calls get(int).

Parameters:
index - index of element to return.
Returns:
LatLng at the specified index.
See Also:
MQObjectCollection.get(int)

addLatLng

public void addLatLng(double latitude,
                      double longitude)
Creates a new LatLng object from the two inputs, and adds it to the collection. Calls add(MQObject).

Parameters:
latitude - a double representing the Latitude
longitude - a double representing the Longitude
See Also:
MQObjectCollection.add(MQObject)

getBoundingRect

public boolean getBoundingRect(LatLng UL,
                               LatLng LR)
Returns lat/lng bounding rectangle of all points in the latlng collection. If the latlng collection is empty, llUL and llLR are not changed.

Parameters:
UL - a LatLng representing the upper-left LatLng
LR - a LatLng representing the lower-right LatLng
Returns:
boolean - true if collection is not empty

expandBoundingRect

public boolean expandBoundingRect(LatLng UL,
                                  LatLng LR)
Expands the given lat/lng bounding rectangle, if necessary, to encompass all points in the latlng collection. If the latlng collection is empty, llUL and llLR are not changed.

Parameters:
UL - a LatLng representing the upper-left LatLng
LR - a LatLng representing the lower-right LatLng
Returns:
boolean - true if collection is not empty

arcDistance

public double arcDistance()
Calculates the actual distance in miles of a line, by from the lat/longs that are part of this collection. (default units: Miles)


arcDistance

public double arcDistance(DistanceUnits lUnits)
Calculates the actual distance in miles of a line, by from the lat/longs that are part of this collection.

Parameters:
lUnits - Units object

generalize

public void generalize(double dDeviance)
Reduce the points in the lat/lng collection. All points that deviate from a straight line by less than dDeviance are eliminated.

Parameters:
dDeviance - the deviance