22 #ifndef ASTSHIM_PCDMAP_H
23 #define ASTSHIM_PCDMAP_H
30 #include "astshim/base.h"
31 #include "astshim/detail/utils.h"
32 #include "astshim/Mapping.h"
86 PcdMap(
double disco, std::vector<double>
const & pcdcen, std::string
const & options=
"") :
87 Mapping(reinterpret_cast<AstMapping *>(_makeRawPcdMap(disco, pcdcen, options)))
98 std::shared_ptr<PcdMap>
copy()
const {
106 double getPcdCen(
int axis)
const {
return getD(detail::formatAxisAttr(
"PcdCen", axis)); }
110 std::vector<double> ctr;
111 for (
auto axis = 1; axis < 3; ++axis) {
119 return _copyImpl<PcdMap, AstPcdMap>();
124 Mapping(reinterpret_cast<AstMapping *>(rawptr))
127 std::ostringstream os;
128 os <<
"this is a " <<
getClass() <<
", which is not a PcdMap";
129 throw std::invalid_argument(os.str());
134 AstPcdMap *_makeRawPcdMap(
double disco, std::vector<double>
const &pcdcen,
135 std::string
const &options =
"") {
136 if (pcdcen.size() != 2) {
137 std::ostringstream os;
138 os <<
"pcdcen.size() = " << pcdcen.size() <<
"; must be 2";
139 throw std::invalid_argument(os.str());
141 return astPcdMap(disco, pcdcen.data(), options.c_str());
virtual std::shared_ptr< Object > _copyPolymorphic() const override
Definition: PcdMap.h:118
PcdMap(AstPcdMap *rawptr)
Construct a PcdMap from a raw AST pointer.
Definition: PcdMap.h:123
std::vector< double > getPcdCen() const
Get PcdMap_PcdCen PcdCen for both axes: centre coordinates of pincushion/barrel distortion.
Definition: PcdMap.h:109
double getPcdCen(int axis) const
Get PcdMap_PcdCen PcdCen(axis) for one axis: centre coordinates of pincushion/barrel distortion...
Definition: PcdMap.h:106
std::string getClass() const
Definition: Object.h:117
std::shared_ptr< PcdMap > copy() const
Return a deep copy of this object.
Definition: PcdMap.h:98
PcdMap(double disco, std::vector< double > const &pcdcen, std::string const &options="")
Definition: PcdMap.h:86
double getD(std::string const &attrib) const
Definition: Object.h:360
double getDisco() const
Get Disco: pincushion/barrel distortion coefficient.
Definition: PcdMap.h:103
AstObject const * getRawPtr() const
Definition: Object.h:260