Represents a hierarchy of frames. More...
#include <Frame.h>
Public Member Functions | |
Frame (vtkSmartPointer< vtkTransform > transform=nullptr, Frame *parentFrame=nullptr) | |
Default constructor with transformation. More... | |
vtkSmartPointer< vtkAxesActor > | getFrameAxisActor () override |
Gives the 3D representation of the frame (based on xyd arrows) More... | |
bool | getFrameVisibility (QString) const override |
Get the Component Frame visibility for a given viewer. More... | |
void | removeFrameChild (InterfaceFrame *frame) override final |
If the parent frame keeps track of its children, when a child is deleted it should warn its parent. More... | |
void | setFrameVisibility (QString, bool) override |
Set the Component Frame visible for a given viewer. More... | |
~Frame () override | |
Default Destructor. More... | |
const QString & | getFrameName () const override final |
Hierarchy accessors / Modifiers. More... | |
void | setFrameName (QString name) override |
Set the Frame Unique identifier. More... | |
InterfaceFrame * | getParentFrame () const override |
Get the parent frame. More... | |
void | setParentFrame (InterfaceFrame *parent, bool keepTransform=true) override final |
Set the parent frame to the parameter frame. More... | |
const QVector< InterfaceFrame * > & | getChildrenFrame () const override |
Get the Children Frames from the current Frame in the Frame Hierarchy The Frame hierarchy may not be the same as the Component Hierarchy. More... | |
const vtkSmartPointer< vtkTransform > | getTransformFromWorld () const override |
Transforms accessors / Modifiers. More... | |
const vtkSmartPointer< vtkTransform > | getTransform () const override |
Get a the transformation with respect to the parent frame. More... | |
const vtkSmartPointer< vtkTransform > | getTransformFromFrame (InterfaceFrame *frame) const override |
Get a COPY of the transformation with respect to another frame. More... | |
void | setTransform (vtkSmartPointer< vtkTransform > transform) override final |
Set the current input frame position (according to its parent Frame) More... | |
void | resetTransform () override |
Set the current frame transform to identity. More... | |
void | translate (double x, double y, double z) override |
Apply a translation relative to the current position. More... | |
void | rotate (double aroundX, double aroundY, double aroundZ) override |
Apply rotations relative to the current position in the alphabetical order (X, Y, Z). More... | |
void | rotateVTK (double aroundX, double aroundY, double aroundZ) override |
Apply a rotation relative to the current position, using the VTK rotation order (Z, X, Y) More... | |
void | setTransformTranslation (double x, double y, double z) override |
Set the translation part of the 3D space transformation of the current frame. More... | |
void | setTransformTranslationVTK (double x, double y, double z) override |
Set the translation part of the 3D space transformation of the current frame. More... | |
void | setTransformRotation (double aroundX, double aroundY, double aroundZ) override |
Set the rotation part of the 3D space transformation of the current frame. More... | |
void | setTransformRotationVTK (double aroundX, double aroundY, double aroundZ) override |
Set the rotation part of the 3D space transformation of the current frame. More... | |
void | initAttributes () |
Public Member Functions inherited from camitk::InterfaceFrame | |
virtual | ~InterfaceFrame ()=default |
empty virtual destructor, to avoid memory leak More... | |
Protected Member Functions | |
QVector< InterfaceFrame * > | computeDescendants (InterfaceFrame *) |
Compute all the descendants of the input frame. More... | |
Protected Attributes | |
QVector< InterfaceFrame * > | childrenFrame |
List of children Frames to keep track of Frame hierarchy. More... | |
QString | frameName |
Frame unique identifier. More... | |
InterfaceFrame * | parentFrame |
The Parent Frame. More... | |
vtkSmartPointer< vtkTransformPolyDataFilter > | representationTransformFilter |
Transform Filter to store the transformation for the Frame's 3D representation. More... | |
vtkSmartPointer< vtkTransform > | transformParentToMe |
Transformation to represent my points (expressed in my frame) in my parent's frame. More... | |
vtkSmartPointer< vtkTransform > | transformWorldToMe |
Transformation to represent my points (expressed in my frame) in the world's frame. More... | |
Represents a hierarchy of frames.
Each frame is represented by its parent frame (by default the World frame) and a linear transformation from its parent frame ; i.e. the transformation to represents my points (expressed in my frame) in my parent's frame.
Frames are in a tree hierarchy, in a top down way.
The frame hierarchy only changes the REPRESENTATION of Components, not Components themselves To obtain the real point position of child components, one should apply getWorldTransformation to them.
When a frame moves, it should move from its parent, not from the world frame (except if its parent frame is the world frame).
camitk::Frame::Frame | ( | vtkSmartPointer< vtkTransform > | transform = nullptr , |
Frame * | parentFrame = nullptr |
||
) |
Default constructor with transformation.
transform | is the vtk transformation to express the current frame coordinates into its parent frame. If no transform is givent the default transform is set to the identity matrix. |
parentFrame | is the base frame in the begin of the hierarchical system. If no parent is given, the default parent is set to NULL and considered as the World frame. |
References camitk::InterfaceFrame::addFrameChild(), getTransformFromWorld(), initAttributes(), parentFrame, setParentFrame(), setTransform(), camitk::transform, transformParentToMe, and transformWorldToMe.
|
override |
Default Destructor.
References childrenFrame, parentFrame, camitk::InterfaceFrame::removeFrameChild(), and camitk::InterfaceFrame::setParentFrame().
|
protected |
Compute all the descendants of the input frame.
References camitk::InterfaceFrame::getChildrenFrame().
Referenced by setParentFrame().
|
overridevirtual |
Get the Children Frames from the current Frame in the Frame Hierarchy The Frame hierarchy may not be the same as the Component Hierarchy.
Implements camitk::InterfaceFrame.
References childrenFrame.
|
overridevirtual |
Gives the 3D representation of the frame (based on xyd arrows)
Implements camitk::InterfaceFrame.
References camitk::axeXTextProp, camitk::axeYTextProp, camitk::axeZTextProp, and transformWorldToMe.
|
finaloverridevirtual |
Hierarchy accessors / Modifiers.
Get the Frame Unique identifier (can be set by user)
Implements camitk::InterfaceFrame.
References frameName.
Referenced by setParentFrame().
|
overridevirtual |
Get the Component Frame visibility for a given viewer.
Implements camitk::InterfaceFrame.
References camitk::Application::getViewer().
|
overridevirtual |
|
overridevirtual |
Get a the transformation with respect to the parent frame.
Implements camitk::InterfaceFrame.
References transformParentToMe.
|
overridevirtual |
Get a COPY of the transformation with respect to another frame.
Implements camitk::InterfaceFrame.
References camitk::InterfaceFrame::getTransformFromWorld(), and transformWorldToMe.
Referenced by setParentFrame().
|
overridevirtual |
Transforms accessors / Modifiers.
Get a the transformation with respect to the world frame
Implements camitk::InterfaceFrame.
References transformWorldToMe.
Referenced by Frame().
void camitk::Frame::initAttributes | ( | ) |
Constructors helpers Private method to initialize private attributes (called only in constrctors but in all constructors)
References childrenFrame, frameName, parentFrame, representationTransformFilter, transformParentToMe, and transformWorldToMe.
Referenced by Frame().
|
finaloverridevirtual |
If the parent frame keeps track of its children, when a child is deleted it should warn its parent.
Implements camitk::InterfaceFrame.
References childrenFrame.
Referenced by setParentFrame().
|
overridevirtual |
Set the current frame transform to identity.
In other words, the current frame and its parent share the same 3D location.
Implements camitk::InterfaceFrame.
References representationTransformFilter, transformParentToMe, and transformWorldToMe.
|
overridevirtual |
Apply rotations relative to the current position in the alphabetical order (X, Y, Z).
Implements camitk::InterfaceFrame.
References representationTransformFilter, transformParentToMe, and transformWorldToMe.
|
overridevirtual |
Apply a rotation relative to the current position, using the VTK rotation order (Z, X, Y)
Implements camitk::InterfaceFrame.
References representationTransformFilter, transformParentToMe, and transformWorldToMe.
|
overridevirtual |
|
overridevirtual |
Set the Component Frame visible for a given viewer.
Implements camitk::InterfaceFrame.
References camitk::Application::getViewer().
|
finaloverridevirtual |
Set the parent frame to the parameter frame.
During the parent transition you have the choice to keep or not the frame transform. If you keep the frame's initial transform after the parent transition, the frame's position will change as its transform's target frame changes. If you decide not to keep the initial frame's transform, this one is updated during the parent transition in order to keep the original frame position (in the world frame).
Caution: if the parent frame in parameter is either the current frame or one of its descendant, the parent frame is set to the world frame.
Implements camitk::InterfaceFrame.
References camitk::InterfaceFrame::addFrameChild(), computeDescendants(), camitk::InterfaceFrame::getFrameName(), getFrameName(), getTransformFromFrame(), camitk::InterfaceFrame::getTransformFromWorld(), parentFrame, removeFrameChild(), camitk::InterfaceFrame::removeFrameChild(), camitk::InterfaceFrame::setParentFrame(), setTransform(), transformParentToMe, and transformWorldToMe.
Referenced by Frame().
|
finaloverridevirtual |
Set the current input frame position (according to its parent Frame)
transform | The 3D transform of the current frame to its parent. |
Implements camitk::InterfaceFrame.
References representationTransformFilter, camitk::transform, transformParentToMe, and transformWorldToMe.
Referenced by Frame(), and setParentFrame().
|
overridevirtual |
Set the rotation part of the 3D space transformation of the current frame.
Implements camitk::InterfaceFrame.
References representationTransformFilter, transformParentToMe, and transformWorldToMe.
|
overridevirtual |
Set the rotation part of the 3D space transformation of the current frame.
This translation uses the VTK rotation order (Z, X, Y) system.
Implements camitk::InterfaceFrame.
References representationTransformFilter, transformParentToMe, and transformWorldToMe.
|
overridevirtual |
Set the translation part of the 3D space transformation of the current frame.
Implements camitk::InterfaceFrame.
References representationTransformFilter, transformParentToMe, and transformWorldToMe.
|
overridevirtual |
Set the translation part of the 3D space transformation of the current frame.
This translation uses the VTK rotation order (Z, X, Y) system.
Implements camitk::InterfaceFrame.
References representationTransformFilter, transformParentToMe, and transformWorldToMe.
|
overridevirtual |
Apply a translation relative to the current position.
Implements camitk::InterfaceFrame.
References representationTransformFilter, transformParentToMe, and transformWorldToMe.
|
protected |
List of children Frames to keep track of Frame hierarchy.
Referenced by getChildrenFrame(), initAttributes(), removeFrameChild(), and ~Frame().
|
protected |
Frame unique identifier.
Referenced by getFrameName(), initAttributes(), and setFrameName().
|
protected |
The Parent Frame.
If it is NULL, then the parent is the World Frame.
Referenced by Frame(), getParentFrame(), initAttributes(), setParentFrame(), and ~Frame().
|
protected |
Transform Filter to store the transformation for the Frame's 3D representation.
Referenced by initAttributes(), resetTransform(), rotate(), rotateVTK(), setTransform(), setTransformRotation(), setTransformRotationVTK(), setTransformTranslation(), setTransformTranslationVTK(), and translate().
|
protected |
Transformation to represent my points (expressed in my frame) in my parent's frame.
Transformation to apply to this (and children) data to place them in my parent's frame.
Referenced by Frame(), getTransform(), initAttributes(), resetTransform(), rotate(), rotateVTK(), setParentFrame(), setTransform(), setTransformRotation(), setTransformRotationVTK(), setTransformTranslation(), setTransformTranslationVTK(), and translate().
|
protected |
Transformation to represent my points (expressed in my frame) in the world's frame.
i.e. Transformation to apply to this (and children) data to place them in the world's frame.
This transformation is always re-calculated and stored only for convenience purpose. It can not be set by a user.
Referenced by Frame(), getFrameAxisActor(), getTransformFromFrame(), getTransformFromWorld(), initAttributes(), resetTransform(), rotate(), rotateVTK(), setParentFrame(), setTransform(), setTransformRotation(), setTransformRotationVTK(), setTransformTranslation(), setTransformTranslationVTK(), and translate().