30 #ifndef COORDINATES_COORDINATE_H
31 #define COORDINATES_COORDINATE_H
36 #include <wcslib/wcs.h>
41 template<
class T>
class Quantum;
42 template<
class T>
class Matrix;
44 class RecordInterface;
434 Int defPrecScientific,
436 Int defPrecTime)
const;
461 const String &fieldName)
const = 0;
484 static void set_wcs (::wcsprm& wcs);
487 static void init_wcs (::wcsprm& wcs,
int naxis);
490 static void sub_wcs(const ::wcsprm &src,
int &nsub,
int axes[], ::wcsprm &dst);
493 static void copy_wcs(const ::wcsprm &src, ::wcsprm &dst);
520 const String& nameIn)
const;
574 const Bool absolute)
const;
A Vector of integers, for indexing into Array<T> objects.
String formatQuantity(String &units, Coordinate::formatType format, const Quantum< Double > &worldValue, uInt axis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1)
virtual ~Coordinate()
Destructor.
static String typeToString(Coordinate::Type type)
virtual Vector< Double > referenceValue() const =0
virtual void setDefaultWorldMixRanges()
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.
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.
virtual Vector< String > worldAxisNames() const =0
Return the requested attributed.
virtual Vector< Double > referencePixel() const =0
virtual Type type() const =0
List the type of this Coordinate object.
Default; formatter decides.
Vector< Double > worldMixMax() const
virtual Bool setReferencePixel(const Vector< Double > &refPix)=0
Vector< Double > worldMin_p
toMix ranges.
const String & errorMessage() const
If the last conversion to world or pixel coordinates resulted in an error, report that error...
virtual void makeWorldAbsoluteMany(Matrix< Double > &world) const
Vector< Double > worldMixMin() const
static void sub_wcs(const ::wcsprm &src, int &nsub, int axes[],::wcsprm &dst)
Call wcssub on the src/dst pair.
Vector< Double > worldMax_p
virtual Bool setWorldAxisUnits(const Vector< String > &units)=0
Change the units.
void xFormToPC(wcsprm &wcs, const Matrix< Double > &xForm) 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.
virtual Vector< String > worldAxisUnits() const =0
formatType
This enum is used for formatting world values into Strings.
virtual Bool setWorldAxisNames(const Vector< String > &names)=0
Set the requested attribute.
virtual Bool setReferenceValue(const Vector< Double > &refval)=0
virtual Bool toPixelMany(Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures) const
void fromCurrentMany(Matrix< Double > &world, const Vector< Double > &toCurrentFactors) const
Coordinate()
Default constructor.
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
Bool toPixelWCS(Vector< Double > &pixel, const Vector< Double > &world, wcsprm &wcs) const
static void init_wcs(::wcsprm &wcs, int naxis)
Call wcsini on the wcs structure.
virtual Matrix< Double > linearTransform() const =0
void makePixelAbsRelMany(Matrix< Double > &value, Bool toAbs) const
virtual void makeWorldRelativeMany(Matrix< Double > &world) const
Either scientific or floating point, auto-selected by the C++ STL formatting routines.
Interface for converting between world and pixel coordinates.
virtual void makePixelAbsolute(Vector< Double > &pixel) const
virtual Bool toPixel(Vector< Double > &pixel, const Vector< Double > &world) const =0
virtual String showType() const =0
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 void makeWorldAbsolute(Vector< Double > &world) const
virtual Coordinate * clone() const =0
Make a copy of ourself.
bool Bool
Define the standard types used by Casacore.
void convertFromMany(Matrix< Double > &world) const
A CoordinateSystem (a collection of Coordinates).
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...
A one-dimensional Cooordinate system, usually created from a table although it can also be purely lin...
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
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.
Type
This enum lists the types of the derived classes.
virtual void convertTo(Vector< Double > &) const
Functions for handling conversion between the current reference frame and the native one...
virtual void convertFrom(Vector< Double > &) const
virtual uInt nWorldAxes() const =0
virtual Bool save(RecordInterface &container, const String &fieldName) const =0
Used for persistence.
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...
Bool toPixelManyWCS(Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures, wcsprm &wcs) const
void toCurrentMany(Matrix< Double > &world, const Vector< Double > &toCurrentFactors) const
Functions for handling conversion between the current units and the wcs units.
Coordinate & operator=(const Coordinate &other)
Assignment (copy semantics)
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.
virtual Bool setLinearTransform(const Matrix< Double > &xform)=0
static void set_wcs(::wcsprm &wcs)
Call wcsset on the wcs structure.
const Double e
e and functions thereof:
void convertToMany(Matrix< Double > &world) const
Functions for handling conversion between the current reference frame and the native one for many con...
virtual uInt nPixelAxes() const =0
How many world/pixel axes are there in this Coordinate? While the number of world and pixel axes will...
Bool toWorldManyWCS(Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures, wcsprm &wcs) const
void makeWorldAbsRelMany(Matrix< Double > &value, Bool toAbs) const
String: the storage and methods of handling collections of characters.
void checkFormat(Coordinate::formatType &format, const Bool absolute) const
Check format type.
virtual void makePixelRelative(Vector< Double > &pixel) const
Make absolute coordinates relative and vice-versa (with respect to the reference value).
virtual void makeWorldRelative(Vector< Double > &world) const
virtual Vector< Double > increment() const =0
Abstract base class for Record classes.
static void copy_wcs(const ::wcsprm &src,::wcsprm &dst)
Call wcssub on the src/dst pair with null nsub/axes.
virtual Bool near(const Coordinate &other, Double tol=1.0e-6) const =0
Comparison to fractional tolerance (for floating point values).
to mark DATA and ERROR values
void pcToXform(Matrix< Double > &xForm, const wcsprm &wcs) const
Interconvert between wcs PC cards and Matrix xForm format.
HHH:MM:SS.SSS style formatting.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
Bool toWorldWCS(Vector< Double > &world, const Vector< Double > &pixel, wcsprm &wcs) const
Functions to interconvert pixel<->world via wcs.
virtual Bool setIncrement(const Vector< Double > &inc)=0
virtual Coordinate * makeFourierCoordinate(const Vector< Bool > &axes, const Vector< Int > &shape) const
Find the Coordinate for when we Fourier Transform ourselves.
void set_error(const String &errorMsg) const
Set error message.
virtual void makePixelAbsoluteMany(Matrix< Double > &pixel) const
virtual Bool toWorldMany(Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures) const
Batch up a lot of transformations.
Fixed floating format (e.g.
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.
virtual void makePixelRelativeMany(Matrix< Double > &pixel) const
Batch up a lot of absolute/relative transformations.