From d98fb34f5791a9683bce3f4d940ebb6c6767dcad Mon Sep 17 00:00:00 2001 From: Andreas Specovius Date: Mon, 15 Jun 2020 15:32:07 +0200 Subject: [PATCH] Replaced tabs by spaces. --- src/sky/GSkyRegionRect.cpp | 208 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/src/sky/GSkyRegionRect.cpp b/src/sky/GSkyRegionRect.cpp index 67f7eb5..7124799 100644 --- a/src/sky/GSkyRegionRect.cpp +++ b/src/sky/GSkyRegionRect.cpp @@ -78,16 +78,16 @@ GSkyRegionRect::GSkyRegionRect(const GSkyDir& centre, const double& w, GSkyRegion() { // Initialise members - init_members(); + init_members(); - // Set members - this->centre(centre); + // Set members + this->centre(centre); this->width(w); this->height(h); this->posang_deg(posang_deg); - // Compute solid angle - compute_solid_angle(); + // Compute solid angle + compute_solid_angle(); // Return return; @@ -108,16 +108,16 @@ GSkyRegionRect::GSkyRegionRect(const double& ra, const double& dec, GSkyRegion() { // Initialise members - init_members(); + init_members(); - // Set members - this->centre(ra, dec); + // Set members + this->centre(ra, dec); this->width(w); this->height(h); this->posang_deg(posang_deg); - // Compute solid angle - compute_solid_angle(); + // Compute solid angle + compute_solid_angle(); // Return return; @@ -133,14 +133,14 @@ GSkyRegionRect::GSkyRegionRect(const double& ra, const double& dec, ***************************************************************************/ GSkyRegionRect::GSkyRegionRect(const std::string& line) : GSkyRegion() { - // Initialise members - init_members(); + // Initialise members + init_members(); - // Read information from DS9 region file line - read(line); + // Read information from DS9 region file line + read(line); - // Return - return; + // Return + return; } @@ -304,14 +304,14 @@ void GSkyRegionRect::posang_deg(const double& posang) ***************************************************************************/ void GSkyRegionRect::width(const double& width) { - if (width < 0.0) { + if (width < 0.0) { std::string msg = "A width of "+gammalib::str(width)+" degrees has been" " specified for a rectangular sky region.\n" "The width of a rectangular sky region can't be less than 0" " degrees."; - throw GException::invalid_argument(G_WIDTH, msg); - } + throw GException::invalid_argument(G_WIDTH, msg); + } // Set radius value m_halfwidth = 0.5*width; @@ -367,44 +367,44 @@ void GSkyRegionRect::height(const double& height) ***************************************************************************/ void GSkyRegionRect::read(const std::string& line) { - // Clear the current instance - clear(); + // Clear the current instance + clear(); - // Split the string into 2 parts seperated by # - std::vector substrings = gammalib::split(line,"#"); - std::string region_def = (!substrings.empty()) ? substrings[0] : ""; - std::string comment = (substrings.size() > 1) ? substrings[1] : ""; + // Split the string into 2 parts seperated by # + std::vector substrings = gammalib::split(line,"#"); + std::string region_def = (!substrings.empty()) ? substrings[0] : ""; + std::string comment = (substrings.size() > 1) ? substrings[1] : ""; - // Finding the box - if (region_def.find("box") == std::string::npos) { + // Finding the box + if (region_def.find("box") == std::string::npos) { std::string msg = "Unable to find the key word \"box\" in provided string" " \""+line+"\".\n" "The \"box\" key word is mandatory."; - throw GException::invalid_value(G_READ, msg); - } + throw GException::invalid_value(G_READ, msg); + } - // Get the the coordinate system of the values - std::string system = gammalib::split(region_def, ";")[0]; + // Get the the coordinate system of the values + std::string system = gammalib::split(region_def, ";")[0]; - // Get the substring of the important values - unsigned pos = region_def.find("box("); - unsigned end = region_def.find(")"); - std::string regionstring = region_def.substr(pos+4, end); - regionstring.erase(regionstring.find(")"), 1); + // Get the substring of the important values + unsigned pos = region_def.find("box("); + unsigned end = region_def.find(")"); + std::string regionstring = region_def.substr(pos+4, end); + regionstring.erase(regionstring.find(")"), 1); - // Get the values of the region x,y,and radius - std::vector values = gammalib::split(regionstring,","); - if (values.size() != 5) { + // Get the values of the region x,y,and radius + std::vector values = gammalib::split(regionstring,","); + if (values.size() != 5) { std::string msg = "Invalid number of "+gammalib::str(values.size())+" arguments" " after the \"box\" key word in provided string \""+line+"\".\n" "Exactly 5 arguments are expected."; - throw GException::invalid_value(G_READ, msg); - } - double x = gammalib::todouble(values[0]); - double y = gammalib::todouble(values[1]); - double w = gammalib::todouble(values[2]); + throw GException::invalid_value(G_READ, msg); + } + double x = gammalib::todouble(values[0]); + double y = gammalib::todouble(values[1]); + double w = gammalib::todouble(values[2]); double h = gammalib::todouble(values[3]); double posang = gammalib::todouble(values[4]); @@ -428,52 +428,52 @@ void GSkyRegionRect::read(const std::string& line) posang /= 3600.0; } - // Initialise centre direction - GSkyDir centre = GSkyDir(); - - // Set the values in the correct system - if (system == "fk5" || system == "icrs") { - centre.radec_deg(x,y); - } - else if (system == "galactic") { - centre.lb_deg(x,y); - } - else { + // Initialise centre direction + GSkyDir centre = GSkyDir(); + + // Set the values in the correct system + if (system == "fk5" || system == "icrs") { + centre.radec_deg(x,y); + } + else if (system == "galactic") { + centre.lb_deg(x,y); + } + else { std::string msg = "Unsupported coordinate system \""+system+"\" in provided string" " \""+line+"\".\n" "Only the following coordinate systems are supported: " "\"fk5\", \"icrs\" and \"galactic\"."; - throw GException::invalid_value(G_READ, msg); - } + throw GException::invalid_value(G_READ, msg); + } - // Set members - this->centre(centre); + // Set members + this->centre(centre); this->width(w); this->height(h); this->posang_deg(posang); - // Compute solid angle - compute_solid_angle(); + // Compute solid angle + compute_solid_angle(); - // Check if there is a given name for the region and set it - std::vectorcomments = gammalib::split(comment, " "); - for (int i = 0; i < comments.size(); i++) { - if (gammalib::contains(comments[i], "text")) { - std::vector attributes = gammalib::split(comments[i], "="); - if (attributes.size() < 2) { + // Check if there is a given name for the region and set it + std::vectorcomments = gammalib::split(comment, " "); + for (int i = 0; i < comments.size(); i++) { + if (gammalib::contains(comments[i], "text")) { + std::vector attributes = gammalib::split(comments[i], "="); + if (attributes.size() < 2) { std::string msg = "Invalid character sequence encountered in provided" " string \""+line+"\".\n" "An attribute of the type \"text=Name\" is expected."; - throw GException::invalid_value(G_READ, msg); - } - m_name = attributes[1]; - } - } - - // Return - return; + throw GException::invalid_value(G_READ, msg); + } + m_name = attributes[1]; + } + } + + // Return + return; } @@ -488,20 +488,20 @@ void GSkyRegionRect::read(const std::string& line) std::string GSkyRegionRect::write(void) const { // Allocate string - std::string result; + std::string result; // Set string - result.append("fk5;box("); - result.append(gammalib::str(m_centre.ra_deg())); - result.append(","); - result.append(gammalib::str(m_centre.dec_deg())); - result.append(","); - result.append(gammalib::str(2*m_halfwidth)); + result.append("fk5;box("); + result.append(gammalib::str(m_centre.ra_deg())); + result.append(","); + result.append(gammalib::str(m_centre.dec_deg())); + result.append(","); + result.append(gammalib::str(2*m_halfwidth)); result.append(","); result.append(gammalib::str(2*m_halfheight)); result.append(","); result.append(gammalib::str(m_posang*gammalib::rad2deg)); - result.append(")"); + result.append(")"); // Optionally add region name if (m_name.length() > 0) { @@ -510,7 +510,7 @@ std::string GSkyRegionRect::write(void) const } // Return string - return result; + return result; } @@ -529,7 +529,7 @@ std::string GSkyRegionRect::print(const GChatter& chatter) const if (chatter != SILENT) { // Append header - result.append("=== GSkyRegionRect ==="); + result.append("=== GSkyRegionRect ==="); // Append sky region information result.append("\n"+gammalib::parformat("Right Ascension of centre")); @@ -559,8 +559,8 @@ std::string GSkyRegionRect::print(const GChatter& chatter) const ***************************************************************************/ bool GSkyRegionRect::contains(const GSkyDir& dir) const { - // Initialise return value - bool dir_is_in = false; + // Initialise return value + bool dir_is_in = false; // std::cout<<"GSkyRegionRect::contains: (1/2) dec: "<