lsst.astshim
14.0-18-g77a82f3
|
#include <FrameSet.h>
Public Member Functions | |
FrameSet (Frame const &frame, std::string const &options="") | |
FrameSet (Frame const &baseFrame, Mapping const &mapping, Frame const ¤tFrame, std::string const &options="") | |
FrameSet (FrameSet const &)=default | |
Copy constructor: make a deep copy. | |
FrameSet (FrameSet &&)=default | |
FrameSet & | operator= (FrameSet const &)=delete |
FrameSet & | operator= (FrameSet &&)=default |
std::shared_ptr< FrameSet > | copy () const |
Return a deep copy of this object. | |
void | addAxes (Frame const &frame) |
virtual void | addFrame (int iframe, Mapping const &map, Frame const &frame) |
void | addVariant (Mapping const &map, std::string const &name) |
std::string | getAllVariants () const |
int | getBase () const |
int | getCurrent () const |
std::shared_ptr< Frame > | getFrame (int iframe, bool copy=true) const |
std::shared_ptr< Mapping > | getMapping (int from=BASE, int to=CURRENT) const |
int | getNFrame () const |
std::string | getVariant () const |
void | mirrorVariants (int iframe) |
void | remapFrame (int iframe, Mapping &map) |
virtual void | removeFrame (int iframe) |
void | renameVariant (std::string const &name) |
void | setBase (int ind) |
void | setCurrent (int ind) |
![]() | |
Frame (int naxes, std::string const &options="") | |
Frame (Frame const &)=default | |
Copy constructor: make a deep copy. | |
Frame (Frame &&)=default | |
Frame & | operator= (Frame const &)=delete |
Frame & | operator= (Frame &&)=default |
std::shared_ptr< Frame > | copy () const |
Return a deep copy of this object. | |
double | angle (PointD const &a, PointD const &b, PointD const &c) const |
double | axAngle (PointD const &a, PointD const &b, int axis) const |
double | axDistance (int axis, double v1, double v2) const |
double | axOffset (int axis, double v1, double dist) const |
std::shared_ptr< FrameSet > | convert (Frame const &to, std::string const &domainlist="") |
double | distance (PointD const &point1, PointD const &point2) const |
std::shared_ptr< FrameSet > | findFrame (Frame const &tmplt, std::string const &domainlist="") |
std::string | format (int axis, double value) const |
bool | getActiveUnit () const |
std::string | getAlignSystem () const |
double | getBottom (int axis) const |
int | getDigits () const |
int | getDigits (int axis) const |
bool | getDirection (int axis) const |
std::string | getDomain () const |
double | getDut1 () const |
double | getEpoch () const |
std::string | getFormat (int axis) const |
std::string | getInternalUnit (int axis) const |
std::string | getLabel (int axis) const |
bool | getMatchEnd () const |
int | getMaxAxes () const |
int | getMinAxes () const |
int | getNAxes () const |
std::string | getNormUnit (int axis) const |
double | getObsAlt () const |
std::string | getObsLat () const |
std::string | getObsLon () const |
bool | getPermute () const |
bool | getPreserveAxes () const |
std::string | getSymbol (int axis) const |
std::string | getSystem () const |
std::string | getTitle () const |
double | getTop (int axis) const |
std::string | getUnit (int axis) const |
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 |
std::vector< int > | matchAxes (Frame const &other) const |
CmpFrame | under (Frame const &next) const |
PointD | norm (PointD value) const |
PointD | offset (PointD point1, PointD point2, double offset) const |
DirectionPoint | offset2 (PointD const &point1, double angle, double offset) const |
void | permAxes (std::vector< int > perm) |
FrameMapping | pickAxes (std::vector< int > const &axes) const |
ResolvedPoint | resolve (std::vector< double > const &point1, std::vector< double > const &point2, std::vector< double > const &point3) const |
void | setAlignSystem (std::string const &system) |
void | setBottom (int axis, double bottom) |
void | setDigits (int digits) |
void | setDigits (int axis, int digits) |
void | setDirection (bool direction, int axis) |
virtual void | setDomain (std::string const &domain) |
void | setDut1 (double dut1) |
void | setEpoch (double epoch) |
void | setEpoch (std::string const &epoch) |
void | setFormat (int axis, std::string const &format) |
void | setLabel (int axis, std::string const &label) |
void | setMatchEnd (bool match) |
void | setMaxAxes (int maxAxes) |
void | setMinAxes (int minAxes) |
void | setObsAlt (double alt) |
void | setObsLat (std::string const &lat) |
void | setObsLon (std::string const &lon) |
void | setActiveUnit (bool enable) |
void | setPermute (bool permute) |
void | setPreserveAxes (bool preserve) |
void | setSymbol (int axis, std::string const &symbol) |
void | setSystem (std::string const &system) |
void | setTitle (std::string const &title) |
void | setTop (int axis, double top) |
void | setUnit (int axis, std::string const &unit) |
NReadValue | unformat (int axis, std::string const &str) const |
![]() | |
Mapping (Mapping const &)=default | |
Copy constructor: make a deep copy. | |
Mapping (Mapping &&)=default | |
Mapping & | operator= (Mapping const &)=delete |
Mapping & | operator= (Mapping &&)=default |
std::shared_ptr< Mapping > | copy () const |
Return a deep copy of this object. | |
int | getNIn () const |
int | getNOut () const |
bool | getIsSimple () const |
bool | isInverted () const |
bool | getIsLinear () const |
bool | getReport () const |
bool | hasForward () const |
bool | hasInverse () const |
std::shared_ptr< Mapping > | getInverse () const |
Array2D | linearApprox (PointD const &lbnd, PointD const &ubnd, double tol) const |
SeriesMap | then (Mapping const &next) const |
ParallelMap | under (Mapping const &next) const |
double | rate (PointD const &at, int ax1, int ax2) const |
void | setReport (bool report) |
std::shared_ptr< Mapping > | simplify () const |
void | applyForward (ConstArray2D const &from, Array2D const &to) const |
Array2D | applyForward (ConstArray2D const &from) const |
std::vector< double > | applyForward (std::vector< double > const &from) const |
void | applyInverse (ConstArray2D const &from, Array2D const &to) const |
Array2D | applyInverse (ConstArray2D const &from) const |
std::vector< double > | applyInverse (std::vector< double > const &from) const |
void | tranGridForward (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, Array2D const &to) const |
Array2D | tranGridForward (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, int nPts) const |
void | tranGridInverse (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, Array2D const &to) const |
Array2D | tranGridInverse (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, int nPts) const |
![]() | |
Object (Object const &object) | |
Copy constructor: make a deep copy. | |
Object (Object &&)=default | |
Object & | operator= (Object const &)=delete |
Object & | operator= (Object &&)=default |
bool | operator== (Object const &rhs) const |
bool | operator!= (Object const &rhs) const |
std::shared_ptr< Object > | copy () const |
Return a deep copy of this object. | |
void | clear (std::string const &attrib) |
bool | hasAttribute (std::string const &attrib) const |
std::string | getClassName () const |
std::string | getID () const |
Get ID: object identification string that is not copied. | |
std::string | getIdent () const |
Get Ident: object identification string that is copied. | |
int | getNObject () const |
int | getObjSize () const |
Get ObjSize: the in-memory size of the AST object in bytes. | |
int | getRefCount () const |
bool | getUseDefs () const |
Get UseDefs: allow use of default values for Object attributes? | |
void | lock (bool wait) |
bool | same (Object const &other) const |
void | setID (std::string const &id) |
Set ID: object identification string that is not copied. | |
void | setIdent (std::string const &ident) |
Set Ident: object identification string that is copied. | |
void | setUseDefs (bool usedefs) |
Set UseDefs: allow use of default values for Object attributes? | |
void | show (std::ostream &os, bool showComments=true) const |
std::string | show (bool showComments=true) const |
bool | test (std::string const &attrib) const |
void | unlock (bool report=false) |
AstObject const * | getRawPtr () const |
AstObject * | getRawPtr () |
Static Public Attributes | |
static int constexpr | BASE = AST__BASE |
index of base frame | |
static int constexpr | CURRENT = AST__CURRENT |
index of current frame | |
static int constexpr | NOFRAME = AST__NOFRAME |
an invalid frame index | |
Protected Member Functions | |
virtual std::shared_ptr< Object > | copyPolymorphic () const override |
FrameSet (AstFrameSet *rawPtr) | |
![]() | |
Frame (AstFrame *rawPtr) | |
![]() | |
Mapping (AstMapping *rawMap) | |
template<typename Class > | |
std::shared_ptr< Class > | decompose (int i, bool copy) const |
![]() | |
Object (AstObject *object) | |
template<typename T , typename AstT > | |
std::shared_ptr< T > | copyImpl () const |
bool | getB (std::string const &attrib) const |
std::string const | getC (std::string const &attrib) const |
double | getD (std::string const &attrib) const |
float | getF (std::string const &attrib) const |
int | getI (std::string const &attrib) const |
long int | getL (std::string const &attrib) const |
void | set (std::string const &setting) |
void | setB (std::string const &attrib, bool value) |
void | setC (std::string const &attrib, std::string const &value) |
void | setD (std::string const &attrib, double value) |
void | setF (std::string const &attrib, float value) |
void | setI (std::string const &attrib, int value) |
void | setL (std::string const &attrib, long int value) |
Friends | |
class | Frame |
class | Object |
Additional Inherited Members | |
![]() | |
using | ObjectPtr = std::unique_ptr< AstObject, Deleter > |
unique pointer holding an AST raw pointer | |
![]() | |
static std::shared_ptr< Object > | fromString (std::string const &str) |
template<typename Class > | |
static std::shared_ptr< Class > | fromAstObject (AstObject *rawObj, bool copy) |
![]() | |
template<typename ShimT , typename AstT > | |
static std::shared_ptr< ShimT > | makeShim (AstObject *p) |
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).
A FrameSet makes it possible to obtain a Mapping between any pair of these Frames (i.e. to convert between any of the coordinate systems which it describes). The individual Frames are identified within the FrameSet by an integer index, with Frames being numbered consecutively from one as they are added to the FrameSet.
Every FrameSet has a "base" Frame and a "current" Frame (which are allowed to be the same). Any of the Frames may be nominated to hold these positions, and the choice is determined by the values of the FrameSet's Base and Current attributes, which hold the indices of the relevant Frames. By default, the first Frame added to a FrameSet is its base Frame, and the last one added is its current Frame.
The base Frame describes the "native" coordinate system of whatever the FrameSet is used to calibrate (e.g. the pixel coordinates of an image) and the current Frame describes the "apparent" coordinate system in which it should be viewed (e.g. displayed, etc.). Any further Frames represent a library of alternative coordinate systems, which may be selected by making them current.
When a FrameSet is used in a context that requires a Frame, (e.g. obtaining its Title value, or number of axes), the current Frame is used. A FrameSet may therefore be used in place of its current Frame in most situations.
When a FrameSet is used in a context that requires a Mapping, the Mapping used is the one between its base Frame and its current Frame. Thus, a FrameSet may be used to convert "native" coordinates into "apparent" ones, and vice versa. Like any Mapping, a FrameSet may also be inverted (see Mapping::getInverse), which has the effect of interchanging its base and current Frames and hence of reversing the Mapping between them.
Regions may be added into a FrameSet (since a Region is a type of Frame), either explicitly or as components within CmpFrames. In this case the Mapping between a pair of Frames within a FrameSet will include the effects of the clipping produced by any Regions included in the path between the Frames.
In addition to those attributes common to Frame Mapping and Object, FrameSet also has the following attributes:
Every FrameSet also inherits any further attributes that belong to its current Frame, regardless of that Frame's class. (For example, the Equinox
attribute, defined by SkyFrame, is inherited by any FrameSet which has a SkyFrame as its current Frame.) The set of attributes belonging to a FrameSet may therefore change when a new current Frame is selected.
|
inlineexplicit |
|
inlineexplicitprotected |
|
inline |
Append the axes from a specified Frame to every existing Frame in this FrameSet.
In detail, each Frame in this FrameSet is replaced by a CmpFrame containing the original Frame and the Frame specified by parameter frame
. In addition, each Mapping in the FrameSet is replaced by a CmpMap containing the original Mapping and a UnitMap in parallel. The NIn and NOut attributes of the UnitMap are set equal to the number of axes in the supplied Frame. Each new CmpMap is simplified using simplify
before being stored in the FrameSet.
|
inlinevirtual |
Add a new Frame and an associated Mapping to this FrameSet so as to define a new coordinate system, derived from one which already exists within this FrameSet.
If frame
is a Frame then it becomes the current frame and its index is the new number of frames. If frame
is a FrameSet then its current frame becomes the new current frame and the indices of all its frames are increased by the number of frames originally in this FrameSet. In both cases the indices of the Frames already in this FrameSet are left unchanged.
[in] | iframe | The index of the Frame within the FrameSet which describes the coordinate system upon which the new one is to be based. This value should lie in the range from 1 to the number of frames already in this FrameSet (as given by getNFrame). A value of FrameSet::BASE or FrameSet::CURRENT may be given to specify the base Frame or the current Frame respectively. A value of AST__ALLFRAMES is not permitted; call addAllFrames instead. |
[in] | map | A Mapping which describes how to convert coordinates from the old coordinate system (described by the Frame with index iframe ) into coordinates in the new system. The Mapping's forward transformation should perform this conversion, and its inverse transformation should convert in the opposite direction. |
[in] | frame | A Frame that describes the new coordinate system. Any type of Frame may be supplied (including Regions and FrameSets). This function may also be used to merge two FrameSets by supplying a pointer to a second FrameSet for this parameter (see the Notes section for details). |
map
and frame
are stored within the modified FrameSet. So any changes made to the FrameSet after calling this method will have no effect on the supplied Mapping and Frame objects.Current
attribute for the FrameSet so that the new Frame subsequently becomes the current Frame.map
(its NIn attribute) must match the number of axes in the Frame identified by the iframe
parameter. Similarly, the number of output coordinate values generated by map
(its NOut attribute) must match the number of axes in frame
.frame
parameter, this is treated as a request to merge frame
into this FrameSet. This is done by appending all the new Frames in the frame
FrameSet to this FrameSet, while preserving their order and retaining all the inter-relationships (i.e. Mappings) between them. The two sets of Frames are inter-related within the merged FrameSet by using the Mapping supplied. This should convert between the Frame identified by the iframe
parameter (in this FrameSet) and the current
Frame of the frame
FrameSet. This latter Frame becomes the current Frame in this FrameSet. Reimplemented in ast::FrameDict.
|
inline |
Store a new variant Mapping with the current Frame.
The newly added variant becomes the current variant (attribute the Variant is set to name
).
See the Variant attribute for more details. See also getVariant, renameVariant and mirrorVariants
|
inlineoverrideprotectedvirtual |
Return a deep copy of this object. This is called by copy.
Each subclass must override this method. The standard implementation is:
for example Frame implements this as:
Reimplemented from ast::Frame.
Reimplemented in ast::FrameDict.
|
inline |
Get AllVariants: a list of all variant mappings stored with the current Frame
|
inline |
Obtain a deep copy of the specified Frame
[in] | iframe | The index of the required Frame within this FrameSet. This value should lie in the range 1 to the number of frames already in this FrameSet (as given by getNFrame). A value of FrameSet::Base or FrameSet::CURRENT may be given to specify the base Frame or the current Frame, respectively. |
[in] | copy | If true return a deep copy, else a shallow copy. |
permAxes
directly on the FrameSet. Do not call permAxes
on a shallow copy of the frame (retrieved by getFrame) as this will not affect the connected mappings.
|
inline |
Obtain a Mapping that converts between two Frames in a FrameSet
[in] | from | The index of the first Frame in the FrameSet, the frame describing the coordinate system for the "input" end of the Mapping. This value should lie in the range 1 to the number of frames already in this FrameSet (as given by getNFrame). |
[in] | to | The index of the second Frame in the FrameSet, the frame describing the coordinate system for the "output" end of the Mapping. This value should lie in the range 1 to the number of frames already in this FrameSet (as given by getNFrame). |
hasForward
or hasInverse
on the returned Mapping to determine if the required transformation is available.
|
inline |
|
inline |
Variant: name of variant mapping in use by current Frame
See also addVariant, mirrorVariants and renameVariant
|
inline |
Indicates that all access to the Variant attribute of the current Frame should should be forwarded to some other nominated Frame in the FrameSet.
For instance, if a value is set subsequently for the Variant attribute of the current Frame, the current Frame will be left unchanged and the setting is instead applied to the nominated Frame. Likewise, if the value of the Variant attribute is requested, the value returned is the value stored for the nominated Frame rather than the current Frame itself.
This provides a mechanism for propagating the effects of variant Mappings around a FrameSet. If a new Frame is added to a FrameSet by connecting it to an pre-existing Frame that has two or more variant Mappings, then it may be appropriate to set the new Frame so that it mirrors the variants Mappings of the pre-existing Frame. If this is done, then it will be possible to select a specific variant Mapping using either the pre-existing Frame or the new Frame.
See also addVariant, getVariant and renameVariant.
[in] | iframe | The index of the Frame within the FrameSet which is to be mirrored by the current Frame. This value should lie in the range from 1 to the number of Frames in the FrameSet (as given by getNFrame). If AST__NOFRAME is supplied (or the current Frame is specified), then any mirroring established by a previous call to this function is disabled. A value of FrameSet::BASE may be given to specify the base frame. |
|
inline |
Modify the relationship (i.e. Mapping) between a specified Frame in a FrameSet and the other Frames in that FrameSet.
Typically, this might be required if the FrameSet has been used to calibrate (say) an image, and that image is re-binned. The Frame describing the image will then have undergone a coordinate transformation, and this should be communicated to the associated FrameSet using this function.
See also addVariant, getVariant and mirrorVariants.
[in] | iframe | The index within the FrameSet of the Frame to be modified. This value should lie in the range 1 to the number of frames already in this FrameSet (as given by getNFrame). A value of FrameSet::BASE or FrameSet::CURRENT may be given to specify the base Frame or the current Frame respectively. |
[in] | map | A Mapping whose forward transformation converts coordinate values from the original coordinate system described by the Frame to the new one, and whose inverse transformation converts in the opposite direction. |
Variant
).
|
inlinevirtual |
Remove a Frame from a FrameSet
Other Frame indices in the FrameSet are re-numbered as follows: Frame indices greater than iframe
are decremented by one; other Frame indeces retain the same index.
[in] | iframe | The index of the required Frame within this FrameSet. This value should lie in the range 1 to the number of Frames in this FrameSet (as given by getNFrame). A value of FrameSet::BASE or FrameSet::CURRENT may be given to specify the base Frame or the current Frame, respectively. |
Base
or Current
attribute (respectively) of the FrameSet will have its value cleared, so that another Frame will then assume its role by default.Base
and/or Current
attributes of the FrameSet will be changed, if necessary, to reflect any change in the indices of these Frames.std::runtime_error | if you attempt to remove the last frame |
Reimplemented in ast::FrameDict.
|
inline |
Rename the current Variant of the current Mapping
The Variant attribute is updated to name
.
See the Variant attribute for more details. See also addVariant, getVariant and mirrorVariants.
[in] | name | The new name of the current variant Mapping. |
|
inline |