casa
$Rev:20696$
|
00001 //# MPosition.h: A Measure: position on Earth 00002 //# Copyright (C) 1995,1996,1997,1998,1999,2000,2002 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: MPosition.h 21298 2012-12-07 14:53:03Z gervandiepen $ 00028 00029 #ifndef MEASURES_MPOSITION_H 00030 #define MEASURES_MPOSITION_H 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <measures/Measures/MeasBase.h> 00035 #include <measures/Measures/MeasRef.h> 00036 #include <casa/Quanta/MVPosition.h> 00037 00038 namespace casa { //# NAMESPACE CASA - BEGIN 00039 00040 //# Forward Declarations 00041 class MPosition; 00042 class MCPosition; 00043 template <class M> class MeasConvert; 00044 template <class M> class ArrayMeasColumn; 00045 template <class M> class ScalarMeasColumn; 00046 00047 //# Typedefs 00048 00049 // <summary> 00050 // A Measure: position on Earth 00051 // </summary> 00052 00053 // <use visibility=export> 00054 00055 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos=""> 00056 // </reviewed> 00057 00058 // <prerequisite> 00059 // <li> <linkto class=Measure>Measure</linkto> class 00060 // </prerequisite> 00061 // 00062 // <etymology> 00063 // </etymology> 00064 // 00065 // <synopsis> 00066 // MPosition forms derived Measure class for an instant in time. 00067 // </synopsis> 00068 // 00069 // <example> 00070 // </example> 00071 // 00072 // <motivation> 00073 // </motivation> 00074 // 00075 // <todo asof="2000/06/15"> 00076 // <li> 00077 // </todo> 00078 00079 class MPosition : public MeasBase<MVPosition, MeasRef<MPosition> > { 00080 00081 public: 00082 //# Friends 00083 // Conversion of data 00084 friend class MeasConvert<MPosition>; 00085 00086 //# Enumerations 00087 // Types of known MPositions 00088 // <note role=warning> The order defines the order in the translation 00089 // matrix FromTo 00090 // in the getConvert routine. Do not change the order without 00091 // changing the array. Additions should be made before N_types, and 00092 // an additional row and column should be coded in FromTo, and 00093 // in showType().</note> 00094 enum Types { 00095 ITRF, 00096 WGS84, 00097 N_Types, 00098 DEFAULT=ITRF}; 00099 00100 //# Typedefs 00101 // Measure value container for this class (i.e. MPosition::MVType) 00102 typedef MVPosition MVType; 00103 // Measure conversion routines for this class (i.e. MPosition::MCType) 00104 typedef MCPosition MCType; 00105 // Measure reference (i.e. MPosition::Ref) 00106 typedef MeasRef<MPosition> Ref; 00107 // Measure Convert (i.e. MPosition::Convert) 00108 typedef MeasConvert<MPosition> Convert; 00109 // Measure table Columns (e.g., MPosition::ScalarColumn) 00110 typedef ScalarMeasColumn<MPosition> ScalarColumn; 00111 typedef ArrayMeasColumn<MPosition> ArrayColumn; 00112 // Reference enum Types (included originally for gcc 2.95) 00113 typedef WHATEVER_SUN_TYPEDEF(MPosition) Types Types; 00114 00115 //# Constructors 00116 // <note role=tip> In the following constructors and other functions, all 00117 // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src> 00118 // where no offsets or frames are needed in the reference. </note> 00119 // Default constructor; generates the ITRF centre 00120 MPosition(); 00121 // Create from data and reference 00122 // <group> 00123 MPosition(const MVPosition &dt); 00124 MPosition(const MVPosition &dt, const MPosition::Ref &rf); 00125 MPosition(const MVPosition &dt, MPosition::Types rf); 00126 MPosition(const Quantity &dt, const Quantity &dt1, const Quantity &dt2); 00127 MPosition(const Quantity &dt, const Quantity &dt1, const Quantity &dt2, 00128 const MPosition::Ref &rf); 00129 MPosition(const Quantity &dt, const Quantity &dt1, const Quantity &dt2, 00130 MPosition::Types rf); 00131 MPosition(const Quantity &dt0, const Quantum<Vector<Double> > &dt); 00132 MPosition(const Quantity &dt0, const Quantum<Vector<Double> > &dt, 00133 const MPosition::Ref &rf); 00134 MPosition(const Quantity &dt0, const Quantum<Vector<Double> > &dt, 00135 MPosition::Types rf); 00136 MPosition(const Measure *dt); 00137 MPosition(const MeasValue *dt); 00138 // </group> 00139 00140 // <group> 00141 MPosition(const MPosition &); 00142 MPosition &operator=(const MPosition &); 00143 // </group> 00144 00145 //# Destructor 00146 virtual ~MPosition(); 00147 00148 //# Operators 00149 00150 //# General Member Functions 00151 // Tell me your type 00152 // <group> 00153 virtual const String &tellMe() const; 00154 static const String &showMe(); 00155 virtual uInt type() const; 00156 static void assure(const Measure &in); 00157 // </group> 00158 // Translate reference code. The uInt version has a check for valid codes 00159 // (i.e. it is a safe cast). 00160 // <thrown> 00161 // <li> AipsError in the uInt interface if illegal code given 00162 // </thrown> 00163 // <group> 00164 static MPosition::Types castType(uInt tp); 00165 static const String &showType(MPosition::Types tp); 00166 static const String &showType(uInt tp); 00167 // </group> 00168 // Translate string to reference code 00169 // <group> 00170 static Bool getType(MPosition::Types &tp, const String &in); 00171 // this one throws an exception for an unrecognized String 00172 static MPosition::Types getType(const String& in); 00173 00174 Bool giveMe(MPosition::Ref &mr, const String &in); 00175 // </group> 00176 // Set the offset in the reference (False if non-matching Measure) 00177 virtual Bool setOffset(const Measure &in); 00178 // Set the reference type to the specified String. False if illegal 00179 // string, reference set to DEFAULT. 00180 virtual Bool setRefString(const String &in); 00181 // Get the default reference type 00182 virtual const String &getDefaultType() const; 00183 // Get a list of all known reference codes. nall returns the number in list, 00184 // nextra the number of specials (like planets) that should be at 00185 // end of list). typ returns the list of corresponding types. 00186 // <group> 00187 virtual const String* allTypes(Int &nall, Int &nextra, 00188 const uInt *&typ) const; 00189 static const String* allMyTypes(Int &nall, Int &nextra, 00190 const uInt *&typ); 00191 // </group> 00192 // Check if all internal tables of types (both enum and String) are 00193 // complete and correct. This function is called automatically if and when 00194 // necessary. 00195 // <thrown> 00196 // <li> AipsError if a (programming) error in the types. 00197 // </thrown> 00198 // <group> 00199 virtual void checkTypes() const; 00200 static void checkMyTypes(); 00201 // </group> 00202 // Get the reference type (for records, including codes like R_) 00203 virtual String getRefString() const; 00204 // Get my type (as Register) 00205 static uInt myType(); 00206 00207 // Get Measure data 00208 // <group> 00209 Quantum<Vector<Double> > get(const Unit &inunit) const; 00210 Quantum<Vector<Double> > getAngle() const; 00211 Quantum<Vector<Double> > getAngle(const Unit &inunit) const; 00212 // </group> 00213 00214 // Make copy 00215 // <group> 00216 virtual Measure *clone() const; 00217 // </group> 00218 00219 private: 00220 //# Enumerations 00221 00222 //# Data 00223 00224 //# Member functions 00225 00226 }; 00227 00228 00229 } //# NAMESPACE CASA - END 00230 00231 #endif