casacore
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::PositionEngine Class Reference

Engine for TaQL UDF Position conversions. More...

#include <PositionEngine.h>

Public Member Functions

 PositionEngine ()
 
MPosition::Types refType () const
 Get the reference type. More...
 
Int valueType () const
 Get the value type. More...
 
const IPositionshape () const
 Get the shape. More...
 
Int ndim () const
 Get the dimensionality. More...
 
Bool isConstant () const
 Tell if the expression is constant. More...
 
const Unitunit () const
 Get the unit. More...
 
Array< DoublegetArrayDouble (const TableExprId &id, MPosition::Types toRefType, Int toValueType)
 Get the values. More...
 
Array< MPositiongetPositions (const TableExprId &id)
 Get the positions. More...
 
void handlePosition (Int toValueType, PtrBlock< TableExprNodeRep *> &args, uInt &argnr)
 Handle the argument(s) giving the input positions and reference type. More...
 
void handlePosType (TableExprNodeRep *operand)
 Handle a position reference type and optional suffix. More...
 

Private Member Functions

void makeDefaults (const Unit &unit)
 
MPosition makePosition (const Quantity &qh, const Quantity &q1, const Quantity &q2) const
 Make an MPosition from xyz or angles,height. More...
 
void handleScalars (TableExprNodeRep *e1, TableExprNodeRep *e2, TableExprNodeRep *heightNode)
 
void handleObservatory (TableExprNodeRep *operand)
 
void handlePosArray (TableExprNodeRep *&operand)
 
void handlePosArray (TableExprNodeRep *angles, TableExprNodeRep *height)
 
void handleConstant (TableExprNodeRep *operand)
 
void handleValues (TableExprNode &operand, const TableExprId &id, Array< MPosition > &positions)
 

Private Attributes

IPosition itsShape
 
Int itsNDim
 
Unit itsInUnit
 
Unit itsOutUnit
 
CountedPtr< MPosition::ConvertitsConvert
 
Array< MPositionitsConstants
 
MPosition::Types itsRefType
 
Int itsValueType
 
TableExprNode itsExprNode
 
ArrayMeasColumn< MPositionitsMeasCol
 

Detailed Description

Engine for TaQL UDF Position conversions.

Intended use:

Public interface

Review Status

Test programs:
tMeas

Prerequisite

Synopsis

PositionEngine defines Engines (user defined functions) that can be used in TaQL to convert Measures for positions. In this way such derived values appear to be ordinary TaQL functions.

In TaQL these functions can be called like:

meas.pos (toref, pos, fromref)
meas.itrf (pos, fromref)
meas.wgs84 (pos, fromref)
For example,
meas.pos ('ITRF', [1e6m,1e6m,1e6m], 'WGS84')

All functions have data type double and unit radian.

Positions can be given like: [x1,y1,z1,x2,y2,z2,...], fromRef [lon1,lat1,lon2,lat2,...], fromRef [lon1,lat1,lon2,lat2,...], [h1,h2,...], fromRef where fromRef is the reference type optionally followed by _xxx where xxx can be 'xyz' or 'll' to specify if the values are given as xyz or as lon,lat. If xxx is not given, it will be derived from the unit type of the values (length means xyz, angle means lon,lat with default height is 0). If xxx nor units are given, 3 values means xyz and 2 values means lon,lat. If heights are also given, xxx must be 'll' if it is also given.

A position can also be a table column which usually knows its type. It can also be an expression (e.g. POSITION[0,]) which also knows the type.

Motivation

It makes it possible to handle measures in TaQL.

Definition at line 100 of file PositionEngine.h.

Constructor & Destructor Documentation

◆ PositionEngine()

casacore::PositionEngine::PositionEngine ( )

Member Function Documentation

◆ getArrayDouble()

Array<Double> casacore::PositionEngine::getArrayDouble ( const TableExprId id,
MPosition::Types  toRefType,
Int  toValueType 
)

Get the values.

Referenced by unit().

◆ getPositions()

Array<MPosition> casacore::PositionEngine::getPositions ( const TableExprId id)

Get the positions.

Referenced by unit().

◆ handleConstant()

void casacore::PositionEngine::handleConstant ( TableExprNodeRep operand)
private

Referenced by unit().

◆ handleObservatory()

