com.maryanovsky.map.client
Class LatLng

java.lang.Object
  extended by com.maryanovsky.map.client.LatLng
All Implemented Interfaces:
DoublePointView

public final class LatLng
extends Object
implements DoublePointView

Represents a location on the surface of the Earth.

Author:
Maryanovsky Alexander

Constructor Summary
LatLng(double latitude, double longitude)
          Creates a new LatLng at the specified latitude and longitude.
 
Method Summary
 boolean equals(Object object)
          Returns whether this LatLng represents the same location on the globe as the specified one.
static LatLng fromUrlValue(String urlValue)
          Creates a new LatLng object from the specified string, in the format of toUrlValue().
 double getLatitude()
          Returns the latitude, in degrees.
 double getLongitude()
          Returns the longitude, in degrees.
 double getX()
          Returns the longitude, in degrees.
 double getY()
          Returns the latitude, in degrees.
 int hashCode()
          Returns the hashcode of this object.
 String toString()
          Returns a textual representation of this coordinate.
 String toUrlValue()
          Same as toUrlValue(int), but with a fixed precision of 6 digits after the decimal point.
 String toUrlValue(int precision)
          Returns a string representing this LatLng suitable for use as the value of a URL parameter.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LatLng

public LatLng(double latitude,
              double longitude)
Creates a new LatLng at the specified latitude and longitude.

Parameters:
latitude - The latitude, in degrees, a value in the range [-90, 90].
longitude - The longitude, in degrees, a value in the range [-180, 180].
Method Detail

fromUrlValue

public static LatLng fromUrlValue(String urlValue)
Creates a new LatLng object from the specified string, in the format of toUrlValue().


getLatitude

public double getLatitude()
Returns the latitude, in degrees.


getLongitude

public double getLongitude()
Returns the longitude, in degrees.


getX

public double getX()
Returns the longitude, in degrees.

Specified by:
getX in interface DoublePointView

getY

public double getY()
Returns the latitude, in degrees.

Specified by:
getY in interface DoublePointView

toUrlValue

public String toUrlValue(int precision)
Returns a string representing this LatLng suitable for use as the value of a URL parameter. The returned value contains the latitude and longitude, with the specified number of digits after the decimal point, separated by a comma.


toUrlValue

public String toUrlValue()
Same as toUrlValue(int), but with a fixed precision of 6 digits after the decimal point.


equals

public boolean equals(Object object)
Returns whether this LatLng represents the same location on the globe as the specified one. Note that the latitude and longitude values may be different while the location is still the same (for example, any two LatLng objects with latitude equal to 90 are equal).

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns the hashcode of this object.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a textual representation of this coordinate.

Overrides:
toString in class Object