Commit 9fccc58827f3dac7a80f9ce6800667fc575666fe
1 parent
ca6d6d37
Rename GSkyRegionRect to GSkyRegionRectangle
Showing
13 changed files
with
211 additions
and
202 deletions
include/GSkyRegionMap.hpp
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | /* __ Forward declarations _______________________________________________ */ |
| 38 | 38 | class GSkyDir; |
| 39 | 39 | class GSkyRegionMap; |
| 40 | -class GSkyRegionRect; | |
| 40 | +class GSkyRegionRectangle; | |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | /***********************************************************************//** |
| ... | ... | @@ -88,7 +88,7 @@ protected: |
| 88 | 88 | void compute_solid_angle(void); |
| 89 | 89 | void set_nonzero_indices(void); |
| 90 | 90 | void set_region_circle(const GSkyRegionCircle* circle); |
| 91 | - void set_region_rect(const GSkyRegionRect* rect); | |
| 91 | + void set_region_rectangle(const GSkyRegionRectangle* rect); | |
| 92 | 92 | |
| 93 | 93 | // Protected members |
| 94 | 94 | GSkyMap m_map; //!< The region map | ... | ... |
include/GSkyRegionRect.hpp renamed to include/GSkyRegionRectangle.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | - * GSkyRegionRect.hpp - rectangular sky region class * | |
| 2 | + * GSkyRegionRectangle.hpp - Rectangular sky region class * | |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | 4 | * copyright (C) 2019-2020 by Andreas Specovius * |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| ... | ... | @@ -19,13 +19,13 @@ |
| 19 | 19 | * * |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | /** |
| 22 | - * @file GSkyRegionRect.hpp | |
| 22 | + * @file GSkyRegionRectangle.hpp | |
| 23 | 23 | * @brief Rectangular sky region class interface definition |
| 24 | 24 | * @author Andreas Specovius |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -#ifndef GSKYREGIONRECT_HPP | |
| 28 | -#define GSKYREGIONRECT_HPP | |
| 27 | +#ifndef GSKYREGIONRECTANGLE_HPP | |
| 28 | +#define GSKYREGIONRECTANGLE_HPP | |
| 29 | 29 | |
| 30 | 30 | /* __ Includes ___________________________________________________________ */ |
| 31 | 31 | #include <vector> |
| ... | ... | @@ -38,7 +38,7 @@ class GSkyPixel; |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | /***********************************************************************//** |
| 41 | - * @class GSkyRegionRect | |
| 41 | + * @class GSkyRegionRectangle | |
| 42 | 42 | * |
| 43 | 43 | * @brief Interface for the rectangular sky region class |
| 44 | 44 | * |
| ... | ... | @@ -59,54 +59,54 @@ class GSkyPixel; |
| 59 | 59 | * be received via the method get_corner(index). |
| 60 | 60 | * |
| 61 | 61 | ***************************************************************************/ |
| 62 | -class GSkyRegionRect : public GSkyRegion { | |
| 62 | +class GSkyRegionRectangle : public GSkyRegion { | |
| 63 | 63 | |
| 64 | 64 | public: |
| 65 | 65 | // Constructors and destructors |
| 66 | - GSkyRegionRect(void); | |
| 67 | - GSkyRegionRect(const GSkyDir& centre, | |
| 68 | - const double& width, | |
| 69 | - const double& height, | |
| 70 | - const double& posang); | |
| 71 | - GSkyRegionRect(const double& ra, | |
| 72 | - const double& dec, | |
| 73 | - const double& width, | |
| 74 | - const double& height, | |
| 75 | - const double& posang); | |
| 76 | - explicit GSkyRegionRect(const std::string& line); | |
| 77 | - GSkyRegionRect(const GSkyRegionRect& region); | |
| 78 | - virtual ~GSkyRegionRect(void); | |
| 66 | + GSkyRegionRectangle(void); | |
| 67 | + GSkyRegionRectangle(const GSkyDir& centre, | |
| 68 | + const double& width, | |
| 69 | + const double& height, | |
| 70 | + const double& posang); | |
| 71 | + GSkyRegionRectangle(const double& ra, | |
| 72 | + const double& dec, | |
| 73 | + const double& width, | |
| 74 | + const double& height, | |
| 75 | + const double& posang); | |
| 76 | + explicit GSkyRegionRectangle(const std::string& line); | |
| 77 | + GSkyRegionRectangle(const GSkyRegionRectangle& region); | |
| 78 | + virtual ~GSkyRegionRectangle(void); | |
| 79 | 79 | |
| 80 | 80 | // Operators |
| 81 | - GSkyRegionRect& operator=(const GSkyRegionRect& region); | |
| 81 | + GSkyRegionRectangle& operator=(const GSkyRegionRectangle& region); | |
| 82 | 82 | |
| 83 | 83 | // Implemented methods |
| 84 | - void clear(void); | |
| 85 | - GSkyRegionRect* clone(void) const; | |
| 86 | - std::string classname(void) const; | |
| 87 | - const GSkyDir& centre(void) const; | |
| 88 | - void centre(const GSkyDir& centre); | |
| 89 | - void centre(const double& ra,const double& dec); | |
| 90 | - double ra(void) const; | |
| 91 | - double dec(void) const; | |
| 92 | - const double& width(void) const; | |
| 93 | - void width(const double& width); | |
| 94 | - const double& height(void) const; | |
| 95 | - void height(const double& height); | |
| 96 | - const double& posang(void) const; | |
| 97 | - void posang(const double& posang); | |
| 98 | - void read(const std::string& line); | |
| 99 | - std::string write(void) const; | |
| 100 | - bool contains(const GSkyDir& dir) const; | |
| 101 | - bool contains(const GSkyRegion& reg) const; | |
| 102 | - bool overlaps(const GSkyRegion& reg) const; | |
| 103 | - GSkyDir corner(const int& index) const; | |
| 104 | - std::string print(const GChatter& chatter = NORMAL) const; | |
| 84 | + void clear(void); | |
| 85 | + GSkyRegionRectangle* clone(void) const; | |
| 86 | + std::string classname(void) const; | |
| 87 | + const GSkyDir& centre(void) const; | |
| 88 | + void centre(const GSkyDir& centre); | |
| 89 | + void centre(const double& ra,const double& dec); | |
| 90 | + double ra(void) const; | |
| 91 | + double dec(void) const; | |
| 92 | + const double& width(void) const; | |
| 93 | + void width(const double& width); | |
| 94 | + const double& height(void) const; | |
| 95 | + void height(const double& height); | |
| 96 | + const double& posang(void) const; | |
| 97 | + void posang(const double& posang); | |
| 98 | + void read(const std::string& line); | |
| 99 | + std::string write(void) const; | |
| 100 | + bool contains(const GSkyDir& dir) const; | |
| 101 | + bool contains(const GSkyRegion& reg) const; | |
| 102 | + bool overlaps(const GSkyRegion& reg) const; | |
| 103 | + GSkyDir corner(const int& index) const; | |
| 104 | + std::string print(const GChatter& chatter = NORMAL) const; | |
| 105 | 105 | |
| 106 | 106 | protected: |
| 107 | 107 | // Protected methods |
| 108 | 108 | void init_members(void); |
| 109 | - void copy_members(const GSkyRegionRect& region); | |
| 109 | + void copy_members(const GSkyRegionRectangle& region); | |
| 110 | 110 | void free_members(void); |
| 111 | 111 | void compute_solid_angle(void); |
| 112 | 112 | bool contains(const GSkyPixel& local) const; |
| ... | ... | @@ -114,22 +114,22 @@ protected: |
| 114 | 114 | GSkyDir local_to_dir(const GSkyPixel& local) const; |
| 115 | 115 | |
| 116 | 116 | // Protected members |
| 117 | - GSkyDir m_centre; //!< Centre or reference point of the region | |
| 118 | - double m_width; //!< Width of the region (degrees) | |
| 119 | - double m_height; //!< Height of the region (degrees) | |
| 120 | - double m_posang; //!< Position angle, counterclockwise from North (degrees) | |
| 117 | + GSkyDir m_centre; //!< Centre or reference point of the region | |
| 118 | + double m_width; //!< Width of the region (degrees) | |
| 119 | + double m_height; //!< Height of the region (degrees) | |
| 120 | + double m_posang; //!< Position angle, counterclockwise from North (degrees) | |
| 121 | 121 | }; |
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | /***********************************************************************//** |
| 125 | 125 | * @brief Return class name |
| 126 | 126 | * |
| 127 | - * @return String containing the class name ("GSkyRegionRect"). | |
| 127 | + * @return String containing the class name ("GSkyRegionRectangle"). | |
| 128 | 128 | ***************************************************************************/ |
| 129 | 129 | inline |
| 130 | -std::string GSkyRegionRect::classname(void) const | |
| 130 | +std::string GSkyRegionRectangle::classname(void) const | |
| 131 | 131 | { |
| 132 | - return ("GSkyRegionRect"); | |
| 132 | + return ("GSkyRegionRectangle"); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
| ... | ... | @@ -141,7 +141,7 @@ std::string GSkyRegionRect::classname(void) const |
| 141 | 141 | * Returns the region centre. |
| 142 | 142 | ***************************************************************************/ |
| 143 | 143 | inline |
| 144 | -const GSkyDir& GSkyRegionRect::centre(void) const | |
| 144 | +const GSkyDir& GSkyRegionRectangle::centre(void) const | |
| 145 | 145 | { |
| 146 | 146 | return (m_centre); |
| 147 | 147 | } |
| ... | ... | @@ -155,7 +155,7 @@ const GSkyDir& GSkyRegionRect::centre(void) const |
| 155 | 155 | * Sets the centre of the rectangular region to the specified sky direction. |
| 156 | 156 | ***************************************************************************/ |
| 157 | 157 | inline |
| 158 | -void GSkyRegionRect::centre(const GSkyDir& dir) | |
| 158 | +void GSkyRegionRectangle::centre(const GSkyDir& dir) | |
| 159 | 159 | { |
| 160 | 160 | m_centre = dir; |
| 161 | 161 | return; |
| ... | ... | @@ -172,7 +172,7 @@ void GSkyRegionRect::centre(const GSkyDir& dir) |
| 172 | 172 | * and Declination. |
| 173 | 173 | ***************************************************************************/ |
| 174 | 174 | inline |
| 175 | -void GSkyRegionRect::centre(const double& ra, const double& dec) | |
| 175 | +void GSkyRegionRectangle::centre(const double& ra, const double& dec) | |
| 176 | 176 | { |
| 177 | 177 | m_centre.radec_deg(ra, dec); |
| 178 | 178 | return; |
| ... | ... | @@ -187,7 +187,7 @@ void GSkyRegionRect::centre(const double& ra, const double& dec) |
| 187 | 187 | * Returns the region centre Right Ascension in degrees. |
| 188 | 188 | ***************************************************************************/ |
| 189 | 189 | inline |
| 190 | -double GSkyRegionRect::ra(void) const | |
| 190 | +double GSkyRegionRectangle::ra(void) const | |
| 191 | 191 | { |
| 192 | 192 | return (m_centre.ra_deg()); |
| 193 | 193 | } |
| ... | ... | @@ -201,7 +201,7 @@ double GSkyRegionRect::ra(void) const |
| 201 | 201 | * Returns the region centre Declination in degrees. |
| 202 | 202 | ***************************************************************************/ |
| 203 | 203 | inline |
| 204 | -double GSkyRegionRect::dec(void) const | |
| 204 | +double GSkyRegionRectangle::dec(void) const | |
| 205 | 205 | { |
| 206 | 206 | return (m_centre.dec_deg()); |
| 207 | 207 | } |
| ... | ... | @@ -215,7 +215,7 @@ double GSkyRegionRect::dec(void) const |
| 215 | 215 | * Returns the region width extension in degrees. |
| 216 | 216 | ***************************************************************************/ |
| 217 | 217 | inline |
| 218 | -const double& GSkyRegionRect::width(void) const | |
| 218 | +const double& GSkyRegionRectangle::width(void) const | |
| 219 | 219 | { |
| 220 | 220 | return (m_width); |
| 221 | 221 | } |
| ... | ... | @@ -229,7 +229,7 @@ const double& GSkyRegionRect::width(void) const |
| 229 | 229 | * Returns the region height extension in degrees. |
| 230 | 230 | ***************************************************************************/ |
| 231 | 231 | inline |
| 232 | -const double& GSkyRegionRect::height(void) const | |
| 232 | +const double& GSkyRegionRectangle::height(void) const | |
| 233 | 233 | { |
| 234 | 234 | return (m_height); |
| 235 | 235 | } |
| ... | ... | @@ -244,7 +244,7 @@ const double& GSkyRegionRect::height(void) const |
| 244 | 244 | * counted counterclockwise from North. |
| 245 | 245 | ***************************************************************************/ |
| 246 | 246 | inline |
| 247 | -const double& GSkyRegionRect::posang(void) const | |
| 247 | +const double& GSkyRegionRectangle::posang(void) const | |
| 248 | 248 | { |
| 249 | 249 | return (m_posang); |
| 250 | 250 | } |
| ... | ... | @@ -260,10 +260,10 @@ const double& GSkyRegionRect::posang(void) const |
| 260 | 260 | * rectangle height. |
| 261 | 261 | ***************************************************************************/ |
| 262 | 262 | inline |
| 263 | -void GSkyRegionRect::posang(const double& posang) | |
| 263 | +void GSkyRegionRectangle::posang(const double& posang) | |
| 264 | 264 | { |
| 265 | 265 | m_posang = posang; |
| 266 | 266 | return; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | -#endif /* GSKYREGIONRECT_HPP */ | |
| 269 | +#endif /* GSKYREGIONRECTANGLE_HPP */ | ... | ... |
include/GammaLib.hpp
| ... | ... | @@ -152,7 +152,7 @@ |
| 152 | 152 | #include "GSkyRegions.hpp" |
| 153 | 153 | #include "GSkyRegion.hpp" |
| 154 | 154 | #include "GSkyRegionCircle.hpp" |
| 155 | -#include "GSkyRegionRect.hpp" | |
| 155 | +#include "GSkyRegionRectangle.hpp" | |
| 156 | 156 | #include "GSkyRegionMap.hpp" |
| 157 | 157 | #include "GSkyProjection.hpp" |
| 158 | 158 | #include "GHealpix.hpp" | ... | ... |
include/Makefile.am
pyext/GSkyRegionRect.i renamed to pyext/GSkyRegionRectangle.i
| 1 | 1 | /*************************************************************************** |
| 2 | - * GSkyRegionRect.i - Sky region class * | |
| 2 | + * GSkyRegionRectangle.i - Rectangular sky region class * | |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | 4 | * copyright (C) 2019-2020 by Andreas Specovius * |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| ... | ... | @@ -19,68 +19,68 @@ |
| 19 | 19 | * * |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | /** |
| 22 | - * @file GSkyRegionRect.i | |
| 22 | + * @file GSkyRegionRectangle.i | |
| 23 | 23 | * @brief Rectangular sky region class interface definition |
| 24 | 24 | * @author Andreas Specovius |
| 25 | 25 | */ |
| 26 | 26 | %{ |
| 27 | 27 | /* Put headers and other declarations here that are needed for compilation */ |
| 28 | -#include "GSkyRegionRect.hpp" | |
| 28 | +#include "GSkyRegionRectangle.hpp" | |
| 29 | 29 | %} |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | /***********************************************************************//** |
| 33 | - * @class GSkyRegionRect | |
| 33 | + * @class GSkyRegionRectangle | |
| 34 | 34 | * |
| 35 | 35 | * @brief Interface for the rectangular sky region class |
| 36 | 36 | ***************************************************************************/ |
| 37 | -class GSkyRegionRect : public GSkyRegion { | |
| 37 | +class GSkyRegionRectangle : public GSkyRegion { | |
| 38 | 38 | |
| 39 | 39 | public: |
| 40 | 40 | // Constructors and destructors |
| 41 | - GSkyRegionRect(void); | |
| 42 | - GSkyRegionRect(const GSkyDir& centre, | |
| 43 | - const double& width, | |
| 44 | - const double& height, | |
| 45 | - const double& posang); | |
| 46 | - GSkyRegionRect(const double& ra, | |
| 47 | - const double& dec, | |
| 48 | - const double& width, | |
| 49 | - const double& height, | |
| 50 | - const double& posang); | |
| 51 | - explicit GSkyRegionRect(const std::string& line); | |
| 52 | - GSkyRegionRect(const GSkyRegionRect& region); | |
| 53 | - virtual ~GSkyRegionRect(void); | |
| 41 | + GSkyRegionRectangle(void); | |
| 42 | + GSkyRegionRectangle(const GSkyDir& centre, | |
| 43 | + const double& width, | |
| 44 | + const double& height, | |
| 45 | + const double& posang); | |
| 46 | + GSkyRegionRectangle(const double& ra, | |
| 47 | + const double& dec, | |
| 48 | + const double& width, | |
| 49 | + const double& height, | |
| 50 | + const double& posang); | |
| 51 | + explicit GSkyRegionRectangle(const std::string& line); | |
| 52 | + GSkyRegionRectangle(const GSkyRegionRectangle& region); | |
| 53 | + virtual ~GSkyRegionRectangle(void); | |
| 54 | 54 | |
| 55 | 55 | // Implemented methods |
| 56 | - void clear(void); | |
| 57 | - GSkyRegionRect* clone(void) const; | |
| 58 | - std::string classname(void) const; | |
| 59 | - const GSkyDir& centre(void) const; | |
| 60 | - void centre(const GSkyDir& centre); | |
| 61 | - void centre(const double& ra,const double& dec); | |
| 62 | - double ra(void) const; | |
| 63 | - double dec(void) const; | |
| 64 | - const double& width(void) const; | |
| 65 | - void width(const double& width); | |
| 66 | - const double& height(void) const; | |
| 67 | - void height(const double& height); | |
| 68 | - const double& posang(void) const; | |
| 69 | - void posang(const double& posang); | |
| 70 | - void read(const std::string& line); | |
| 71 | - std::string write(void) const; | |
| 72 | - bool contains(const GSkyDir& dir) const; | |
| 73 | - bool contains(const GSkyRegion& reg) const; | |
| 74 | - bool overlaps(const GSkyRegion& reg) const; | |
| 75 | - GSkyDir corner(const int& index) const; | |
| 56 | + void clear(void); | |
| 57 | + GSkyRegionRectangle* clone(void) const; | |
| 58 | + std::string classname(void) const; | |
| 59 | + const GSkyDir& centre(void) const; | |
| 60 | + void centre(const GSkyDir& centre); | |
| 61 | + void centre(const double& ra,const double& dec); | |
| 62 | + double ra(void) const; | |
| 63 | + double dec(void) const; | |
| 64 | + const double& width(void) const; | |
| 65 | + void width(const double& width); | |
| 66 | + const double& height(void) const; | |
| 67 | + void height(const double& height); | |
| 68 | + const double& posang(void) const; | |
| 69 | + void posang(const double& posang); | |
| 70 | + void read(const std::string& line); | |
| 71 | + std::string write(void) const; | |
| 72 | + bool contains(const GSkyDir& dir) const; | |
| 73 | + bool contains(const GSkyRegion& reg) const; | |
| 74 | + bool overlaps(const GSkyRegion& reg) const; | |
| 75 | + GSkyDir corner(const int& index) const; | |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | /***********************************************************************//** |
| 80 | - * @brief GSkyRegionRect class extension | |
| 80 | + * @brief GSkyRegionRectangle class extension | |
| 81 | 81 | ***************************************************************************/ |
| 82 | -%extend GSkyRegionRect { | |
| 83 | - GSkyRegionRect copy() { | |
| 82 | +%extend GSkyRegionRectangle { | |
| 83 | + GSkyRegionRectangle copy() { | |
| 84 | 84 | return (*self); |
| 85 | 85 | } |
| 86 | 86 | %pythoncode { | ... | ... |
pyext/gammalib/sky.i
| ... | ... | @@ -118,7 +118,7 @@ namespace std { |
| 118 | 118 | %include "GSkyRegions.i" |
| 119 | 119 | %include "GSkyRegion.i" |
| 120 | 120 | %include "GSkyRegionCircle.i" |
| 121 | -%include "GSkyRegionRect.i" | |
| 121 | +%include "GSkyRegionRectangle.i" | |
| 122 | 122 | %include "GSkyRegionMap.i" |
| 123 | 123 | %include "GSkyProjection.i" |
| 124 | 124 | %include "GHealpix.i" | ... | ... |
src/sky/GSkyRegionCircle.cpp
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | #endif |
| 31 | 31 | #include "GTools.hpp" |
| 32 | 32 | #include "GSkyRegionCircle.hpp" |
| 33 | -#include "GSkyRegionRect.hpp" | |
| 33 | +#include "GSkyRegionRectangle.hpp" | |
| 34 | 34 | #include "GSkyRegionMap.hpp" |
| 35 | 35 | |
| 36 | 36 | /* __ Method name definitions ____________________________________________ */ |
| ... | ... | @@ -547,10 +547,11 @@ bool GSkyRegionCircle::contains(const GSkyRegion& reg) const |
| 547 | 547 | |
| 548 | 548 | // ... otherwise, if the other region is a rectangle then check whether |
| 549 | 549 | // all four corners are contained within the circle |
| 550 | - else if (reg.type() == "Rect") { | |
| 550 | + else if (reg.type() == "Rectangle") { | |
| 551 | 551 | |
| 552 | 552 | // Create rectangular region from reg |
| 553 | - const GSkyRegionRect* rect = dynamic_cast<const GSkyRegionRect*>(®); | |
| 553 | + const GSkyRegionRectangle* rect = | |
| 554 | + dynamic_cast<const GSkyRegionRectangle*>(®); | |
| 554 | 555 | |
| 555 | 556 | // Check containment of all corners |
| 556 | 557 | contains = this->contains(rect->corner(0)) && |
| ... | ... | @@ -634,10 +635,11 @@ bool GSkyRegionCircle::overlaps(const GSkyRegion& reg) const |
| 634 | 635 | } // endif: region was circle |
| 635 | 636 | |
| 636 | 637 | // ... otherwise if region is rectangle then check overlap |
| 637 | - else if (reg.type() == "Rect") { | |
| 638 | + else if (reg.type() == "Rectangle") { | |
| 638 | 639 | |
| 639 | 640 | // Create rectangular region from reg |
| 640 | - const GSkyRegionRect* rect = dynamic_cast<const GSkyRegionRect*>(®); | |
| 641 | + const GSkyRegionRectangle* rect = | |
| 642 | + dynamic_cast<const GSkyRegionRectangle*>(®); | |
| 641 | 643 | |
| 642 | 644 | // Check overlap with circle |
| 643 | 645 | overlap = rect->overlaps(*this); | ... | ... |
src/sky/GSkyRegionMap.cpp
| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | #include "GSkyMap.hpp" |
| 35 | 35 | #include "GSkyRegion.hpp" |
| 36 | 36 | #include "GSkyRegionCircle.hpp" |
| 37 | -#include "GSkyRegionRect.hpp" | |
| 37 | +#include "GSkyRegionRectangle.hpp" | |
| 38 | 38 | #include "GSkyRegionMap.hpp" |
| 39 | 39 | |
| 40 | 40 | /* __ Method name definitions ____________________________________________ */ |
| ... | ... | @@ -119,9 +119,9 @@ GSkyRegionMap::GSkyRegionMap(const GSkyRegion* region) : GSkyRegion(*region) |
| 119 | 119 | init_members(); |
| 120 | 120 | |
| 121 | 121 | // Get dynamic casts |
| 122 | - const GSkyRegionMap* map = dynamic_cast<const GSkyRegionMap*>(region); | |
| 123 | - const GSkyRegionCircle* circle = dynamic_cast<const GSkyRegionCircle*>(region); | |
| 124 | - const GSkyRegionRect* rect = dynamic_cast<const GSkyRegionRect*>(region); | |
| 122 | + const GSkyRegionMap* map = dynamic_cast<const GSkyRegionMap*>(region); | |
| 123 | + const GSkyRegionCircle* circle = dynamic_cast<const GSkyRegionCircle*>(region); | |
| 124 | + const GSkyRegionRectangle* rect = dynamic_cast<const GSkyRegionRectangle*>(region); | |
| 125 | 125 | |
| 126 | 126 | // If region is of type GSkyRegionMap then copy class members |
| 127 | 127 | if (map != NULL) { |
| ... | ... | @@ -134,9 +134,10 @@ GSkyRegionMap::GSkyRegionMap(const GSkyRegion* region) : GSkyRegion(*region) |
| 134 | 134 | set_region_circle(circle); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - // If region is of type GSkyRegionRect than set region map fron region rect | |
| 137 | + // If region is of type GSkyRegionRectangle than set region map fron | |
| 138 | + // region rect | |
| 138 | 139 | else if (rect != NULL) { |
| 139 | - set_region_rect(rect); | |
| 140 | + set_region_rectangle(rect); | |
| 140 | 141 | } |
| 141 | 142 | |
| 142 | 143 | // Return |
| ... | ... | @@ -447,10 +448,11 @@ bool GSkyRegionMap::contains(const GSkyRegion& reg) const |
| 447 | 448 | } // endcase: circular region |
| 448 | 449 | |
| 449 | 450 | // Case of a rectangular region |
| 450 | - else if (reg.type() == "Rect") { | |
| 451 | + else if (reg.type() == "Rectangle") { | |
| 451 | 452 | |
| 452 | 453 | // Create rectangular region from reg |
| 453 | - const GSkyRegionRect* rect = dynamic_cast<const GSkyRegionRect*>(®); | |
| 454 | + const GSkyRegionRectangle* rect = | |
| 455 | + dynamic_cast<const GSkyRegionRectangle*>(®); | |
| 454 | 456 | |
| 455 | 457 | // Create region map from rectangle |
| 456 | 458 | GSkyRegionMap rect_map(rect); |
| ... | ... | @@ -665,7 +667,7 @@ void GSkyRegionMap::set_region_circle(const GSkyRegionCircle* circle) |
| 665 | 667 | * are added at either side of the map. The sky map is created in celestial |
| 666 | 668 | * coordinates and TAN projection. |
| 667 | 669 | ***************************************************************************/ |
| 668 | -void GSkyRegionMap::set_region_rect(const GSkyRegionRect* rect) | |
| 670 | +void GSkyRegionMap::set_region_rectangle(const GSkyRegionRectangle* rect) | |
| 669 | 671 | { |
| 670 | 672 | // Define desired resolution (in degrees) |
| 671 | 673 | const double resolution_goal = 0.01; | ... | ... |
src/sky/GSkyRegionRect.cpp renamed to src/sky/GSkyRegionRectangle.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | - * GSkyRegionRect.cpp - Rectangular sky region class * | |
| 2 | + * GSkyRegionRectangle.cpp - Rectangular sky region class * | |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | 4 | * copyright (C) 2019-2020 by Andreas Specovius * |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | * * |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | /** |
| 22 | - * @file GSkyRegionRect.hpp | |
| 22 | + * @file GSkyRegionRectangle.hpp | |
| 23 | 23 | * @brief Rectangular sky region implementation |
| 24 | 24 | * @author Andreas Specovius |
| 25 | 25 | */ |
| ... | ... | @@ -30,16 +30,16 @@ |
| 30 | 30 | #endif |
| 31 | 31 | #include "GTools.hpp" |
| 32 | 32 | #include "GSkyRegionCircle.hpp" |
| 33 | -#include "GSkyRegionRect.hpp" | |
| 33 | +#include "GSkyRegionRectangle.hpp" | |
| 34 | 34 | #include "GSkyRegionMap.hpp" |
| 35 | 35 | |
| 36 | 36 | /* __ Method name definitions ____________________________________________ */ |
| 37 | -#define G_WIDTH "GSkyRegionRect::width(double&)" | |
| 38 | -#define G_HEIGHT "GSkyRegionRect::height(double&)" | |
| 39 | -#define G_READ "GSkyRegionRect::read(std::string&)" | |
| 40 | -#define G_CONTAINS "GSkyRegionRect::contains(GSkyRegion&)" | |
| 41 | -#define G_OVERLAPS "GSkyRegionRect::overlaps(GSkyRegion&)" | |
| 42 | -#define G_CORNER "GSkyRegionRect::corner(int&)" | |
| 37 | +#define G_WIDTH "GSkyRegionRectangle::width(double&)" | |
| 38 | +#define G_HEIGHT "GSkyRegionRectangle::height(double&)" | |
| 39 | +#define G_READ "GSkyRegionRectangle::read(std::string&)" | |
| 40 | +#define G_CONTAINS "GSkyRegionRectangle::contains(GSkyRegion&)" | |
| 41 | +#define G_OVERLAPS "GSkyRegionRectangle::overlaps(GSkyRegion&)" | |
| 42 | +#define G_CORNER "GSkyRegionRectangle::corner(int&)" | |
| 43 | 43 | |
| 44 | 44 | /* __ Macros _____________________________________________________________ */ |
| 45 | 45 | |
| ... | ... | @@ -59,7 +59,7 @@ |
| 59 | 59 | /***********************************************************************//** |
| 60 | 60 | * @brief Void constructor |
| 61 | 61 | ***************************************************************************/ |
| 62 | -GSkyRegionRect::GSkyRegionRect(void) : GSkyRegion() | |
| 62 | +GSkyRegionRectangle::GSkyRegionRectangle(void) : GSkyRegion() | |
| 63 | 63 | { |
| 64 | 64 | // Initialise members |
| 65 | 65 | init_members(); |
| ... | ... | @@ -77,10 +77,10 @@ GSkyRegionRect::GSkyRegionRect(void) : GSkyRegion() |
| 77 | 77 | * @param[in] height Region height (degrees). |
| 78 | 78 | * @param[in] posang Position angle (degrees). |
| 79 | 79 | ***************************************************************************/ |
| 80 | -GSkyRegionRect::GSkyRegionRect(const GSkyDir& centre, | |
| 81 | - const double& width, | |
| 82 | - const double& height, | |
| 83 | - const double& posang) : GSkyRegion() | |
| 80 | +GSkyRegionRectangle::GSkyRegionRectangle(const GSkyDir& centre, | |
| 81 | + const double& width, | |
| 82 | + const double& height, | |
| 83 | + const double& posang) : GSkyRegion() | |
| 84 | 84 | { |
| 85 | 85 | // Initialise members |
| 86 | 86 | init_members(); |
| ... | ... | @@ -108,11 +108,11 @@ GSkyRegionRect::GSkyRegionRect(const GSkyDir& centre, |
| 108 | 108 | * @param[in] height Region height (degrees). |
| 109 | 109 | * @param[in] posang Position angle (degrees). |
| 110 | 110 | ***************************************************************************/ |
| 111 | -GSkyRegionRect::GSkyRegionRect(const double& ra, | |
| 112 | - const double& dec, | |
| 113 | - const double& width, | |
| 114 | - const double& height, | |
| 115 | - const double& posang) : GSkyRegion() | |
| 111 | +GSkyRegionRectangle::GSkyRegionRectangle(const double& ra, | |
| 112 | + const double& dec, | |
| 113 | + const double& width, | |
| 114 | + const double& height, | |
| 115 | + const double& posang) : GSkyRegion() | |
| 116 | 116 | { |
| 117 | 117 | // Initialise members |
| 118 | 118 | init_members(); |
| ... | ... | @@ -138,7 +138,7 @@ GSkyRegionRect::GSkyRegionRect(const double& ra, |
| 138 | 138 | * |
| 139 | 139 | * Constructs region from a DS9 region file line. |
| 140 | 140 | ***************************************************************************/ |
| 141 | -GSkyRegionRect::GSkyRegionRect(const std::string& line) : GSkyRegion() | |
| 141 | +GSkyRegionRectangle::GSkyRegionRectangle(const std::string& line) : GSkyRegion() | |
| 142 | 142 | { |
| 143 | 143 | // Initialise members |
| 144 | 144 | init_members(); |
| ... | ... | @@ -157,7 +157,8 @@ GSkyRegionRect::GSkyRegionRect(const std::string& line) : GSkyRegion() |
| 157 | 157 | * |
| 158 | 158 | * @param[in] region Rectangular sky region. |
| 159 | 159 | ***************************************************************************/ |
| 160 | -GSkyRegionRect::GSkyRegionRect(const GSkyRegionRect& region) : GSkyRegion(region) | |
| 160 | +GSkyRegionRectangle::GSkyRegionRectangle(const GSkyRegionRectangle& region) : | |
| 161 | + GSkyRegion(region) | |
| 161 | 162 | { |
| 162 | 163 | // Initialise members |
| 163 | 164 | init_members(); |
| ... | ... | @@ -173,7 +174,7 @@ GSkyRegionRect::GSkyRegionRect(const GSkyRegionRect& region) : GSkyRegion(region |
| 173 | 174 | /***********************************************************************//** |
| 174 | 175 | * @brief Destructor |
| 175 | 176 | ***************************************************************************/ |
| 176 | -GSkyRegionRect::~GSkyRegionRect(void) | |
| 177 | +GSkyRegionRectangle::~GSkyRegionRectangle(void) | |
| 177 | 178 | { |
| 178 | 179 | // Free members |
| 179 | 180 | free_members(); |
| ... | ... | @@ -195,7 +196,7 @@ GSkyRegionRect::~GSkyRegionRect(void) |
| 195 | 196 | * @param[in] region Rectangular sky region. |
| 196 | 197 | * @return Rectangular sky region. |
| 197 | 198 | ***************************************************************************/ |
| 198 | -GSkyRegionRect& GSkyRegionRect::operator=(const GSkyRegionRect& region) | |
| 199 | +GSkyRegionRectangle& GSkyRegionRectangle::operator=(const GSkyRegionRectangle& region) | |
| 199 | 200 | { |
| 200 | 201 | // Execute only if object is not identical |
| 201 | 202 | if (this != ®ion) { |
| ... | ... | @@ -228,7 +229,7 @@ GSkyRegionRect& GSkyRegionRect::operator=(const GSkyRegionRect& region) |
| 228 | 229 | /***********************************************************************//** |
| 229 | 230 | * @brief Clear instance |
| 230 | 231 | ***************************************************************************/ |
| 231 | -void GSkyRegionRect::clear(void) | |
| 232 | +void GSkyRegionRectangle::clear(void) | |
| 232 | 233 | { |
| 233 | 234 | // Free members |
| 234 | 235 | free_members(); |
| ... | ... | @@ -248,10 +249,10 @@ void GSkyRegionRect::clear(void) |
| 248 | 249 | * |
| 249 | 250 | * @return Deep copy to rectangular sky region. |
| 250 | 251 | ***************************************************************************/ |
| 251 | -GSkyRegionRect* GSkyRegionRect::clone(void) const | |
| 252 | +GSkyRegionRectangle* GSkyRegionRectangle::clone(void) const | |
| 252 | 253 | { |
| 253 | 254 | // Clone rectangular sky region |
| 254 | - return new GSkyRegionRect(*this); | |
| 255 | + return new GSkyRegionRectangle(*this); | |
| 255 | 256 | } |
| 256 | 257 | |
| 257 | 258 | |
| ... | ... | @@ -266,7 +267,7 @@ GSkyRegionRect* GSkyRegionRect::clone(void) const |
| 266 | 267 | * Sets the @p width of the rectangular sky region. Only non-negative widths |
| 267 | 268 | * are allowed. |
| 268 | 269 | ***************************************************************************/ |
| 269 | -void GSkyRegionRect::width(const double& width) | |
| 270 | +void GSkyRegionRectangle::width(const double& width) | |
| 270 | 271 | { |
| 271 | 272 | // Throw an exception if the width is less than zero |
| 272 | 273 | if (width < 0.0) { |
| ... | ... | @@ -302,7 +303,7 @@ void GSkyRegionRect::width(const double& width) |
| 302 | 303 | * Note that for a position angle of zero, the height axis is pointing to |
| 303 | 304 | * celestial north. |
| 304 | 305 | ***************************************************************************/ |
| 305 | -void GSkyRegionRect::height(const double& height) | |
| 306 | +void GSkyRegionRectangle::height(const double& height) | |
| 306 | 307 | { |
| 307 | 308 | if (height < 0.0) { |
| 308 | 309 | std::string msg = |
| ... | ... | @@ -331,7 +332,7 @@ void GSkyRegionRect::height(const double& height) |
| 331 | 332 | * @exception GException::invalid_value |
| 332 | 333 | * Invalid value found in DS9 format string. |
| 333 | 334 | ***************************************************************************/ |
| 334 | -void GSkyRegionRect::read(const std::string& line) | |
| 335 | +void GSkyRegionRectangle::read(const std::string& line) | |
| 335 | 336 | { |
| 336 | 337 | // Clear the current instance |
| 337 | 338 | clear(); |
| ... | ... | @@ -449,7 +450,7 @@ void GSkyRegionRect::read(const std::string& line) |
| 449 | 450 | * Writes a DS9 region into a string. The region name is only written if it |
| 450 | 451 | * is defined. |
| 451 | 452 | ***************************************************************************/ |
| 452 | -std::string GSkyRegionRect::write(void) const | |
| 453 | +std::string GSkyRegionRectangle::write(void) const | |
| 453 | 454 | { |
| 454 | 455 | // Allocate string |
| 455 | 456 | std::string result; |
| ... | ... | @@ -486,7 +487,7 @@ std::string GSkyRegionRect::write(void) const |
| 486 | 487 | * A sky direction lies within a region when its distance to the region |
| 487 | 488 | * centre is not larger than the region extension in both axes directions. |
| 488 | 489 | ***************************************************************************/ |
| 489 | -bool GSkyRegionRect::contains(const GSkyDir& dir) const | |
| 490 | +bool GSkyRegionRectangle::contains(const GSkyDir& dir) const | |
| 490 | 491 | { |
| 491 | 492 | // Transform sky direction to local coordinate system |
| 492 | 493 | GSkyPixel local = dir_to_local(dir); |
| ... | ... | @@ -507,7 +508,7 @@ bool GSkyRegionRect::contains(const GSkyDir& dir) const |
| 507 | 508 | * @exception GException::feature_not_implemented |
| 508 | 509 | * Not all region types supported currently. |
| 509 | 510 | ***************************************************************************/ |
| 510 | -bool GSkyRegionRect::contains(const GSkyRegion& reg) const | |
| 511 | +bool GSkyRegionRectangle::contains(const GSkyRegion& reg) const | |
| 511 | 512 | { |
| 512 | 513 | // Initialise return value |
| 513 | 514 | bool contains = false; |
| ... | ... | @@ -517,7 +518,8 @@ bool GSkyRegionRect::contains(const GSkyRegion& reg) const |
| 517 | 518 | if (reg.type() == "Circle") { |
| 518 | 519 | |
| 519 | 520 | // Create circular region from reg |
| 520 | - const GSkyRegionCircle* circle = dynamic_cast<const GSkyRegionCircle*>(®); | |
| 521 | + const GSkyRegionCircle* circle = | |
| 522 | + dynamic_cast<const GSkyRegionCircle*>(®); | |
| 521 | 523 | |
| 522 | 524 | // Transform circle center to local coordinate system |
| 523 | 525 | GSkyPixel local = dir_to_local(circle->centre()); |
| ... | ... | @@ -538,10 +540,11 @@ bool GSkyRegionRect::contains(const GSkyRegion& reg) const |
| 538 | 540 | |
| 539 | 541 | // ... otherwise, if the other region is a rectangle then check whether |
| 540 | 542 | // all corners fall within the rectangle |
| 541 | - else if (reg.type() == "Rect") { | |
| 543 | + else if (reg.type() == "Rectangle") { | |
| 542 | 544 | |
| 543 | 545 | // Create rectangular region from reg |
| 544 | - const GSkyRegionRect* rect = dynamic_cast<const GSkyRegionRect*>(®); | |
| 546 | + const GSkyRegionRectangle* rect = | |
| 547 | + dynamic_cast<const GSkyRegionRectangle*>(®); | |
| 545 | 548 | |
| 546 | 549 | // Initialise containment flag to true |
| 547 | 550 | contains = true; |
| ... | ... | @@ -561,7 +564,7 @@ bool GSkyRegionRect::contains(const GSkyRegion& reg) const |
| 561 | 564 | |
| 562 | 565 | } // endfor: looped over the four corners |
| 563 | 566 | |
| 564 | - } // endif: other region was of type "Rect" | |
| 567 | + } // endif: other region was a rectangle | |
| 565 | 568 | |
| 566 | 569 | // ... otherwise, if the other region is a map then check whether it |
| 567 | 570 | // is contained within the rectangle |
| ... | ... | @@ -614,7 +617,7 @@ bool GSkyRegionRect::contains(const GSkyRegion& reg) const |
| 614 | 617 | * |
| 615 | 618 | * @todo Improve implementation for rectangle-rectangle |
| 616 | 619 | ***************************************************************************/ |
| 617 | -bool GSkyRegionRect::overlaps(const GSkyRegion& reg) const | |
| 620 | +bool GSkyRegionRectangle::overlaps(const GSkyRegion& reg) const | |
| 618 | 621 | { |
| 619 | 622 | // Initialise return value |
| 620 | 623 | bool overlap = false; |
| ... | ... | @@ -624,7 +627,8 @@ bool GSkyRegionRect::overlaps(const GSkyRegion& reg) const |
| 624 | 627 | if (reg.type() == "Circle") { |
| 625 | 628 | |
| 626 | 629 | // Create circular region from reg |
| 627 | - const GSkyRegionCircle* circle = dynamic_cast<const GSkyRegionCircle*>(®); | |
| 630 | + const GSkyRegionCircle* circle = | |
| 631 | + dynamic_cast<const GSkyRegionCircle*>(®); | |
| 628 | 632 | |
| 629 | 633 | // Transform circle center to local coordinate system |
| 630 | 634 | GSkyPixel local = dir_to_local(circle->centre()); |
| ... | ... | @@ -645,16 +649,17 @@ bool GSkyRegionRect::overlaps(const GSkyRegion& reg) const |
| 645 | 649 | |
| 646 | 650 | // ... otherwise if region is a rectangle then check overlap between |
| 647 | 651 | // two rectangles |
| 648 | - else if (reg.type() == "Rect") { | |
| 652 | + else if (reg.type() == "Rectangle") { | |
| 649 | 653 | |
| 650 | 654 | // Create rectangular region from reg |
| 651 | - const GSkyRegionRect* rect = dynamic_cast<const GSkyRegionRect*>(®); | |
| 655 | + const GSkyRegionRectangle* rect = | |
| 656 | + dynamic_cast<const GSkyRegionRectangle*>(®); | |
| 652 | 657 | |
| 653 | 658 | // Dirty kludge: compare with map |
| 654 | 659 | GSkyRegionMap map = GSkyRegionMap(rect); |
| 655 | 660 | overlap = map.overlaps(*this); |
| 656 | 661 | |
| 657 | - } // endif: region was of type "Rect" | |
| 662 | + } // endif: region was a rectangle | |
| 658 | 663 | |
| 659 | 664 | // ... otherwise if region is map then check overlap with map |
| 660 | 665 | else if (reg.type() == "Map") { |
| ... | ... | @@ -700,7 +705,7 @@ bool GSkyRegionRect::overlaps(const GSkyRegion& reg) const |
| 700 | 705 | * Declination of the rectangle centre, and \f${\rm width}\f$ and |
| 701 | 706 | * \f${\rm height}\f$ are the width and height of the rectangle. |
| 702 | 707 | ***************************************************************************/ |
| 703 | -GSkyDir GSkyRegionRect::corner(const int& index) const | |
| 708 | +GSkyDir GSkyRegionRectangle::corner(const int& index) const | |
| 704 | 709 | { |
| 705 | 710 | // Assert index is in [0,3] |
| 706 | 711 | if ((index < 0) || (index > 3)) { |
| ... | ... | @@ -732,7 +737,7 @@ GSkyDir GSkyRegionRect::corner(const int& index) const |
| 732 | 737 | * @param[in] chatter Chattiness |
| 733 | 738 | * @return String containing region information. |
| 734 | 739 | ***************************************************************************/ |
| 735 | -std::string GSkyRegionRect::print(const GChatter& chatter) const | |
| 740 | +std::string GSkyRegionRectangle::print(const GChatter& chatter) const | |
| 736 | 741 | { |
| 737 | 742 | // Initialise result string |
| 738 | 743 | std::string result;; |
| ... | ... | @@ -741,7 +746,7 @@ std::string GSkyRegionRect::print(const GChatter& chatter) const |
| 741 | 746 | if (chatter != SILENT) { |
| 742 | 747 | |
| 743 | 748 | // Append header |
| 744 | - result.append("=== GSkyRegionRect ==="); | |
| 749 | + result.append("=== GSkyRegionRectangle ==="); | |
| 745 | 750 | |
| 746 | 751 | // Append sky region information |
| 747 | 752 | result.append("\n"+gammalib::parformat("Right Ascension of centre")); |
| ... | ... | @@ -771,10 +776,10 @@ std::string GSkyRegionRect::print(const GChatter& chatter) const |
| 771 | 776 | /***********************************************************************//** |
| 772 | 777 | * @brief Initialise class members |
| 773 | 778 | ***************************************************************************/ |
| 774 | -void GSkyRegionRect::init_members(void) | |
| 779 | +void GSkyRegionRectangle::init_members(void) | |
| 775 | 780 | { |
| 776 | 781 | // Initialise members |
| 777 | - m_type = "Rect"; | |
| 782 | + m_type = "Rectangle"; | |
| 778 | 783 | m_centre.clear(); |
| 779 | 784 | m_width = 0.0; |
| 780 | 785 | m_height = 0.0; |
| ... | ... | @@ -790,7 +795,7 @@ void GSkyRegionRect::init_members(void) |
| 790 | 795 | * |
| 791 | 796 | * @param[in] region Rectangular sky region. |
| 792 | 797 | ***************************************************************************/ |
| 793 | -void GSkyRegionRect::copy_members(const GSkyRegionRect& region) | |
| 798 | +void GSkyRegionRectangle::copy_members(const GSkyRegionRectangle& region) | |
| 794 | 799 | { |
| 795 | 800 | // Copy attributes |
| 796 | 801 | m_centre = region.m_centre; |
| ... | ... | @@ -806,7 +811,7 @@ void GSkyRegionRect::copy_members(const GSkyRegionRect& region) |
| 806 | 811 | /***********************************************************************//** |
| 807 | 812 | * @brief Delete class members |
| 808 | 813 | ***************************************************************************/ |
| 809 | -void GSkyRegionRect::free_members(void) | |
| 814 | +void GSkyRegionRectangle::free_members(void) | |
| 810 | 815 | { |
| 811 | 816 | // Return |
| 812 | 817 | return; |
| ... | ... | @@ -828,7 +833,7 @@ void GSkyRegionRect::free_members(void) |
| 828 | 833 | * where \f${\rm width}\f$ and \f${\rm height}\f$ are the width and the |
| 829 | 834 | * height of the rectangle expressed in radians. |
| 830 | 835 | ***************************************************************************/ |
| 831 | -void GSkyRegionRect::compute_solid_angle(void) | |
| 836 | +void GSkyRegionRectangle::compute_solid_angle(void) | |
| 832 | 837 | { |
| 833 | 838 | // Compute solid angle |
| 834 | 839 | m_solid = m_width * m_height * gammalib::deg2rad * gammalib::deg2rad; |
| ... | ... | @@ -846,7 +851,7 @@ void GSkyRegionRect::compute_solid_angle(void) |
| 846 | 851 | * A local direction lies within a region when its distance to the region |
| 847 | 852 | * centre is not larger than the region extension in both axes directions. |
| 848 | 853 | ***************************************************************************/ |
| 849 | -bool GSkyRegionRect::contains(const GSkyPixel& local) const | |
| 854 | +bool GSkyRegionRectangle::contains(const GSkyPixel& local) const | |
| 850 | 855 | { |
| 851 | 856 | // Initialise return value |
| 852 | 857 | bool contains = false; |
| ... | ... | @@ -897,7 +902,7 @@ bool GSkyRegionRect::contains(const GSkyPixel& local) const |
| 897 | 902 | * position angle of the sky direction @p dir with respect to the position |
| 898 | 903 | * angle of the rectangle, computed counter clockwise. |
| 899 | 904 | ***************************************************************************/ |
| 900 | -GSkyPixel GSkyRegionRect::dir_to_local(const GSkyDir& dir) const | |
| 905 | +GSkyPixel GSkyRegionRectangle::dir_to_local(const GSkyDir& dir) const | |
| 901 | 906 | { |
| 902 | 907 | // Get distance and polar angle relative to rectangle centre |
| 903 | 908 | double dist = m_centre.dist(dir); |
| ... | ... | @@ -922,10 +927,10 @@ GSkyPixel GSkyRegionRect::dir_to_local(const GSkyDir& dir) const |
| 922 | 927 | * @return Sky direction. |
| 923 | 928 | * |
| 924 | 929 | * Transform the local coordinates @p local to a sky direction. See |
| 925 | - * GSkyRegionRect::dir_to_local for the relation between local rectangle | |
| 930 | + * GSkyRegionRectangle::dir_to_local for the relation between local rectangle | |
| 926 | 931 | * coordinates and the sky direction. |
| 927 | 932 | ***************************************************************************/ |
| 928 | -GSkyDir GSkyRegionRect::local_to_dir(const GSkyPixel& local) const | |
| 933 | +GSkyDir GSkyRegionRectangle::local_to_dir(const GSkyPixel& local) const | |
| 929 | 934 | { |
| 930 | 935 | // Get local coordinates (radians) |
| 931 | 936 | double x = local.x(); | ... | ... |
src/sky/GSkyRegions.cpp
| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | #include "GSkyDir.hpp" |
| 35 | 35 | #include "GSkyRegion.hpp" |
| 36 | 36 | #include "GSkyRegionCircle.hpp" |
| 37 | -#include "GSkyRegionRect.hpp" | |
| 37 | +#include "GSkyRegionRectangle.hpp" | |
| 38 | 38 | #include "GSkyRegions.hpp" |
| 39 | 39 | |
| 40 | 40 | /* __ Method name definitions ____________________________________________ */ |
| ... | ... | @@ -539,7 +539,7 @@ void GSkyRegions::load(const GFilename& filename) |
| 539 | 539 | // If region is a circle then read circle |
| 540 | 540 | if (std::string::npos != fileline.find("circle")) { |
| 541 | 541 | |
| 542 | - // Create instance of GSkyRegion object | |
| 542 | + // Create instance of GSkyRegionCircle object | |
| 543 | 543 | GSkyRegionCircle region; |
| 544 | 544 | |
| 545 | 545 | // If coordinate system and region defined on the same line |
| ... | ... | @@ -564,8 +564,8 @@ void GSkyRegions::load(const GFilename& filename) |
| 564 | 564 | // ... otherwise if region is a box then read rectangle |
| 565 | 565 | else if (std::string::npos != fileline.find("box")) { |
| 566 | 566 | |
| 567 | - // Create instance of GSkyRegion object | |
| 568 | - GSkyRegionRect region; | |
| 567 | + // Create instance of GSkyRegionRectangle object | |
| 568 | + GSkyRegionRectangle region; | |
| 569 | 569 | |
| 570 | 570 | // If coordinate system and region defined on the same line |
| 571 | 571 | if ((std::string::npos != fileline.find("fk5")) || | ... | ... |
src/sky/Makefile.am
test/test_GSky.cpp
| ... | ... | @@ -45,7 +45,7 @@ |
| 45 | 45 | |
| 46 | 46 | /* __ Constants __________________________________________________________ */ |
| 47 | 47 | const std::string datadir = std::getenv("TEST_DATA"); |
| 48 | -const std::string sky_region = datadir + "/test_circle_region.reg"; | |
| 48 | +const std::string sky_region_circ = datadir + "/test_circle_region.reg"; | |
| 49 | 49 | const std::string sky_region_rect = datadir + "/test_rect_region.reg"; |
| 50 | 50 | const std::string sky_region_map = datadir + "/test_map_region.fits"; |
| 51 | 51 | const std::string sky_map = datadir + "/cena_lobes_parkes.fits"; |
| ... | ... | @@ -84,8 +84,8 @@ void TestGSky::set(void){ |
| 84 | 84 | "Test GSkyRegions"); |
| 85 | 85 | append(static_cast<pfunction>(&TestGSky::test_GSkyRegionCircle), |
| 86 | 86 | "Test GSkyRegionCircle"); |
| 87 | - append(static_cast<pfunction>(&TestGSky::test_GSkyRegionRect), | |
| 88 | - "Test GSkyRegionRect"); | |
| 87 | + append(static_cast<pfunction>(&TestGSky::test_GSkyRegionRectangle), | |
| 88 | + "Test GSkyRegionRectangle"); | |
| 89 | 89 | append(static_cast<pfunction>(&TestGSky::test_GSkyRegionMap), |
| 90 | 90 | "Test GSkyRegionMap"); |
| 91 | 91 | append(static_cast<pfunction>(&TestGSky::test_GHorizDir), |
| ... | ... | @@ -1650,7 +1650,7 @@ void TestGSky::test_GSkyMap_io(void) |
| 1650 | 1650 | // Test regions loading |
| 1651 | 1651 | test_try("Test regions loading"); |
| 1652 | 1652 | try { |
| 1653 | - regions.load(sky_region); | |
| 1653 | + regions.load(sky_region_circ); | |
| 1654 | 1654 | test_try_success(); |
| 1655 | 1655 | } |
| 1656 | 1656 | catch (std::exception &e) { |
| ... | ... | @@ -1821,9 +1821,9 @@ void TestGSky::test_GSkyRegionCircle(void) |
| 1821 | 1821 | |
| 1822 | 1822 | |
| 1823 | 1823 | /*************************************************************************** |
| 1824 | - * @brief GSkyRegionRect | |
| 1824 | + * @brief GSkyRegionRectangle | |
| 1825 | 1825 | ***************************************************************************/ |
| 1826 | -void TestGSky::test_GSkyRegionRect(void) | |
| 1826 | +void TestGSky::test_GSkyRegionRectangle(void) | |
| 1827 | 1827 | { |
| 1828 | 1828 | // Define region for comparison |
| 1829 | 1829 | GSkyDir refdir_radeczerozero = GSkyDir(); |
| ... | ... | @@ -1835,7 +1835,7 @@ void TestGSky::test_GSkyRegionRect(void) |
| 1835 | 1835 | // Test constructing |
| 1836 | 1836 | test_try("Test constructor"); |
| 1837 | 1837 | try { |
| 1838 | - GSkyRegionRect rect(refdir_radeczerozero, ref_width, ref_height, ref_pa_deg); | |
| 1838 | + GSkyRegionRectangle rect(refdir_radeczerozero, ref_width, ref_height, ref_pa_deg); | |
| 1839 | 1839 | test_try_success(); |
| 1840 | 1840 | } |
| 1841 | 1841 | catch (std::exception &e) { |
| ... | ... | @@ -1845,7 +1845,7 @@ void TestGSky::test_GSkyRegionRect(void) |
| 1845 | 1845 | // Test constructing with negative width (should be forbidden) |
| 1846 | 1846 | test_try("Test constructor2"); |
| 1847 | 1847 | try { |
| 1848 | - GSkyRegionRect rect(refdir_radeczerozero, -1, ref_height, ref_pa_deg); | |
| 1848 | + GSkyRegionRectangle rect(refdir_radeczerozero, -1, ref_height, ref_pa_deg); | |
| 1849 | 1849 | test_try_failure(); |
| 1850 | 1850 | } |
| 1851 | 1851 | catch (GException::invalid_argument &e) { |
| ... | ... | @@ -1858,7 +1858,7 @@ void TestGSky::test_GSkyRegionRect(void) |
| 1858 | 1858 | // Test constructing with negative height (should be forbidden) |
| 1859 | 1859 | test_try("Test constructor3"); |
| 1860 | 1860 | try { |
| 1861 | - GSkyRegionRect rect(refdir_radeczerozero, ref_width, -1, ref_pa_deg); | |
| 1861 | + GSkyRegionRectangle rect(refdir_radeczerozero, ref_width, -1, ref_pa_deg); | |
| 1862 | 1862 | test_try_failure(); |
| 1863 | 1863 | } |
| 1864 | 1864 | catch (GException::invalid_argument &e) { |
| ... | ... | @@ -1871,7 +1871,7 @@ void TestGSky::test_GSkyRegionRect(void) |
| 1871 | 1871 | // Test constructing with negative posang (should be allowed) |
| 1872 | 1872 | test_try("Test constructor4"); |
| 1873 | 1873 | try { |
| 1874 | - GSkyRegionRect rect(refdir_radeczerozero, ref_width, ref_height, -1); | |
| 1874 | + GSkyRegionRectangle rect(refdir_radeczerozero, ref_width, ref_height, -1); | |
| 1875 | 1875 | test_try_success(); |
| 1876 | 1876 | } |
| 1877 | 1877 | catch (GException::invalid_argument &e) { |
| ... | ... | @@ -1884,7 +1884,7 @@ void TestGSky::test_GSkyRegionRect(void) |
| 1884 | 1884 | // Test assignment of neg width after construction |
| 1885 | 1885 | test_try("Test width assignment after"); |
| 1886 | 1886 | try { |
| 1887 | - GSkyRegionRect rect(refdir_radeczerozero, ref_width, ref_height, ref_pa_deg); | |
| 1887 | + GSkyRegionRectangle rect(refdir_radeczerozero, ref_width, ref_height, ref_pa_deg); | |
| 1888 | 1888 | rect.width(-1.0); |
| 1889 | 1889 | test_try_failure(); |
| 1890 | 1890 | } |
| ... | ... | @@ -1898,7 +1898,7 @@ void TestGSky::test_GSkyRegionRect(void) |
| 1898 | 1898 | // Test assignment of neg height after construction |
| 1899 | 1899 | test_try("Test height assignment after"); |
| 1900 | 1900 | try { |
| 1901 | - GSkyRegionRect rect(refdir_radeczerozero, ref_width, ref_height, ref_pa_deg); | |
| 1901 | + GSkyRegionRectangle rect(refdir_radeczerozero, ref_width, ref_height, ref_pa_deg); | |
| 1902 | 1902 | rect.height(-1.0); |
| 1903 | 1903 | test_try_failure(); |
| 1904 | 1904 | } |
| ... | ... | @@ -1912,7 +1912,7 @@ void TestGSky::test_GSkyRegionRect(void) |
| 1912 | 1912 | // Test assignment of neg posang after construction |
| 1913 | 1913 | test_try("Test posang assignment after"); |
| 1914 | 1914 | try { |
| 1915 | - GSkyRegionRect rect(refdir_radeczerozero, ref_width, ref_height, ref_pa_deg); | |
| 1915 | + GSkyRegionRectangle rect(refdir_radeczerozero, ref_width, ref_height, ref_pa_deg); | |
| 1916 | 1916 | rect.posang(-1.0); |
| 1917 | 1917 | test_try_success(); |
| 1918 | 1918 | } |
| ... | ... | @@ -1924,7 +1924,7 @@ void TestGSky::test_GSkyRegionRect(void) |
| 1924 | 1924 | } |
| 1925 | 1925 | |
| 1926 | 1926 | // Check radius assignment |
| 1927 | - GSkyRegionRect rect(refdir_radeczerozero, ref_width, ref_height, ref_pa_deg); | |
| 1927 | + GSkyRegionRectangle rect(refdir_radeczerozero, ref_width, ref_height, ref_pa_deg); | |
| 1928 | 1928 | |
| 1929 | 1929 | double check_width = rect.width(); |
| 1930 | 1930 | test_value(ref_width, check_width, 1.0e-10, "Test width assignment"); |
| ... | ... | @@ -1947,7 +1947,7 @@ void TestGSky::test_GSkyRegionRect(void) |
| 1947 | 1947 | GSkyDir test_dir_2 = GSkyDir(); |
| 1948 | 1948 | |
| 1949 | 1949 | refdir_radeczerozero.radec_deg(0,0); |
| 1950 | - GSkyRegionRect refregion(refdir_radeczerozero, 10, 6, 0); | |
| 1950 | + GSkyRegionRectangle refregion(refdir_radeczerozero, 10, 6, 0); | |
| 1951 | 1951 | |
| 1952 | 1952 | // Check GSkyDir containment |
| 1953 | 1953 | // Upper right |
| ... | ... | @@ -1990,7 +1990,7 @@ void TestGSky::test_GSkyRegionRect(void) |
| 1990 | 1990 | |
| 1991 | 1991 | |
| 1992 | 1992 | // Check GSkyDir containment for rotated rectangle |
| 1993 | - GSkyRegionRect refregion_rot(refdir_radeczerozero, 10, 10, 45); | |
| 1993 | + GSkyRegionRectangle refregion_rot(refdir_radeczerozero, 10, 10, 45); | |
| 1994 | 1994 | |
| 1995 | 1995 | // Check corner containment |
| 1996 | 1996 | test_assert(refregion_rot.contains(refregion_rot.corner(0)),"test for corner containment"); |
| ... | ... | @@ -2028,11 +2028,11 @@ void TestGSky::test_GSkyRegionRect(void) |
| 2028 | 2028 | GSkyDir refdir_ndecpole = GSkyDir(); |
| 2029 | 2029 | refdir_ndecpole.radec_deg(100,89); |
| 2030 | 2030 | |
| 2031 | - GSkyRegionRect refregion_smaller(refdir_radeczerozero, 5, 3, 0); | |
| 2032 | - GSkyRegionRect refregion_larger(refdir_radeczerozero, 20, 12, 0); | |
| 2033 | - GSkyRegionRect refregion_raoffset(refdir_raoffset, 10, 6, 0); | |
| 2034 | - GSkyRegionRect refregion_rapole(refdir_rapole, 3, 3, 0); | |
| 2035 | - GSkyRegionRect refregion_decpole(refdir_decpole, 3, 3, 0); | |
| 2031 | + GSkyRegionRectangle refregion_smaller(refdir_radeczerozero, 5, 3, 0); | |
| 2032 | + GSkyRegionRectangle refregion_larger(refdir_radeczerozero, 20, 12, 0); | |
| 2033 | + GSkyRegionRectangle refregion_raoffset(refdir_raoffset, 10, 6, 0); | |
| 2034 | + GSkyRegionRectangle refregion_rapole(refdir_rapole, 3, 3, 0); | |
| 2035 | + GSkyRegionRectangle refregion_decpole(refdir_decpole, 3, 3, 0); | |
| 2036 | 2036 | |
| 2037 | 2037 | // Test contain dirs (same from circle) |
| 2038 | 2038 | test_assert(refregion.contains(refdir_radeczerozero),"test for containment"); |
| ... | ... | @@ -2114,9 +2114,9 @@ void TestGSky::test_GSkyRegionMap(void) |
| 2114 | 2114 | |
| 2115 | 2115 | |
| 2116 | 2116 | // Test rectangles |
| 2117 | - GSkyRegionRect inrect(refdir_radeczerozero, 0.3, 0.3, 0); | |
| 2118 | - GSkyRegionRect outrect(refdir_radeclargeshift, 0.3, 0.3, 0); | |
| 2119 | - GSkyRegionRect overrect(refdir_radecsmallshift, 0.3, 0.3, 0); | |
| 2117 | + GSkyRegionRectangle inrect(refdir_radeczerozero, 0.3, 0.3, 0); | |
| 2118 | + GSkyRegionRectangle outrect(refdir_radeclargeshift, 0.3, 0.3, 0); | |
| 2119 | + GSkyRegionRectangle overrect(refdir_radecsmallshift, 0.3, 0.3, 0); | |
| 2120 | 2120 | |
| 2121 | 2121 | // Test contains regions |
| 2122 | 2122 | test_assert(regmap.contains(inrect),"test for region containment"); | ... | ... |
test/test_GSky.hpp
| ... | ... | @@ -53,7 +53,7 @@ public: |
| 53 | 53 | void test_GSkyMap_io(void); |
| 54 | 54 | void test_GSkyRegions(void); |
| 55 | 55 | void test_GSkyRegionCircle(void); |
| 56 | - void test_GSkyRegionRect(void); | |
| 56 | + void test_GSkyRegionRectangle(void); | |
| 57 | 57 | void test_GSkyRegionMap(void); |
| 58 | 58 | void test_GHorizDir(void); |
| 59 | 59 | ... | ... |