lsst.astshim  master-gd1207e8857
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
SphMap.h
1 /*
2  * LSST Data Management System
3  * Copyright 2016 AURA/LSST.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <https://www.lsstcorp.org/LegalNotices/>.
21  */
22 #ifndef ASTSHIM_SPHMAP_H
23 #define ASTSHIM_SPHMAP_H
24 
25 #include <memory>
26 
27 #include "astshim/base.h"
28 #include "astshim/Mapping.h"
29 
30 namespace ast {
31 
54 class SphMap: public Mapping {
55 friend class Object;
56 public:
62  explicit SphMap(std::string const & options="") :
63  Mapping(reinterpret_cast<AstMapping *>(astSphMap(options.c_str())))
64  {}
65 
66  virtual ~SphMap() {}
67 
68  SphMap(SphMap const &) = delete;
69  SphMap(SphMap &&) = default;
70  SphMap & operator=(SphMap const &) = delete;
71  SphMap & operator=(SphMap &&) = default;
72 
74  std::shared_ptr<SphMap> copy() const {
75  return std::static_pointer_cast<SphMap>(_copyPolymorphic());
76  }
77 
79  bool getUnitRadius() const { return getB("UnitRadius"); }
80 
82  double getPolarLong() const { return getD("PolarLong"); }
83 
84 protected:
85  virtual std::shared_ptr<Object> _copyPolymorphic() const override {
86  return _copyImpl<SphMap, AstSphMap>();
87  }
88 
90  explicit SphMap(AstSphMap * rawptr) :
91  Mapping(reinterpret_cast<AstMapping *>(rawptr))
92  {
93  if (!astIsASphMap(getRawPtr())) {
94  std::ostringstream os;
95  os << "this is a " << getClass() << ", which is not a SphMap";
96  throw std::invalid_argument(os.str());
97  }
98  }
99 };
100 
101 } // namespace ast
102 
103 #endif
bool getUnitRadius() const
Get UnitRadius: input vectors lie on a unit sphere?
Definition: SphMap.h:79
std::string getClass() const
Definition: Object.h:117
Definition: SphMap.h:54
Definition: Mapping.h:59
Definition: Object.h:49
virtual std::shared_ptr< Object > _copyPolymorphic() const override
Definition: SphMap.h:85
SphMap(AstSphMap *rawptr)
Construct a SphMap from a raw AST pointer.
Definition: SphMap.h:90
double getD(std::string const &attrib) const
Definition: Object.h:360
double getPolarLong() const
Get PolarLong: the longitude value to assign to either pole (radians).
Definition: SphMap.h:82
SphMap(std::string const &options="")
Definition: SphMap.h:62
bool getB(std::string const &attrib) const
Definition: Object.h:334
std::shared_ptr< SphMap > copy() const
Return a deep copy of this object.
Definition: SphMap.h:74
AstObject const * getRawPtr() const
Definition: Object.h:260