com.mymed.utils.locator
Class Location

java.lang.Object
  extended by com.mymed.utils.locator.Location

public class Location
extends java.lang.Object


Field Summary
static double earthRadius
           
 
Constructor Summary
Location(java.lang.Double latitude, java.lang.Double longitude)
           
 
Method Summary
 Location[] boundingCoordinates(double distance)
          Finds the coordinates of the bounding box of the circle with radius distance
 double distanceGCTo(Location location)
          Computes the great circle distance between this GeoLocation instance and the location argument.
static Location fromDegrees(double latitude, double longitude, java.lang.String provider)
           
static Location fromRadians(double latitude, double longitude, java.lang.String provider)
           
 double getLatitude()
           
 double getLatitudeInRadians()
           
 double getLongitude()
           
 double getLongitudeInRadians()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

earthRadius

public static double earthRadius
Constructor Detail

Location

public Location(java.lang.Double latitude,
                java.lang.Double longitude)
         throws GeoLocationOutOfBoundException
Throws:
GeoLocationOutOfBoundException
Method Detail

fromDegrees

public static Location fromDegrees(double latitude,
                                   double longitude,
                                   java.lang.String provider)
                            throws GeoLocationOutOfBoundException
Parameters:
latitude - the latitude, in degrees.
longitude - the longitude, in degrees.
Throws:
GeoLocationOutOfBoundException

fromRadians

public static Location fromRadians(double latitude,
                                   double longitude,
                                   java.lang.String provider)
                            throws GeoLocationOutOfBoundException
Parameters:
latitude - the latitude, in radians.
longitude - the longitude, in radians.
Throws:
GeoLocationOutOfBoundException

getLatitudeInRadians

public double getLatitudeInRadians()
Returns:
the latitude, in radians.

getLongitude

public double getLongitude()
Returns:
the longitude, in radians.

getLatitude

public double getLatitude()
Returns:
the latitude, in radians.

getLongitudeInRadians

public double getLongitudeInRadians()
Returns:
the longitude, in radians.

toString

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

distanceGCTo

public double distanceGCTo(Location location)
Computes the great circle distance between this GeoLocation instance and the location argument.

Parameters:
radius - the radius of the sphere, e.g. the average radius for a spherical approximation of the figure of the Earth is approximately 6371.01 kilometers.
Returns:
the distance, measured in meters

boundingCoordinates

public Location[] boundingCoordinates(double distance)
Finds the coordinates of the bounding box of the circle with radius distance

Parameters:
distance - The radius of the circle whose bounding box is found.
Returns:
The bottom-left and the top-right corner of the bounding box.
Throws:
GeoLocationOutOfBoundException