Package org.geotools.measure
Class Angle
Object
Angle
- All Implemented Interfaces:
Serializable
,Comparable<Angle>
An angle in degrees. An angle is the amount of rotation needed to bring one line or plane into coincidence with
another, generally measured in degrees, sexagesimal degrees or grads.
This class is registered with ClassChanger
, which means it can be converted to and from
Double
.
- Since:
- 2.0
- Author:
- Martin Desruisseaux (PMO, IRD)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compares twoAngle
objects numerically.double
degrees()
Returns the angle value in degrees.boolean
Compares the specified object with this angle for equality.int
hashCode()
Returns a hash code for thisAngle
object.double
radians()
Returns the angle value in radians.toString()
Returns a string representation of thisAngle
object.
-
Constructor Details
-
Angle
public Angle(double theta) Contructs a new angle with the specified value.- Parameters:
theta
- Angle in degrees.
-
Angle
Constructs a newly allocatedAngle
object that represents the angle value represented by the string. The string should represents an angle in either fractional degrees (e.g. 45.5°) or degrees with minutes and seconds (e.g. 45°30').- Parameters:
string
- A string to be converted to anAngle
.- Throws:
NumberFormatException
- if the string does not contain a parsable angle.
-
-
Method Details
-
degrees
public double degrees()Returns the angle value in degrees. -
radians
public double radians()Returns the angle value in radians. -
hashCode
public int hashCode()Returns a hash code for thisAngle
object. -
equals
Compares the specified object with this angle for equality. -
compareTo
Compares twoAngle
objects numerically. The comparaison is done as if by theDouble.compare(double,double)
method.- Specified by:
compareTo
in interfaceComparable<Angle>
-
toString
Returns a string representation of thisAngle
object.
-