vizkit3d
Public Types | Static Public Member Functions | List of all members
vizkit3d::TransformerGraph Class Reference

#include <TransformerGraph.hpp>

Public Types

typedef std::pair< std::string, std::string > EdgeDescription
 
typedef std::list< EdgeDescriptionGraphDescription
 

Static Public Member Functions

static osg::Node * create (const std::string &name)
 
static std::string getWorldName (const osg::Node &transformer)
 
static void setTextSize (osg::Node &transformer, float size)
 
static float getTextSize (osg::Node &transformer)
 
static osg::Node * addFrame (osg::Node &transformer, const std::string &name)
 
static osg::Node * getFrame (osg::Node &transformer, const std::string &name)
 
static osg::Node * getFrame (osg::Node &transformer, osg::Node *node)
 
static osg::Group * getFrameGroup (osg::Node &transformer, const std::string &frame="")
 
static std::string getFrameName (osg::Node &transformer, osg::Node *node)
 
static GraphDescription getGraphDescription (osg::Node &transformer)
 
static bool setTransformation (osg::Node &transformer, const std::string &source_frame, const std::string &target_frame, const osg::Quat &quat, const osg::Vec3d &trans)
 
static void makeRoot (osg::Node &transformer, std::string const &desiredRoot)
 
static bool getTransformation (osg::Node &transformer, const std::string &source_frame, const std::string &target_frame, osg::Quat &quat, osg::Vec3d &trans)
 
static bool removeFrame (osg::Node &transformer, const std::string &name)
 
static bool hasFrame (osg::Node &transformer, const std::string &name)
 
static std::vector< std::string > getFrameNames (osg::Node &transformer)
 
static void showFrameAnnotation (osg::Node &transformer, bool value)
 
static bool areFrameAnnotationVisible (osg::Node &transformer)
 
static void attachNode (osg::Node &transformer, const std::string &frame, osg::Node &node)
 
static void detachNode (osg::Node &transformer, osg::Node &node)
 

Detailed Description

The class TransfromerGraph is a collection of methods for creating and manipulating an osg sub scene graph used to maintain osg nodes living in different relative coordinate frames.

Member Typedef Documentation

◆ EdgeDescription

typedef std::pair<std::string, std::string> vizkit3d::TransformerGraph::EdgeDescription

◆ GraphDescription

Member Function Documentation

◆ addFrame()

osg::Node * TransformerGraph::addFrame ( osg::Node &  transformer,
const std::string &  name 
)
static

Adds a new coordinate frame to the graph. Use setTranformation to change its location in the graph.

Parameters
transformerThe osg node of the transformer graph
nameThe name of the new coordinate frame

◆ areFrameAnnotationVisible()

bool TransformerGraph::areFrameAnnotationVisible ( osg::Node &  transformer)
static

Returns true if the frame annotations are activated

Parameters
transformerThe osg node of the transformer graph

◆ attachNode()

void TransformerGraph::attachNode ( osg::Node &  transformer,
const std::string &  frame,
osg::Node &  node 
)
static

Attaches the given node to the given coordinate frame. If the node is already attached it will be removed first.

Parameters
transformerThe osg node of the transformer graph
frameThe name of the coordinate frame.
nodeThe node which shall be attached.

◆ create()

osg::Node * TransformerGraph::create ( const std::string &  name)
static

Creates a new sub scene graph for maintaining a transformation stack

Do not directly add nodes to this node. Use getGroupNode instead!

Parameters
nameThe name of the wold coordinate frame
Returns
The transformer node of the created sub graph

◆ detachNode()

void TransformerGraph::detachNode ( osg::Node &  transformer,
osg::Node &  node 
)
static

Detaches the given node from the transformer graph

Parameters
transformerThe osg node of the transformer graph
nodeThe node which shall be detached.

◆ getFrame() [1/2]

osg::Node * TransformerGraph::getFrame ( osg::Node &  transformer,
const std::string &  name 
)
static

Returns the osg node for the given frame name. Returns NULL if the frame name does not exist.

Do not directly add nodes to this node. Use getGroupNode instead!

