casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MDirection.h
Go to the documentation of this file.
1 //# MDirection.h: A Measure: astronomical direction
2 //# Copyright (C) 1995-2000,2002,2004,2007
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef MEASURES_MDIRECTION_H
30 #define MEASURES_MDIRECTION_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class MDirection;
42 class MCDirection;
43 template <class M> class MeasConvert;
44 template <class M> class ArrayMeasColumn;
45 template <class M> class ScalarMeasColumn;
46 
47 //# Typedefs
48 
49 // <summary>
50 // A Measure: astronomical direction
51 // </summary>
52 
53 // <use visibility=export>
54 
55 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
56 // </reviewed>
57 
58 // <prerequisite>
59 // <li> <linkto class=Measure>Measure</linkto> class
60 // </prerequisite>
61 //
62 // <etymology>
63 // </etymology>
64 //
65 // <synopsis>
66 // MDirection forms a derived Measure class for a direction in space.<br>
67 // An MDirection can be generated from a
68 // <linkto class=MVDirection>MVDirection</linkto> or a pair of
69 // <linkto class=Quantum>Quantities</linkto> specifying a longitudinal and a
70 // latitudinal angle.<br>
71 // The different reference types that can be used for a Direction are:
72 // <ul>
73 // <li>MDirection::J2000 -- mean equator and equinox at J2000.0 (FK5)
74 // <li>MDirection::JNAT --- geocentric natural frame
75 // <li>MDirection::JMEAN -- mean equator and equinox at frame epoch
76 // <li>MDirection::JTRUE -- true equator and equinox at frame epoch
77 // <li>MDirection::APP ---- apparent geocentric position
78 // <li>MDirection::B1950 -- mean epoch and ecliptic at B1950.0. The epoch
79 // is taken from the frame epoch; or from the aipsrc variable
80 // measures.b1950.d_epoch; or has default 2000.0
81 // <li>MDirection::B1950_VLA -- mean epoch(1979.9)) and ecliptic at B1950.0
82 // <li>MDirection::BMEAN -- mean equator and equinox at frame epoch
83 // <li>MDirection::BTRUE -- true equator and equinox at frame epoch
84 // <li>MDirection::GALACTIC -- galactic coordinates
85 // <li>MDirection::HADEC -- topocentric HA and declination
86 // <li>MDirection::AZEL --- topocentric Azimuth and Elevation (N through E)
87 // <li>MDirection::AZELSW - topocentric Azimuth and Elevation (S through W)
88 // <li>MDirection::AZELNE - topocentric Azimuth and Elevation (N through E)
89 // <li>MDirection::AZELGEO --- geodetic Azimuth and Elevation (N through E)
90 // <li>MDirection::AZELSWGEO - geodetic Azimuth and Elevation (S through W)
91 // <li>MDirection::AZELNEGEO - geodetic Azimuth and Elevation (N through E)
92 // <li>MDirection::ECLIPTC -- ecliptic for J2000 equator and equinox
93 // <li>MDirection::MECLIPTIC -- ecliptic for mean equator of date
94 // <li>MDirection::TECLIPTIC -- ecliptic for true equator of date
95 // <li>MDirection::SUPERGAL -- supergalactic coordinates
96 // <li>MDirection::ITRF -- coordinates wrt ITRF Earth frame
97 // <li>MDirection::TOPO -- apparent topocentric position
98 // <li>MDirection::ICRS -- International Celestial reference system
99 // <li>MDirection::MERCURY -- the planet: has no data attached
100 // <li>MDirection::VENUS
101 // <li>MDirection::MARS
102 // <li>MDirection::JUPITER
103 // <li>MDirection::SATURN
104 // <li>MDirection::URANUS
105 // <li>MDirection::NEPTUNE
106 // <li>MDirection::PLUTO
107 // <li>MDirection::SUN
108 // <li>MDirection::MOON
109 // <li>MDirection::COMET -- solar system body: no coordinates attached,
110 // only table
111 // <li>MDirection::DEFAULT = J2000
112 // </ul>
113 // <p>
114 // Conversion between the different types is done with the standard
115 // <linkto class=MeasConvert>MeasConvert</linkto> class
116 // (<src>MDirection::Convert</src> in this case).<br>
117 // For some conversion additional <linkto class=MeasFrame>MeasFrame</linkto>
118 // information is essential. The following list specifies which information
119 // is needed if the conversion goes to or from the different types:
120 // <ul>
121 // <li><em>Epoch</em>: all but J2000, B1950, GALACTIC, SUPGAL, ECLIPTIC, ICRS
122 // <li><em>Positiom</em>: HADEC, AZEL, AZELGEO
123 // </ul>
124 // The conversion between B1950 and J2000 may have an Epoch. If none given
125 // an epoch of 2000.0 is assumed for the conversion, unless an aipsrc
126 // variable <em>measures.b1950.d_epoch</em> is given.
127 //
128 // Conversions are based on the IAU system of
129 // <linkto class=Precession>precession</linkto> and
130 // <linkto class=Nutation>nutation</linkto> (with
131 // IERS corrections if available); and on series expansions of the DE200
132 // planetary ephemeris (J system; for B sytem older expansions) for the
133 // <linkto class=Aberration>aberration</linkto> and the
134 // <linkto class=SolarPos>solar position</linkto>.<br>
135 // The <em>HADEC</em> position has corrections for polar motion and the
136 // equation of equinoxes; the <em>AZEL</em> will include Earth tides and
137 // refraction at a later stage.<br>
138 // Note that conversion between B1950 and J2000 can only be approximate, and is
139 // based on FK4 to FK5 conversion. The best conversion is to convert first
140 // to an apparent position at the time of observation, and convert from there
141 // to the other standard (the correct route will be followed).<br>
142 // Another problem can arise if the source has proper motion and/or radial
143 // velocities. These should be taken into account. An
144 // MCatalog class will maybe take care of that.
145 // <note role=warning>
146 // The offset that can be specified in the MDirection::Ref is an MDirection
147 // offset, and can not be used for specifying angular offsets. shift()
148 // methods are available for these cases.
149 // </note>
150 // <p>
151 // To aid in formatting of the angles without having to check all difference
152 // referencetypes, the following global types are provided:
153 // <ul>
154 // <li> GRADEC for types that are probably expressed in HM,DM
155 // <li> GHADEC for types that are probably expressed in +-HM,DM
156 // <li> GAZEL for types that are probably expressed in +-deg,deg
157 // <li> GLONGLAT for types that are probably expressed in deg,deg
158 // </ul>
159 // they can be obtained with the globalType() method.
160 // </synopsis>
161 //
162 // <example>
163 // See <linkto module=Measures>Measures</linkto> module description for
164 // extensive examples.
165 // </example>
166 //
167 // <motivation>
168 // </motivation>
169 //
170 // <todo asof="2000/06/15">
171 // <li>
172 // </todo>
173 
174 class MDirection : public MeasBase<MVDirection, MeasRef<MDirection> > {
175 
176 public:
177 //# Friends
178 // Conversion of data
179  friend class MeasConvert<MDirection>;
180 
181 //# Enumerations
182 // Types of known MDirections
183 // <note role=warning> The order defines the order in the translation matrix FromTo
184 // in the getConvert routine. Do not change the order without
185 // changing the array. Additions should be made before N_types, and
186 // an additional row and column should be coded in FromTo, and
187 // in showType().</note>
188  enum Types {
212  // Planets. First one should be Mercury
213  MERCURY = 32,
223  // Comet or other table-described solar system body
226  // All extra bits
227  EXTRA = 32,
228  // Defaults
230  // Synonyms
233  // Global types
234  enum GlobalTypes {
240 
241  //# Typedefs
242  // Measure value container for this class (i.e. MDirection::MVType)
244  // Measure conversion routines for this class (i.e. MDirection::MCType)
246  // Measure reference (i.e. MDirection::Ref)
248  // Measure Convert (i.e. MDirection::Convert)
250  // Measure table Columns (e.g., MDirection::ScalarColumn)
253 
254 //# Constructors
255 // <note role=tip> In the following constructors and other functions, all
256 // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
257 // where no offsets or frames are needed in the reference. </note>
258 // Default constructor; generates the J2000 pole direction
259  MDirection();
260 // Create from data and reference
261 // <group>
262  MDirection(const MVDirection &dt);
263  MDirection(const MVDirection &dt, const MDirection::Ref &rf);
265  MDirection(const Quantity &dt, const Quantity &dt1);
266  MDirection(const Quantity &dt, const Quantity &dt1,
267  const MDirection::Ref &rf);
268  MDirection(const Quantity &dt, const Quantity &dt1,
269  MDirection::Types rf);
270  MDirection(const Quantum<Vector<Double> > &dt);
271  MDirection(const Quantum<Vector<Double> > &dt,
272  const MDirection::Ref &rf);
273  MDirection(const Quantum<Vector<Double> > &dt,
274  MDirection::Types rf);
275  MDirection(const Measure *dt);
276  MDirection(const MeasValue *dt);
277  MDirection(const MDirection::Ref &rf);
279 // </group>
280 
281 //# Destructor
282  virtual ~MDirection();
283 
284 // Make an MDirection object given the case-insensitive name of a
285 // moving source (ZENITH, SUN, etc.),
286 // or of a known standard source (CygA, etc.).
287  static MDirection makeMDirection(const String& sourceName);
288 
289 //# Operators
290 
291 //# General Member Functions
292 // Tell me your type ('Direction')
293 // <group>
294  virtual const String &tellMe() const;
295  static const String &showMe();
296 // </group>
297 // Assert you are a direction
298  static void assure(const Measure &in);
299 // Tell me the global type (like GRADEC) for tp (tp like MDirection::J2000)
301 // Translate reference code tp. The uInt version has a check for valid codes
302  // (i.e. it is a safe cast).
303  // <thrown>
304  // <li> AipsError in the uInt interface if illegal code given
305  // </thrown>
306  // <group>
307  static MDirection::Types castType(uInt tp);
308  static const String &showType(MDirection::Types tp);
309  static const String &showType(uInt tp);
310  // </group>
311 // Translate string to reference code
312 // <group>
313  static Bool getType(MDirection::Types &tp, const String &in);
314  Bool giveMe(MDirection::Ref &mr, const String &in);
315 // </group>
316  // Set the offset in the reference (False if non-matching Measure)
317  virtual Bool setOffset(const Measure &in);
318  // Set the reference type to the specified String. False if illegal
319  // string, reference set to DEFAULT.
320  virtual Bool setRefString(const String &in);
321  // Get the default reference type
322  virtual const String &getDefaultType() const;
323  // Get a list of all known reference codes. nall returns the number in list,
324  // nextra the number of specials (like planets) that should be at
325  // end of list). typ returns the list of corresponding types.
326  // <group>
327  virtual const String* allTypes(Int &nall, Int &nextra,
328  const uInt *&typ) const;
329  static const String* allMyTypes(Int &nall, Int &nextra,
330  const uInt *&typ);
331  // </group>
332  // Check if all internal tables of types (both enum and String) are
333  // complete and correct. This function is called automatically if and when
334  // necessary.
335  // <thrown>
336  // <li> AipsError if a (programming) error in the types.
337  // </thrown>
338  // <group>
339  virtual void checkTypes() const;
340  static void checkMyTypes();
341  // </group>
342  // Get the reference type (for records, including codes like R_)
343  virtual String getRefString() const;
344  // Tell me if you are a pure model (e.g. a planet)
345  virtual Bool isModel() const;
346 
347  // Get Measure data
348  // <group>
350  Quantum<Vector<Double> > getAngle(const Unit &inunit) const;
351  // </group>
352  // Shift the direction in longitude (radians if Double) and/or latitude.
353  // If the trueAngle switch is True, the longitude shift will be in
354  // angular units perpendicular to the direction to pole, along a great
355  // circle. See <linkto class=MVDirection>MVDirection</linkto>
356  // for more details.
357  // <group>
358  void shift(const Quantum<Double> &lng,
359  const Quantum<Double> &lat, Bool trueAngle=False);
360  void shift(Double lng, Double lat, Bool trueAngle=False);
361  void shiftLongitude(const Quantity &lng, Bool trueAngle=False);
362  void shiftLongitude(Double lng, Bool trueAngle=False);
363  void shiftLatitude(const Quantum<Double> &lat, Bool trueAngle=False);
364  void shiftLatitude(Double lat, Bool trueAngle=False);
365  void shift(const MVDirection &shft, Bool trueAngle=False);
366  // </group>
367  // Shift over an angle off in the direction pa. pa is measured from North,
368  // in the direction of increasing longitude.
369  // See <linkto class=MVDirection>MVDirection</linkto>
370  // for implementation.
371  // <group>
372  void shiftAngle(const Quantum<Double> &off,
373  const Quantum<Double> &pa);
374  void shiftAngle(Double off, Double pa);
375  // </group>
376 
377 // Make a copy
378 // <group>
379  virtual Measure *clone() const;
380 // </group>
381 
382  // Convert to a String in astronomer-friendly format based on
383  // reference frame
384  String toString() const;
385 
386 private:
387 
388 //# Data
389 
390 //# Member functions
391 
392 };
393 
394 
395 } //# NAMESPACE CASACORE - END
396 
397 #endif
398 
A Measure: astronomical direction.
Definition: MDirection.h:174
int Int
Definition: aipstype.h:50
Conversion of Measures.
Definition: MBaseline.h:44
MeasRef< MDirection > Ref
Measure reference (i.e.
Definition: MDirection.h:247
static void assure(const Measure &in)
Assert you are a direction.
static MDirection::GlobalTypes globalType(uInt tp)
Tell me the global type (like GRADEC) for tp (tp like MDirection::J2000)
virtual const String * allTypes(Int &nall, Int &nextra, const uInt *&typ) const
Get a list of all known reference codes.
virtual const String & getDefaultType() const
Get the default reference type.
virtual Bool setOffset(const Measure &in)
Set the offset in the reference (False if non-matching Measure)
static Bool getType(MDirection::Types &tp, const String &in)
Translate string to reference code.
ArrayMeasColumn< MDirection > ArrayColumn
Definition: MDirection.h:252
MCDirection MCType
Measure conversion routines for this class (i.e.
Definition: MDirection.h:245
Physical quantities within reference frame.
Definition: Measure.h:235
GlobalTypes
Global types.
Definition: MDirection.h:234
Base class for all measures.
Definition: MeasBase.h:73
MDirection conversion routines.
Definition: MCDirection.h:86
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
MVDirection MVType
Measure value container for this class (i.e.
Definition: MDirection.h:243
virtual Bool isModel() const
Tell me if you are a pure model (e.g.
defines physical units
Definition: Unit.h:189
static void checkMyTypes()
void shiftLongitude(const Quantity &lng, Bool trueAngle=False)
Comet or other table-described solar system body.
Definition: MDirection.h:224
virtual void checkTypes() const
Check if all internal tables of types (both enum and String) are complete and correct.
Base class for values in a Measure.
Definition: MeasValue.h:107
virtual Bool setRefString(const String &in)
Set the reference type to the specified String.
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
void shiftLatitude(const Quantum< Double > &lat, Bool trueAngle=False)
virtual const String & tellMe() const
Tell me your type (&#39;Direction&#39;)
Bool giveMe(MDirection::Ref &mr, const String &in)
double Double
Definition: aipstype.h:55
static MDirection::Types castType(uInt tp)
Translate reference code tp.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void shift(const Quantum< Double > &lng, const Quantum< Double > &lat, Bool trueAngle=False)
Shift the direction in longitude (radians if Double) and/or latitude.
virtual Measure * clone() const
Make a copy.
static const String & showMe()
const Bool False
Definition: aipstype.h:44
static const String & showType(MDirection::Types tp)
void shiftAngle(const Quantum< Double > &off, const Quantum< Double > &pa)
Shift over an angle off in the direction pa.
static MDirection makeMDirection(const String &sourceName)
Make an MDirection object given the case-insensitive name of a moving source (ZENITH, SUN, etc.), or of a known standard source (CygA, etc.).
static const String * allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
String: the storage and methods of handling collections of characters.
Definition: String.h:225
MeasConvert< MDirection > Convert
Measure Convert (i.e.
Definition: MDirection.h:249
MDirection()
Tip: In the following constructors and other functions, all MeasRef can be replaced with simple Meas...
Vector of three direction cosines.
Definition: MVDirection.h:107
virtual String getRefString() const
Get the reference type (for records, including codes like R_)
String toString() const
Convert to a String in astronomer-friendly format based on reference frame.
ScalarMeasColumn< MDirection > ScalarColumn
Measure table Columns (e.g., MDirection::ScalarColumn)
Definition: MDirection.h:251
Quantum< Vector< Double > > getAngle() const
Get Measure data.
unsigned int uInt
Definition: aipstype.h:51