void casacore::PositionEngine::handleObservatory ( TableExprNodeRep operand)
private

Referenced by unit().

◆ handlePosArray() [1/2]

void casacore::PositionEngine::handlePosArray ( TableExprNodeRep *&  operand)
private

Referenced by unit().

◆ handlePosArray() [2/2]

void casacore::PositionEngine::handlePosArray ( TableExprNodeRep angles,
TableExprNodeRep height 
)
private

◆ handlePosition()

void casacore::PositionEngine::handlePosition ( Int  toValueType,
PtrBlock< TableExprNodeRep *> &  args,
uInt argnr 
)

Handle the argument(s) giving the input positions and reference type.

The position can be a column in a table.

Referenced by unit().

◆ handlePosType()

void casacore::PositionEngine::handlePosType ( TableExprNodeRep operand)

Handle a position reference type and optional suffix.

Referenced by unit().

◆ handleScalars()

void casacore::PositionEngine::handleScalars ( TableExprNodeRep e1,
TableExprNodeRep e2,
TableExprNodeRep heightNode 
)
private

Referenced by unit().

◆ handleValues()

void casacore::PositionEngine::handleValues ( TableExprNode operand,
const TableExprId id,
Array< MPosition > &  positions 
)
private

Referenced by unit().

◆ isConstant()

Bool casacore::PositionEngine::isConstant ( ) const
inline

Tell if the expression is constant.

Definition at line 123 of file PositionEngine.h.

References itsConstants.

◆ makeDefaults()

void casacore::PositionEngine::makeDefaults ( const Unit unit)
private

Referenced by unit().

◆ makePosition()

MPosition casacore::PositionEngine::makePosition ( const Quantity qh,
const Quantity q1,
const Quantity q2 
) const
private

Make an MPosition from xyz or angles,height.

Referenced by unit().

◆ ndim()

Int casacore::PositionEngine::ndim ( ) const
inline

Get the dimensionality.

Definition at line 119 of file PositionEngine.h.

References itsNDim.

◆ refType()

MPosition::Types casacore::PositionEngine::refType ( ) const
inline

Get the reference type.

Definition at line 106 of file PositionEngine.h.

References itsRefType.

◆ shape()

const IPosition& casacore::PositionEngine::shape ( ) const
inline

Get the shape.

Definition at line 115 of file PositionEngine.h.

References itsShape.

◆ unit()

const Unit& casacore::PositionEngine::unit ( ) const
inline

◆ valueType()

Int casacore::PositionEngine::valueType ( ) const
inline

Get the value type.

It also gives the nr of output values per position. 0=default, 1=height, 2=angles, 3=xyz

Definition at line 111 of file PositionEngine.h.

References itsValueType.

Member Data Documentation

◆ itsConstants

Array<MPosition> casacore::PositionEngine::itsConstants
private

Definition at line 169 of file PositionEngine.h.

Referenced by isConstant().

◆ itsConvert

CountedPtr<MPosition::Convert> casacore::PositionEngine::itsConvert
private

Definition at line 168 of file PositionEngine.h.

◆ itsExprNode

TableExprNode casacore::PositionEngine::itsExprNode
private

Definition at line 173 of file PositionEngine.h.

◆ itsInUnit

Unit casacore::PositionEngine::itsInUnit
private

Definition at line 166 of file PositionEngine.h.

◆ itsMeasCol

ArrayMeasColumn<MPosition> casacore::PositionEngine::itsMeasCol
private

Definition at line 174 of file PositionEngine.h.

◆ itsNDim

Int casacore::PositionEngine::itsNDim
private

Definition at line 165 of file PositionEngine.h.

Referenced by ndim().

◆ itsOutUnit

Unit casacore::PositionEngine::itsOutUnit
private

Definition at line 167 of file PositionEngine.h.

Referenced by unit().

◆ itsRefType

MPosition::Types casacore::PositionEngine::itsRefType
private

Definition at line 170 of file PositionEngine.h.

Referenced by refType().

◆ itsShape

IPosition casacore::PositionEngine::itsShape
private

Definition at line 164 of file PositionEngine.h.

Referenced by shape().

◆ itsValueType

Int casacore::PositionEngine::itsValueType
private

Definition at line 171 of file PositionEngine.h.

Referenced by valueType().


The documentation for this class was generated from the following file: