casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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 //# $Id$
27 
28 #ifndef MEAS_DIRECTIONUDF_H
29 #define MEAS_DIRECTIONUDF_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
37 
38 namespace casacore {
39 
40 // <summary>
41 // TaQL UDFs for Direction conversions.
42 // </summary>
43 
44 // <use visibility=export>
45 
46 // <reviewed reviewer="" date="" tests="tMeas.cc">
47 // </reviewed>
48 
49 // <prerequisite>
50 //# Classes you should understand before using this one.
51 // <li> UDFBase
52 // </prerequisite>
53 
54 // <synopsis>
55 // DirectionUDF defines UDFs (user defined functions) that can be used in TaQL
56 // to convert Measures for directions.
57 // Special functions exist to convert to hourangle and azimuth/elevation.
58 // In this way such derived values appear to be ordinary TaQL functions.
59 //
60 // A function is called like:
61 // <srcblock>
62 // meas.dir (toref, dir, time, pos)
63 // meas.dir (toref, dir, time, pos)
64 // For example,
65 // meas.dir ('B1950', [2rad,1rad])
66 // meas.dir ('B1950', [[2rad,1rad], 'J2000'])
67 // meas.dir ('APP', 'MOON', TIME, [[5d12m, 52deg, 11m], 'WGS84'])
68 // meas.dir ('APP', 'MOON', TIME, POSITION)
69 // Or
70 // meas.dir (toref, fromref, dir, pos, time)
71 // </srcblock>
72 // <ul>
73 // <li>
74 // <src>toref</src> is a single constant string.
75 // <li>
76 // <src>dir</src> can have various value types. A single numeric array is
77 // a series of RA,DEC in J2000. If given as a set, the last argument of the
78 // set can be the reference types of the values in the set. The values can
79 // be strings (indicating planetary objects) or value pairs giving lon,lat.
80 // The default reference type is J2000.
81 // </ul>
82 // All functions have data type double and unit radian.
83 // </synopsis>
84 
85 // <motivation>
86 // It makes it possible to handle measures in TaQL.
87 // </motivation>
88 
89  class DirectionUDF: public UDFBase
90  {
91  public:
92  // Define the possible function types.
95 
96  // Create for the given function type.
97  // The Bools tell if rise/set times have to be calculated.
98  explicit DirectionUDF (FuncType, Bool riseSet=False);
99 
100  // Function to create an object.
101  static UDFBase* makeDIR (const String&);
102  static UDFBase* makeDIRCOS (const String&);
103  static UDFBase* makeHADEC (const String&);
104  static UDFBase* makeAZEL (const String&);
105  static UDFBase* makeAPP (const String&);
106  static UDFBase* makeJ2000 (const String&);
107  static UDFBase* makeB1950 (const String&);
108  static UDFBase* makeECL (const String&);
109  static UDFBase* makeGAL (const String&);
110  static UDFBase* makeSGAL (const String&);
111  static UDFBase* makeITRF (const String&);
112  static UDFBase* makeRISESET (const String&);
113 
114  // Setup the object.
115  virtual void setup (const Table&, const TaQLStyle&);
116 
117  // Get the value.
118  virtual Double getDouble (const TableExprId& id);
119  virtual MArray<Double> getArrayDouble (const TableExprId& id);
120  virtual MArray<MVTime> getArrayDate (const TableExprId& id);
121 
122  private:
123  //# Data members.
129  Bool itsRiseSet; //# True = calculate rise/set time
130  };
131 
132 } //end namespace
133 
134 #endif
virtual void setup(const Table &, const TaQLStyle &)
Setup the object.
static UDFBase * makeRISESET(const String &)
Main interface class to a read/write table.
Definition: Table.h:153
static UDFBase * makeDIRCOS(const String &)
MDirection::Types itsRefType
Definition: DirectionUDF.h:128
static UDFBase * makeITRF(const String &)
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
virtual MArray< Double > getArrayDouble(const TableExprId &id)
static UDFBase * makeSGAL(const String &)
Engine for TaQL UDF Position conversions.
Abstract base class for a user-defined TaQL function.
Definition: UDFBase.h:236
virtual Double getDouble(const TableExprId &id)
Get the value.
static UDFBase * makeGAL(const String &)
EpochEngine itsEpochEngine
Definition: DirectionUDF.h:125
DirectionEngine itsEngine
Definition: DirectionUDF.h:124
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
TaQL UDFs for Direction conversions.
Definition: DirectionUDF.h:89
double Double
Definition: aipstype.h:55
Class with static members defining the TaQL style.
Definition: TaQLStyle.h:64
Engine for TaQL UDF Epoch conversions.
Definition: EpochEngine.h:90
Engine for TaQL UDF Direction conversions.
PositionEngine itsPositionEngine
Definition: DirectionUDF.h:126
static UDFBase * makeAPP(const String &)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool False
Definition: aipstype.h:44
FuncType
Define the possible function types.
Definition: DirectionUDF.h:93
The identification of a TaQL selection subject.
Definition: TableExprId.h:97
static UDFBase * makeB1950(const String &)
static UDFBase * makeHADEC(const String &)
static UDFBase * makeAZEL(const String &)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static UDFBase * makeDIR(const String &)
Function to create an object.
static UDFBase * makeJ2000(const String &)
static UDFBase * makeECL(const String &)
DirectionUDF(FuncType, Bool riseSet=False)
Create for the given function type.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42