22#ifndef ASTSHIM_FRAME_H
23#define ASTSHIM_FRAME_H
169 :
Mapping(reinterpret_cast<AstMapping *>(astFrame(naxes,
"%s",
options.c_str()))) {
202 assertPointLength(a,
"a");
203 assertPointLength(
b,
"b");
204 assertPointLength(c,
"c");
230 assertPointLength(a,
"a");
231 assertPointLength(
b,
"b");
263 double axOffset(
int axis,
double v1,
double dist)
const {
475 assertPointLength(point1,
"point1");
476 assertPointLength(point2,
"point2");
783 char const *rawstr = astFormat(
getRawPtr(), axis, value);
793 bool ret = astGetActiveUnit(
getRawPtr());
1076 assertPointLength(point1,
"point1");
1077 assertPointLength(point2,
"point2");
1119 assertPointLength(point1,
"point1");
1504 int nread = astUnformat(
getRawPtr(), axis, str.c_str(), &value);
1519 explicit Frame(AstFrame *rawPtr) :
Mapping(reinterpret_cast<AstMapping *>(rawPtr)) {
1522 os <<
"This is a " <<
getClassName() <<
", which is not a Frame";
1536 template <
typename T>
1537 void assertPointLength(T
const &p,
char const *name)
const {
1538 if (
static_cast<int>(p.size()) !=
getNIn()) {
1540 os <<
"point " << name <<
" has " << p.size() <<
" axes, but " <<
getNIn() <<
" required";
table::Key< double > angle
A CmpFrame is a compound Frame which allows two component Frames (of any class) to be merged together...
Struct returned by Frame::offset2 containing a direction and a point.
DirectionPoint(double direction, PointD const &point)
Construct a DirectionPoint.
double direction
Direction, an angle in radians.
Frame is used to represent a coordinate system.
void permAxes(std::vector< int > perm)
Permute the order in which a Frame's axes occur.
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...
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.
std::string getFormat(int axis) const
Get Format for one axis: format specification for axis values.
int getMaxAxes() const
Get MaxAxes: the maximum axes a frame found by findFrame may have.
double getDut1() const
Get Dut1: difference between the UT1 and UTC timescale (sec)
void setSymbol(int axis, std::string const &symbol)
Set Symbol(axis) for one axis: axis symbol.
void setActiveUnit(bool enable)
Set ActiveUnit: pay attention to units when one Frame is used to match another?
std::string getObsLat() const
Get ObsLat: Geodetic latitude of observer.
int getMinAxes() const
Get MinAxes: the maximum axes a frame found by findFrame may have.
void setMaxAxes(int maxAxes)
Get MaxAxes: the maximum number of axes a frame found by findFrame may have.
virtual void setDomain(std::string const &domain)
Set Domain: coordinate system domain.
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.
std::string getSymbol(int axis) const
Get Symbol(axis) for one axis: axis symbol.
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,...
double getBottom(int axis) const
Get Bottom for one axis: the lowest axis value to display.
void setPermute(bool permute)
Set Permute: allow axis permutation when used as a template?
virtual std::shared_ptr< Object > copyPolymorphic() const override
Return a deep copy of this object.
bool getPermute() const
Get Permute: allow axis permutation when used as a template?
int getDigits() const
Get Digits: the default used if no specific value specified for an axis.
Frame(Frame const &)=default
Copy constructor: make a deep copy.
int getNAxes() const
Get NAxes: the number of axes in the frame (i.e.
std::string getAlignSystem() const
Get AlignSystem: the coordinate system used by convert and findFrame to align Frames.
double distance(PointD const &point1, PointD const &point2) const
Find the distance between two points whose Frame coordinates are given.
void setDigits(int digits)
Set Digits for all axes: number of digits of precision.
std::string getDomain() const
Get Domain: coordinate system domain.
void setFormat(int axis, std::string const &format)
Set Format for one axis: format specification for axis values.
std::string getSystem() const
Get System: coordinate system used to describe positions within the domain.
void setDirection(bool direction, int axis)
Set Direction for one axis: display axis in conventional direction?
std::shared_ptr< FrameSet > findFrame(Frame const &tmplt, std::string const &domainlist="")
Find a coordinate system with specified characteristics.
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...
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 ...
std::string getNormUnit(int axis) const
Get NormUnit(axis) read-only attribute for one frame: normalised physical units for formatted axis va...
std::shared_ptr< Frame > copy() const
Return a deep copy of this object.
Frame & operator=(Frame const &)=delete
double getObsAlt() const
Get ObsAlt: Geodetic altitude of observer (m).
std::string getInternalUnit(int axis) const
Get InternalUnit(axis) read-only attribute for one axis: physical units for unformated axis values.
void setPreserveAxes(bool preserve)
Set PreserveAxes: preserve axes?
void setMatchEnd(bool match)
Set MatchEnd: match trailing axes?
void setObsAlt(double alt)
Set ObsAlt: Geodetic altitude of observer (m).
void setAlignSystem(std::string const &system)
Set AlignSystem: the coordinate system used by convert and findFrame to align Frames.
void setBottom(int axis, double bottom)
Set Bottom: the lowest axis value to display.
std::vector< double > intersect(std::vector< double > const &a1, std::vector< double > const &a2, std::vector< double > const &b1, std::vector< double > const &b2) const
Find the point of intersection between two geodesic curves.
std::vector< int > matchAxes(Frame const &other) const
Look for corresponding axes between this frame and another.
bool getPreserveAxes() const
Get PreserveAxes: preserve axes?
CmpFrame under(Frame const &next) const
Combine this frame with another to form a compound frame (CmpFrame), with the axes of this frame foll...
void setTitle(std::string const &title)
Set Title: frame title.
bool getMatchEnd() const
Get MatchEnd: match trailing axes?
void setObsLon(std::string const &lon)
Set ObsLon: Geodetic longitude of observer.
void setTop(int axis, double top)
Set Top for one axis: the highest axis value to display.
Frame & operator=(Frame &&)=default
PointD norm(PointD value) const
Normalise a set of Frame coordinate values which might be unsuitable for display (e....
std::string getObsLon() const
Get ObsLon: Geodetic longitude of observer.
void setDut1(double dut1)
Set Dut1: difference between the UT1 and UTC timescale (sec)
std::string getUnit(int axis) const
Get Unit(axis) for one axis: physical units for formatted axis values.
double getTop(int axis) const
Get Top: the highest axis value to display.
bool getActiveUnit() const
Get ActiveUnit: pay attention to units when one Frame is used to match another?
bool getDirection(int axis) const
Get Direction for one axis: display axis in conventional direction?
void setUnit(int axis, std::string const &unit)
Set Unit(axis) for one axis: physical units for formatted axis values.
void setObsLat(std::string const &lat)
Set ObsLat: frame title.
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 ...
std::string getLabel(int axis) const
Get Label(axis) for one axis: axis label.
FrameMapping pickAxes(std::vector< int > const &axes) const
Create a new Frame whose axes are copied from an existing Frame along with other Frame attributes,...
void setLabel(int axis, std::string const &label)
Set Label(axis) for one axis: axis label.
void setSystem(std::string const &system)
Set System: coordinate system used to describe positions within the domain.
Frame(int naxes, std::string const &options="")
Construct a Frame.
std::string format(int axis, double value) const
Return a string containing the formatted (character) version of a coordinate value for a Frame axis.
void setDigits(int axis, int digits)
Set Digits for one axis: number of digits of precision.
void setEpoch(double epoch)
Set Epoch: Epoch of observation as a double (years)
std::string getTitle() const
Get Title: frame title.
void setMinAxes(int minAxes)
Get MinAxes: the minimum number of axes a frame found by findFrame may have.
Frame(AstFrame *rawPtr)
Construct a Frame from a pointer to a raw AstFrame.
ResolvedPoint resolve(std::vector< double > const &point1, std::vector< double > const &point2, std::vector< double > const &point3) const
Resolve a vector into two orthogonal components.
void setEpoch(std::string const &epoch)
Set Epoch: Epoch of observation as a string.
int getDigits(int axis) const
Get Digits for one axis.
double getEpoch() const
Get Epoch: Epoch of observation.
std::shared_ptr< FrameSet > convert(Frame const &to, std::string const &domainlist="")
Compute a frameset that describes the conversion between this frame and another frame.
Struct returned by Frame::pickAxes containing a frame and a mapping.
FrameMapping(std::shared_ptr< Frame > frame, std::shared_ptr< Mapping > mapping)
Construct a FrameMapping.
std::shared_ptr< Mapping > mapping
Mapping.
std::shared_ptr< Frame > frame
Frame.
A FrameSet consists of a set of one or more Frames (which describe coordinate systems),...
An abstract base class for objects which transform one set of coordinates to another.
int getNIn() const
Get NIn: the number of input axes.
Struct returned by Frame::unformat containing the number of characters read and corresponding value.
NReadValue(int nread, double value)
Construct an NReadValue.
double value
Value that was read.
int nread
Number of characters that was read.
Abstract base class for all AST objects.
void setD(std::string const &attrib, double value)
Set the value of an attribute as a double.
double getD(std::string const &attrib) const
Get the value of an attribute as a double.
std::string const getC(std::string const &attrib) const
Get the value of an attribute as a string.
std::string getClassName() const
Get Class: the name of the class (e.g.
void setI(std::string const &attrib, int value)
Set the value of an attribute as an int.
bool getB(std::string const &attrib) const
Get the value of an attribute as a bool.
int getI(std::string const &attrib) const
Get the value of an attribute as an int.
void setC(std::string const &attrib, std::string const &value)
Set the value of an attribute as a string.
void setB(std::string const &attrib, bool value)
Set the value of an attribute as a bool.
AstObject const * getRawPtr() const
Get the raw AST pointer.
Struct returned by Frame::resolve containing a point and the resolved vector components.
std::vector< double > point
Point.
ResolvedPoint(int naxes)
Construct an empty ResolvedPoint.
double d2
Resolved vector component 2.
double d1
Resolved vector component 1.
std::string formatAxisAttr(std::string const &name, int axis)
Format an axis-specific attribute by appending the axis index.
void assertEqual(T1 val1, std::string const &descr1, T2 val2, std::string const &descr2)
double safeDouble(double val)
Return a double value after checking status and replacing AST__BAD with nan
void astBadToNan(std::vector< double > &p)
Replace AST__BAD with a quiet NaN in a vector.
AST wrapper classes and functions.
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST's state is bad.