lsst.afw  13.0-91-g2a3e2ee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Observatory.h
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 #if !defined(LSST_AFW_COORD_OBSERVATORY_H)
26 #define LSST_AFW_COORD_OBSERVATORY_H
27 /*
28  * Class to hold observatory/telescope location
29  */
30 
31 #include <iostream>
32 #include "lsst/afw/geom/Angle.h"
33 
34 namespace lsst {
35 namespace afw {
36 namespace coord {
37 
41 class Observatory {
42 public:
51  double const elevation);
52 
61  Observatory(std::string const& longitude, std::string const& latitude, double const elevation);
62 
64  void setLongitude(lsst::afw::geom::Angle const longitude);
66  void setLatitude(lsst::afw::geom::Angle const latitude);
68  void setElevation(double const elevation);
69 
75  double getElevation() const { return _elevation; }
76 
78  std::string getLongitudeStr() const;
80  std::string getLatitudeStr() const;
82  std::string toString() const;
83 
84  bool operator==(Observatory const& rhs) const {
85  auto deltaLongitude = (_latitude - rhs.getLatitude()).wrapCtr();
86  auto deltaLatitude = (_longitude - rhs.getLongitude()).wrapCtr();
87  return (deltaLongitude == 0.0 * lsst::afw::geom::degrees) &&
88  (deltaLatitude == 0.0 * lsst::afw::geom::degrees) && ((_elevation - rhs._elevation) == 0.0);
89  }
90  bool operator!=(Observatory const& rhs) const { return !(*this == rhs); }
91 
92 private:
93  lsst::afw::geom::Angle _latitude;
94  lsst::afw::geom::Angle _longitude;
95  double _elevation;
96 };
97 
104 std::ostream& operator<<(std::ostream& os, Observatory const& obs);
105 }
106 }
107 }
108 
109 #endif
void setElevation(double const elevation)
set telescope elevation (meters above reference spheroid)
Definition: Observatory.cc:55
table::Key< geom::Angle > longitude
Definition: VisitInfo.cc:166
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
AngleUnit constexpr degrees
constant with units of degrees
Definition: Angle.h:88
std::string getLongitudeStr() const
get telescope longitude as a dd:mm:ss.s string (positive values are E of Greenwich) ...
Definition: Observatory.cc:57
void setLatitude(lsst::afw::geom::Angle const latitude)
set telescope latitude (positive values are E of Greenwich)
Definition: Observatory.cc:51
std::ostream & operator<<(std::ostream &os, Coord const &coord)
Definition: Coord.cc:967
A class representing an angle.
Definition: Angle.h:102
lsst::afw::geom::Angle getLongitude() const
get telescope longitude (positive values are E of Greenwich)
Definition: Observatory.cc:47
table::Key< geom::Angle > latitude
Definition: VisitInfo.cc:165
bool operator!=(Observatory const &rhs) const
Definition: Observatory.h:90
table::Key< double > elevation
Definition: VisitInfo.cc:167
std::string getLatitudeStr() const
get telescope latitude as a dd:mm:ss.s string
Definition: Observatory.cc:59
bool operator==(Observatory const &rhs) const
Definition: Observatory.h:84
std::string toString() const
get string representation
Definition: Observatory.cc:61
double getElevation() const
get telescope elevation (meters above reference spheroid)
Definition: Observatory.h:75
lsst::afw::geom::Angle getLatitude() const
get telescope latitude
Definition: Observatory.cc:49