Commit d98fb34f5791a9683bce3f4d940ebb6c6767dcad

Authored by Andreas Specovius
Committed by Jürgen Knödlseder
1 parent 4fe83f55

Replaced tabs by spaces.

Showing 1 changed file with 104 additions and 104 deletions
src/sky/GSkyRegionRect.cpp
... ... @@ -78,16 +78,16 @@ GSkyRegionRect::GSkyRegionRect(const GSkyDir& centre, const double& w,
78 78 GSkyRegion()
79 79 {
80 80 // Initialise members
81   - init_members();
  81 + init_members();
82 82  
83   - // Set members
84   - this->centre(centre);
  83 + // Set members
  84 + this->centre(centre);
85 85 this->width(w);
86 86 this->height(h);
87 87 this->posang_deg(posang_deg);
88 88  
89   - // Compute solid angle
90   - compute_solid_angle();
  89 + // Compute solid angle
  90 + compute_solid_angle();
91 91  
92 92 // Return
93 93 return;
... ... @@ -108,16 +108,16 @@ GSkyRegionRect::GSkyRegionRect(const double& ra, const double& dec,
108 108 GSkyRegion()
109 109 {
110 110 // Initialise members
111   - init_members();
  111 + init_members();
112 112  
113   - // Set members
114   - this->centre(ra, dec);
  113 + // Set members
  114 + this->centre(ra, dec);
115 115 this->width(w);
116 116 this->height(h);
117 117 this->posang_deg(posang_deg);
118 118  
119   - // Compute solid angle
120   - compute_solid_angle();
  119 + // Compute solid angle
  120 + compute_solid_angle();
121 121  
122 122 // Return
123 123 return;
... ... @@ -133,14 +133,14 @@ GSkyRegionRect::GSkyRegionRect(const double& ra, const double& dec,
133 133 ***************************************************************************/
134 134 GSkyRegionRect::GSkyRegionRect(const std::string& line) : GSkyRegion()
135 135 {
136   - // Initialise members
137   - init_members();
  136 + // Initialise members
  137 + init_members();
138 138  
139   - // Read information from DS9 region file line
140   - read(line);
  139 + // Read information from DS9 region file line
  140 + read(line);
141 141  
142   - // Return
143   - return;
  142 + // Return
  143 + return;
144 144  
145 145 }
146 146  
... ... @@ -304,14 +304,14 @@ void GSkyRegionRect::posang_deg(const double& posang)
304 304 ***************************************************************************/
305 305 void GSkyRegionRect::width(const double& width)
306 306 {
307   - if (width < 0.0) {
  307 + if (width < 0.0) {
308 308 std::string msg =
309 309 "A width of "+gammalib::str(width)+" degrees has been"
310 310 " specified for a rectangular sky region.\n"
311 311 "The width of a rectangular sky region can't be less than 0"
312 312 " degrees.";
313   - throw GException::invalid_argument(G_WIDTH, msg);
314   - }
  313 + throw GException::invalid_argument(G_WIDTH, msg);
  314 + }
315 315  
316 316 // Set radius value
317 317 m_halfwidth = 0.5*width;
... ... @@ -367,44 +367,44 @@ void GSkyRegionRect::height(const double&amp; height)
367 367 ***************************************************************************/
368 368 void GSkyRegionRect::read(const std::string& line)
369 369 {
370   - // Clear the current instance
371   - clear();
  370 + // Clear the current instance
  371 + clear();
372 372  
373   - // Split the string into 2 parts seperated by #
374   - std::vector<std::string> substrings = gammalib::split(line,"#");
375   - std::string region_def = (!substrings.empty()) ? substrings[0] : "";
376   - std::string comment = (substrings.size() > 1) ? substrings[1] : "";
  373 + // Split the string into 2 parts seperated by #
  374 + std::vector<std::string> substrings = gammalib::split(line,"#");
  375 + std::string region_def = (!substrings.empty()) ? substrings[0] : "";
  376 + std::string comment = (substrings.size() > 1) ? substrings[1] : "";
377 377  
378   - // Finding the box
379   - if (region_def.find("box") == std::string::npos) {
  378 + // Finding the box
  379 + if (region_def.find("box") == std::string::npos) {
380 380 std::string msg =
381 381 "Unable to find the key word \"box\" in provided string"
382 382 " \""+line+"\".\n"
383 383 "The \"box\" key word is mandatory.";
384   - throw GException::invalid_value(G_READ, msg);
385   - }
  384 + throw GException::invalid_value(G_READ, msg);
  385 + }
386 386  
387   - // Get the the coordinate system of the values
388   - std::string system = gammalib::split(region_def, ";")[0];
  387 + // Get the the coordinate system of the values
  388 + std::string system = gammalib::split(region_def, ";")[0];
389 389  
390   - // Get the substring of the important values
391   - unsigned pos = region_def.find("box(");
392   - unsigned end = region_def.find(")");
393   - std::string regionstring = region_def.substr(pos+4, end);
394   - regionstring.erase(regionstring.find(")"), 1);
  390 + // Get the substring of the important values
  391 + unsigned pos = region_def.find("box(");
  392 + unsigned end = region_def.find(")");
  393 + std::string regionstring = region_def.substr(pos+4, end);
  394 + regionstring.erase(regionstring.find(")"), 1);
395 395  
396   - // Get the values of the region x,y,and radius
397   - std::vector<std::string> values = gammalib::split(regionstring,",");
398   - if (values.size() != 5) {
  396 + // Get the values of the region x,y,and radius
  397 + std::vector<std::string> values = gammalib::split(regionstring,",");
  398 + if (values.size() != 5) {
399 399 std::string msg =
400 400 "Invalid number of "+gammalib::str(values.size())+" arguments"
401 401 " after the \"box\" key word in provided string \""+line+"\".\n"
402 402 "Exactly 5 arguments are expected.";
403   - throw GException::invalid_value(G_READ, msg);
404   - }
405   - double x = gammalib::todouble(values[0]);
406   - double y = gammalib::todouble(values[1]);
407   - double w = gammalib::todouble(values[2]);
  403 + throw GException::invalid_value(G_READ, msg);
  404 + }
  405 + double x = gammalib::todouble(values[0]);
  406 + double y = gammalib::todouble(values[1]);
  407 + double w = gammalib::todouble(values[2]);
408 408 double h = gammalib::todouble(values[3]);
409 409 double posang = gammalib::todouble(values[4]);
410 410  
... ... @@ -428,52 +428,52 @@ void GSkyRegionRect::read(const std::string&amp; line)
428 428 posang /= 3600.0;
429 429 }
430 430  
431   - // Initialise centre direction
432   - GSkyDir centre = GSkyDir();
433   -
434   - // Set the values in the correct system
435   - if (system == "fk5" || system == "icrs") {
436   - centre.radec_deg(x,y);
437   - }
438   - else if (system == "galactic") {
439   - centre.lb_deg(x,y);
440   - }
441   - else {
  431 + // Initialise centre direction
  432 + GSkyDir centre = GSkyDir();
  433 +
  434 + // Set the values in the correct system
  435 + if (system == "fk5" || system == "icrs") {
  436 + centre.radec_deg(x,y);
  437 + }
  438 + else if (system == "galactic") {
  439 + centre.lb_deg(x,y);
  440 + }
  441 + else {
442 442 std::string msg =
443 443 "Unsupported coordinate system \""+system+"\" in provided string"
444 444 " \""+line+"\".\n"
445 445 "Only the following coordinate systems are supported: "
446 446 "\"fk5\", \"icrs\" and \"galactic\".";
447   - throw GException::invalid_value(G_READ, msg);
448   - }
  447 + throw GException::invalid_value(G_READ, msg);
  448 + }
449 449  
450   - // Set members
451   - this->centre(centre);
  450 + // Set members
  451 + this->centre(centre);
452 452 this->width(w);
453 453 this->height(h);
454 454 this->posang_deg(posang);
455 455  
456   - // Compute solid angle
457   - compute_solid_angle();
  456 + // Compute solid angle
  457 + compute_solid_angle();
458 458  
459   - // Check if there is a given name for the region and set it
460   - std::vector<std::string>comments = gammalib::split(comment, " ");
461   - for (int i = 0; i < comments.size(); i++) {
462   - if (gammalib::contains(comments[i], "text")) {
463   - std::vector<std::string> attributes = gammalib::split(comments[i], "=");
464   - if (attributes.size() < 2) {
  459 + // Check if there is a given name for the region and set it
  460 + std::vector<std::string>comments = gammalib::split(comment, " ");
  461 + for (int i = 0; i < comments.size(); i++) {
  462 + if (gammalib::contains(comments[i], "text")) {
  463 + std::vector<std::string> attributes = gammalib::split(comments[i], "=");
  464 + if (attributes.size() < 2) {
465 465 std::string msg =
466 466 "Invalid character sequence encountered in provided"
467 467 " string \""+line+"\".\n"
468 468 "An attribute of the type \"text=Name\" is expected.";
469   - throw GException::invalid_value(G_READ, msg);
470   - }
471   - m_name = attributes[1];
472   - }
473   - }
474   -
475   - // Return
476   - return;
  469 + throw GException::invalid_value(G_READ, msg);
  470 + }
  471 + m_name = attributes[1];
  472 + }
  473 + }
  474 +
  475 + // Return
  476 + return;
477 477 }
478 478  
479 479  
... ... @@ -488,20 +488,20 @@ void GSkyRegionRect::read(const std::string&amp; line)
488 488 std::string GSkyRegionRect::write(void) const
489 489 {
490 490 // Allocate string
491   - std::string result;
  491 + std::string result;
492 492  
493 493 // Set string
494   - result.append("fk5;box(");
495   - result.append(gammalib::str(m_centre.ra_deg()));
496   - result.append(",");
497   - result.append(gammalib::str(m_centre.dec_deg()));
498   - result.append(",");
499   - result.append(gammalib::str(2*m_halfwidth));
  494 + result.append("fk5;box(");
  495 + result.append(gammalib::str(m_centre.ra_deg()));
  496 + result.append(",");
  497 + result.append(gammalib::str(m_centre.dec_deg()));
  498 + result.append(",");
  499 + result.append(gammalib::str(2*m_halfwidth));
500 500 result.append(",");
501 501 result.append(gammalib::str(2*m_halfheight));
502 502 result.append(",");
503 503 result.append(gammalib::str(m_posang*gammalib::rad2deg));
504   - result.append(")");
  504 + result.append(")");
505 505  
506 506 // Optionally add region name
507 507 if (m_name.length() > 0) {
... ... @@ -510,7 +510,7 @@ std::string GSkyRegionRect::write(void) const
510 510 }
511 511  
512 512 // Return string
513   - return result;
  513 + return result;
514 514 }
515 515  
516 516  
... ... @@ -529,7 +529,7 @@ std::string GSkyRegionRect::print(const GChatter&amp; chatter) const
529 529 if (chatter != SILENT) {
530 530  
531 531 // Append header
532   - result.append("=== GSkyRegionRect ===");
  532 + result.append("=== GSkyRegionRect ===");
533 533  
534 534 // Append sky region information
535 535 result.append("\n"+gammalib::parformat("Right Ascension of centre"));
... ... @@ -559,8 +559,8 @@ std::string GSkyRegionRect::print(const GChatter&amp; chatter) const
559 559 ***************************************************************************/
560 560 bool GSkyRegionRect::contains(const GSkyDir& dir) const
561 561 {
562   - // Initialise return value
563   - bool dir_is_in = false;
  562 + // Initialise return value
  563 + bool dir_is_in = false;
564 564  
565 565 // std::cout<<"GSkyRegionRect::contains: (1/2) dec: "<<m_centre.dec_deg()-m_halfheight<<"<="<<dir.dec_deg()<<"<="<<m_centre.dec_deg()+m_halfheight<<std::endl;
566 566  
... ... @@ -581,8 +581,8 @@ bool GSkyRegionRect::contains(const GSkyDir&amp; dir) const
581 581 // std::cout<<"GSkyRegionRect::contains: (2/2) ra: "<<m_centre.ra_deg()-half_width_scaled<<"<="<<dir.ra_deg()<<"<="<<m_centre.ra_deg()+half_width_scaled<<std::endl;
582 582 }
583 583  
584   - // Return bool
585   - return dir_is_in;
  584 + // Return bool
  585 + return dir_is_in;
586 586 }
587 587  
588 588 /***********************************************************************//**
... ... @@ -601,8 +601,8 @@ bool GSkyRegionRect::contains(const GSkyRegion&amp; reg) const
601 601 throw GException::feature_not_implemented(G_CONTAINS,
602 602 "Cannot compare Rect region type yet");
603 603  
604   - // Return value
605   - return fully_inside;
  604 + // Return value
  605 + return fully_inside;
606 606 }
607 607  
608 608  
... ... @@ -617,14 +617,14 @@ bool GSkyRegionRect::contains(const GSkyRegion&amp; reg) const
617 617 bool GSkyRegionRect::overlaps(const GSkyRegion& reg) const
618 618 {
619 619  
620   - // Initialise return value
621   - bool overlap = false;
  620 + // Initialise return value
  621 + bool overlap = false;
622 622  
623   - throw GException::feature_not_implemented(G_OVERLAPS,
  623 + throw GException::feature_not_implemented(G_OVERLAPS,
624 624 "Cannot compare Rect region type yet");
625 625  
626   - // Return value
627   - return overlap;
  626 + // Return value
  627 + return overlap;
628 628 }
629 629  
630 630  
... ... @@ -673,14 +673,14 @@ GSkyDir GSkyRegionRect::transform_to_local(const GSkyDir&amp; skydir) const
673 673 void GSkyRegionRect::init_members(void)
674 674 {
675 675 // Initialise members
676   - m_centre = GSkyDir();
677   - m_halfwidth = 0.0;
  676 + m_centre = GSkyDir();
  677 + m_halfwidth = 0.0;
678 678 m_halfheight = 0.0;
679 679 m_posang = 0.0;
680   - m_type = "Rect";
  680 + m_type = "Rect";
681 681  
682   - //Return
683   - return;
  682 + //Return
  683 + return;
684 684 }
685 685  
686 686  
... ... @@ -691,9 +691,9 @@ void GSkyRegionRect::init_members(void)
691 691 ***************************************************************************/
692 692 void GSkyRegionRect::copy_members(const GSkyRegionRect& region)
693 693 {
694   - // Copy attributes
695   - m_centre = region.m_centre;
696   - m_halfwidth = region.m_halfwidth;
  694 + // Copy attributes
  695 + m_centre = region.m_centre;
  696 + m_halfwidth = region.m_halfwidth;
697 697 m_halfheight = region.m_halfheight;
698 698 m_posang = region.m_posang;
699 699  
... ...