![]() |
OpenDAFF C++ API
v1.7
Directional Audio File Format
|
Base class for scene graph nodes. More...
#include <DAFFVizSGNode.h>
Public Member Functions | |
SGNode (DAFFViz::SGNode *pParentNode=NULL) | |
Constructor with optional linking to a parent node. More... | |
virtual | ~SGNode () |
Destructor. More... | |
DAFFViz::SGNode * | GetRootNode () const |
Traverses up to the root (recursively) and returns the node pointer. More... | |
DAFFViz::SGNode * | GetParentNode () const |
Returns the parent node pointer. More... | |
bool | HasParentNode () const |
Returns true if the node is appended to a parent node. More... | |
bool | IsRoot () const |
Returns true if the node is a root node (... has no parent node) More... | |
bool | HasChildNodes () const |
Returns true if the node combines one or more child nodes. More... | |
bool | IsLeaf () const |
Returns true if the node appears as a leaf node (... has no child nodes) More... | |
const DAFFViz::SGNode * | GetChildNode (int iIndex) const |
Returns the pointer to the child node of given index (for const correctness) More... | |
DAFFViz::SGNode * | GetChildNode (int iIndex) |
Returns the pointer to the child node of given index. More... | |
void | GetChildNodes (std::vector< const DAFFViz::SGNode * > &vpChildren) const |
Returns all the pointers to the child nodes (for const correctness, clears vector if no childs available) More... | |
void | GetChildNodes (std::vector< DAFFViz::SGNode * > &vpChildren) |
Returns all the pointers to the child nodes (clears vector if no childs available) More... | |
bool | AddChildNode (DAFFViz::SGNode *pChild) |
Appends a single child node. More... | |
bool | AddChildNodes (const std::vector< DAFFViz::SGNode * > &vpChildren) |
Appends a vector child nodes. More... | |
bool | RemoveChildNode (DAFFViz::SGNode *pChild) |
Removes a single child node. More... | |
bool | RemoveChildNodes (const std::vector< DAFFViz::SGNode * > &vpChildren) |
Removes a vector of child nodes. More... | |
void | GetPosition (double &x, double &y, double &z) const |
Position setter (unit is meter) More... | |
void | SetPosition (double x, double y, double z) |
Position getter (unit is meter) More... | |
void | GetOrientation (double &dRotXDeg, double &dRotYDeg, double &dRotZDeg) const |
Orientation getter (angles in [°]) More... | |
void | SetOrientation (double dRotXDeg, double dRotYDeg, double dRotZDeg) |
Sets the orientation of the node assembly based on world coordinate axis (angles in [°]) More... | |
void | SetOrientationYPR (double dYawDeg, double dPitchDeg, double dRollDeg) |
Sets the orientation of the node assembly based on yaw, pitch and roll angles around own coordinate axis (angles in [°]) More... | |
void | GetOrientationYPR (double &dYawDeg, double &dPitchDeg, double &dRollDeg) |
Orientation getter of the node assembly based on yaw, pitch and roll angles around own coordinate axis (angles in [°]) More... | |
void | SetOrientationVU (double vx, double vy, double vz, double ux, double uy, double uz) |
Sets the orientation of the node assembly based on view- and up-vectors. More... | |
void | GetOrientationVU (double &vx, double &vy, double &vz, double &ux, double &uy, double &uz) |
Returns the orientation of the node assembly based on view- and up-vectors. More... | |
void | GetScale (double &sx, double &sy, double &sz) const |
Scale getter. More... | |
void | SetScale (double sx, double sy, double sz) |
Scale setter. More... | |
virtual void | SetVisible (bool bVisible) |
Set visibility. More... | |
virtual bool | IsVisible () const |
Returns true if the node is visible. More... | |
Protected Member Functions | |
void | AddActor (vtkSmartPointer< vtkActor > pActor) |
Add a VTK actor to the node. More... | |
void | RemoveActor (vtkSmartPointer< vtkActor > pActor) |
Remove a VTK actor from the assembly of the node. More... | |
void | AddAssembly (vtkSmartPointer< vtkAssembly > pAssembly) |
Add a VTK assembly to the node. More... | |
void | RemoveAssembly (vtkSmartPointer< vtkAssembly > pAssembly) |
Release an assembly from the assembly of the node. More... | |
virtual void | OnSetFollowerCamera (vtkSmartPointer< vtkCamera > pCamera) |
Set active camera for followers. More... | |
Friends | |
class | VTKDAFFVizWindow |
class | QDAFFVTKWidget |
class | QtDAFFVizTestWindow |
Base class for scene graph nodes.
This class defines the base class for all nodes within an DAFFViz scene graph. It implements basic functionality, like the scene graph tree and operations. Internally it projects the DAFFViz scene graph onto a matching VTK scene assembly making it possible to use VTK objects in the classical scene graph way. DAFFViz includes subclasses for common objects (cube, cylinder, sphere and so on). But the SGNode design is flexible to incorporate any VTK object into the DAFFViz hierarchy.
The tree operations include modification of the scene graph (adding/removing child nodes, traversal, etc.). Moreover each node implements a common set of transformation operations (translation, rotation, scaling), which is applicable to all node implementations.
The usage of a node in your tree structure has strict rules. Any scene graph node may only be member of one parent scene graph. Therefore each scene graph node has a defined identity and may not be cloned/copied during runtime.
Any transformation on a node will treat the subtree (if node has child nodes) as a fixed single object. For instance you want to create a table, then you might want to join the desktop and the legs to form a simple table which then can be placed and rotated within the scene as one object.
Nodes that only group other nodes does not have material properties, e.g. no color. You have to colorize the leaf nodes which as a rule are derived objects of the SGNode class. Those leaves implement the appearing objects like cubes, cylinders and so on.
If you want to use the scene graph tree, you normally do it like this: Create a scene root node. Add children like primitive objects or create your own node by copying from the provided classes and fabricate any geometric that is possible with VTK. You can also group DAFFViz primitive objects to form a more complicated construction and append this to your scene graph root or any subtree. At the very end you will apply the scene graph root to your DAFFViz::QtDAFFWidget which will render your own scene and display it in your Qt application.
Definition at line 67 of file DAFFVizSGNode.h.
DAFFViz::SGNode::SGNode | ( | DAFFViz::SGNode * | pParentNode = NULL | ) |
Constructor with optional linking to a parent node.
Generates a node and connects it with the given parent node [optional]
[in] | pParentNode | Parent scene graph node of this child |
Definition at line 18 of file DAFFVizSGNode.cpp.
|
virtual |
Destructor.
Definition at line 27 of file DAFFVizSGNode.cpp.
|
protected |
Add a VTK actor to the node.
Will assert if the pointer is NULL in debug mode.
[in] | pActor | Pointer to VTK actor |
Definition at line 505 of file DAFFVizSGNode.cpp.
|
protected |
Add a VTK assembly to the node.
Will assert if the pointer is NULL in debug mode.
[in] | pAssembly | Pointer to VTK assembly |
Definition at line 524 of file DAFFVizSGNode.cpp.
bool DAFFViz::SGNode::AddChildNode | ( | DAFFViz::SGNode * | pChild | ) |
Appends a single child node.
Will return true if successful, false if the given Child is not a root node.
[in] | pChild | Adds a child to this node |
Definition at line 129 of file DAFFVizSGNode.cpp.
bool DAFFViz::SGNode::AddChildNodes | ( | const std::vector< DAFFViz::SGNode * > & | vpChildren | ) |
Appends a vector child nodes.
Will return true if successful, false if any given Child is not a root node, though it will continue appending the other given nodes.
[in] | vpChildren | Adds the children to this node |
Definition at line 164 of file DAFFVizSGNode.cpp.
const DAFFViz::SGNode * DAFFViz::SGNode::GetChildNode | ( | int | iIndex | ) | const |
Returns the pointer to the child node of given index (for const correctness)
[in] | iIndex | Index number of child node |
Definition at line 86 of file DAFFVizSGNode.cpp.
DAFFViz::SGNode * DAFFViz::SGNode::GetChildNode | ( | int | iIndex | ) |
Returns the pointer to the child node of given index.
[in] | iIndex | Index number of child node |
Definition at line 96 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::GetChildNodes | ( | std::vector< const DAFFViz::SGNode * > & | vpChildren | ) | const |
Returns all the pointers to the child nodes (for const correctness, clears vector if no childs available)
[out] | vpChildren | Vector of const pointers to child nodes |
Definition at line 106 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::GetChildNodes | ( | std::vector< DAFFViz::SGNode * > & | vpChildren | ) |
Returns all the pointers to the child nodes (clears vector if no childs available)
[out] | vpChildren | Vector of pointers to child nodes |
Definition at line 118 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::GetOrientation | ( | double & | dRotXDeg, |
double & | dRotYDeg, | ||
double & | dRotZDeg | ||
) | const |
Orientation getter (angles in [°])
Corresponds to euler angles with first rotation around z axis, then x, then y. Orientations are right-handed.
[out] | dRotXDeg | X axis rotation value |
[out] | dRotYDeg | Y axis rotation value |
[out] | dRotZDeg | Z axis rotation value |
Definition at line 214 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::GetOrientationVU | ( | double & | vx, |
double & | vy, | ||
double & | vz, | ||
double & | ux, | ||
double & | uy, | ||
double & | uz | ||
) |
Returns the orientation of the node assembly based on view- and up-vectors.
[out] | vx | X axis view vector value |
[out] | vy | Y axis view vector value |
[out] | vz | Z axis view vector value |
[out] | ux | X axis up vector value |
[out] | uy | Y axis up vector value |
[out] | uz | Z axis up vector value |
Definition at line 367 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::GetOrientationYPR | ( | double & | dYawDeg, |
double & | dPitchDeg, | ||
double & | dRollDeg | ||
) |
Orientation getter of the node assembly based on yaw, pitch and roll angles around own coordinate axis (angles in [°])
Will first rotate around -z axis (roll), then x (pitch), then y (yaw)
[out] | dYawDeg | Yaw rotation value(first rotation around Y) |
[out] | dPitchDeg | Pitch rotation value(first rotation around X) |
[out] | dRollDeg | Roll rotation value(first rotation around - Z) |
Definition at line 405 of file DAFFVizSGNode.cpp.
DAFFViz::SGNode * DAFFViz::SGNode::GetParentNode | ( | ) | const |
Returns the parent node pointer.
Definition at line 61 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::GetPosition | ( | double & | x, |
double & | y, | ||
double & | z | ||
) | const |
Position setter (unit is meter)
[out] | x | X axis value |
[out] | y | Y axis value |
[out] | z | Z axis value |
Definition at line 198 of file DAFFVizSGNode.cpp.
DAFFViz::SGNode * DAFFViz::SGNode::GetRootNode | ( | ) | const |
Traverses up to the root (recursively) and returns the node pointer.
Definition at line 55 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::GetScale | ( | double & | sx, |
double & | sy, | ||
double & | sz | ||
) | const |
Scale getter.
[out] | sx | X axis scale value |
[out] | sy | Y axis scale value |
[out] | sz | Z axis scale value |
Definition at line 471 of file DAFFVizSGNode.cpp.
bool DAFFViz::SGNode::HasChildNodes | ( | ) | const |
Returns true if the node combines one or more child nodes.
Definition at line 76 of file DAFFVizSGNode.cpp.
bool DAFFViz::SGNode::HasParentNode | ( | ) | const |
Returns true if the node is appended to a parent node.
Definition at line 66 of file DAFFVizSGNode.cpp.
bool DAFFViz::SGNode::IsLeaf | ( | ) | const |
Returns true if the node appears as a leaf node (... has no child nodes)
Definition at line 81 of file DAFFVizSGNode.cpp.
bool DAFFViz::SGNode::IsRoot | ( | ) | const |
Returns true if the node is a root node (... has no parent node)
Definition at line 71 of file DAFFVizSGNode.cpp.
|
virtual |
Returns true if the node is visible.
If this node is visible, the method will return true. Note, that this does not actually mean, that the child nodes are visible, too.
Reimplemented in DAFFViz::Arrow, DAFFViz::Sphere, DAFFViz::Line, DAFFViz::Label, DAFFViz::Plane, and DAFFViz::Grid.
Definition at line 486 of file DAFFVizSGNode.cpp.
|
protectedvirtual |
Set active camera for followers.
[in] | pCamera | VTK camera followers shall face |
Definition at line 542 of file DAFFVizSGNode.cpp.
|
protected |
Remove a VTK actor from the assembly of the node.
Will assert if the pointer is NULL in debug mode.
[in] | pActor | Pointer to VTK actor |
Definition at line 514 of file DAFFVizSGNode.cpp.
|
protected |
Release an assembly from the assembly of the node.
Will assert if the pointer is NULL in debug mode.
[in] | pAssembly | Pointer to VTK assembly |
Definition at line 533 of file DAFFVizSGNode.cpp.
bool DAFFViz::SGNode::RemoveChildNode | ( | DAFFViz::SGNode * | pChild | ) |
Removes a single child node.
Will return true if successful, false if the given child node is non existent.
[in] | pChild | Child node to be removed |
Definition at line 171 of file DAFFVizSGNode.cpp.
bool DAFFViz::SGNode::RemoveChildNodes | ( | const std::vector< DAFFViz::SGNode * > & | vpChildren | ) |
Removes a vector of child nodes.
Will return true if successful, false if any given child node is non existent, though it will continue removing the other given nodes.
[in] | vpChildren | Vector of child nodes to be removed |
Definition at line 191 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::SetOrientation | ( | double | dRotXDeg, |
double | dRotYDeg, | ||
double | dRotZDeg | ||
) |
Sets the orientation of the node assembly based on world coordinate axis (angles in [°])
Will first rotate around z axis, then x, then y. Orientations are right-handed.
[in] | dRotXDeg | X axis rotation value |
[in] | dRotYDeg | Y axis rotation value |
[in] | dRotZDeg | Z axis rotation value |
Definition at line 222 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::SetOrientationVU | ( | double | vx, |
double | vy, | ||
double | vz, | ||
double | ux, | ||
double | uy, | ||
double | uz | ||
) |
Sets the orientation of the node assembly based on view- and up-vectors.
[in] | vx | X axis view vector value |
[in] | vy | Y axis view vector value |
[in] | vz | Z axis view vector value |
[in] | ux | X axis up vector value |
[in] | uy | Y axis up vector value |
[in] | uz | Z axis up vector value |
Definition at line 316 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::SetOrientationYPR | ( | double | dYawDeg, |
double | dPitchDeg, | ||
double | dRollDeg | ||
) |
Sets the orientation of the node assembly based on yaw, pitch and roll angles around own coordinate axis (angles in [°])
Will first rotate around -z axis (roll), then x (pitch), then y (yaw)
[in] | dYawDeg | Yaw rotation value (first rotation around Y) |
[in] | dPitchDeg | Pitch rotation value (first rotation around X) |
[in] | dRollDeg | Roll rotation value (first rotation around -Z) |
Definition at line 230 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::SetPosition | ( | double | x, |
double | y, | ||
double | z | ||
) |
Position getter (unit is meter)
[in] | x | X axis value |
[in] | y | Y axis value |
[in] | z | Z axis value |
Definition at line 206 of file DAFFVizSGNode.cpp.
void DAFFViz::SGNode::SetScale | ( | double | sx, |
double | sy, | ||
double | sz | ||
) |
Scale setter.
[in] | sx | X axis scale value |
[in] | sy | Y axis scale value |
[in] | sz | Z axis scale value |
Definition at line 479 of file DAFFVizSGNode.cpp.
|
virtual |
Set visibility.
The method will traverse the subtree and set the visibility of all nodes. If you want to hide a leaf node or a subtree, you have to manually hide it afterwards.
[in] | bVisible | True for visible, false for hidden |
Reimplemented in DAFFViz::Arrow, DAFFViz::CartesianCoordinateAssistant, DAFFViz::SphericalCoordinateAssistant, DAFFViz::Sphere, DAFFViz::Line, DAFFViz::Label, DAFFViz::Plane, and DAFFViz::Grid.
Definition at line 491 of file DAFFVizSGNode.cpp.
|
friend |
Definition at line 401 of file DAFFVizSGNode.h.
|
friend |
Definition at line 402 of file DAFFVizSGNode.h.
|
friend |
Definition at line 400 of file DAFFVizSGNode.h.