edu.nrao.sss.astronomy
Class SimpleSkyPosition

java.lang.Object
  extended by edu.nrao.sss.astronomy.SimpleSkyPosition
All Implemented Interfaces:
SkyPosition, SphericalPosition, Cloneable

public class SimpleSkyPosition
extends Object

A very basic implementation of a sky position.

Version Info:

$Revision: 1156 $
$Date: 2008-03-12 11:43:13 -0600 (Wed, 12 Mar 2008) $
$Author: dharland $

Since:
2007-04-17
Author:
David M. Harland

Constructor Summary
SimpleSkyPosition()
          Creates a new equatorial, J2000, position.
SimpleSkyPosition(CelestialCoordinateSystem system, Epoch epoch)
          Creates a new instance with the given properties.
 
Method Summary
 SimpleSkyPosition clone()
          Returns a copy of this sky position.
 boolean equals(Object o)
          Returns true if o is equal to this position.
 Angle getAngularSeparation(SphericalPosition other)
          Calculates the current angular separation between this position and other.
 Angle getAngularSeparation(SphericalPosition other, Date time)
          Calculates current angular separation between this position and other at the given time.
 CelestialCoordinateSystem getCoordinateSystem()
          Returns the coordinate system to use when interpreting the latitude and longitude values of this position.
 Distance getDistance()
          Returns the current distance of this position.
 Distance getDistance(Date time)
          Returns the distance of this position at the given point in time.
 Distance getDistanceUncertainty()
          Returns the uncertainty in the distance of this position.
 Epoch getEpoch()
          Returns the epoch on which this position is based.
 Latitude getLatitude()
          Returns the current latitude of this position.
 Latitude getLatitude(Date time)
          Returns the latitude of this position at the given point in time.
 Latitude getLatitudeUncertainty()
          Returns the uncertainty in the latitude of this position.
 Longitude getLongitude()
          Returns the current longitude of this position.
 Longitude getLongitude(Date time)
          Returns the longitude of this position at the given point in time.
 Longitude getLongitudeUncertainty()
          Returns the uncertainty in the longitude of this position.
 String getOriginOfInformation()
          Returns the origin of this position's information.
 SkyPositionType getType()
          Provides a hint as to how this position stores its information.
 int hashCode()
          Returns a hash code value for this position.
 boolean isMoving()
          Returns true if this position has different properties at time T than it does at time U ≠ T.
 void reset()
          Puts this instance into the same state as one newly created via the no-argument constructor.
 void setCoordinateSystem(CelestialCoordinateSystem newSystem)
          Sets the system of latitude and longitude on which this position is based.
 void setDistance(Distance newDistance)
          Sets the distance of this position.
 void setDistanceUncertainty(Distance newUncertainty)
          Sets the uncertainty in the distance of this position.
 void setEpoch(Epoch newEpoch)
          Sets the epoch on which this position is based.
 void setLatitude(Latitude newLatitude)
          Sets the latitude of this position.
 void setLatitudeUncertainty(Latitude newUncertainty)
          Sets the uncertainty in the latitude of this position.
 void setLongitude(Longitude newLongitude)
          Sets the longitude of this position.
 void setLongitudeUncertainty(Longitude newUncertainty)
          Sets the uncertainty in the longitude of this position.
 void setOriginOfInformation(String origin)
          Sets the origin of this position's information.
 PolynomialPosition toPolynomialPosition()
          Creates and returns a new polynomial position whose time-zero values are the same as those of this position.
 SkyPosition toPosition(CelestialCoordinateSystem system, Epoch epoch, EarthPosition observer, LocalSiderealTime lst)
          Returns a new position expressed in the given coordinate system and epoch that is equivalent to this position.
 SkyPosition toPosition(CelestialCoordinateSystem system, Epoch epoch, EarthPosition observer, LocalSiderealTime lst, CelestialCoordinateConverter converter)
          Returns a new position expressed in the given coordinate system and epoch that is equivalent to this position.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleSkyPosition

public SimpleSkyPosition()
Creates a new equatorial, J2000, position.


SimpleSkyPosition

public SimpleSkyPosition(CelestialCoordinateSystem system,
                         Epoch epoch)
Creates a new instance with the given properties.

Method Detail

reset

public void reset()
Puts this instance into the same state as one newly created via the no-argument constructor.


getType

public SkyPositionType getType()
Description copied from interface: SkyPosition
Provides a hint as to how this position stores its information.

Returns:
a hint as to how this position stores its information.

isMoving

public boolean isMoving()
Description copied from interface: SkyPosition
Returns true if this position has different properties at time T than it does at time U ≠ T.

The determination of motion will be made with respect to the coordinate system in which this position is expressed. For example, a position that is expressed in the equatorial system, and that is holding steady at its position in that system, will said to be not moving, even though in other coordinate systems it may be moving quite rapidly.

Returns:
true if this position is moving.

setLongitude

public void setLongitude(Longitude newLongitude)
Sets the longitude of this position.

If newLongitude is null, this method creates, and saves a reference to, a new longitude object. Otherwise it saves a reference to newLongitude. This means that any changes made to (a non-null) newLongitude by clients after this call will be reflected in this position.

Parameters:
newLongitude - a new longitude for this position.

getLongitude

public Longitude getLongitude()
Returns the current longitude of this position.

The returned object is guaranteed to be non-null and is also a reference to the internal longitude held by this position. This means any changes made by clients to the returned object will be reflected in this position.

Specified by:
getLongitude in interface SphericalPosition
Returns:
the current longitude of this position.

setLatitude

public void setLatitude(Latitude newLatitude)
Sets the latitude of this position.

If newLatitude is null, this method creates, and saves a reference to, a new latitude object. Otherwise it saves a reference to newLatitude. This means that any changes made to (a non-null) newLatitude by clients after this call will be reflected in this position.

Parameters:
newLatitude - a new latitude for this position.

getLatitude

public Latitude getLatitude()
Returns the current latitude of this position.

The returned object is guaranteed to be non-null and is also a reference to the internal latitude held by this position. This means any changes made by clients to the returned object will be reflected in this position.

Specified by:
getLatitude in interface SphericalPosition
Returns:
the current latitude of this position.

setDistance

public void setDistance(Distance newDistance)
Sets the distance of this position.

If newDistance is null, this method creates, and saves a reference to, a new distance object. Otherwise it saves a reference to newDistance. This means that any changes made to (a non-null) newDistance by clients after this call will be reflected in this position.

Parameters:
newDistance - a new distance for this position.

getDistance

public Distance getDistance()
Returns the current distance of this position.

The returned object is guaranteed to be non-null and is also a reference to the internal distance held by this position. This means any changes made by clients to the returned object will be reflected in this position.

Specified by:
getDistance in interface SphericalPosition
Returns:
the current distance of this position.

getLongitude

public Longitude getLongitude(Date time)
Returns the longitude of this position at the given point in time.

The returned object is guaranteed to be non-null and is also a reference to the internal longitude held by this position. This means any changes made by clients to the returned object will be reflected in this position.

Since this class has no concept of time, the value returned here will be the same as that returned by the corresponding no-argument method.

Parameters:
time - the point in time for which the longitude is sought.
Returns:
the longitude of this position at the given point in time.

getLatitude

public Latitude getLatitude(Date time)
Returns the latitude of this position at the given point in time.

The returned object is guaranteed to be non-null and is also a reference to the internal latitude held by this position. This means any changes made by clients to the returned object will be reflected in this position.

Since this class has no concept of time, the value returned here will be the same as that returned by the corresponding no-argument method.

Parameters:
time - the point in time for which the latitude is sought.
Returns:
the latitude of this position at the given point in time.

getDistance

public Distance getDistance(Date time)
Returns the distance of this position at the given point in time.

The returned object is guaranteed to be non-null and is also a reference to the internal distance held by this position. This means any changes made by clients to the returned object will be reflected in this position.

Since this class has no concept of time, the value returned here will be the same as that returned by the corresponding no-argument method.

Parameters:
time - the point in time for which the distance is sought.
Returns:
the distance at the given point in time.

setLongitudeUncertainty

public void setLongitudeUncertainty(Longitude newUncertainty)
Sets the uncertainty in the longitude of this position.

If newUncertainty is null, this method creates, and saves a reference to, a new longitude object. Otherwise it saves a reference to newUncertainty. This means that any changes made to (a non-null) newUncertainty by clients after this call will be reflected in this position.

Parameters:
newUncertainty - a new value for the uncertainty of the longitude of this position.

getLongitudeUncertainty

public Longitude getLongitudeUncertainty()
Returns the uncertainty in the longitude of this position.

The returned object is guaranteed to be non-null and is also a reference to the internal uncertainty held by this position. This means any changes made by clients to the returned object will be reflected in this position.

Specified by:
getLongitudeUncertainty in interface SphericalPosition
Returns:
the uncertainty in the longitude of this position.

setLatitudeUncertainty

public void setLatitudeUncertainty(Latitude newUncertainty)
Sets the uncertainty in the latitude of this position.

If newUncertainty is null, this method creates, and saves a reference to, a new latitude object. Otherwise it saves a reference to newUncertainty. This means that any changes made to (a non-null) newUncertainty by clients after this call will be reflected in this position.

Parameters:
newUncertainty - a new value for the uncertainty of the latitude of this position.

getLatitudeUncertainty

public Latitude getLatitudeUncertainty()
Returns the uncertainty in the latitude of this position.

The returned object is guaranteed to be non-null and is also a reference to the internal uncertainty held by this position. This means any changes made by clients to the returned object will be reflected in this position.

Specified by:
getLatitudeUncertainty in interface SphericalPosition
Returns:
the uncertainty in the latitude of this position.

setDistanceUncertainty

public void setDistanceUncertainty(Distance newUncertainty)
Sets the uncertainty in the distance of this position.

If newUncertainty is null, this method creates, and saves a reference to, a new distance object. Otherwise it saves a reference to newUncertainty. This means that any changes made to (a non-null) newUncertainty by clients after this call will be reflected in this position.

Parameters:
newUncertainty - a new value for the uncertainty of the distance of this position.

getDistanceUncertainty

public Distance getDistanceUncertainty()
Returns the uncertainty in the distance of this position.

The returned object is guaranteed to be non-null and is also a reference to the internal uncertainty held by this position. This means any changes made by clients to the returned object will be reflected in this position.

Specified by:
getDistanceUncertainty in interface SphericalPosition
Returns:
the uncertainty in the distance of this position.

toPolynomialPosition

public PolynomialPosition toPolynomialPosition()
Creates and returns a new polynomial position whose time-zero values are the same as those of this position. The returned position has a default reference time and a default valid time interval.

Returns:
a new polynomial position based on this position.

toString

public String toString()
Overrides:
toString in class Object

clone

public SimpleSkyPosition clone()
Returns a copy of this sky position.

If anything goes wrong during the cloning procedure, a RuntimeException will be thrown.

Specified by:
clone in interface SkyPosition
Specified by:
clone in interface SphericalPosition
Returns:
a copy of this sky position.

equals

public boolean equals(Object o)
Returns true if o is equal to this position.


hashCode

public int hashCode()
Returns a hash code value for this position.


setCoordinateSystem

public void setCoordinateSystem(CelestialCoordinateSystem newSystem)
Sets the system of latitude and longitude on which this position is based. If newSystem is null, this method does nothing.

Parameters:
newSystem - the system of latitude and longitude on which this position is based.

getCoordinateSystem

public CelestialCoordinateSystem getCoordinateSystem()
Description copied from interface: SkyPosition
Returns the coordinate system to use when interpreting the latitude and longitude values of this position.

Specified by:
getCoordinateSystem in interface SkyPosition
Returns:
the system of latitude and longitude used by this position.

setEpoch

public void setEpoch(Epoch newEpoch)
Sets the epoch on which this position is based. If newEpoch is null, this method does nothing.

Parameters:
newEpoch - the epoch on which this position is based.

getEpoch

public Epoch getEpoch()
Description copied from interface: SkyPosition
Returns the epoch on which this position is based.

Specified by:
getEpoch in interface SkyPosition
Returns:
the epoch on which this position is based.

setOriginOfInformation

public void setOriginOfInformation(String origin)
Sets the origin of this position's information.

Parameters:
origin - the origin of this position's information. A value of null will be replaced by a non-null default value.

getOriginOfInformation

public String getOriginOfInformation()
Description copied from interface: SkyPosition
Returns the origin of this position's information.

