GWcs.hpp
4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/***************************************************************************
* GWcs.hpp - World Coordinate System virtual base class *
* ----------------------------------------------------------------------- *
* copyright (C) 2010 by Jurgen Knodlseder *
* ----------------------------------------------------------------------- *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/**
* @file GWcs.hpp
* @brief GWcs virtual base class definition.
* @author J. Knodlseder
*/
#ifndef GWCS_HPP
#define GWCS_HPP
/* __ Includes ___________________________________________________________ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "GFitsHDU.hpp"
#include "GSkyDir.hpp"
#include "GSkyPixel.hpp"
#include "GMatrix.hpp"
#include "GVector.hpp"
/***********************************************************************//**
* @class GWcs
*
* @brief GWcs virtual base class interface defintion
***************************************************************************/
class GWcs {
// Friend classes
friend class GSkymap;
public:
// Constructors and destructors
GWcs(void);
GWcs(const std::string& coords,
const double& crval1, const double& crval2,
const double& crpix1, const double& crpix2,
const double& cdelt1, const double& cdelt2);
GWcs(const GWcs& wcs);
virtual ~GWcs(void);
// Operators
virtual GWcs& operator= (const GWcs& wcs);
// Pure virtual methods (not implemented)
virtual void read(const GFitsHDU* hdu) = 0;
virtual void write(GFitsHDU* hdu) const = 0;
// Virtual methods
virtual std::string type(void) const;
virtual std::string coordsys(void) const;
virtual void coordsys(const std::string& coordsys);
virtual double omega(const int& pix) const;
virtual double omega(const GSkyPixel& pix) const;
virtual GSkyDir pix2dir(const int& pix);
virtual int dir2pix(GSkyDir dir) const;
virtual GSkyDir xy2dir(const GSkyPixel& pix);
virtual GSkyPixel dir2xy(GSkyDir dir) const;
private:
// Private methods
void init_members(void);
void copy_members(const GWcs& wcs);
void free_members(void);
virtual GWcs* clone(void) const = 0;
protected:
// Typdefs
typedef void (GWcs::*_wcspf)(GVector* coord) const;
// Protected methods (providing services to derived classes)
GVector wcs_dir2native(GSkyDir dir) const;
GSkyDir wcs_native2dir(GVector native) const;
void wcs_init(const double& theta0);
GVector wcs_getpole(const double& theta0);
GMatrix wcs_get_rot(void);
void wcs_set(const std::string& coords,
const double& crval1, const double& crval2,
const double& crpix1, const double& crpix2,
const double& cdelt1, const double& cdelt2);
void wcs_read(const GFitsHDU* hdu);
void wcs_write(GFitsHDU* hdu) const;
std::string wcs_crval1(void) const;
std::string wcs_crval2(void) const;
void wcs_dump(std::ostream& os) const;
// Protected data area (astr structure)
std::string m_type; //!< WCS type
int m_coordsys; //!< 0=celestial, 1=galactic
int m_reverse; //!< Reverse axes (1=true)
GVector m_crval; //!< Value of reference point
GVector m_crpix; //!< Pixel of reference point (starting from 1)
GVector m_cdelt; //!< Increment at reference point (deg/pixel)
GVector m_npole; //!< Native coordinate of North Pole
GMatrix m_cd; //!< Astrometry parameters (2x2 matrix, deg/pixel)
GVector m_pv2; //!< Projection parameters (up to 21)
// Derived parameters
double m_theta0; //!< Native latitude of the fiducial point
GVector m_refval; //!< Ordered value of reference point
GVector m_refpix; //!< Pixel of reference point (starting from 0)
GMatrix m_invcd; //!< Inverse of CD matrix
GVector m_native_pole; //!< Coordinates of native pole
GMatrix m_rot; //!< Rotation matrix
GMatrix m_trot; //!< Transpose of rotation matrix
_wcspf m_std2nat; //!< Standard to native projection function
_wcspf m_nat2std; //!< Native to standard projection function
};
#endif /* GWCS_HPP */