LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Observatory.cc
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
32 #include <sstream>
33 #include <cmath>
34 
35 #include "lsst/pex/exceptions.h"
36 #include "boost/format.hpp"
37 #include "boost/algorithm/string.hpp"
38 #include "boost/tuple/tuple.hpp"
39 
40 #include "lsst/afw/geom/Angle.h"
41 #include "lsst/afw/coord/Coord.h"
43 
44 namespace coord = lsst::afw::coord;
45 namespace ex = lsst::pex::exceptions;
46 namespace afwGeom = lsst::afw::geom;
47 
48 
49 
54  afwGeom::Angle const longitude,
55  afwGeom::Angle const latitude,
56  double const elevation
57  ) :
58  _latitude(latitude),
59  _longitude(longitude),
60  _elevation(elevation) {
61 }
62 
63 
64 
65 /*
66  * @brief Constructor for the observatory with lat/long as strings
67  *
68  * @note RA is assumed to be in DMS, not HMS!
69  *
70  */
72  std::string const longitude,
73  std::string const latitude,
74  double const elevation
75  ) :
76  _latitude(dmsStringToAngle(latitude)),
77  _longitude(dmsStringToAngle(longitude)),
78  _elevation(elevation) {
79 }
80 
81 
82 
83 
89  return _longitude;
90 }
91 
100  return _latitude;
101 }
102 
103 
108  afwGeom::Angle const latitude
109  ) {
110  _latitude = latitude;
111 }
112 
117  afwGeom::Angle const longitude
118  ) {
119  _longitude = longitude;
120 }
121 
122 
127  double const elevation
128  ) {
129  _elevation = elevation;
130 }
131 
132 
133 
142  return angleToDmsString(_longitude);
143 }
152  return angleToDmsString(_latitude);
153 }
154 
158 std::ostream & coord::operator<<(std::ostream &os,
159  coord::Observatory const& obs
160  )
161 {
162  return os << (boost::format("%gW, %gN %g")
163  % obs.getLatitude().asDegrees()
164  % obs.getLongitude().asDegrees()
165  % obs.getElevation()).str();
166 }
167 
168 /************************************************************************************************************/
Observatory(lsst::afw::geom::Angle const longitude, lsst::afw::geom::Angle const latitude, double const elevation)
Constructor for the observatory with lat/long as afwGeom::Angles.
Definition: Observatory.cc:53
Store information about an observatory ... lat/long, elevation.
Definition: Observatory.h:48
std::string getLatitudeStr() const
Allow quick access to the longitude coordinate as a string.
Definition: Observatory.cc:151
Class to hold observatory information.
double asDegrees() const
Definition: Angle.h:124
void setLongitude(lsst::afw::geom::Angle const longitude)
Set the longitude.
Definition: Observatory.cc:116
void setElevation(double const elevation)
Set the Elevation.
Definition: Observatory.cc:126
std::ostream & operator<<(std::ostream &os, Coord const &coord)
Definition: Coord.cc:1418
std::string getLongitudeStr() const
Allow quick access to the longitudinal coordinate as a string.
Definition: Observatory.cc:141
void setLatitude(lsst::afw::geom::Angle const latitude)
Set the latitude.
Definition: Observatory.cc:107
std::string angleToDmsString(lsst::afw::geom::Angle const deg)
a Function to convert a coordinate in decimal degrees to a string with form dd:mm:ss ...
Definition: Coord.cc:293
lsst::afw::geom::Angle getLongitude() const
The main access method for the longitudinal coordinate.
Definition: Observatory.cc:88
double getElevation() const
Definition: Observatory.h:60
lsst::afw::geom::Angle getLatitude() const
The main access method for the longitudinal coordinate.
Definition: Observatory.cc:99
lsst::afw::geom::Angle dmsStringToAngle(std::string const dms)
Convert a dd:mm:ss string to Angle.
Definition: Coord.cc:344
Include files required for standard LSST Exception handling.
Functions to handle coordinates.