GSkyRegion.hpp
6.3 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/***************************************************************************
* GSkyRegion.hpp - Abstract virtual sky region base class *
* ----------------------------------------------------------------------- *
* copyright (C) 2013-2017 by Pierrick Martin *
* ----------------------------------------------------------------------- *
* *
* 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 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
/**
* @file GSkyRegion.hpp
* @brief Abstract sky region base class interface definition
* @author Pierrick Martin
*/
#ifndef GSKYREGION_HPP
#define GSKYREGION_HPP
/* __ Includes ___________________________________________________________ */
#include <vector>
#include <string>
#include "GBase.hpp"
/* __ Forward declarations _______________________________________________ */
class GSkyPixel;
class GSkyDir;
/***********************************************************************//**
* @class GSkyRegion
*
* @brief Abstract interface for the sky region class
*
* This class provides an abstract interface for a sky region. The sky region
* is defined by an array of parameters names and values specific to the
* derived class where the region type or shape is implemented.
*
* Accessible information elements are:
* - Type of the region (circle, rectangle,...)
* - Solid angle subtended by the region
*
* The object can be initialised from a string in the DS9 region file format,
* and return its description as a string in the DS9 region file format. The
* input/ouput to/from files is handled in the container class GSkyRegions.
***************************************************************************/
class GSkyRegion : public GBase {
public:
// Constructors and destructors
GSkyRegion(void);
GSkyRegion(const GSkyRegion& region);
virtual ~GSkyRegion(void);
// Operators
virtual GSkyRegion& operator=(const GSkyRegion& region);
// Pure virtual methods
virtual void clear(void) = 0;
virtual GSkyRegion* clone(void) const = 0;
virtual std::string classname(void) const = 0;
virtual void read(const std::string& regstring) = 0;
virtual std::string write(void) const = 0;
virtual bool contains(const GSkyDir& dir) const = 0;
virtual bool overlaps(const GSkyRegion& reg) const = 0;
virtual bool contains(const GSkyRegion& reg) const = 0;
virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
// Implemented methods
const std::string& type(void) const;
const std::string& name(void) const;
const double& solidangle(void) const;
void type(const std::string& type);
void name(const std::string& name);
void solidangle(const double& solidangle);
protected:
// Protected methods
void init_members(void);
void copy_members(const GSkyRegion& region);
void free_members(void);
// Protected members
std::string m_type; //!< Type of the region (circle, rectangle,...)
std::string m_name; //!< Name of the region
double m_solid; //!< Solid angle subtended by the region (sr)
};
/***********************************************************************//**
* @brief Return region name
*
* @return Region name
*
* Returns the region name.
***************************************************************************/
inline
const std::string& GSkyRegion::name(void) const
{
return (m_name);
}
/***********************************************************************//**
* @brief Set region name
*
* @param[in] name Region name.
*
* Sets the region name.
***************************************************************************/
inline
void GSkyRegion::name(const std::string& name)
{
m_name = name;
return;
}
/***********************************************************************//**
* @brief Return region type
*
* @return Region type
*
* Returns the region type.
***************************************************************************/
inline
const std::string& GSkyRegion::type(void) const
{
return (m_type);
}
/***********************************************************************//**
* @brief Set region type
*
* @param[in] type Region type.
*
* Sets the region type.
***************************************************************************/
inline
void GSkyRegion::type(const std::string& type)
{
m_type = type;
return;
}
/***********************************************************************//**
* @brief Return solid angle of region
*
* @return Solid angle of region.
*
* Returns the solid angle subtended by the region (in steradians).
***************************************************************************/
inline
const double& GSkyRegion::solidangle(void) const
{
return (m_solid);
}
/***********************************************************************//**
* @brief Set solid angle of region
*
* @param[in] solidangle Solid angle of region (in steradians).
*
* Sets the solid angle subtended by the region (in steradians).
***************************************************************************/
inline
void GSkyRegion::solidangle(const double& solidangle)
{
m_solid = solidangle;
return;
}
#endif /* GSKYREGION_HPP */