casa
$Rev:20696$
|
00001 //# MCDirection.h: MDirection conversion routines 00002 //# Copyright (C) 1995-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: MCDirection.h 21130 2011-10-18 07:39:05Z gervandiepen $ 00028 00029 #ifndef MEASURES_MCDIRECTION_H 00030 #define MEASURES_MCDIRECTION_H 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <measures/Measures/MeasBase.h> 00035 #include <measures/Measures/MeasRef.h> 00036 #include <measures/Measures/MCBase.h> 00037 #include <measures/Measures/MConvertBase.h> 00038 #include <measures/Measures/MDirection.h> 00039 #include <measures/Measures/MeasMath.h> 00040 #include <casa/OS/Mutex.h> 00041 00042 namespace casa { //# NAMESPACE CASA - BEGIN 00043 00044 //# Forward Declarations 00045 class MCDirection; 00046 class MVPosition; 00047 class String; 00048 00049 template <class T> class Vector; 00050 00051 //# Typedefs 00052 00053 // <summary> MDirection conversion routines </summary> 00054 00055 // <use visibility=local> 00056 00057 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos=""> 00058 // </reviewed> 00059 00060 // <prerequisite> 00061 // <li> <linkto class=Measure>Measure</linkto> class 00062 // <li> <linkto class=MCBase>MCBase</linkto> base class 00063 // <li> <linkto class=MConvertBase>overall conversion</linkto> class 00064 // </prerequisite> 00065 // 00066 // <etymology> 00067 // Measure, Convert and Direction 00068 // </etymology> 00069 // 00070 // <synopsis> 00071 // Contains state machinery and caching for actual conversions 00072 // </synopsis> 00073 // 00074 // <example> 00075 // See <linkto module=Measures>Measures</linkto> module description for 00076 // conversion examples. 00077 // </example> 00078 // 00079 // <motivation> 00080 // </motivation> 00081 // 00082 // <todo asof="2000/09/12"> 00083 // <li> nothing I know 00084 // </todo> 00085 00086 class MCDirection : public MCBase { 00087 00088 public: 00089 00090 //# Friends 00091 // Conversion of data 00092 friend class MeasConvert<MDirection>; 00093 00094 //# Constructors 00095 // Default constructor 00096 MCDirection(); 00097 00098 //# Destructor 00099 ~MCDirection(); 00100 00101 //# Member functions 00102 // Show the state of the conversion engine (mainly for debugging purposes) 00103 static String showState(); 00104 00105 private: 00106 //# Enumerations 00107 // The list of actual routines provided. 00108 // <note role=warning> Each <src>AA_BB</src> in the list points to routine 00109 // that can be used in the FromTo list in the getConvert routine. 00110 // In addition the type to which each is converted should be in the 00111 // ToRef array, again in the proper order. </note> 00112 enum Routes { 00113 GAL_J2000, 00114 GAL_B1950, 00115 J2000_GAL, 00116 B1950_GAL, 00117 J2000_B1950, 00118 J2000_B1950_VLA, 00119 B1950_J2000, 00120 B1950_VLA_J2000, 00121 B1950_B1950_VLA, 00122 B1950_VLA_B1950, 00123 J2000_JMEAN, 00124 B1950_BMEAN, 00125 JMEAN_J2000, 00126 JMEAN_JTRUE, 00127 BMEAN_B1950, 00128 BMEAN_BTRUE, 00129 JTRUE_JMEAN, 00130 BTRUE_BMEAN, 00131 J2000_JNAT, 00132 JNAT_J2000, 00133 B1950_APP, 00134 APP_B1950, 00135 APP_TOPO, 00136 HADEC_AZEL, 00137 HADEC_AZELGEO, 00138 AZEL_HADEC, 00139 AZELGEO_HADEC, 00140 HADEC_TOPO, 00141 AZEL_AZELSW, 00142 AZELGEO_AZELSWGEO, 00143 AZELSW_AZEL, 00144 AZELSWGEO_AZELGEO, 00145 APP_JNAT, 00146 JNAT_APP, 00147 J2000_ECLIP, 00148 ECLIP_J2000, 00149 JMEAN_MECLIP, 00150 MECLIP_JMEAN, 00151 JTRUE_TECLIP, 00152 TECLIP_JTRUE, 00153 GAL_SUPERGAL, 00154 SUPERGAL_GAL, 00155 ITRF_HADEC, 00156 HADEC_ITRF, 00157 TOPO_HADEC, 00158 TOPO_APP, 00159 ICRS_J2000, 00160 J2000_ICRS, 00161 N_Routes, 00162 // General for Planets 00163 R_PLANET0, 00164 R_PLANET, 00165 R_COMET0, 00166 R_COMET, 00167 // Individual planets. Order should be the same as in MDirection.h 00168 R_MERCURY, 00169 R_VENUS, 00170 R_MARS, 00171 R_JUPITER, 00172 R_SATURN, 00173 R_URANUS, 00174 R_NEPTUNE, 00175 R_PLUTO, 00176 R_SUN, 00177 R_MOON }; 00178 00179 //# Typedefs 00180 00181 //# Operators 00182 00183 //# General Member Functions 00184 00185 //# Enumerations 00186 00187 //# Cached Data 00188 MVPosition *MVPOS1, *MVPOS2, *MVPOS3; 00189 Vector<Double> *VEC61, *VEC62, *VEC63; 00190 MeasMath measMath; 00191 00192 //# State machine data 00193 // Transition list 00194 static uInt ToRef_p[N_Routes][3]; 00195 // Transition matrix 00196 static uInt FromTo_p[MDirection::N_Types][MDirection::N_Types]; 00197 // Mutex for thread-safety. 00198 static MutexedInit theirMutexedInit; 00199 00200 // Fill the global state in a thread-safe way. 00201 static void fillState() 00202 { theirMutexedInit.exec(); } 00203 00204 //# Constructors 00205 // Copy constructor (not implemented) 00206 MCDirection(const MCDirection &other); 00207 // Assignment (not implemented) 00208 MCDirection &operator=(const MCDirection &other); 00209 00210 //# Member functions 00211 00212 // Create conversion function pointer 00213 virtual void getConvert(MConvertBase &mc, 00214 const MRBase &inref, 00215 const MRBase &outref); 00216 00217 // Create help structures for Measure conversion routines 00218 virtual void initConvert(uInt which, MConvertBase &mc); 00219 00220 // Delete the pointers used in the MeasConvert help structure cache 00221 virtual void clearConvert(); 00222 00223 // Routines to convert directions from one reference frame to another 00224 virtual void doConvert(MeasValue &in, 00225 MRBase &inref, 00226 MRBase &outref, 00227 const MConvertBase &mc); 00228 // Conversion routine to cater for inheritance question 00229 void doConvert(MVDirection &in, 00230 MRBase &inref, 00231 MRBase &outref, 00232 const MConvertBase &mc); 00233 00234 private: 00235 // Fill the global state in a thread-safe way. 00236 static void doFillState (void*); 00237 }; 00238 00239 00240 } //# NAMESPACE CASA - END 00241 00242 #endif 00243