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