Parameters
transformerThe osg node of the transformer graph
nameThe name of coordinate frame

◆ getFrame() [2/2]

osg::Node * TransformerGraph::getFrame ( osg::Node &  transformer,
osg::Node *  node 
)
static

Returns the osg frame node for the given custom node. Returns NULL if the given node is not port of the sub scene graph

Do not directly add nodes to this node. Use getGroupNode instead!

Parameters
transformerThe osg node of the transformer graph
nodeThe node

◆ getFrameGroup()

osg::Group * TransformerGraph::getFrameGroup ( osg::Node &  transformer,
const std::string &  frame = "" 
)
static

Returns the osg group node for the given frame. Use this node if you want to attach custom nodes to the frame

if no name is given it will return the group of the top level

Parameters
transformerThe osg node of the transformer graph
nodeThe node

◆ getFrameName()

std::string TransformerGraph::getFrameName ( osg::Node &  transformer,
osg::Node *  node 
)
static

Returns the name of the osg frame node for the given custom node. Returns an empty string if the given node is not port of the sub scene graph

Parameters
transformerThe osg node of the transformer graph
nodeThe node

◆ getFrameNames()

std::vector< std::string > TransformerGraph::getFrameNames ( osg::Node &  transformer)
static

Returns the names of all added coordinate frames.

Parameters
transformerThe osg node of the transformer graph

◆ getGraphDescription()

TransformerGraph::GraphDescription TransformerGraph::getGraphDescription ( osg::Node &  transformer)
static

Returns the shape of the graph as a list of frame names pairs (from->to)

◆ getTextSize()

float TransformerGraph::getTextSize ( osg::Node &  transformer)
static

Returns the size of the frame annotations

◆ getTransformation()

bool TransformerGraph::getTransformation ( osg::Node &  transformer,
const std::string &  source_frame,
const std::string &  target_frame,
osg::Quat &  quat,
osg::Vec3d &  trans 
)
static

Gets the transformation between two coordinate frames. Thereby unlike setTransformation the frames do not have to be subsequently.

Parameters
transformerThe osg node of the transformer graph
source_frameThe name of the source coordinate frame
target_frameThe name of the target coordinate frame
quatThe rotation between source and target frame
transThe translation between source and target frame

◆ getWorldName()

std::string TransformerGraph::getWorldName ( const osg::Node &  transformer)
static

Returns the name of the wold (root) frame.

◆ hasFrame()

bool TransformerGraph::hasFrame ( osg::Node &  transformer,
const std::string &  name 
)
static

Returns true if the given frame name exists.

Parameters
transformerThe osg node of the transformer graph
nameThe name of coordinate frame

◆ makeRoot()

void TransformerGraph::makeRoot ( osg::Node &  transformer,
std::string const &  desiredRoot 
)
static

Ensures that the transform node for the given frame is a direct child of the transformer node

◆ removeFrame()

bool TransformerGraph::removeFrame ( osg::Node &  transformer,
const std::string &  name 
)
static

Removes the osg node for the given frame name. Returns false if the frame name does not exist.

Parameters
transformerThe osg node of the transformer graph
nameThe name of coordinate frame

◆ setTextSize()

void TransformerGraph::setTextSize ( osg::Node &  transformer,
float  size 
)
static

Sets the size of the frame annotations

◆ setTransformation()

bool TransformerGraph::setTransformation ( osg::Node &  transformer,
const std::string &  source_frame,
const std::string &  target_frame,
const osg::Quat &  quat,
const osg::Vec3d &  trans 
)
static

Sets the transformation between two subsequently coordinate frames.

Parameters
transformerThe osg node of the transformer graph
source_frameThe name of the source coordinate frame
target_frameThe name of the target coordinate frame
quatThe rotation between source and target frame
transThe translation between source and target frame

◆ showFrameAnnotation()

void TransformerGraph::showFrameAnnotation ( osg::Node &  transformer,
bool  value 
)
static

Activates or deactivates the annotation of the frame nodes

Parameters
transformerThe osg node of the transformer graph
value

The documentation for this class was generated from the following files: