edu.nrao.sss.astronomy
Class CompositeConverter

java.lang.Object
  extended by edu.nrao.sss.astronomy.CompositeConverter
All Implemented Interfaces:
CelestialCoordinateConverter

public class CompositeConverter
extends Object
implements CelestialCoordinateConverter

A coordinate converter that delegates its work to other converters.

Version Info:

$Revision: 1147 $
$Date: 2008-03-06 08:50:11 -0700 (Thu, 06 Mar 2008) $
$Author: dharland $ (last person to modify)

Since:
2008-02-29
Author:
David M. Harland

Constructor Summary
CompositeConverter()
          Creates a new composite converter with no component converters.
 
Method Summary
 SkyPosition createFrom(SkyPosition position, CelestialCoordinateSystem toSystem, Epoch toEpoch, EarthPosition observer, LocalSiderealTime lst)
          Returns a new position that is equivalent to position, but in the given coordinate system and epoch.
 SkyPosition executeChain(edu.nrao.sss.astronomy.CompositeConverter.CcsEpochChain chain, SkyPosition position, EarthPosition observer, LocalSiderealTime lst)
          Executes all the conversions in the chain.
static CompositeConverter getDefaultConverter()
          Creates a new converter that is preequipped with component converters.
 void setConverter(CelestialCoordinateConverter converter, CelestialCoordinateSystem fromSystem, Epoch fromEpoch, CelestialCoordinateSystem toSystem, Epoch toEpoch)
          Sets the converter to use for the given conversion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeConverter

public CompositeConverter()
Creates a new composite converter with no component converters.

See Also:
getDefaultConverter()
Method Detail

getDefaultConverter

public static CompositeConverter getDefaultConverter()
Creates a new converter that is preequipped with component converters. The component converters can handle these conversions directly:
FromTo
ECLIPTICEQUATORIAL (J2000)
ECLIPTICGALACTIC
EQUATORIAL (B1950)EQUATORIAL (J2000)
EQUATORIAL (J2000)ECLIPTIC
EQUATORIAL (J2000)EQUATORIAL (B1950)
EQUATORIAL (J2000)GALACTIC
EQUATORIAL (J2000)HORIZONTAL
GALACTICECLIPTIC
GALACTICEQUATORIAL (J2000)
A conversion from any one of the five systems listed above can be made to any of the others, if not directly, then by chaining two conversions together. Note: any conversion involving B1950 coordinates requires internet connectivity.

Returns:
a new composite converter preequipped with component converters.

createFrom

public SkyPosition createFrom(SkyPosition position,
                              CelestialCoordinateSystem toSystem,
                              Epoch toEpoch,
                              EarthPosition observer,
                              LocalSiderealTime lst)
                       throws CoordinateConversionException
Description copied from interface: CelestialCoordinateConverter
Returns a new position that is equivalent to position, but in the given coordinate system and epoch.

Specified by:
createFrom in interface CelestialCoordinateConverter
Parameters:
position - the position to be converted.
toSystem - the coordinate system for the returned position.
toEpoch - the epoch for the returned position. Unless the toSystem is EQUATORIAL, this value will probably not be used.
observer - the location of the the observer. Unless one of the coordinate systems is HORIZONTAL, this value will probably not be used.
lst - the local sidereal time at the observer's location. This value is important when one of the coordinate systems is HORIZONTAL. However, it can be used for all systems in order to get the coordinates of position at a particular point in time. If this value is null and neither of the coordinate systems is HORIZONTAL, the coordinates of position will be determined as of the time on the system clock.
Returns:
a new position that is equivalent to position, but is expressed in a coordinate system of toSystem for epoch toEpoch.
Throws:
CoordinateConversionException - if anything goes wrong during conversion.

executeChain

public SkyPosition executeChain(edu.nrao.sss.astronomy.CompositeConverter.CcsEpochChain chain,
                                SkyPosition position,
                                EarthPosition observer,
                                LocalSiderealTime lst)
                         throws CoordinateConversionException
Executes all the conversions in the chain.

Throws:
CoordinateConversionException

setConverter

public void setConverter(CelestialCoordinateConverter converter,
                         CelestialCoordinateSystem fromSystem,
                         Epoch fromEpoch,
                         CelestialCoordinateSystem toSystem,
                         Epoch toEpoch)
Sets the converter to use for the given conversion. Adding a new conversion pathway may open up other pathways. For example, if this converter already handles A->B conversions and this method adds a B->C conversion, it will also construct an A->B->C conversion pathway, unless a direct A->C pathway already exists.

Parameters:
converter - the converter to use for the given from/to system.
fromSystem - the celestial coordinate system that the given converter can take as input.
fromEpoch - the epoch that the given converter can take as input. This is usually important only for the Equatorial coordinate system.
toSystem - the celestial coordinate system that the given converter can produce as output.
toEpoch - the epoch that the given converter can produce as output. This is usually important only for the Equatorial coordinate system.


Copyright © 2009. All Rights Reserved.