com.google.gdata.data.geo.impl
Class PointConstruct
java.lang.Object
com.google.gdata.data.AbstractExtension
com.google.gdata.data.ValueConstruct
com.google.gdata.data.geo.impl.PointConstruct
- All Implemented Interfaces:
- Extension, Point
- Direct Known Subclasses:
- GeoRssPoint, GmlLowerCorner, GmlPos, GmlUpperCorner
public abstract class PointConstruct
- extends ValueConstruct
- implements Point
A basic point construct consists of a space-separated coordinate in geo
space. The namespace and name of the element are supplied by subclasses.
Constructor Summary |
PointConstruct(XmlNamespace namespace,
java.lang.String name)
Constructor to create an empty point object. |
PointConstruct(XmlNamespace namespace,
java.lang.String name,
java.lang.Double lat,
java.lang.Double lon)
Constructor to create a point from a given lat/lon pair. |
PointConstruct(XmlNamespace namespace,
java.lang.String name,
Point copyFrom)
Copy constructor to create a point from another point. |
Method Summary |
java.lang.Double |
getLatitude()
|
java.lang.Double |
getLongitude()
|
void |
setGeoLocation(java.lang.Double lat,
java.lang.Double lon)
Sets the latitude and longitude coordinates of this Point. |
void |
setValue(java.lang.String v)
Sets the value. |
java.lang.String |
toString()
|
protected void |
validate()
Checks the attributes to see if there are any problems. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
PointConstruct
public PointConstruct(XmlNamespace namespace,
java.lang.String name)
- Constructor to create an empty point object.
PointConstruct
public PointConstruct(XmlNamespace namespace,
java.lang.String name,
java.lang.Double lat,
java.lang.Double lon)
- Constructor to create a point from a given lat/lon pair. Will create an
empy point if both values are null, if only one value is null with throw
an illegal argument exception.
PointConstruct
public PointConstruct(XmlNamespace namespace,
java.lang.String name,
Point copyFrom)
- Copy constructor to create a point from another point.
getLatitude
public java.lang.Double getLatitude()
- Specified by:
getLatitude
in interface Point
- Returns:
- the value of latitude coordinate of this Point.
getLongitude
public java.lang.Double getLongitude()
- Specified by:
getLongitude
in interface Point
- Returns:
- the value of the longitude coordinate of this Point.
setGeoLocation
public void setGeoLocation(java.lang.Double lat,
java.lang.Double lon)
- Description copied from interface:
Point
- Sets the latitude and longitude coordinates of this Point. Either both lat
and lon must be non-null, or both must be null. Implementations will throw
an IllegalArgumentException if only one is null and one is not. They will
also throw an IllegalArgumentException if either of the lat values is
outside the valid range.
- Specified by:
setGeoLocation
in interface Point
- Parameters:
lat
- The latitude in degrees, from -90 to 90.lon
- The longitude in degrees, from -180 to 180.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
setValue
public void setValue(java.lang.String v)
- Description copied from class:
ValueConstruct
- Sets the value. Subclasses can override this method to do
additional validation of the value.
- Overrides:
setValue
in class ValueConstruct
- Parameters:
v
- new value for the value construct or null
to reset.
validate
protected void validate()
throws java.lang.IllegalStateException
- Description copied from class:
AbstractExtension
- Checks the attributes to see if there are any problems. Default
implementation does nothing, though generally this is discouraged unless
there really are no restrictions.
- Overrides:
validate
in class AbstractExtension
- Throws:
java.lang.IllegalStateException
- if any problems are found with the
attributes