22 #ifndef ASTSHIM_FRAME_H 23 #define ASTSHIM_FRAME_H 67 NReadValue(
int nread,
double value) : nread(nread), value(value){};
100 : frame(frame), mapping(mapping) {}
169 :
Mapping(reinterpret_cast<AstMapping *>(astFrame(naxes,
"%s",
options.c_str()))) {}
200 assertPointLength(a,
"a");
201 assertPointLength(b,
"b");
202 assertPointLength(c,
"c");
228 assertPointLength(a,
"a");
229 assertPointLength(b,
"b");
261 double axOffset(
int axis,
double v1,
double dist)
const {
474 assertPointLength(point1,
"point1");
475 assertPointLength(point2,
"point2");
782 char const *rawstr = astFormat(getRawPtr(), axis, value);
792 bool ret = astGetActiveUnit(getRawPtr());
831 double getDut1()
const {
return getD(
"Dut1"); }
986 astMatchAxes(getRawPtr(), other.
getRawPtr(), ret.data());
1045 astNorm(getRawPtr(), value.
data());
1075 assertPointLength(point1,
"point1");
1076 assertPointLength(point2,
"point2");
1078 astOffset(getRawPtr(), point1.
data(), point2.
data(), offset, ret.
data());
1118 assertPointLength(point1,
"point1");
1120 double offsetAngle = astOffset2(getRawPtr(), point1.
data(),
angle, offset, point2.
data());
1139 astPermAxes(getRawPtr(), perm.
data());
1295 astSetActiveUnit(getRawPtr(), enable);
1503 int nread = astUnformat(getRawPtr(), axis, str.
c_str(), &value);
1518 explicit Frame(AstFrame *rawPtr) :
Mapping(reinterpret_cast<AstMapping *>(rawPtr)) {
1519 if (!astIsAFrame(getRawPtr())) {
1521 os <<
"This is a " <<
getClassName() <<
", which is not a Frame";
1535 template <
typename T>
1536 void assertPointLength(T
const &p,
char const *
name)
const {
1537 if (static_cast<int>(p.size()) != getNIn()) {
1539 os <<
"point " << name <<
" has " << p.size() <<
" axes, but " << getNIn() <<
" required";
double axOffset(int axis, double v1, double dist) const
Return an axis value formed by adding a signed axis increment onto a supplied axis value...
A CmpFrame is a compound Frame which allows two component Frames (of any class) to be merged together...
Frame(int naxes, std::string const &options="")
Construct a Frame.
std::string getDomain() const
Get Domain: coordinate system domain.
void setDigits(int digits)
Set Digits for all axes: number of digits of precision.
void setObsLat(std::string const &lat)
Set ObsLat: frame title.
double getTop(int axis) const
Get Top: the highest axis value to display.
Struct returned by Frame::resolve containing a point and the resolved vector components.
AstObject const * getRawPtr() const
Get the raw AST pointer.
double value
Value that was read.
void setEpoch(std::string const &epoch)
Set Epoch: Epoch of observation as a string.
Struct returned by Frame::pickAxes containing a frame and a mapping.
void setPreserveAxes(bool preserve)
Set PreserveAxes: preserve axes?
double distance(PointD const &point1, PointD const &point2) const
Find the distance between two points whose Frame coordinates are given.
AST wrapper classes and functions.
double axDistance(int axis, double v1, double v2) const
Return a signed value representing the axis increment from axis value v1 to axis value v2...
void setMaxAxes(int maxAxes)
Get MaxAxes: the maximum number of axes a frame found by findFrame may have.
void setDut1(double dut1)
Set Dut1: difference between the UT1 and UTC timescale (sec)
std::shared_ptr< Frame > copy() const
Return a deep copy of this object.
double d2
Resolved vector component 2.
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST's state is bad.
void setSymbol(int axis, std::string const &symbol)
Set Symbol(axis) for one axis: axis symbol.
DirectionPoint(double direction, PointD const &point)
Construct a DirectionPoint.
double getBottom(int axis) const
Get Bottom for one axis: the lowest axis value to display.
table::Key< double > angle
std::vector< double > point
Point.
double axAngle(PointD const &a, PointD const &b, int axis) const
Find the angle, as seen from point A, between the positive direction of a specified axis...
void setFormat(int axis, std::string const &format)
Set Format for one axis: format specification for axis values.
void permAxes(std::vector< int > perm)
Permute the order in which a Frame's axes occur.
void astBadToNan(std::vector< double > &p)
Replace AST__BAD with a quiet NaN in a vector.
double direction
Direction, an angle in radians.
void setTop(int axis, double top)
Set Top for one axis: the highest axis value to display.
An abstract base class for objects which transform one set of coordinates to another.
bool getMatchEnd() const
Get MatchEnd: match trailing axes?
std::string getFormat(int axis) const
Get Format for one axis: format specification for axis values.
void setEpoch(double epoch)
Set Epoch: Epoch of observation as a double (years)
std::string getSystem() const
Get System: coordinate system used to describe positions within the domain.
Struct returned by Frame::unformat containing the number of characters read and corresponding value...
Frame is used to represent a coordinate system.
int getNAxes() const
Get NAxes: the number of axes in the frame (i.e.
std::shared_ptr< Mapping > mapping
Mapping.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
std::string getUnit(int axis) const
Get Unit(axis) for one axis: physical units for formatted axis values.
void setBottom(int axis, double bottom)
Set Bottom: the lowest axis value to display.
Frame(AstFrame *rawPtr)
Construct a Frame from a pointer to a raw AstFrame.
T static_pointer_cast(T... args)
double d1
Resolved vector component 1.
void setLabel(int axis, std::string const &label)
Set Label(axis) for one axis: axis label.
std::shared_ptr< Frame > frame
Frame.
void setObsAlt(double alt)
Set ObsAlt: Geodetic altitude of observer (m).
PointD offset(PointD point1, PointD point2, double offset) const
Find the point which is offset a specified distance along the geodesic curve between two other points...
int getDigits() const
Get Digits: the default used if no specific value specified for an axis.
virtual void setDomain(std::string const &domain)
Set Domain: coordinate system domain.
bool getDirection(int axis) const
Get Direction for one axis: display axis in conventional direction?
std::string getObsLon() const
Get ObsLon: Geodetic longitude of observer.
int getDigits(int axis) const
Get Digits for one axis.
double getObsAlt() const
Get ObsAlt: Geodetic altitude of observer (m).
std::string getClassName(AstObject const *rawObj)
Get the AST class name, changing CmpMap to SeriesMap or ParallelMap as appropriate.
double angle(PointD const &a, PointD const &b, PointD const &c) const
Find the angle at point B between the line joining points A and B, and the line joining points C and ...
int getMaxAxes() const
Get MaxAxes: the maximum axes a frame found by findFrame may have.
std::string getInternalUnit(int axis) const
Get InternalUnit(axis) read-only attribute for one axis: physical units for unformated axis values...
double getEpoch() const
Get Epoch: Epoch of observation.
std::string getTitle() const
Get Title: frame title.
int getNIn() const
Get NIn: the number of input axes.
bool getPreserveAxes() const
Get PreserveAxes: preserve axes?
std::string getLabel(int axis) const
Get Label(axis) for one axis: axis label.
ResolvedPoint(int naxes)
Construct an empty ResolvedPoint.
double getDut1() const
Get Dut1: difference between the UT1 and UTC timescale (sec)
void setObsLon(std::string const &lon)
Set ObsLon: Geodetic longitude of observer.
std::string formatAxisAttr(std::string const &name, int axis)
Format an axis-specific attribute by appending the axis index.
void setMatchEnd(bool match)
Set MatchEnd: match trailing axes?
bool getPermute() const
Get Permute: allow axis permutation when used as a template?
double safeDouble(double val)
Return a double value after checking status and replacing AST__BAD with nan
ItemVariant const * other
std::string getAlignSystem() const
Get AlignSystem: the coordinate system used by convert and findFrame to align Frames.
void assertEqual(T1 val1, std::string const &descr1, T2 val2, std::string const &descr2)
void setUnit(int axis, std::string const &unit)
Set Unit(axis) for one axis: physical units for formatted axis values.
void setSystem(std::string const &system)
Set System: coordinate system used to describe positions within the domain.
std::string getObsLat() const
Get ObsLat: Geodetic latitude of observer.
FrameMapping(std::shared_ptr< Frame > frame, std::shared_ptr< Mapping > mapping)
Construct a FrameMapping.
Struct returned by Frame::offset2 containing a direction and a point.
void setDirection(bool direction, int axis)
Set Direction for one axis: display axis in conventional direction?
DirectionPoint offset2(PointD const &point1, double angle, double offset) const
Find the point which is offset a specified distance along the geodesic curve at a given angle from a ...
NReadValue unformat(int axis, std::string const &str) const
Read a formatted coordinate value (given as a character string) for a Frame axis and return the numbe...
std::string format(int axis, double value) const
Return a string containing the formatted (character) version of a coordinate value for a Frame axis...
Abstract base class for all AST objects.
std::string getSymbol(int axis) const
Get Symbol(axis) for one axis: axis symbol.
void setMinAxes(int minAxes)
Get MinAxes: the minimum number of axes a frame found by findFrame may have.
A FrameSet consists of a set of one or more Frames (which describe coordinate systems), connected together by Mappings (which describe how the coordinate systems are inter-related).
void setActiveUnit(bool enable)
Set ActiveUnit: pay attention to units when one Frame is used to match another?
void setAlignSystem(std::string const &system)
Set AlignSystem: the coordinate system used by convert and findFrame to align Frames.
NReadValue(int nread, double value)
Construct an NReadValue.
bool getActiveUnit() const
Get ActiveUnit: pay attention to units when one Frame is used to match another?
virtual std::shared_ptr< Object > copyPolymorphic() const override
Return a deep copy of this object.
void setPermute(bool permute)
Set Permute: allow axis permutation when used as a template?
void setDigits(int axis, int digits)
Set Digits for one axis: number of digits of precision.
void setTitle(std::string const &title)
Set Title: frame title.
std::vector< int > matchAxes(Frame const &other) const
Look for corresponding axes between this frame and another.
PointD norm(PointD value) const
Normalise a set of Frame coordinate values which might be unsuitable for display (e.g.
std::string getNormUnit(int axis) const
Get NormUnit(axis) read-only attribute for one frame: normalised physical units for formatted axis va...
int getMinAxes() const
Get MinAxes: the maximum axes a frame found by findFrame may have.