LCOV - code coverage report
Current view: top level - atmosphere/ATM - ATMAngle.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 11 34 32.4 %
Date: 2024-10-12 00:35:29 Functions: 3 8 37.5 %

          Line data    Source code
       1             : /*******************************************************************************
       2             :  * ALMA - Atacama Large Millimiter Array
       3             :  * (c) Instituto de Estructura de la Materia, 2009
       4             :  *
       5             :  * This library is free software; you can redistribute it and/or
       6             :  * modify it under the terms of the GNU Lesser General Public
       7             :  * License as published by the Free Software Foundation; either
       8             :  * version 2.1 of the License, or (at your option) any later version.
       9             :  *
      10             :  * This library is distributed in the hope that it will be useful,
      11             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13             :  * Lesser General Public License for more details.
      14             :  *
      15             :  * You should have received a copy of the GNU Lesser General Public
      16             :  * License along with this library; if not, write to the Free Software
      17             :  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
      18             :  *
      19             :  * "@(#) $Id: ATMAngle.cpp Exp $"
      20             :  *
      21             :  * who       when      what
      22             :  * --------  --------  ----------------------------------------------
      23             :  * pardo     24/03/09  created
      24             :  */
      25             : 
      26             : #include "ATMAngle.h"
      27             : 
      28             : 
      29             : 
      30             : ATM_NAMESPACE_BEGIN
      31             : 
      32           0 : Angle::Angle() :
      33           0 :   valueIS_(0.0)
      34             : {
      35           0 : }
      36             : 
      37           0 : Angle::Angle(double angle) :
      38           0 :   valueIS_(angle)
      39             : {
      40           0 : }
      41             : 
      42           0 : Angle::Angle(double angle, const std::string &units)
      43             : {
      44           0 :   if(units == "Rad" || units == "RAD" || units == "rad") {
      45           0 :     valueIS_ = angle;
      46           0 :   } else if(units == "deg" || units == "DEG") {
      47           0 :     valueIS_ = (angle / 360.0) * 6.2831852;
      48             :   } else {
      49           0 :     valueIS_ = angle;
      50             :   }
      51           0 : }
      52             : 
      53       43209 : Angle::Angle(double angle, Angle::Units units)
      54             : {
      55       43209 :   if(units == Angle::UnitRadian) {
      56           0 :     valueIS_ = angle;
      57       43209 :   } else if(units == Angle::UnitDegree) {
      58       43209 :     valueIS_ = (angle / 360.0) * 6.2831852;
      59             :   } else {
      60           0 :     valueIS_ = angle;
      61             :   }
      62       43209 : }
      63             : 
      64       86418 : Angle::~Angle()
      65             : {
      66       86418 : }
      67             : 
      68           0 : double Angle::get(const std::string &units) const
      69             : {
      70           0 :   if(units == "Rad" || units == "RAD" || units == "rad") {
      71           0 :     return valueIS_;
      72           0 :   } else if(units == "deg" || units == "DEG") {
      73           0 :     return 360.0 * (valueIS_ / 6.2831852);
      74             :   } else {
      75           0 :     return valueIS_;
      76             :   }
      77             : }
      78             : 
      79       43209 : double Angle::get(Angle::Units units) const
      80             : {
      81       43209 :   if(units == Angle::UnitRadian) {
      82           0 :     return valueIS_;
      83       43209 :   } else if(units == Angle::UnitDegree) {
      84       43209 :     return 360.0 * (valueIS_ / 6.2831852);
      85             :   } else {
      86           0 :     return valueIS_;
      87             :   }
      88             : }
      89             : 
      90             : ATM_NAMESPACE_END

Generated by: LCOV version 1.16