GSkyRegionMap.hpp
5.6 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
/***************************************************************************
* GSkyRegionMap.hpp - Sky region map class *
* ----------------------------------------------------------------------- *
* copyright (C) 2017-2020 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 GSkyRegionMap.hpp
* @brief Sky region map class interface definition
* @author Pierrick Martin
*/
#ifndef GSKYREGIONMAP_HPP
#define GSKYREGIONMAP_HPP
/* __ Includes ___________________________________________________________ */
#include <vector>
#include <string>
#include "GSkyRegion.hpp"
#include "GSkyMap.hpp"
#include "GFilename.hpp"
/* __ Forward declarations _______________________________________________ */
class GSkyDir;
class GSkyRegionMap;
class GSkyRegionRectangle;
/***********************************************************************//**
* @class GSkyRegionMap
*
* @brief Interface for a sky region map
*
* This class provides an implementation for a sky region defined by a
* sky map. The map is provided as a FITS file. Pixels with non-zero values
* are within the region, pixels with zero values outside the region.
***************************************************************************/
class GSkyRegionMap : public GSkyRegion {
public:
// Constructors and destructors
GSkyRegionMap(void);
explicit GSkyRegionMap(const GFilename& filename);
explicit GSkyRegionMap(const GSkyMap& map);
explicit GSkyRegionMap(const GSkyRegion* region);
GSkyRegionMap(const GSkyRegionMap& region);
virtual ~GSkyRegionMap(void);
// Operators
GSkyRegionMap& operator=(const GSkyRegionMap& region);
// Implemented pure virtual methods
void clear(void);
GSkyRegionMap* clone(void) const;
std::string classname(void) const;
void read(const std::string& line);
std::string write(void) const;
bool contains(const GSkyDir& dir) const;
bool contains(const GSkyRegion& reg) const;
bool overlaps(const GSkyRegion& reg) const;
std::string print(const GChatter& chatter = NORMAL) const;
// Other methods
void load(const GFilename& filename);
void map(const GSkyMap& map);
const GSkyMap& map(void) const;
const std::vector<int>& nonzero_indices(void) const;
protected:
// Protected methods
void init_members(void);
void copy_members(const GSkyRegionMap& region);
void free_members(void);
void compute_solid_angle(void);
void set_nonzero_indices(void);
void set_region_circle(const GSkyRegionCircle* circle);
void set_region_rectangle(const GSkyRegionRectangle* rect);
// Protected members
GSkyMap m_map; //!< The region map
std::vector<int> m_nonzero_indices; //!< Vector of non-zero pixel indices
};
/***********************************************************************//**
* @brief Return class name
*
* @return String containing the class name ("GSkyRegionMap").
***************************************************************************/
inline
std::string GSkyRegionMap::classname(void) const
{
return ("GSkyRegionMap");
}
/***********************************************************************//**
* @brief Return sky map
*
* @return region sky map.
***************************************************************************/
inline
const GSkyMap& GSkyRegionMap::map(void) const
{
return (m_map);
}
/***********************************************************************//**
* @brief Get non-zero index vector
*
* @return Reference to non-zero pixel indices vector.
***************************************************************************/
inline
const std::vector<int>& GSkyRegionMap::nonzero_indices(void) const
{
return (m_nonzero_indices);
}
/***********************************************************************//**
* @brief Return file name
*
* @return File name from which the region was loaded or into which
* the region was saved.
*
* Returns the file name from which the region was loaded or into
* which the region was saved. The returned string will be empty if
* no load() or save() method has been called before.
***************************************************************************/
/*
inline
const GFilename& GSkyRegionMap::filename(void) const
{
return (m_filename);
}
*/
#endif /* GSKYREGIONMAP_HPP */