lsst.afw  13.0-101-g894215678
Observatory.cc
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008-2016 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 
25 #include <sstream>
26 #include <string>
27 
28 #include "boost/format.hpp"
29 
30 #include "lsst/afw/geom/Angle.h"
31 #include "lsst/afw/coord/Coord.h"
33 
34 namespace lsst {
35 namespace afw {
36 namespace coord {
37 
39  double const elevation)
40  : _latitude(latitude), _longitude(longitude), _elevation(elevation) {}
41 
42 Observatory::Observatory(std::string const& longitude, std::string const& latitude, double const elevation)
43  : _latitude(dmsStringToAngle(latitude)),
44  _longitude(dmsStringToAngle(longitude)),
45  _elevation(elevation) {}
46 
47 afw::geom::Angle Observatory::getLongitude() const { return _longitude; }
48 
49 afw::geom::Angle Observatory::getLatitude() const { return _latitude; }
50 
52 
54 
55 void Observatory::setElevation(double const elevation) { _elevation = elevation; }
56 
57 std::string Observatory::getLongitudeStr() const { return angleToDmsString(_longitude); }
58 
59 std::string Observatory::getLatitudeStr() const { return angleToDmsString(_latitude); }
60 
61 std::string Observatory::toString() const {
62  return (boost::format("%gW, %gN %g") % getLatitude().asDegrees() % getLongitude().asDegrees() %
63  getElevation())
64  .str();
65 }
66 
67 std::ostream& operator<<(std::ostream& os, Observatory const& obs) {
68  os << obs.toString();
69  return os;
70 }
71 }
72 }
73 } // namespace lsst::afw::coord
void setElevation(double const elevation)
set telescope elevation (meters above reference spheroid)
Definition: Observatory.cc:55
lsst::afw::geom::Angle getLatitude() const
get telescope latitude
Definition: Observatory.cc:49
std::string getLongitudeStr() const
get telescope longitude as a dd:mm:ss.s string (positive values are E of Greenwich) ...
Definition: Observatory.cc:57
std::string toString() const
get string representation
Definition: Observatory.cc:61
lsst::afw::geom::Angle dmsStringToAngle(std::string const dms)
Convert a dd:mm:ss string to Angle.
Definition: Coord.cc:284
void setLongitude(lsst::afw::geom::Angle const longitude)
set telescope longitude
Definition: Observatory.cc:53
Hold the location of an observatory.
Definition: Observatory.h:41
Observatory(lsst::afw::geom::Angle const longitude, lsst::afw::geom::Angle const latitude, double const elevation)
Construct an Observatory with longitude and latitude specified as lsst::afw::geom::Angle.
Definition: Observatory.cc:38
void setLatitude(lsst::afw::geom::Angle const latitude)
set telescope latitude (positive values are E of Greenwich)
Definition: Observatory.cc:51
table::Key< geom::Angle > latitude
Definition: VisitInfo.cc:165
std::ostream & operator<<(std::ostream &os, Coord const &coord)
Definition: Coord.cc:967
A class representing an angle.
Definition: Angle.h:102
A base class for image defects.
Definition: cameraGeom.dox:3
table::Key< geom::Angle > longitude
Definition: VisitInfo.cc:166
double getElevation() const
get telescope elevation (meters above reference spheroid)
Definition: Observatory.h:75
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:249
lsst::afw::geom::Angle getLongitude() const
get telescope longitude (positive values are E of Greenwich)
Definition: Observatory.cc:47
std::string getLatitudeStr() const
get telescope latitude as a dd:mm:ss.s string
Definition: Observatory.cc:59
table::Key< double > elevation
Definition: VisitInfo.cc:167