casacore
Loading...
Searching...
No Matches
DirectionUDF.h
Go to the documentation of this file.
1// # DirectionUDF.h: TaQL UDFs for Direction conversions
2// # Copyright (C) 2011
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 MEAS_DIRECTIONUDF_H
27#define MEAS_DIRECTIONUDF_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/meas/MeasUDF/DirectionEngine.h>
32#include <casacore/meas/MeasUDF/EpochEngine.h>
33#include <casacore/meas/MeasUDF/PositionEngine.h>
34#include <casacore/tables/TaQL/UDFBase.h>
35
36namespace casacore {
37
38// <summary>
39// TaQL UDFs for Direction conversions.
40// </summary>
41
42// <use visibility=export>
43
44// <reviewed reviewer="" date="" tests="tMeas.cc">
45// </reviewed>
46
47// <prerequisite>
48// # Classes you should understand before using this one.
49// <li> UDFBase
50// </prerequisite>
51
52// <synopsis>
53// DirectionUDF defines UDFs (user defined functions) that can be used in TaQL
54// to convert Measures for directions.
55// Special functions exist to convert to hourangle and azimuth/elevation.
56// In this way such derived values appear to be ordinary TaQL functions.
57//
58// A function is called like:
59// <srcblock>
60// meas.dir (toref, dir, time, pos)
61// meas.dir (toref, dir, time, pos)
62// For example,
63// meas.dir ('B1950', [2rad,1rad])
64// meas.dir ('B1950', [[2rad,1rad], 'J2000'])
65// meas.dir ('APP', 'MOON', TIME, [[5d12m, 52deg, 11m], 'WGS84'])
66// meas.dir ('APP', 'MOON', TIME, POSITION)
67// Or
68// meas.dir (toref, fromref, dir, pos, time)
69// </srcblock>
70// <ul>
71// <li>
72// <src>toref</src> is a single constant string.
73// <li>
74// <src>dir</src> can have various value types. A single numeric array is
75// a series of RA,DEC in J2000. If given as a set, the last argument of the
76// set can be the reference types of the values in the set. The values can
77// be strings (indicating planetary objects) or value pairs giving lon,lat.
78// The default reference type is J2000.
79// </ul>
80// All functions have data type double and unit radian.
81// </synopsis>
82
83// <motivation>
84// It makes it possible to handle measures in TaQL.
85// </motivation>
86
87class DirectionUDF : public UDFBase {
88 public:
89 // Define the possible function types.
103
104 // Create for the given function type.
105 // The Bools tell if rise/set times have to be calculated.
106 explicit DirectionUDF(FuncType, Bool riseSet = False);
107
108 // Function to create an object.
109 static UDFBase* makeDIR(const String&);
110 static UDFBase* makeDIRCOS(const String&);
111 static UDFBase* makeHADEC(const String&);
112 static UDFBase* makeAZEL(const String&);
113 static UDFBase* makeAPP(const String&);
114 static UDFBase* makeJ2000(const String&);
115 static UDFBase* makeB1950(const String&);
116 static UDFBase* makeECL(const String&);
117 static UDFBase* makeGAL(const String&);
118 static UDFBase* makeSGAL(const String&);
119 static UDFBase* makeITRF(const String&);
120 static UDFBase* makeRISESET(const String&);
121
122 // Setup the object.
123 virtual void setup(const Table&, const TaQLStyle&);
124
125 // Get the value.
126 virtual Double getDouble(const TableExprId& id);
129
130 private:
131 // # Data members.
137 Bool itsRiseSet; // # True = calculate rise/set time
138};
139
140} // namespace casacore
141
142#endif
static UDFBase * makeGAL(const String &)
static UDFBase * makeITRF(const String &)
static UDFBase * makeB1950(const String &)
PositionEngine itsPositionEngine
MDirection::Types itsRefType
static UDFBase * makeJ2000(const String &)
static UDFBase * makeAPP(const String &)
static UDFBase * makeAZEL(const String &)
virtual void setup(const Table &, const TaQLStyle &)
Setup the object.
static UDFBase * makeDIRCOS(const String &)
DirectionUDF(FuncType, Bool riseSet=False)
Create for the given function type.
virtual MArray< Double > getArrayDouble(const TableExprId &id)
static UDFBase * makeSGAL(const String &)
static UDFBase * makeDIR(const String &)
Function to create an object.
DirectionEngine itsEngine
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
static UDFBase * makeECL(const String &)
static UDFBase * makeRISESET(const String &)
FuncType
Define the possible function types.
virtual Double getDouble(const TableExprId &id)
Get the value.
static UDFBase * makeHADEC(const String &)
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition MDirection.h:187
String: the storage and methods of handling collections of characters.
Definition String.h:355
UDFBase()
Only default constructor is needed.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53