|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjsky.science.Coordinates
public class Coordinates
A position in the World Coordinate System. This position is represented by a right-ascension angle and a declination angle.
This code was developed by NASA, Goddard Space Flight Center, Code 588 for the Scientist's Expert Assistant (SEA) project.
Nested Class Summary | |
---|---|
static class |
Coordinates.LocalPropertyChangeHandler
|
Field Summary | |
---|---|
static java.lang.String |
ARCSEC
|
static int |
B1950_EQUINOX
The B1950 equinox |
static java.lang.String |
B1950_EQUINOX_LABEL
|
static int |
COLON_SEPARATOR_STYLE
Constant for indicating that coordinate values should be separated by colons. |
static java.lang.String |
COLON_SEPARATOR_STYLE_LABEL
|
static java.lang.String |
DEGREE
support conversion units |
static java.lang.String |
FORMATSTYLEPROPERTY
Bound property name. |
static int |
J2000_EQUINOX
The J2000 equinox |
static java.lang.String |
J2000_EQUINOX_LABEL
|
static int |
LETTER_SEPARATOR_STYLE
Constant for indicating that coordinate values should be separated by 'h', 'd', 'm', 's' letters. |
static java.lang.String |
LETTER_SEPARATOR_STYLE_LABEL
|
static int |
NUM_DECIMAL
Number of decimal places to show when displaying as string |
static java.lang.String |
RADIAN
|
static int |
SPACE_SEPARATOR_STYLE
Constant for indicating that coordinate values should be separated by spaces. |
static java.lang.String |
SPACE_SEPARATOR_STYLE_LABEL
|
Constructor Summary | |
---|---|
Coordinates()
Constructs a coordinates object with RA and Dec of zero. |
|
Coordinates(Coordinates old)
Constructs a new coordinates object that is a copy of the specified object. |
|
Coordinates(double ra,
double dec)
Constructs a coordinates object with specified RA and Dec in the default equinox. |
|
Coordinates(double ra,
double dec,
int equinox)
Constructs a coordinates object with specified RA and Dec in the specified equinox. |
|
Coordinates(double ra,
double dec,
int equinox,
double epoch)
Constructs a coordinates object with specified RA and Dec in the specified equinox and epoch. |
Method Summary | |
---|---|
Coordinates |
add(CoordinatesOffset offset)
Adds an offset to the current coordinates and returns the sum as a new Coordinates object. |
static void |
addSeparatorStyleChangeListener(java.beans.PropertyChangeListener listener)
add a listener to the list of objects listening to changes in the separator style |
static double |
convert(double coord,
java.lang.String fromUnits,
java.lang.String toUnits)
converts a coordinate from specified source units to the destination units |
java.lang.String |
decToString()
Returns a string representation of the declination. |
java.lang.String |
decToString(int separatorStyle)
Returns a string representation of the declination. |
java.lang.String |
epochToString()
Returns a string representation of the epoch. |
boolean |
equals(java.lang.Object obj)
Compares this Coordinates object to the specified object and returns true if the objects are equivalent. |
static java.lang.String |
equinoxIntToString(int equinox)
returns the full label name of an equinox |
static double |
equinoxIntToYear(int equinox)
returns the year of the enumerated equinox value |
static int |
equinoxStringToInt(java.lang.String equinox)
returns the equinox given its label |
java.lang.String |
equinoxToString()
Returns a string representation of the equinox. |
protected static void |
fireSeparatorStyleChange(java.beans.PropertyChangeEvent evt)
fire a property change event to all listeners of the separator style |
static java.lang.String[] |
getAllEquinoxes()
returns the list of string labels for possible equinoxs |
static java.lang.String[] |
getAllSeparatorStyles()
returns the list of string labels for possible separator styles |
double |
getDec()
Returns the declination of the position in degrees. |
double |
getDec(java.lang.String units)
Returns the declination of the position in degrees. |
static int |
getDefaultEquinox()
Returns the default equinox |
double |
getEclipticLatitude()
Returns the ecliptic latitude of the position in degrees. |
double |
getEclipticLongitude()
Returns the ecliptic longitude of the position in degrees. |
double |
getEpoch()
Returns the epoch year for the position. |
int |
getEquinox()
Returns the equinox used to display and parse the coordinate values. |
double |
getRa()
Returns the right-ascension of the position in degrees. |
double |
getRa(java.lang.String units)
Returns the right-ascension of the position in degrees. |
static int |
getSeparatorStyle()
Returns the global separator style. |
int |
hashCode()
Returns the hashcode for this Coordinates. |
java.lang.String |
raToString()
Returns a string representation of the right-ascension. |
java.lang.String |
raToString(int separatorStyle)
Returns a string representation of the right-ascension. |
static void |
removeSeparatorStyleChangeListener(java.beans.PropertyChangeListener listener)
remove a listener from the list of objects listening to changes in the separator style |
void |
rotate(double angleRad,
double ra,
double dec)
Rotates the position angleRad radians about a specified center position (ra, dec). |
static java.lang.String |
separatorStyleIntToString(int style)
returns the full label name of a separator style |
static int |
separatorStyleStringToInt(java.lang.String style)
returns the separator style given its label |
void |
setDec(double dec)
Sets the declination of the position in degrees. |
void |
setDec(double dec,
java.lang.String units)
Sets the declination of the position in degrees. |
void |
setEpoch(double epoch)
Sets the epoch year for the position. |
void |
setEquinox(int equinox)
Sets the equinox used to display and parse the coordinate values. |
void |
setRa(double ra)
Sets the right-ascension of the position in degrees. |
void |
setRa(double ra,
java.lang.String units)
Sets the right-ascension of the position in degrees. |
static void |
setSeparatorStyle(int style)
Changes the global separator style. |
void |
setValue(double ra,
double dec)
Sets the right-ascension and declination of the position in degrees. |
CoordinatesOffset |
subtract(Coordinates c)
Subtracts the coordinates c from the current coordinates and returns the difference as a new CoordinatesOffset. |
Coordinates |
toB1950()
Returns the coordinates converted to the B1950 equinox, or just returns itself if already B1950. |
Coordinates |
toJ2000()
Returns the coordinates converted to the J2000 equinox, or just returns itself if already J2000. |
java.lang.String |
toString()
Returns a string representation of the position. |
void |
translate(CoordinatesOffset offset)
Translates this position by the specified offset so that the new position equals the current position + the argument. |
void |
translate(double raArcsec,
double decArcsec)
Translates this position by the specified amounts so that the new position equals the current position + the arguments. |
static double |
validateDec(double dec)
Returns a properly validated declination in degrees. |
static double |
validateDec(double dec,
java.lang.String units)
Returns a properly validated declination in specified units |
static double |
validateRa(double ra)
Returns a properly validated right-ascension in degrees. |
static double |
validateRa(double ra,
java.lang.String units)
Returns a properly validated right-ascension in specified units |
static Coordinates |
valueOf(java.lang.String raInput,
java.lang.String decInput)
Creates a new Coordinates object using two strings for the RA and Dec. |
static Coordinates |
valueOf(java.lang.String raInput,
java.lang.String decInput,
int equinox)
Creates a new Coordinates object using two strings for the RA and Dec. |
protected static void |
writeError(java.lang.Object source,
java.lang.Object message)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEGREE
public static final java.lang.String ARCSEC
public static final java.lang.String RADIAN
public static final int NUM_DECIMAL
public static final int SPACE_SEPARATOR_STYLE
public static final java.lang.String SPACE_SEPARATOR_STYLE_LABEL
public static final int COLON_SEPARATOR_STYLE
public static final java.lang.String COLON_SEPARATOR_STYLE_LABEL
public static final int LETTER_SEPARATOR_STYLE
public static final java.lang.String LETTER_SEPARATOR_STYLE_LABEL
public static final int B1950_EQUINOX
public static final java.lang.String B1950_EQUINOX_LABEL
public static final int J2000_EQUINOX
public static final java.lang.String J2000_EQUINOX_LABEL
public static final java.lang.String FORMATSTYLEPROPERTY
Constructor Detail |
---|
public Coordinates()
public Coordinates(double ra, double dec)
ra
- right-ascension in degreesdec
- declination in degreespublic Coordinates(double ra, double dec, int equinox)
ra
- right-ascension in degreesdec
- declination in degreesequinox
- equinox constantpublic Coordinates(double ra, double dec, int equinox, double epoch)
ra
- right-ascension in degreesdec
- declination in degreesequinox
- equinox constantepoch
- epoch yearpublic Coordinates(Coordinates old)
old
- Coordinates object to copyMethod Detail |
---|
public double getRa()
public double getDec()
public static double convert(double coord, java.lang.String fromUnits, java.lang.String toUnits)
coord
- The coordinate to be convertedfromUnits
- String containing source unitstoUnits
- String containing target unitsprotected static void writeError(java.lang.Object source, java.lang.Object message)
public double getRa(java.lang.String units)
public double getDec(java.lang.String units)
public void setRa(double ra)
ra
- the new right-ascension of the position in degreespublic void setDec(double dec)
dec
- the new declination of the position in degreespublic void setRa(double ra, java.lang.String units)
ra
- the new right-ascension of the positionunits
- ra's unitspublic void setDec(double dec, java.lang.String units)
dec
- the new declination of the position in degreesunits
- dec's unitspublic void setValue(double ra, double dec)
ra
- the new right-ascension of the position in degreesdec
- the new declination of the position in degreespublic static final double validateRa(double ra, java.lang.String units)
ra
- a right-ascension of a positionunits
- the units of the right ascension
public static final double validateRa(double ra)
ra
- a right-ascension of a position in degrees
public static final double validateDec(double dec, java.lang.String units)
dec
- a declination of a positionunits
- the units of the declination
public static final double validateDec(double dec)
dec
- a declination of a position in degrees
public double getEclipticLongitude()
public double getEclipticLatitude()
public int getEquinox()
public void setEquinox(int equinox)
equinox
- enumerated equinox constantpublic double getEpoch()
public void setEpoch(double epoch)
epoch
- the epoch yearpublic static int getSeparatorStyle()
public static void setSeparatorStyle(int style)
style
- new global separator stylepublic static int getDefaultEquinox()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- object to compare to this Coodinates objectpublic int hashCode()
hashCode
in class java.lang.Object
public void translate(double raArcsec, double decArcsec)
raArcsec
- amount to translate the right-ascensiondecArcsec
- amount to translate the declinationpublic void translate(CoordinatesOffset offset)
offset
- amount to add to current coordinatespublic void rotate(double angleRad, double ra, double dec)
angleRad
- rotation angle in radiansra
- rotate about a center point with this radec
- rotate about a center point with this decpublic Coordinates add(CoordinatesOffset offset)
offset
- add to the current coordinates
public CoordinatesOffset subtract(Coordinates c)
c
- subtract these coordinates from current
public java.lang.String toString()
toString
in class java.lang.Object
public Coordinates toB1950()
public Coordinates toJ2000()
public java.lang.String raToString()
public java.lang.String raToString(int separatorStyle)
separatorStyle
- style of separator desired in output
public java.lang.String decToString()
public java.lang.String decToString(int separatorStyle)
separatorStyle
- style of separator desired in output
public java.lang.String equinoxToString()
public java.lang.String epochToString()
public static Coordinates valueOf(java.lang.String raInput, java.lang.String decInput, int equinox) throws java.lang.NumberFormatException, java.lang.IllegalArgumentException
raInput
- Right-ascension in string formatdecInput
- Declination in string formatequinox
- equinox constant for the new Coordinates
java.lang.NumberFormatException
- thrown if unable to parse the input strings
java.lang.IllegalArgumentException
public static Coordinates valueOf(java.lang.String raInput, java.lang.String decInput) throws java.lang.NumberFormatException, java.lang.IllegalArgumentException
raInput
- Right-ascension in string formatdecInput
- Declination in string format
java.lang.NumberFormatException
- thrown if unable to parse the input strings
java.lang.IllegalArgumentException
public static int separatorStyleStringToInt(java.lang.String style)
public static java.lang.String separatorStyleIntToString(int style)
public static java.lang.String[] getAllSeparatorStyles()
public static int equinoxStringToInt(java.lang.String equinox)
public static java.lang.String equinoxIntToString(int equinox)
public static double equinoxIntToYear(int equinox)
public static java.lang.String[] getAllEquinoxes()
public static void addSeparatorStyleChangeListener(java.beans.PropertyChangeListener listener)
listener
- to addpublic static void removeSeparatorStyleChangeListener(java.beans.PropertyChangeListener listener)
listener
- to removeprotected static void fireSeparatorStyleChange(java.beans.PropertyChangeEvent evt)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |