GSkyRegionCircle.hpp

Martin Pierrick, 06/21/2013 04:59 PM

Download (5.65 KB)

 
1
/***************************************************************************
2
 *             GSkyRegionCircle.hpp - Circular sky region class            *
3
 * ----------------------------------------------------------------------- *
4
 *  copyright (C) 2009-2013 by Juergen Knoedlseder                         *
5
 * ----------------------------------------------------------------------- *
6
 *                                                                         *
7
 *  This program is free software: you can redistribute it and/or modify   *
8
 *  it under the terms of the GNU General Public License as published by   *
9
 *  the Free Software Foundation, either version 3 of the License, or      *
10
 *  (at your option) any later version.                                    *
11
 *                                                                         *
12
 *  This program is distributed in the hope that it will be useful,        *
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
15
 *  GNU General Public License for more details.                           *
16
 *                                                                         *
17
 *  You should have received a copy of the GNU General Public License      *
18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
19
 *                                                                         *
20
 ***************************************************************************/
21
/**
22
 * @file GSkyRegionCircle.hpp
23
 * @brief Circular sky region class interface definition
24
 * @author Pierrick Martin
25
 */
26

    
27
#ifndef GSKYREGIONCIRCLE_HPP
28
#define GSKYREGIONCIRCLE_HPP
29

    
30
/* __ Includes ___________________________________________________________ */
31
#include <string>
32
#include "GSkyRegion.hpp"
33
#include "GSkyDir.hpp"
34
#include "GXmlElement.hpp"
35

    
36

    
37
/***********************************************************************//**
38
 * @class GSkyRegionCircle
39
 *
40
 * @brief Circular sky region
41
 *
42
 * This class implements a sky region delimited by a circle over the sky.
43
 * The sky region has three parameters: the Right Ascension and Declination 
44
 * of the centre, and the radius of the circle.
45
 *
46
 ***************************************************************************/
47
class GSkyRegionCircle : public GSkyRegion {
48

    
49
public:
50
    // Constructors and destructors
51
    GSkyRegionCircle(void);
52
        GSkyRegionCircle(const GSkyRegionCircle& region);
53
    explicit GSkyRegionCircle(const GSkyDir& dir, const double& rad);
54
    explicit GSkyRegionCircle(const double& ra, const double& dec, const double& rad);
55
    explicit GSkyRegionCircle(const GXmlElement& xml);    
56
    virtual ~GSkyRegionCircle(void);
57

    
58
    // Operators
59
    virtual GSkyRegionCircle& operator=(const GSkyRegionCircle& region);
60

    
61
    // Implemented pure virtual methods
62
    virtual void         clear(void);
63
    virtual GSkyRegion*  clone(void) const;
64
    virtual std::string  type(void) const;
65
    virtual void         read(const GXmlElement& xml);
66
    virtual void         write(GXmlElement& xml) const;
67
    virtual std::string  print(const GChatter& chatter = NORMAL) const;
68

    
69
    // Other methods
70
    double  ra(void) const;
71
    double  dec(void) const;
72
    void    ra(const double& ra);
73
    void    dec(const double& dec);
74
    GSkyDir dir(void) const;
75
    void    dir(const GSkyDir& dir);
76
    double  rad(void) const;
77
    void    rad(const double& rad);
78

    
79
protected:
80
    // Protected methods
81
    void init_members(void);
82
    void copy_members(const GSkyRegionCircle& region);
83
    void free_members(void);
84

    
85
    // Protected members
86
    double m_ra;          //!< Right Ascension of centre (deg)
87
    double m_dec;         //!< Declination of centre (deg)
88
    double m_rad;         //!< Circle radius (deg)
89
};
90

    
91

    
92
/***********************************************************************//**
93
 * @brief Return sky region type
94
 *
95
 * @return "SkyRegionCircle".
96
 *
97
 * Returns the type of the sky region.
98
 ***************************************************************************/
99
inline
100
std::string GSkyRegionCircle::type(void) const
101
{
102
    return "SkyRegionCircle";
103
}
104

    
105

    
106
/***********************************************************************//**
107
 * @brief Return Right Ascension of region centre
108
 *
109
 * @return Right Ascension of region centre (degrees).
110
 *
111
 * Returns the Right Ascension of the region centre in degrees.
112
 ***************************************************************************/
113
inline
114
double GSkyRegionCircle::ra(void) const
115
{
116
    return (m_ra.value());
117
}
118

    
119

    
120
/***********************************************************************//**
121
 * @brief Set Right Ascension of region centre
122
 *
123
 * @param[in] ra Right Ascension of region centre.
124
 *
125
 * Sets the Right Ascension of region centre.
126
 ***************************************************************************/
127
inline
128
void GSkyRegionCircle::ra(const double& ra)
129
{
130
    m_ra.value(ra);
131
    return;
132
}
133

    
134

    
135
/***********************************************************************//**
136
 * @brief Return Declination of region centre
137
 *
138
 * @return Declination of region centre (degrees).
139
 *
140
 * Returns the Declination of the region centre in degrees.
141
 ***************************************************************************/
142
inline
143
double GSkyRegionCircle::dec(void) const
144
{
145
    return (m_dec.value());
146
}
147

    
148

    
149
/***********************************************************************//**
150
 * @brief Set Declination of region centre
151
 *
152
 * @param[in] dec Declination of region centre.
153
 *
154
 * Sets the Declination of region centre.
155
 ***************************************************************************/
156
inline
157
void GSkyRegionCircle::dec(const double& dec)
158
{
159
    m_dec.value(dec);
160
    return;
161
}
162

    
163
#endif /* GSKYREGIONCIRCLE_HPP */