30 #ifndef COORDINATES_COORDINATE_H
31 #define COORDINATES_COORDINATE_H
33 #include <casacore/casa/aips.h>
34 #include <casacore/casa/Arrays/ArrayFwd.h>
35 #include <casacore/casa/BasicSL/String.h>
36 #include <casacore/casa/Arrays/Vector.h>
37 #include <wcslib/wcs.h>
42 template<
class T>
class Quantum;
44 class RecordInterface;
367 Double tol=1.0e-6)
const = 0;
370 Double tol=1.0e-6)
const = 0;
434 Int defPrecScientific,
436 Int defPrecTime)
const;
461 const String &fieldName)
const = 0;
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;
const String & errorMessage() const
If the last conversion to world or pixel coordinates resulted in an error, report that error.
virtual Vector< Double > referencePixel() const =0
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...
Vector< Double > worldMixMax() const
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 void convertFrom(Vector< Double > &) const
Bool toWorldWCS(Vector< Double > &world, const Vector< Double > &pixel, wcsprm &wcs) const
Functions to interconvert pixel<->world via wcs.
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 Vector< String > worldAxisNames() const =0
Return the requested attributed.
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
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< Double > referenceValue() const =0
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 Coordinate * clone() const =0
Make a copy of ourself.
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.
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 Vector< String > worldAxisUnits() const =0
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.
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
Coordinate & operator=(const Coordinate &other)
Assignment (copy semantics)
virtual Bool setReferenceValue(const Vector< Double > &refval)=0
virtual Bool setReferencePixel(const Vector< Double > &refPix)=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).
virtual Coordinate * makeFourierCoordinate(const Vector< Bool > &axes, const Vector< Int > &shape) const
Find the Coordinate for when we Fourier Transform ourselves.
virtual Coordinate * rotate(const Quantum< Double > &angle) const
return the result of rotating the coordinate clockwise through the specified angle.
virtual Matrix< Double > linearTransform() const =0
virtual Vector< Double > increment() const =0
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 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...
Vector< Double > worldMixMin() const
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.