| java.lang.Object org.geotools.referencing.GeodeticCalculator
GeodeticCalculator | public class GeodeticCalculator (Code) | | Performs geodetic calculations on an
. This class encapsulates
a generic ellipsoid and calculates the following properties:
- Distance and azimuth between two points.
- Point located at a given distance and azimuth from an other point.
The calculation use the following informations:
- The
, which is always considered valid.
It is initially set at (0,0) and can only be changed to another legitimate value.
- Only one of the following:
The latest one set overrides the other and determines what will be calculated.
Note: This class is not thread-safe. If geodetic calculations are needed in a multi-threads
environment, create one distinct instance of
GeodeticCalculator for each thread.
since: 2.1 version: $Id: GeodeticCalculator.java 24925 2007-03-27 20:12:08Z jgarnett $ author: Daniele Franzoni author: Martin Desruisseaux |
Constructor Summary | |
public | GeodeticCalculator() Constructs a new geodetic calculator associated with the WGS84 ellipsoid. | public | GeodeticCalculator(Ellipsoid ellipsoid) Constructs a new geodetic calculator associated with the specified ellipsoid. | public | GeodeticCalculator(CoordinateReferenceSystem crs) Constructs a new geodetic calculator expecting coordinates in the supplied CRS. |
Method Summary | |
public double | getAzimuth() Returns the azimuth. | public CoordinateReferenceSystem | getCoordinateReferenceSystem() Returns the coordinate reference system for all methods working on
Position objects. | public Point2D | getDestinationGeographicPoint() Returns the destination point. | public DirectPosition | getDestinationPosition() Returns the destination position in user coordinates, which doesn't need to be geographic. | public Ellipsoid | getEllipsoid() Returns the referenced ellipsoid. | public Shape | getGeodeticCurve(int numberOfPoints) Calculates the geodetic curve between two points in the referenced ellipsoid.
A curve in the ellipsoid is a path which points contain the longitude and latitude
of the points in the geodetic curve. | public Shape | getGeodeticCurve() Calculates the geodetic curve between two points in the referenced ellipsoid.
A curve in the ellipsoid is a path which points contain the longitude and latitude
of the points in the geodetic curve. | public GeographicCRS | getGeographicCRS() Returns the geographic coordinate reference system for all methods working
on
Point2D objects. | public double | getMeridianArcLength(double latitude1, double latitude2) Calculates the meridian arc length between two points in the same meridian
in the referenced ellipsoid.
Parameters: latitude1 - The latitude of the first point (in decimal degrees). Parameters: latitude2 - The latitude of the second point (in decimal degrees). | public double | getOrthodromicDistance() Returns the orthodromic distance. | public Point2D | getStartingGeographicPoint() Returns the starting point in geographic coordinates. | public DirectPosition | getStartingPosition() Returns the starting position in user coordinates, which doesn't need to be geographic. | public void | setDestinationGeographicPoint(double longitude, double latitude) Set the destination point in geographic coordinates. | public void | setDestinationGeographicPoint(Point2D point) Set the destination point in geographic coordinates. | public void | setDestinationPosition(Position position) Set the destination position in user coordinates, which doesn't need to be geographic. | public void | setDirection(double azimuth, double distance) Set the azimuth and the distance from the
. | public void | setStartingGeographicPoint(double longitude, double latitude) Set the starting point in geographic coordinates.
The
,
the
and
the
are discarted. | public void | setStartingGeographicPoint(Point2D point) Set the starting point in geographic coordinates. | public void | setStartingPosition(Position position) Set the starting position in user coordinates, which doesn't need to be geographic. | public String | toString() Returns a string representation of the current state of this calculator. |
GeodeticCalculator | public GeodeticCalculator()(Code) | | Constructs a new geodetic calculator associated with the WGS84 ellipsoid.
|
GeodeticCalculator | public GeodeticCalculator(Ellipsoid ellipsoid)(Code) | | Constructs a new geodetic calculator associated with the specified ellipsoid.
All calculations done by the new instance are referenced to this ellipsoid.
Parameters: ellipsoid - The ellipsoid onto which calculates distances and azimuths. |
GeodeticCalculator | public GeodeticCalculator(CoordinateReferenceSystem crs)(Code) | | Constructs a new geodetic calculator expecting coordinates in the supplied CRS.
The ellipsoid will be inferred from the CRS.
Parameters: crs - The reference system for the Position objects. since: 2.2 |
getAzimuth | public double getAzimuth() throws IllegalStateException(Code) | | Returns the azimuth. This method returns the value set by the last call to
(azimuth,distance) ,
except if
(...) has been invoked after. In this later case, the
azimuth will be computed from the
to the destination point.
The azimuth, in decimal degrees from -180° to +180°. throws: IllegalStateException - if the destination point has not been set. |
getCoordinateReferenceSystem | public CoordinateReferenceSystem getCoordinateReferenceSystem()(Code) | | Returns the coordinate reference system for all methods working on
Position objects.
This is the CRS specified at
.
since: 2.2 |
getDestinationGeographicPoint | public Point2D getDestinationGeographicPoint() throws IllegalStateException(Code) | | Returns the destination point. This method returns the point set by the last
call to a
(...)
method, except if
(...) has been
invoked after. In this later case, the destination point will be computed from the
to the azimuth and distance
specified.
The destination point. The x and y coordinatesare the longitude and latitude in decimal degrees, respectively. throws: IllegalStateException - if the azimuth and the distance have not been set. since: 2.3 |
getDestinationPosition | public DirectPosition getDestinationPosition() throws TransformException(Code) | | Returns the destination position in user coordinates, which doesn't need to be geographic.
The coordinate reference system is the one specified to the
.
throws: TransformException - if the position can't be transformed to user coordinates. since: 2.2 |
getEllipsoid | public Ellipsoid getEllipsoid()(Code) | | Returns the referenced ellipsoid.
|
getGeodeticCurve | public Shape getGeodeticCurve(int numberOfPoints)(Code) | | Calculates the geodetic curve between two points in the referenced ellipsoid.
A curve in the ellipsoid is a path which points contain the longitude and latitude
of the points in the geodetic curve. The geodetic curve is computed from the
to the
.
Parameters: numberOfPoints - The number of vertex in the geodetic curve.NOTE: This argument is only a hint and may be ignoredin future version (if we compute a real curve rather than a list of linesegments). The path that represents the geodetic curve from the to the. |
getGeodeticCurve | public Shape getGeodeticCurve()(Code) | | Calculates the geodetic curve between two points in the referenced ellipsoid.
A curve in the ellipsoid is a path which points contain the longitude and latitude
of the points in the geodetic curve. The geodetic curve is computed from the
to the
.
The path that represents the geodetic curve from the to the. |
getGeographicCRS | public GeographicCRS getGeographicCRS()(Code) | | Returns the geographic coordinate reference system for all methods working
on
Point2D objects. This is inferred from the CRS specified at
.
since: 2.3 |
getMeridianArcLength | public double getMeridianArcLength(double latitude1, double latitude2)(Code) | | Calculates the meridian arc length between two points in the same meridian
in the referenced ellipsoid.
Parameters: latitude1 - The latitude of the first point (in decimal degrees). Parameters: latitude2 - The latitude of the second point (in decimal degrees). Returned the meridian arc length between latitude1 and latitude2 |
getOrthodromicDistance | public double getOrthodromicDistance() throws IllegalStateException(Code) | | Returns the orthodromic distance. This method returns the value set by the last call to
(azimuth,distance) ,
except if
(...) has been invoked after. In this later case, the
distance will be computed from the
to the destination point.
The orthodromic distance, in the same units as the axis. throws: IllegalStateException - if the destination point has not been set. |
getStartingGeographicPoint | public Point2D getStartingGeographicPoint()(Code) | | Returns the starting point in geographic coordinates. The x and y
coordinates are the longitude and latitude in decimal degrees, respectively. If the
starting point has never been set, then the default value is (0,0).
The starting point in geographic coordinates. since: 2.3 |
getStartingPosition | public DirectPosition getStartingPosition() throws TransformException(Code) | | Returns the starting position in user coordinates, which doesn't need to be geographic.
The coordinate reference system is the one specified to the
.
throws: TransformException - if the position can't be transformed to user coordinates. since: 2.3 |
setDestinationGeographicPoint | public void setDestinationGeographicPoint(double longitude, double latitude) throws IllegalArgumentException(Code) | | Set the destination point in geographic coordinates. The azimuth and distance values
will be updated as a side effect of this call. They will be recomputed the next time
GeodeticCalculator.getAzimuth() or
GeodeticCalculator.getOrthodromicDistance() are invoked.
Parameters: longitude - The longitude in decimal degrees between -180 and +180° Parameters: latitude - The latgitude in decimal degrees between -90 and +90° throws: IllegalArgumentException - if the longitude or the latitude is out of bounds. since: 2.3 |
setDestinationGeographicPoint | public void setDestinationGeographicPoint(Point2D point) throws IllegalArgumentException(Code) | | Set the destination point in geographic coordinates. The x and y
coordinates must be the longitude and latitude in decimal degrees, respectively.
This is a convenience method for
(x,y) .
Parameters: point - The destination point. throws: IllegalArgumentException - if the longitude or the latitude is out of bounds. since: 2.3 |
setDestinationPosition | public void setDestinationPosition(Position position) throws TransformException(Code) | | Set the destination position in user coordinates, which doesn't need to be geographic.
The coordinate reference system is the one specified to the
.
Parameters: position - The position in user coordinate reference system. throws: TransformException - if the position can't be transformed. since: 2.2 |
setStartingGeographicPoint | public void setStartingGeographicPoint(double longitude, double latitude) throws IllegalArgumentException(Code) | | Set the starting point in geographic coordinates.
The
,
the
and
the
are discarted. They will need to be specified again.
Parameters: longitude - The longitude in decimal degrees between -180 and +180° Parameters: latitude - The latitude in decimal degrees between -90 and +90° throws: IllegalArgumentException - if the longitude or the latitude is out of bounds. since: 2.3 |
setStartingGeographicPoint | public void setStartingGeographicPoint(Point2D point) throws IllegalArgumentException(Code) | | Set the starting point in geographic coordinates. The x and y
coordinates must be the longitude and latitude in decimal degrees, respectively.
This is a convenience method for
(x,y) .
Parameters: point - The starting point. throws: IllegalArgumentException - if the longitude or the latitude is out of bounds. since: 2.3 |
setStartingPosition | public void setStartingPosition(Position position) throws TransformException(Code) | | Set the starting position in user coordinates, which doesn't need to be geographic.
The coordinate reference system is the one specified to the
.
Parameters: position - The position in user coordinate reference system. throws: TransformException - if the position can't be transformed. since: 2.3 |
toString | public String toString()(Code) | | Returns a string representation of the current state of this calculator.
|
|
|