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());
832 double getDut1()
const {
return getD(
"Dut1"); }
987 astMatchAxes(getRawPtr(), other.getRawPtr(), ret.
data());
1046 astNorm(getRawPtr(), value.
data());
1076 assertPointLength(point1,
"point1");
1077 assertPointLength(point2,
"point2");
1119 assertPointLength(point1,
"point1");
1121 double offsetAngle = astOffset2(getRawPtr(), point1.
data(),
angle,
offset, point2.
data());
1140 astPermAxes(getRawPtr(), perm.
data());
1296 astSetActiveUnit(getRawPtr(), enable);
1504 int nread = astUnformat(getRawPtr(), axis, str.
c_str(), &value);
1519 explicit Frame(AstFrame *rawPtr) :
Mapping(reinterpret_cast<AstMapping *>(rawPtr)) {
1520 if (!astIsAFrame(getRawPtr())) {
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";
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.
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.
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.
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.
std::string getNormUnit(int axis) const
Get NormUnit(axis) read-only attribute for one frame: normalised physical units for formatted axis va...
double getTop(int axis) const
Get Top: the highest axis value to display.
void setMatchEnd(bool match)
Set MatchEnd: match trailing axes?
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 setObsAlt(double alt)
Set ObsAlt: Geodetic altitude of observer (m).
void setPreserveAxes(bool preserve)
Set PreserveAxes: preserve axes?
PointD norm(PointD value) const
Normalise a set of Frame coordinate values which might be unsuitable for display (e....
*Return a deep copy of this object std::shared_ptr< Frame > copy() const
void setActiveUnit(bool enable)
Set ActiveUnit: pay attention to units when one Frame is used to match another?
bool getMatchEnd() const
Get MatchEnd: match trailing axes?
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...
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.
Frame & operator=(Frame const &)=delete
std::shared_ptr< FrameSet > findFrame(Frame const &tmplt, std::string const &domainlist="")
Find a coordinate system with specified characteristics.
std::string getAlignSystem() const
Get AlignSystem: the coordinate system used by convert and findFrame to align Frames.
void permAxes(std::vector< int > perm)
Permute the order in which a Frame's axes occur.
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.
void setUnit(int axis, std::string const &unit)
Set Unit(axis) for one axis: physical units for formatted axis values.
double distance(PointD const &point1, PointD const &point2) const
Compute a frameset that describes the conversion between this frame and another frame.
std::string getUnit(int axis) const
Get Unit(axis) for one axis: physical units for formatted axis values.
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 setObsLat(std::string const &lat)
Set ObsLat: frame title.
std::string getLabel(int axis) const
Get Label(axis) for one axis: axis label.
int getDigits() const
Get Digits: the default used if no specific value specified for an axis.
std::vector< double > PointD
Vector of double; used for bounds, points.
std::string getTitle() const
Get Title: frame title.
std::string getSymbol(int axis) const
Get Symbol(axis) for one axis: axis symbol.
Frame(int naxes, std::string const &options="")
Frame is used to represent a coordinate system.
void setLabel(int axis, std::string const &label)
Set Label(axis) for one axis: axis label.
void setTop(int axis, double top)
Set Top for one axis: the highest axis value to display.
std::string getObsLat() const
Get ObsLat: Geodetic latitude of observer.
double getEpoch() const
Get Epoch: Epoch of observation.
std::string getObsLon() const
Get ObsLon: Geodetic longitude of observer.
double getDut1() const
Get Dut1: difference between the UT1 and UTC timescale (sec).
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST's state is bad.
bool getPermute() const
Get Permute: allow axis permutation when used as a template?
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...
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.
void setPermute(bool permute)
Set Permute: allow axis permutation when used as a template?
void setTitle(std::string const &title)
Set Title: frame title.
void setFormat(int axis, std::string const &format)
Set Format for one axis: format specification for axis values.
bool getActiveUnit() const
Get ActiveUnit: pay attention to units when one Frame is used to match another?
void setBottom(int axis, double bottom)
Set Bottom: the lowest axis value to display.
int getNAxes() const
Get NAxes: the number of axes in the frame (i.e.
void setEpoch(double epoch)
Set Epoch: Epoch of observation as a double (years).
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 ...
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 setDut1(double dut1)
Set Dut1: difference between the UT1 and UTC timescale (sec).
virtual void setDomain(std::string const &domain)
Set Domain: coordinate system domain.
std::vector< int > matchAxes(Frame const &other) const
Look for corresponding axes between this frame and another.
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 setAlignSystem(std::string const &system)
Set AlignSystem: the coordinate system used by convert and findFrame to align Frames.
virtual std::shared_ptr< Object > copyPolymorphic() const override
void setDigits(int digits)
Set Digits for all axes: number of digits of precision.
double getBottom(int axis) const
Get Bottom for one axis: the lowest axis value to display.
void setDirection(bool direction, int axis)
Set Direction for one axis: display axis in conventional direction?
std::string getInternalUnit(int axis) const
Get InternalUnit(axis) read-only attribute for one axis: physical units for unformated axis values.
void setSystem(std::string const &system)
Set System: coordinate system used to describe positions within the domain.
bool getPreserveAxes() const
Get PreserveAxes: preserve axes?
double getObsAlt() const
Get ObsAlt: Geodetic altitude of observer (m).
bool getDirection(int axis) const
Get Direction for one axis: display axis in conventional direction?
void setObsLon(std::string const &lon)
Set ObsLon: Geodetic longitude of observer.
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 ...
int getMaxAxes() const
Get MaxAxes: the maximum axes a frame found by findFrame may have.
std::string getFormat(int axis) const
Get Format for one axis: format specification for axis values.
void setMinAxes(int minAxes)
Get MinAxes: the minimum number of axes a frame found by findFrame may have.
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,...
std::string getSystem() const
Get System: coordinate system used to describe positions within the domain.
void setSymbol(int axis, std::string const &symbol)
Set Symbol(axis) for one axis: axis symbol.
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.
std::string getDomain() const
Get Domain: coordinate system domain.
T static_pointer_cast(T... args)