org.hibernate.search.spatial.impl
Class Point

java.lang.Object
  extended by org.hibernate.search.spatial.impl.Point
All Implemented Interfaces:
Coordinates

public final class Point
extends Object
implements Coordinates

Normalized latitude,longitude holder (in [-90;90],[-180,180]) with distance and destination computations methods

Author:
Nicolas Helleringer , Mathieu Perez

Method Summary
 Point computeDestination(double distance, double heading)
          Calculate end of travel point
static Point fromCoordinates(Coordinates center)
           
static Point fromDegrees(double latitude, double longitude)
           
static Point fromDegreesInclusive(double latitude, double longitude)
           
static Point fromRadians(double latitude, double longitude)
           
 double getDistanceTo(double latitude, double longitude)
          Compute distance point and other location given by its latitude and longitude in decimal degrees
 double getDistanceTo(Point other)
          Compute distance between two points
 Double getLatitude()
           
 double getLatitudeRad()
           
 Double getLongitude()
           
 double getLongitudeRad()
           
static double normalizeLatitude(double latitude)
           
static double normalizeLongitude(double longitude)
           
static double normalizeLongitudeInclusive(double longitude)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

fromDegrees

public static Point fromDegrees(double latitude,
                                double longitude)
Parameters:
latitude - in degrees
longitude - in degrees
Returns:
a point with coordinates given in degrees

fromCoordinates

public static Point fromCoordinates(Coordinates center)
Parameters:
center - the coordinates for the Point to be created
Returns:
a Point from given Coordinates. Same instance when given a Point.

fromDegreesInclusive

public static Point fromDegreesInclusive(double latitude,
                                         double longitude)
Parameters:
latitude - in degrees
longitude - in degrees
Returns:
a point with coordinates given in degrees

normalizeLongitude

public static double normalizeLongitude(double longitude)
Parameters:
longitude - in degrees
Returns:
longitude normalized in ]-180;+180]

normalizeLongitudeInclusive

public static double normalizeLongitudeInclusive(double longitude)
Parameters:
longitude - in degrees
Returns:
longitude normalized in [-180;+180]

normalizeLatitude

public static double normalizeLatitude(double latitude)
Parameters:
latitude - in degrees
Returns:
latitude normalized in [-90;+90]

fromRadians

public static Point fromRadians(double latitude,
                                double longitude)
Parameters:
latitude - in radians
longitude - in radians
Returns:
a point with coordinates given in radians

computeDestination

public Point computeDestination(double distance,
                                double heading)
Calculate end of travel point

Parameters:
distance - to travel
heading - of travel in decimal degree
Returns:
arrival point
See Also:
Compute destination

getDistanceTo

public double getDistanceTo(Point other)
Compute distance between two points

Parameters:
other - a Point object.
See Also:
Distance haversine formula

getDistanceTo

public double getDistanceTo(double latitude,
                            double longitude)
Compute distance point and other location given by its latitude and longitude in decimal degrees

Parameters:
latitude - in decimal degrees
longitude - in decimal degrees
See Also:
Distance haversine formula

getLatitude

public Double getLatitude()
Specified by:
getLatitude in interface Coordinates
Returns:
the latitude in degrees

getLongitude

public Double getLongitude()
Specified by:
getLongitude in interface Coordinates
Returns:
the longitude in degrees

getLatitudeRad

public double getLatitudeRad()

getLongitudeRad

public double getLongitudeRad()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2013 Red Hat Middleware, LLC. All Rights Reserved