27#ifndef COORDINATES_DIRECTIONCOORDINATE_H
28#define COORDINATES_DIRECTIONCOORDINATE_H
30#include <casacore/casa/aips.h>
31#include <casacore/coordinates/Coordinates/Coordinate.h>
32#include <casacore/coordinates/Coordinates/Projection.h>
33#include <casacore/casa/Arrays/Vector.h>
34#include <casacore/measures/Measures/MDirection.h>
35#include <casacore/measures/Measures/MeasConvert.h>
36#include <casacore/casa/Quanta/RotMatrix.h>
37#include <wcslib/wcs.h>
48template<
class T>
class Quantum;
275 const ::wcsprm& wcs,
Bool oneRel=
True);
534 Int defPrecScientific,
536 Int defPrecTime)
const;
565 const String &fieldName)
const;
654 Bool absolute)
const;
674 Bool longIsWorld)
const;
Type
This enum lists the types of the derived classes.
formatType
This enum is used for formatting world values into Strings.
void setReferenceFrame(const MDirection::Types rf)
Set the base (as opposed to conversion) reference frame.
MDirection::Types directionType(Bool showConversion=False) const
Recover the requested attribute.
virtual Matrix< Double > linearTransform() const
Quantity getPixelArea() const
get the pixel area.
Vector< String > units_p
Current units.
Vector< Double > to_degrees_p
WCS computes in degrees - use this to convert back and forth between current DirectionCoordinate unit...
virtual ~DirectionCoordinate()
Destructor.
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.
static DirectionCoordinate * restore(const RecordInterface &container, const String &fieldName)
Recover the DirectionCoordinate from a record.
virtual void setDefaultWorldMixRanges()
virtual uInt nWorldAxes() const
MDirection::Types conversionType_p
virtual void makeWorldRelative(Vector< Double > &world) const
Make absolute world coordinates relative and vice-versa (relative to the reference value).
virtual Bool setWorldAxisUnits(const Vector< String > &units)
Change the world axis units.
void makeConversionMachines()
Set up conversion machine.
virtual Bool toWorldMany(Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures) const
Batch up a lot of transformations.
DirectionCoordinate & operator=(const DirectionCoordinate &other)
Assignment (copy semantics).
void toCurrent(Vector< Double > °rees) const
Interconvert between the current units and wcs units (degrees)
virtual String format(String &units, Coordinate::formatType format, Double worldValue, uInt axis, Bool isAbsolute, Bool showAsAbsolute, Int precision=-1, Bool usePrecForMixed=False) const
virtual Bool save(RecordInterface &container, const String &fieldName) const
Save the DirectionCoordinate into the supplied record using the supplied field name.
virtual Bool near(const Coordinate &other, Double tol=1e-6) const
Comparison function.
void makeWCS(::wcsprm &wcs, const Matrix< Double > &xform, const Projection &proj, MDirection::Types directionType, Double refPixLong, Double refPixLat, Double refLong, Double refLat, Double incLong, Double incLat, Double longPole, Double latPole)
void makeDirectionCoordinate(MDirection::Types directionType, const Projection &proj, Double refLong, Double refLat, Double incLong, Double incLat, const Matrix< Double > &xform, Double refX, Double refY, Double longPole, Double latPole)
Helper functions interfacing to WCS.
Bool toPixel(Vector< Double > &pixel, const MDirection &world) const
Vector< Double > to_radians_p
virtual Vector< Double > referencePixel() const
virtual void makeWorldRelative(MDirection &world) const
DirectionCoordinate convert(Quantity &angle, MDirection::Types directionType) const
Convert this coordinate to another reference frame by rotating it about the reference pixel so the th...
virtual Bool setIncrement(const Vector< Double > &inc)
MDirection::Types type_p
Direction type.
static Vector< String > axisNames(MDirection::Types type, Bool FITSName=False)
Return canonical axis names for the given MDirection type, giving FITS names if desired.
virtual Bool toPixel(Vector< Double > &pixel, const Vector< Double > &world) const
world values must have units equivalent to the world axis units.
virtual Bool setWorldAxisNames(const Vector< String > &names)
Set the value of the requested attribute.
const Vector< Double > toCurrentFactors() const
Return unit conversion vector for converting to current units.
RotMatrix rot_p
Rotation matrix used to handle relative coordinates.
virtual Vector< Double > referenceValue() const
Vector< Double > longLatPoles() const
Fish out the ref and non-native poles (refLong, refLat, longPole, latPole) Not for general use.
DirectionCoordinate(MDirection::Types directionType, const ::wcsprm &wcs, Bool oneRel=True)
Constructor from WCS structure; must hold ONLY a celestial wcs structure Specify whether the absolute...
virtual Bool setReferenceValue(const Vector< Double > &refval)
void setProjection(const Projection &)
Set the projection.
Bool cylindricalFix(Int shapeLong, Int shapeLat)
Fix cylindrical coordinates to put the longitude in [-180,180] range.
virtual Bool toWorld(Vector< Double > &world, const Vector< Double > &pixel, Bool useConversionFrame=True) const
Convert a pixel position to a world position or vice versa.
virtual Vector< String > worldAxisNames() const
Return the requested attributed.
Projection projection() const
Bool toWorld(MVDirection &world, const Vector< Double > &pixel) const
MVDirection toWorld(const Vector< Double > &pixel) 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 pixel/world coordinate conversion.
void setReferenceConversion(MDirection::Types type)
Set extra conversion type.
virtual Coordinate * makeFourierCoordinate(const Vector< Bool > &axes, const Vector< Int > &shape) const
Find the Coordinate for when we Fourier Transform ourselves.
virtual Coordinate * clone() const
Make a copy of the DirectionCoordinate using new.
void getReferenceConversion(MDirection::Types &type) const
virtual Vector< Double > increment() const
void setRotationMatrix()
Set up the offset coordinate rotation matrix.
void setWorldMixRanges(const Vector< Bool > &which, const Vector< Double > &world)
Non-virtual function.
Bool toMix2(Vector< Double > &out, const Vector< Double > &in, const Vector< Double > &minWorld, const Vector< Double > &maxWorld, Bool longIsWorld) const
Mixed pixel/world coordinate conversion.
Bool hasSquarePixels() const
Are the pixels square?
virtual void makeWorldAbsolute(MDirection &world) const
virtual Bool setLinearTransform(const Matrix< Double > &xform)
Double putLongInPiRange(Double lon, const String &unit) const
MDirection::Convert * pConversionMachineTo_p
Conversion machines.
Vector< String > names_p
Axis names.
virtual Coordinate::Type type() const
Return Coordinate::DIRECTION.
virtual String showType() const
Always returns the String "Direction".
DirectionCoordinate(const DirectionCoordinate &other)
Copy constructor (copy semantics)
String formatLongitude(String &units, MVAngle &mVA, MDirection::GlobalTypes gtype, Bool absolute, Coordinate::formatType form, Int prec) const
Format a longitude.
void initializeFactors()
Initialize unit conversion vectors and units.
String formatLatitude(String &units, MVAngle &mVA, Bool absolute, Coordinate::formatType form, Int prec) const
Format a latitude.
virtual void convertFrom(Vector< Double > &world) const
void checkFormat(Coordinate::formatType &format, Bool absolute) const
Check formatting types.
void fromCurrent(Vector< Double > ¤t) const
virtual void getPrecision(Int &precision, Coordinate::formatType &format, Bool showAsAbsolute, Int defPrecScientific, Int defPrecFixed, Int defPrecTime) const
Format a DirectionCoordinate coordinate world value nicely through the common format interface.
MDirection::Convert * pConversionMachineFrom_p
DirectionCoordinate()
The default constructor creates a J2000 DirectionCoordinate with a CARtesion projection with longitud...
Vector< Double > toPixel(const MDirection &world) const
DirectionCoordinate(MDirection::Types directionType, const Projection &projection, const Quantum< Double > &refLong, const Quantum< Double > &refLat, const Quantum< Double > &incLong, const Quantum< Double > &incLat, const Matrix< Double > &xform, Double refX, Double refY, const Quantum< Double > &longPole=Quantum< Double >(999.0, Unit("rad")), const Quantum< Double > &latPole=Quantum< Double >(999.0, Unit("rad")))
Create DirectionCoordinate with Quantum-based interface.
mutable::wcsprm wcs_p
WCS structure.
virtual void makeWorldAbsolute(Vector< Double > &world) const
virtual Bool near(const Coordinate &other, const Vector< Int > &excludeAxes, Double tol=1e-6) const
virtual Bool setReferencePixel(const Vector< Double > &refPix)
DirectionCoordinate(MDirection::Types directionType, const Projection &projection, Double refLong, Double refLat, Double incLong, Double incLat, const Matrix< Double > &xform, Double refX, Double refY, Double longPole=999.0, Double latPole=999.0)
Define the DirectionCoordinate transformation.
void copy(const DirectionCoordinate &other)
Copy private data.
void setRotationMatrix(RotMatrix &rot, Double lon, Double lat) const
Bool toPixel(Vector< Double > &pixel, const MVDirection &world) const
Projection projection_p
Projection parameters.
Bool isNCP() const
Is the projection equivalent to NCP?
virtual Bool toPixelMany(Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures) const
Bool toWorld(MDirection &world, const Vector< Double > &pixel) const
A convenient way to turn the world vector into an MDirection or MVDirection for further processing in...
virtual Vector< String > worldAxisUnits() const
virtual void convertTo(Vector< Double > &world) const
Convert from type_p -> conversionType_p.
virtual Bool setWorldMixRanges(const IPosition &shape)
Compute and retrieve the world min and max ranges, for use in function toMix, for a lattice of the gi...
virtual uInt nPixelAxes() const
Always returns 2.
Vector< Double > toPixel(const MVDirection &world) const
void normalizePCMatrix()
Normalize each row of the PC matrix such that increment() will return the actual angular increment an...
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
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.