casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Muvw.h
Go to the documentation of this file.
00001 //# Muvw.h: A Measure: uvw on Earth
00002 //# Copyright (C) 1998-2000,2002,2004,2007
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id: Muvw.h 21298 2012-12-07 14:53:03Z gervandiepen $
00028 
00029 #ifndef MEASURES_MUVW_H
00030 #define MEASURES_MUVW_H
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <measures/Measures/MeasBase.h>
00035 #include <measures/Measures/MDirection.h>
00036 #include <measures/Measures/MeasRef.h>
00037 #include <casa/Quanta/MVuvw.h>
00038 
00039 namespace casa { //# NAMESPACE CASA - BEGIN
00040 
00041 //# Forward Declarations
00042 class Muvw;
00043 class MCuvw;
00044 class MDirection;
00045 template <class M> class MeasConvert;
00046 template <class M> class ArrayMeasColumn;
00047 template <class M> class ScalarMeasColumn;
00048 
00049 //# Typedefs
00050 
00051 // <summary> A Measure: uvw on Earth </summary>
00052 
00053 // <use visibility=export>
00054 
00055 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMuvw" demos="">
00056 // </reviewed>
00057 
00058 // <prerequisite>
00059 //   <li> <linkto class=Measure>Measure</linkto> class 
00060 // </prerequisite>
00061 //
00062 // <etymology>
00063 // From Measure and uvw
00064 // </etymology>
00065 //
00066 // <synopsis>
00067 // Muvw is the derived Measure class for an interferometer uvw.
00068 // uvws can be given in any of the direction types, or as ITRF, the 
00069 // IERS base.<br>
00070 // Note that at the moment no correction for Earth tides (error <~ 0.05 mm/km
00071 // EW uvw), plate motion (not relevant for telescopes on same plate) and
00072 // relativistic effects are incorporated. B1950 has the same caveat as in
00073 // <linkto class=MDirection>MDirection</linkto>.
00074 // </synopsis>
00075 //
00076 // <example>
00077 // <srcblock>
00078 //      // Specify an Epoch and a telescope position
00079 //      MEpoch tbm(Quantity(50927.92931, "d"));
00080 //      MPosition pos(MVPosition(-4750915.84032, 2792906.17778, 
00081 //                               -3200483.75028), 
00082 //                    MPosition::ITRF);
00083 //      // Use them in a frame
00084 //      MeasFrame mf(tbm, pos);
00085 //      // Specify an uvw (note that values here are in m)
00086 //      MVuvw mvb0(100 ,10, 0);
00087 //      cout << "uvw: " << mvb0 << endl;
00088 //      // Specify a reference (type and where and when) for the following uvw
00089 //      Muvw::Ref mbref0(Muvw::ITRF, mf);
00090 //      Muvw mb0(mvb0, mbref0);
00091 //      // Show the uvw
00092 //      cout << "uvw: " << mb0 << endl;
00093 //      cout << "uvw reference: " << mbref0 << endl;
00094 //      // Another reference
00095 //      Muvw::Ref mbref1(Muvw::J2000);
00096 //      cout << "uvw reference: " << mbref1 << endl;
00097 //      // Convert the uvw coordinates to the other reference and show it
00098 //      cout << "Test uvw conversion ..." << endl;
00099 //      Muvw::Convert bconv(mb0, mbref1);
00100 //      cout << "Converted " << mb0 << endl <<
00101 //        " to " << mbref1 << endl <<
00102 //        " as " << bconv() << endl;
00103 // </srcblock>
00104 // </example>
00105 //
00106 // <motivation>
00107 // To be able to handle conversions between uvw coordinates with different 
00108 // reference directions.
00109 // </motivation>
00110 //
00111 // <todo asof="2000/11/08">
00112 //      <li> EW baselines
00113 // </todo>
00114 
00115 class Muvw : public MeasBase<MVuvw, MeasRef<Muvw> > {
00116 
00117 public:
00118   //# Friends
00119   // Conversion of data
00120   friend class MeasConvert<Muvw>;
00121   
00122   //# Enumerations
00123   // Types of known Muvws
00124   // <note role=warning>
00125   // The order defines the order in the translation matrix FromTo
00126   // in the getConvert routine. Do not change the order without
00127   // changing the array. Additions should be made before N_types, and
00128   // an additional row and column should be coded in FromTo, and
00129   // in showType().</note>
00130   enum Types {
00131     J2000,
00132     JMEAN,
00133     JTRUE,
00134     APP,
00135     B1950,
00136     B1950_VLA,
00137     BMEAN,
00138     BTRUE,
00139     GALACTIC,
00140     HADEC,
00141     AZEL,
00142     AZELSW,
00143     AZELGEO,
00144     AZELSWGEO,
00145     JNAT,
00146     ECLIPTIC,
00147     MECLIPTIC,
00148     TECLIPTIC,
00149     SUPERGAL,
00150     ITRF,
00151     TOPO,
00152     ICRS,
00153     N_Types,
00154     // Defaults
00155     DEFAULT=ITRF,
00156     // Synonyms
00157     AZELNE=AZEL,
00158     AZELNEGEO=AZELGEO };
00159   
00160   //# Typedefs
00161   // Measure value container for this class (i.e. Muvw::MVType)
00162   typedef MVuvw MVType;
00163   // Measure conversion routines for this class (i.e. Muvw::MCType)
00164   typedef MCuvw MCType;
00165   // Measure reference (i.e. Muvw::Ref)
00166   typedef MeasRef<Muvw> Ref;
00167   // MeasConvert use (i.e. Muvw::Convert)
00168   typedef MeasConvert<Muvw> Convert;
00169   // Measure table Columns (e.g., Muvw::ScalarColumn)
00170   typedef ScalarMeasColumn<Muvw> ScalarColumn;
00171   typedef ArrayMeasColumn<Muvw> ArrayColumn;
00172   // Reference enum Types (included originally for gcc 2.95)  
00173   typedef WHATEVER_SUN_TYPEDEF(Muvw) Types Types;
00174   
00175   //# Constructors
00176   // <note role=tip> In the following constructors and other functions, all 
00177   // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
00178   // where no offsets or frames are needed in the reference. </note>
00179   // Default constructor; generates the ITRF centre
00180   Muvw();
00181   // Create from data and reference
00182   // <group>
00183   Muvw(const MVuvw &dt);
00184   Muvw(const MVuvw &dt, const Muvw::Ref &rf);
00185   Muvw(const MVuvw &dt, Muvw::Types rf);
00186   Muvw(const Measure *dt);
00187   Muvw(const MeasValue *dt);
00188   // </group>
00189   // Copy constructor and assign
00190   // <group>
00191   Muvw(const Muvw &);
00192   Muvw &operator=(const Muvw &);
00193   // </group>
00194   
00195   //# Destructor
00196   virtual ~Muvw();
00197   
00198   //# Operators
00199   
00200   //# General Member Functions
00201   // Tell me your type
00202   // <group>
00203   virtual const String &tellMe() const;
00204   static const String &showMe();
00205   virtual uInt type() const;
00206   static void assure(const Measure &in);
00207   // </group>
00208   // Translate reference code. The uInt version has a check for valid codes
00209   // (i.e. it is a safe cast).
00210   // <thrown>
00211   //   <li> AipsError in the uInt interface if illegal code given
00212   // </thrown>
00213   // <group>
00214   static Muvw::Types castType(uInt tp);
00215   static const String &showType(Muvw::Types tp);
00216   static const String &showType(uInt tp);
00217   // </group>
00218   // Translate string to reference code
00219   // <group>
00220   static Bool getType(Muvw::Types &tp, const String &in);
00221   Bool giveMe(Muvw::Ref &mr, const String &in);
00222   // </group>
00223   // Set the offset in the reference (False if non-matching Measure)
00224   virtual Bool setOffset(const Measure &in);
00225   // Set the reference type to the specified String. False if illegal
00226   // string, reference set to DEFAULT.
00227   virtual Bool setRefString(const String &in);
00228   // Get the default reference type
00229   virtual const String &getDefaultType() const;
00230   // Get a list of all known reference codes. nall returns the number in list,
00231   // nextra the number of specials (like planets) that should be at 
00232   // end of list). typ returns the list of corresponding types.
00233   // <group>
00234   virtual const String* allTypes(Int &nall, Int &nextra,
00235                                  const uInt *&typ) const;
00236   static const String* allMyTypes(Int &nall, Int &nextra,
00237                                   const uInt *&typ);
00238   // </group>
00239   // Check if all internal tables of types (both enum and String) are 
00240   // complete and correct. This function is called automatically if and when
00241   // necessary.
00242   // <thrown>
00243   //   <li> AipsError if a (programming) error in the types.
00244   // </thrown>
00245   // <group> 
00246   virtual void checkTypes() const;
00247   static void checkMyTypes();
00248   // </group>
00249   // Get the correct Muvw type from a given direction type (or v.v.)
00250   // <group>
00251   static Muvw::Types fromDirType(const MDirection::Types in);
00252   static MDirection::Types toDirType(const Muvw::Types in);
00253   // </group>
00254   // Get the reference type (for records, including codes like R_)
00255   virtual String getRefString() const;
00256   // Get my type (as Register)
00257   static uInt myType();
00258   
00259   // Get Measure data
00260   // <group>
00261   Quantum<Vector<Double> > get(const Unit &inunit) const;
00262   Quantum<Vector<Double> > getAngle() const;
00263   Quantum<Vector<Double> > getAngle(const Unit &inunit) const;
00264   // </group>
00265   
00266   // Make copy
00267   // <group>
00268   virtual Measure *clone() const;
00269   // </group>
00270   
00271  private:
00272   //# Enumerations
00273   
00274   //# Data
00275   
00276   //# Member functions
00277 
00278 };
00279 
00280 
00281 } //# NAMESPACE CASA - END
00282 
00283 #endif