casacore
PositionUDF.h
Go to the documentation of this file.
1 //# PositionUDF.h: TaQL UDFs for Position 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_POSITIONUDF_H
29 #define MEAS_POSITIONUDF_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/meas/MeasUDF/PositionEngine.h>
34 #include <casacore/tables/TaQL/UDFBase.h>
35 #include <casacore/tables/TaQL/ExprNode.h>
36 #include <casacore/measures/Measures/MPosition.h>
37 #include <casacore/measures/Measures/MCPosition.h>
38 #include <casacore/measures/Measures/MeasConvert.h>
39 #include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
40 
41 namespace casacore {
42 
43 // <summary>
44 // TaQL UDFs for Position conversions.
45 // </summary>
46 
47 // <use visibility=export>
48 
49 // <reviewed reviewer="" date="" tests="tMeas.cc">
50 // </reviewed>
51 
52 // <prerequisite>
53 //# Classes you should understand before using this one.
54 // <li> UDFBase
55 // </prerequisite>
56 
57 // <synopsis>
58 // PositionUDF defines UDFs (user defined functions) that can be used in TaQL
59 // to convert Measures for positions.
60 // In this way such derived values appear to be ordinary TaQL functions.
61 //
62 // A function is called like:
63 // <srcblock>
64 // meas.pos (toref, pos)
65 // For example,
66 // meas.dir ('ITRF', [1rad,1rad], 'WGS84')
67 // </srcblock>
68 // <ul>
69 // <li>
70 // <src>toref</src> is a single constant string.
71 // <li>
72 // <src>pos</src> can have various value types. A single numeric array is
73 // a series of RA,DEC in J2000. If given as a set, the last argument of the
74 // set can be the reference types of the values in the set. The values can
75 // be strings (indicating planetary objects) or value pairs giving lon,lat.
76 // The default reference type is J2000.
77 // </ul>
78 // All functions have data type double and unit radian.
79 // </synopsis>
80 
81 // <motivation>
82 // It makes it possible to handle measures in TaQL.
83 // </motivation>
84 
85  class PositionUDF: public UDFBase
86  {
87  public:
88  // Define the possible function types.
90 
91  explicit PositionUDF (FuncType);
92 
93  // Function to create an object.
94  static UDFBase* makePOS (const String&);
95  static UDFBase* makeITRFXYZ (const String&);
96  static UDFBase* makeITRFLL (const String&);
97  static UDFBase* makeITRFH (const String&);
98  static UDFBase* makeWGSXYZ (const String&);
99  static UDFBase* makeWGSLL (const String&);
100  static UDFBase* makeWGSH (const String&);
101 
102  // Setup the object.
103  virtual void setup (const Table&, const TaQLStyle&);
104 
105  // Get the value.
106  virtual Double getDouble (const TableExprId& id);
107  virtual Array<Double> getArrayDouble (const TableExprId& id);
108 
109  private:
110  //# Data members.
115  };
116 
117 } //end namespace
118 
119 #endif
int Int
Definition: aipstype.h:47
Main interface class to a read/write table.
Definition: Table.h:149
PositionEngine itsEngine
Definition: PositionUDF.h:111
Engine for TaQL UDF Position conversions.
Abstract base class for a user-defined TaQL function.
Definition: UDFBase.h:233
static UDFBase * makeWGSH(const String &)
static UDFBase * makePOS(const String &)
Function to create an object.
static UDFBase * makeITRFLL(const String &)
static UDFBase * makeITRFH(const String &)
static UDFBase * makeWGSXYZ(const String &)
static UDFBase * makeWGSLL(const String &)
double Double
Definition: aipstype.h:52
TaQL UDFs for Position conversions.
Definition: PositionUDF.h:85
Class with static members defining the TaQL style.
Definition: TaQLStyle.h:64
virtual Array< Double > getArrayDouble(const TableExprId &id)
FuncType
Define the possible function types.
Definition: PositionUDF.h:89
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition: MPosition.h:94
The identification of a TaQL selection subject.
Definition: TableExprId.h:98
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static UDFBase * makeITRFXYZ(const String &)
virtual void setup(const Table &, const TaQLStyle &)
Setup the object.
this file contains all the compiler specific defines
Definition: mainpage.dox:28
virtual Double getDouble(const TableExprId &id)
Get the value.
MPosition::Types itsRefType
Definition: PositionUDF.h:113