27#ifndef COORDINATES_COORDINATE_H 
   28#define COORDINATES_COORDINATE_H 
   30#include <casacore/casa/aips.h> 
   31#include <casacore/casa/Arrays/ArrayFwd.h> 
   32#include <casacore/casa/BasicSL/String.h> 
   33#include <casacore/casa/Arrays/Vector.h> 
   34#include <wcslib/wcs.h> 
   39template<
class T> 
class Quantum;
 
  364                      Double tol=1.0e-6) 
const = 0;
 
  367                      Double tol=1.0e-6) 
const = 0;
 
  431                              Int defPrecScientific,
 
  433                              Int defPrecTime) 
const;
 
  458            const String &fieldName) 
const = 0;
 
  487    static void sub_wcs(const ::wcsprm &src, 
int &nsub, 
int axes[], ::wcsprm &dst);
 
  490    static void copy_wcs(const ::wcsprm &src, ::wcsprm &dst);
 
  517                       const String& nameIn) 
const;
 
  571                     const Bool absolute) 
const;
 
 
const String & errorMessage() const
If the last conversion to world or pixel coordinates resulted in an error, report that error.
 
virtual void setDefaultWorldMixRanges()
 
static String typeToString(Coordinate::Type type)
 
Bool toPixelManyWCS(Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures, wcsprm &wcs) const
 
virtual Bool doNearPixel(const Coordinate &other, const Vector< Bool > &thisAxes, const Vector< Bool > &otherAxes, Double tol=1.0e-6) const
Comparison only made for specified axes in this and other Coordinate The default implementation shoul...
 
virtual ~Coordinate()
Destructor.
 
Vector< Double > worldMax_p
 
void toCurrentMany(Matrix< Double > &world, const Vector< Double > &toCurrentFactors) const
Functions for handling conversion between the current units and the wcs units.
 
void set_error(const String &errorMsg) const
Set error message.
 
virtual Coordinate * clone() const =0
Make a copy of ourself.
 
virtual Vector< Double > referenceValue() const =0
 
virtual Vector< String > worldAxisUnits() const =0
 
virtual void convertFrom(Vector< Double > &) const
 
Bool toWorldWCS(Vector< Double > &world, const Vector< Double > &pixel, wcsprm &wcs) const
Functions to interconvert pixel<->world via wcs.
 
Coordinate & operator=(const Coordinate &other)
Assignment (copy semantics)
 
virtual void convertTo(Vector< Double > &) const
Functions for handling conversion between the current reference frame and the native one.
 
virtual void makeWorldAbsoluteMany(Matrix< Double > &world) const
 
virtual Bool toMix(Vector< Double > &worldOut, Vector< Double > &pixelOut, const Vector< Double > &worldIn, const Vector< Double > &pixelIn, const Vector< Bool > &worldAxes, const Vector< Bool > &pixelAxes, const Vector< Double > &worldMin, const Vector< Double > &worldMax) const
Mixed absolute pixel/world coordinate conversion.
 
void convertToMany(Matrix< Double > &world) const
Functions for handling conversion between the current reference frame and the native one for many con...
 
static void set_wcs(::wcsprm &wcs)
Call wcsset on the wcs structure.
 
Coordinate()
Default constructor.
 
virtual void makePixelAbsoluteMany(Matrix< Double > &pixel) const
 
virtual Bool toPixelMany(Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures) const
 
Type
This enum lists the types of the derived classes.
 
@ TABULAR
A one-dimensional Cooordinate system, usually created from a table although it can also be purely lin...
 
@ SPECTRAL
A spectral axis.
 
@ QUALITY
to mark DATA and ERROR values
 
@ COORDSYS
A CoordinateSystem (a collection of Coordinates).
 
virtual void makePixelAbsolute(Vector< Double > &pixel) const
 
virtual Matrix< Double > linearTransform() const =0
 
