RobWorkProject
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
SceneNode Class Reference

a node that can have leafs (DrawableNode) or other nodes as children. More...

#include <SceneNode.hpp>

Inherited by DrawableNode, GroupNode, and SceneCamera.

Public Types

enum  AddPolicy { Front, Back }
 Policy for adding parent nodes. More...
 
enum  NodeType { GroupType =0, CameraType, DrawableType, UserBeginType =1024 }
 Node types. More...
 
typedef rw::common::Ptr< SceneNodePtr
 Smart pointer type for SceneNode.
 
typedef std::list< SceneNode::PtrNodeList
 Type for the list of nodes.
 
typedef const std::list< SceneNode::PtrNodeListConst
 Type for a const list of nodes.
 

Public Member Functions

virtual ~SceneNode ()
 Destructor.
 
void addParent (SceneNode::Ptr node, AddPolicy policy=Back)
 Add a parent node. More...
 
bool hasParent (SceneNode::Ptr parent)
 Check if the given node is a parent node. More...
 
void removeParent (SceneNode::Ptr node)
 erases the parent from the parent list. More...
 
virtual GroupNodeasGroupNode ()
 Get a pointer to a GroupNode, if this is a GroupNode. More...
 
virtual SceneCameraasCameraNode ()
 Get a pointer to a CameraNode, if this is a CameraNode. More...
 
virtual DrawableNodeasDrawableNode ()
 Get a pointer to a DrawableNode, if this is a DrawableNode. More...
 
int getType ()
 Get the NodeType. More...
 
const std::string & getName ()
 Get the name of the node. More...
 
void setName (const std::string &name)
 Set the name of this node. More...
 

Static Public Member Functions

static void removeParent (SceneNode::Ptr node, SceneNode::Ptr parent)
 Remove a parent node. More...
 

Public Attributes

std::string _name
 The name of the node.
 
std::list< SceneNode::Ptr_parentNodes
 The list of parent nodes.
 
int _type
 The NodeType.
 

Protected Member Functions

 SceneNode (const std::string &name, int type)
 Construct new scene node. More...
 

Detailed Description

a node that can have leafs (DrawableNode) or other nodes as children.

Member Enumeration Documentation

◆ AddPolicy

enum AddPolicy

Policy for adding parent nodes.

Enumerator
Front 

Add to front of list.

Back 

Add to back of list (default).

◆ NodeType

enum NodeType

Node types.

Enumerator
GroupType 

For a GroupNode.

CameraType 

For a SceneCamera.

DrawableType 

For a DrawableNode.

UserBeginType 

For user defined types.

Constructor & Destructor Documentation

◆ SceneNode()

SceneNode ( const std::string &  name,
int  type 
)
inlineprotected

Construct new scene node.

Parameters
name[in] name of the node.
type[in] the NodeType.

Member Function Documentation

◆ addParent()

void addParent ( SceneNode::Ptr  node,
AddPolicy  policy = Back 
)
inline

Add a parent node.

Parameters
node[in] the node to add as parent node.
policy[in] the AddPolicy (default is Back).

◆ asCameraNode()

virtual SceneCamera* asCameraNode ( )
inlinevirtual

Get a pointer to a CameraNode, if this is a CameraNode.

Returns
a pointer, or NULL if the SceneNode is not of correct type.

Reimplemented in SceneCamera.

◆ asDrawableNode()

virtual DrawableNode* asDrawableNode ( )
inlinevirtual

Get a pointer to a DrawableNode, if this is a DrawableNode.

Returns
a pointer, or NULL if the SceneNode is not of correct type.

Reimplemented in DrawableNode.

◆ asGroupNode()

virtual GroupNode* asGroupNode ( )
inlinevirtual

Get a pointer to a GroupNode, if this is a GroupNode.

Returns
a pointer, or NULL if the SceneNode is not of correct type.

Reimplemented in GroupNode.

◆ getName()

const std::string& getName ( )
inline

Get the name of the node.

Returns
the name.

◆ getType()

int getType ( )
inline

Get the NodeType.

Returns
the type of node.

◆ hasParent()

bool hasParent ( SceneNode::Ptr  parent)
inline

Check if the given node is a parent node.

Parameters
parent[in] the node to look for.
Returns
true if parent is a parent node.

◆ removeParent() [1/2]

void removeParent ( SceneNode::Ptr  node)
inline

erases the parent from the parent list.

Note
this node is not removed from the parents child list, using this
Parameters
node[in] the parent to remove.

◆ removeParent() [2/2]

static void removeParent ( SceneNode::Ptr  node,
SceneNode::Ptr  parent 
)
inlinestatic

Remove a parent node.

Parameters
node[in] the node.
parent[in] the parent node to remove as a parent of node.

◆ setName()

void setName ( const std::string &  name)
inline

Set the name of this node.

Parameters
name[in] a new name.

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