lsst.astshim  master-gd1207e8857
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
ZoomMap.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_ZOOMMAP_H
23 #define ASTSHIM_ZOOMMAP_H
24 
25 #include <memory>
26 
27 #include "astshim/base.h"
28 #include "astshim/Mapping.h"
29 
30 namespace ast {
31 
45 class ZoomMap: public Mapping {
46 friend class Object;
47 public:
60  explicit ZoomMap(int ncoord, double zoom, std::string const & options=""):
61  Mapping(reinterpret_cast<AstMapping *>(
62  astZoomMap(ncoord, zoom, options.c_str())))
63  {}
64 
65  virtual ~ZoomMap() {}
66 
67  ZoomMap(ZoomMap const &) = delete;
68  ZoomMap(ZoomMap &&) = default;
69  ZoomMap & operator=(ZoomMap const &) = delete;
70  ZoomMap & operator=(ZoomMap &&) = default;
71 
73  std::shared_ptr<ZoomMap> copy() const {
74  return std::static_pointer_cast<ZoomMap>(_copyPolymorphic());
75  }
76 
78  double getZoom() const { return getF("Zoom"); }
79 
80 protected:
81  virtual std::shared_ptr<Object> _copyPolymorphic() const override {
82  return _copyImpl<ZoomMap, AstZoomMap>();
83  }
84 
86  explicit ZoomMap(AstZoomMap * rawptr) :
87  Mapping(reinterpret_cast<AstMapping *>(rawptr))
88  {
89  if (!astIsAZoomMap(getRawPtr())) {
90  std::ostringstream os;
91  os << "this is a " << getClass() << ", which is not a ZoomMap";
92  throw std::invalid_argument(os.str());
93  }
94  }
95 };
96 
97 } // namespace ast
98 
99 #endif
double getZoom() const
Get Zoom: scale factor.
Definition: ZoomMap.h:78
std::string getClass() const
Definition: Object.h:117
Definition: Mapping.h:59
Definition: Object.h:49
Definition: ZoomMap.h:45
ZoomMap(int ncoord, double zoom, std::string const &options="")
Definition: ZoomMap.h:60
float getF(std::string const &attrib) const
Definition: Object.h:373
ZoomMap(AstZoomMap *rawptr)
Construct a ZoomMap from a raw AST pointer.
Definition: ZoomMap.h:86
virtual std::shared_ptr< Object > _copyPolymorphic() const override
Definition: ZoomMap.h:81
std::shared_ptr< ZoomMap > copy() const
Return a deep copy of this object.
Definition: ZoomMap.h:73
AstObject const * getRawPtr() const
Definition: Object.h:260