void fourierUnits(String &nameOut, String &unitOut, String &unitInCanon, Coordinate::Type type, Int axis, const String &unitIn, const String &nameIn) const
Tries to find a canonical unit for input unit (e.g.
 
static void copy_wcs(const ::wcsprm &src, ::wcsprm &dst)
Call wcssub on the src/dst pair with null nsub/axes.
 
virtual Bool setWorldAxisUnits(const Vector< String > &units)=0
Change the units.
 
virtual Bool setIncrement(const Vector< Double > &inc)=0
 
virtual Bool save(RecordInterface &container, const String &fieldName) const =0
Used for persistence.
 
Coordinate(const Coordinate &other)
Copy constructor (copy semantics)
 
void checkFormat(Coordinate::formatType &format, const Bool absolute) const
Check format type.
 
virtual Bool toWorld(Vector< Double > &world, const Vector< Double > &pixel, Bool useConversionFrame=True) const =0
Convert an absolute pixel position to an absolute world position or vice versa.
 
Vector< Double > worldMixMin() const
 
void makeWorldAbsRelMany(Matrix< Double > &value, Bool toAbs) const
 
virtual Bool setWorldMixRanges(const IPosition &shape)
Set the world min and max ranges, for use in function toMix, for a lattice of the given shape for thi...
 
void makePixelAbsRelMany(Matrix< Double > &value, Bool toAbs) const
 
static void sub_wcs(const ::wcsprm &src, int &nsub, int axes[], ::wcsprm &dst)
Call wcssub on the src/dst pair.
 
virtual void makeWorldRelativeMany(Matrix< Double > &world) const
 
void pcToXform(Matrix< Double > &xForm, const wcsprm &wcs) const
Interconvert between wcs PC cards and Matrix xForm format
 
virtual void makePixelRelativeMany(Matrix< Double > &pixel) const
Batch up a lot of absolute/relative transformations.
 
virtual Bool toWorldMany(Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures) const
Batch up a lot of transformations.
 
virtual Bool setWorldAxisNames(const Vector< String > &names)=0
Set the requested attribute.
 
virtual Vector< Double > referencePixel() const =0
 
Bool toPixelWCS(Vector< Double > &pixel, const Vector< Double > &world, wcsprm &wcs) const
 
formatType
This enum is used for formatting world values into Strings.
 
@ TIME
HHH:MM:SS.SSS style formatting.
 
@ SCIENTIFIC
Scientific format (e.g.
 
@ DEFAULT
Default; formatter decides.
 
@ FIXED
Fixed floating format (e.g.
 
@ MIXED
Either scientific or floating point, auto-selected by the C++ STL formatting routines.
 
void convertFromMany(Matrix< Double > &world) const
 
virtual Bool setReferenceValue(const Vector< Double > &refval)=0
 
virtual Bool setReferencePixel(const Vector< Double > &refPix)=0
 
virtual Vector< Double > increment() const =0
 
virtual String format(String &units, Coordinate::formatType format, Double worldValue, uInt axis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1, Bool usePrecForMixed=False) const
 
virtual void getPrecision(Int &precision, Coordinate::formatType &format, Bool showAsAbsolute, Int defPrecScientific, Int defPrecFixed, Int defPrecTime) const
Provide a common interface to getting formatted representations of coordinate values.
 
virtual Type type() const =0
List the type of this Coordinate object.
 
static void init_wcs(::wcsprm &wcs, int naxis)
Call wcsini on the wcs structure.
 
void fromCurrentMany(Matrix< Double > &world, const Vector< Double > &toCurrentFactors) const
 
virtual Bool near(const Coordinate &other, Double tol=1.0e-6) const =0
Comparison to fractional tolerance (for floating point values).
 
Vector< Double > worldMixMax() const
 
virtual Vector< String > worldAxisNames() const =0
Return the requested attributed.
 
virtual void makeWorldAbsolute(Vector< Double > &world) const
 
Bool find_scale_factor(String &error, Vector< Double > &factor, const Vector< String > &units, const Vector< String > &oldUnits)
 
virtual Coordinate * rotate(const Quantum< Double > &angle) const
return the result of rotating the coordinate clockwise through the specified angle.
 
virtual void makePixelRelative(Vector< Double > &pixel) const
Make absolute coordinates relative and vice-versa (with respect to the reference value).
 
Bool toWorldManyWCS(Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures, wcsprm &wcs) const
 
virtual Bool toPixel(Vector< Double > &pixel, const Vector< Double > &world) const =0
 
virtual void makeWorldRelative(Vector< Double > &world) const
 
virtual uInt nWorldAxes() const =0
 
String formatQuantity(String &units, Coordinate::formatType format, const Quantum< Double > &worldValue, uInt axis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1)
 
virtual void makeWorldAbsoluteRef(Vector< Double > &world, const Vector< Double > &refVal) const
Make absolute coordinates relative and vice versa with respect to the given reference value.
 
virtual Bool near(const Coordinate &other, const Vector< Int > &excludeAxes, Double tol=1.0e-6) const =0
 
Vector< Double > worldMin_p
toMix ranges.
 
virtual String showType() const =0
 
virtual Bool setLinearTransform(const Matrix< Double > &xform)=0
 
virtual uInt nPixelAxes() const =0
How many world/pixel axes are there in this Coordinate? While the number of world and pixel axes will...
 
virtual Coordinate * makeFourierCoordinate(const Vector< Bool > &axes, const Vector< Int > &shape) const
Find the Coordinate for when we Fourier Transform ourselves.
 
void xFormToPC(wcsprm &wcs, const Matrix< Double > &xForm) const
 
String: the storage and methods of handling collections of characters.
 
this file contains all the compiler specific defines
 
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
 
bool Bool
Define the standard types used by Casacore.
 
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.