Specified by:
getOriginOfInformation in interface SkyPosition
Returns:
the origin of this position's information.

toPosition

public SkyPosition toPosition(CelestialCoordinateSystem system,
                              Epoch epoch,
                              EarthPosition observer,
                              LocalSiderealTime lst)
                       throws CoordinateConversionException
Description copied from interface: SkyPosition
Returns a new position expressed in the given coordinate system and epoch that is equivalent to this position. This position is not changed by this method.

Specified by:
toPosition in interface SkyPosition
Parameters:
system - the celestial coordinate system of the returned position.
epoch - the epoch of the returned position.
observer - the location of the observer. This value is used almost exclusively for conversions to or from the HORIZONTAL (az/el) coordinate system. If a given conversion does not require this parameter, a null value will do no harm.
lst - the local sidereal time at the observer's location. This parameter serves two purposes. First, it is integral in conversions to or from the HORIZONTAL (az/el) coordinate system. Second, even for conversions that do not depend on the observer's location, the conversion method will use the UTC time represented by this LST to determine the exact location of this position before converting it to another system. When used this way the location associated with the LST is immaterial. If this value is null it will be replaced with the current time. Using a null value is not recommended when dealing with the HORIZONTAL system because the LST may not be for the location of interest.
Returns:
a new position with a coordinate system of system, and epoch of epoch, and coordinates that represent a conversion from those of this position.
Throws:
CoordinateConversionException - if anything goes wrong with the conversion.

toPosition

public SkyPosition toPosition(CelestialCoordinateSystem system,
                              Epoch epoch,
                              EarthPosition observer,
                              LocalSiderealTime lst,
                              CelestialCoordinateConverter converter)
                       throws CoordinateConversionException
Description copied from interface: SkyPosition
Returns a new position expressed in the given coordinate system and epoch that is equivalent to this position. This position is not changed by this method.

Specified by:
toPosition in interface SkyPosition
Parameters:
system - the celestial coordinate system of the returned position.
epoch - the epoch of the returned position.
observer - the location of the observer. This value is used almost exclusively for conversions to or from the HORIZONTAL (az/el) coordinate system.
lst - the local sidereal time at the observer's location. This parameter serves two purposes. First, it is integral in conversions to or from the HORIZONTAL (az/el) coordinate system. Second, even for conversions that do not depend on the observer's location, the conversion method will use the UTC time represented by this LST to determine the exact location of this position before converting it to another system. When used this way the location associated with the LST is immaterial. If this value is null it will be replaced with the current time. Using a null value is not recommended when dealing with the HORIZONTAL system because the LST may not be for the location of interest.
converter - the converter used to perform the transformation.
Returns:
a new position with a coordinate system of system, and epoch of epoch, and coordinates that represent a conversion from those of this position.
Throws:
CoordinateConversionException - if anything goes wrong with the conversion.

getAngularSeparation

public Angle getAngularSeparation(SphericalPosition other)
Description copied from interface: SphericalPosition
Calculates the current angular separation between this position and other.

The distances of the positions from the center of the sphere are not considered. The returned angle is the smallest possible such angle. It is the angular size of the arc of a great circle that passes through both the ray from the orgin to this position and the ray from the origin to other.

The returned value is never negative. This means that the returned angle does not contain directional information. That is, the angle from A to B is exactly equal to the angle from B to A.

Specified by:
getAngularSeparation in interface SphericalPosition
Parameters:
other - a position from which this one is separated by the returned angle.
Returns:
the angle of separation between this position and other.

getAngularSeparation

public Angle getAngularSeparation(SphericalPosition other,
                                  Date time)
Description copied from interface: SkyPosition
Calculates current angular separation between this position and other at the given time.

The distances of the positions from the center of the sphere are not considered. The returned angle is the smallest possible such angle. It is the angular size of the arc of a great circle that passes through both the ray from the orgin to this position and the ray from the origin to other.

The returned value is never negative. This means that the returned angle does not contain directional information. That is, the angle from A to B is exactly equal to the angle from B to A.

Specified by:
getAngularSeparation in interface SkyPosition
Parameters:
other - a position from which this one is separated by the returned angle.
time - the point in time for which the separation is sought.
Returns:
the angle of separation between this position and other.


Copyright © 2009. All Rights Reserved.