public final class AngleFormat extends Object
Formatter to print angles as a degrees/minutes/seconds (DMS) and to parse DMS strings
The format method uses pattern such as #D� MM' SS\" H(N|S) to define the string representation of an angle.
| Modifier and Type | Field and Description |
|---|---|
static AngleFormat |
LATITUDE_FORMATTER |
static AngleFormat |
LONGITUDE_FORMATTER |
| Constructor and Description |
|---|
AngleFormat() |
AngleFormat(String pattern)
Create a new angle formatter able to write an angle as a DMS string
following a specific pattern.
|
| Modifier and Type | Method and Description |
|---|---|
static double |
dd2dms(double ddAngle) |
static double |
deg2gra(double angle) |
static double |
deg2min(double angle) |
static double |
deg2rad(double angle) |
static double |
deg2sec(double angle) |
static double |
dms2dd(double dmsAngle) |
String |
format(double angle)
Format an angle following the special pattern defined by this object.
|
static double |
gra2deg(double angle) |
static double |
gra2rad(double angle) |
static double |
parseAndConvert2Radians(String angle)
This method parse a string which represent an angle in radians, in
grades or in degrees.
|
static double |
parseAngle(String angle)
Parse a string representing an angle written in DMSH (degrees / minutes /
seconds / hemisphere).
|
static double |
rad2deg(double angle) |
static double |
rad2gra(double angle) |
static double |
rad2min(double angle) |
static double |
rad2sec(double angle) |
public static final AngleFormat LONGITUDE_FORMATTER
public static final AngleFormat LATITUDE_FORMATTER
public AngleFormat()
public AngleFormat(String pattern) throws IllegalArgumentException
pattern - the Pattern to format angles
Exemples :
IllegalArgumentExceptionpublic static double rad2deg(double angle)
public static double rad2gra(double angle)
public static double rad2min(double angle)
public static double rad2sec(double angle)
public static double deg2rad(double angle)
public static double deg2gra(double angle)
public static double deg2min(double angle)
public static double deg2sec(double angle)
public static double gra2rad(double angle)
public static double gra2deg(double angle)
public static double dms2dd(double dmsAngle)
public static double dd2dms(double ddAngle)
public String format(double angle)
angle - angle to format (the angle must be in degrees).public static double parseAngle(String angle) throws IllegalArgumentException
angle - the string to parseIllegalArgumentExceptionpublic static double parseAndConvert2Radians(String angle) throws IllegalArgumentException
This method parse a string which represent an angle in radians, in grades or in degrees.
The parser try to recognize a symbol to determine the units used in the string and convert the angle into radians.
IllegalArgumentExceptionCopyright © 2019 CNRS. All rights reserved.