Package org.geotools.referencing.cs
Class DirectionAlongMeridian
- Object
-
- DirectionAlongMeridian
-
- All Implemented Interfaces:
Serializable
,Comparable<DirectionAlongMeridian>
public final class DirectionAlongMeridian extends Object implements Comparable<DirectionAlongMeridian>, Serializable
Parses axis direction of the kind "South along 90 deg East". Those directions are used in the EPSG database for polar stereographic projections.- Since:
- 2.7.2
- Author:
- Martin Desruisseaux
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description AxisDirection
baseDirection
The base direction, which must beAxisDirection.NORTH
orAxisDirection.SOUTH
.double
meridian
The meridian, in degrees.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(DirectionAlongMeridian that)
Compares this direction with the specified one for order.boolean
equals(Object object)
Tests this object for equality with the specified one.double
getAngle(DirectionAlongMeridian other)
Returns the arithmetic (counterclockwise) angle from this direction to the specified direction, in decimal degrees.AxisDirection
getDirection()
Returns the axis direction for this object.int
hashCode()
Returns a hash code value, for consistency withequals(java.lang.Object)
.static DirectionAlongMeridian
parse(String name)
If the specified name is a direction along some specific meridian, returns information about that.static DirectionAlongMeridian
parse(AxisDirection direction)
Returns the dimension along meridian for the specified axis direction, ornull
if none.String
toString()
Returns a string representation of this direction, using a syntax matching the one used by EPSG.
-
-
-
Field Detail
-
baseDirection
public final AxisDirection baseDirection
The base direction, which must beAxisDirection.NORTH
orAxisDirection.SOUTH
.
-
meridian
public final double meridian
The meridian, in degrees.
-
-
Method Detail
-
parse
public static DirectionAlongMeridian parse(AxisDirection direction)
Returns the dimension along meridian for the specified axis direction, ornull
if none.
-
parse
public static DirectionAlongMeridian parse(String name)
If the specified name is a direction along some specific meridian, returns information about that. Otherwise returnsnull
.
-
getDirection
public AxisDirection getDirection()
Returns the axis direction for this object. If a suitable axis direction already exists, it will be returned. Otherwise a new one is created and returned.
-
getAngle
public double getAngle(DirectionAlongMeridian other)
Returns the arithmetic (counterclockwise) angle from this direction to the specified direction, in decimal degrees. This method returns a value between -180° and +180°, orNaN
if the base directions don't match. A positive angle denote a right-handed system.Example: the angle from "North along 90 deg East" to "North along 0 deg is 90°.
-
compareTo
public int compareTo(DirectionAlongMeridian that)
Compares this direction with the specified one for order. This method tries to reproduce the ordering used for the majority of coordinate systems in the EPSG database, i.e. the ordering of a right-handed coordinate system. Examples of ordered pairs that we should get (extracted from the EPSG database):North along 90 deg East, North along 0 deg North along 75 deg West, North along 165 deg West South along 90 deg West, South along 0 deg South along 180 deg, South along 90 deg West North along 130 deg West North along 140 deg East - Specified by:
compareTo
in interfaceComparable<DirectionAlongMeridian>
-
equals
public boolean equals(Object object)
Tests this object for equality with the specified one. This method is used mostly for assertions.
-
hashCode
public int hashCode()
Returns a hash code value, for consistency withequals(java.lang.Object)
.
-
toString
public String toString()
Returns a string representation of this direction, using a syntax matching the one used by EPSG. This string representation will be used for creating a newAxisDirection
. The generated name should be identical to EPSG name, but we use the generated one anyway (rather than the one provided by EPSG) in order to make sure that we create a singleAxisDirection
for a given direction; we avoid potential differences like lower versus upper cases, amount of white space, etc.
-
-