BaseObjectData Class Reference

#include <OpenFlipper/common/BaseObjectData.hh>

Inheritance diagram for BaseObjectData:
Inheritance graph
[legend]
Collaboration diagram for BaseObjectData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BaseObjectData (const BaseObjectData &_object)
 copy constructor
 BaseObjectData ()
 constructor
virtual ~BaseObjectData ()
 destructor
Data

virtual void cleanup ()
Picking

virtual bool picked (uint _node_idx)
 detect if the node has been picked
virtual void enablePicking (bool _enable)
virtual bool pickingEnabled ()
Content

virtual void update (UpdateType _type=UPDATE_ALL)
 This function is called to update the object.

Protected Member Functions

virtual void init ()

Name and Path handling



QString path_
 path to the file from which the object is loaded ( defaults to "." )
void setFromFileName (QString _filename)
virtual void setName (QString _name)
 set the name of the object. ( If you overwrite it, call BaseObjectData::setName(_name ) it in your funtion first)
QString path ()
 return the path to the object ( defaults to "." if unset )
void setPath (QString _path)
 set the path to the object.

Object visualization



bool manipPlaced_
SeparatorNoderootNode_
 rootNode of global Scenegraph structure
SeparatorNodeseparatorNode_
 Separator at top of Scenegraph structure used for this Object.
QtTranslationManipulatorNodemanipulatorNode_
 Manipulator used for this Object.
MaterialNodematerialNode_
 Scenegraph Material Node for the object.
BoundingBoxNodeboundingBoxNode_
 Bounding box node for the object.
StencilRefNodestencilRefNode_
 Stencil reference node for the object.
virtual void show ()
 Sets the whole Scenegraph subtree of this node to visible.
virtual void hide ()
 Sets the whole Scenegraph subtree of this node to invisible.
virtual bool visible ()
 return visiblity
virtual void visible (bool _visible)
 Sets visiblity of the whole Scenegraph subtree of this node.
SeparatorNodebaseNode ()
virtual bool hasNode (BaseNode *_node)
 Check if the given node is owned by this object.
virtual BaseNodeprimaryNode ()
QtTranslationManipulatorNodemanipulatorNode ()
virtual
ACG::SceneGraph::ShaderNode
shaderNode ()
MaterialNodematerialNode ()
 get a pointer to the materialnode
BoundingBoxNodeboundingBoxNode ()
 get a pointer to the bounding box node
StencilRefNodestencilRefNode ()
 get a pointer to the stencil reference node
bool manipPlaced ()
 Check if the manipulator has been placed.
void manipPlaced (bool _placed)
 set the manipulator place status
void getBoundingBox (ACG::Vec3d &bbmin, ACG::Vec3d &bbmax)
 get the bounding box of the object
void setObjectDrawMode (const ACG::SceneGraph::DrawModes::DrawMode _mode, bool _force=false)
 Set the draw mode for the object.

Additional nodes



std::vector< std::pair
< BaseNode *, QString > > 
additionalNodes_
template<typename NodeT >
bool addAdditionalNode (NodeT *_node, QString _pluginName, QString _nodeName, int _id=0)
 add an additional node to the object
bool hasAdditionalNode (QString _pluginName, QString _nodeName, int _id=0)
 check if an object has the additional node
template<typename NodeT >
bool getAdditionalNode (NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
 get an addition node from the object
template<typename NodeT >
bool removeAdditionalNode (NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
 remove an additional node from the object

Detailed Description

This is the basic Data class providing the functions common to all objects which show Objects in the SceneGraph

Definition at line 98 of file BaseObjectData.hh.


Constructor & Destructor Documentation

BaseObjectData::BaseObjectData ( const BaseObjectData _object  ) 

copy constructor

Create new basic scenegraph nodes for this object

Definition at line 67 of file BaseObjectData.cc.

References init().


Member Function Documentation

template<typename NodeT >
bool BaseObjectData::addAdditionalNode ( NodeT *  _node,
QString  _pluginName,
QString  _nodeName,
int  _id = 0 
) [inline]

add an additional node to the object

This function can be used to store an additional Scenegraph node. If you add nodes there, you do not need to keep track of deleted, added objects, as this will be done in the main application. You have to create the node yourself as this function does not know the type. You should add the new node below the manipulatorNode ( BaseObjectData::manipulatorNode() ) if you want that it moves with the rest of the data. Otherwise add it below the baseNode ( BaseObjectData::baseNode() of the object.

Parameters:
_node Node to add
_pluginName Name of the current plugin
_nodeName Name of the New Node
_id extra index, if there will be multiple nodes with this name( defaults to 0)
Returns:
true if successfull

Definition at line 67 of file BaseObjectDataT.cc.

References additionalNodes_, hasAdditionalNode(), and BaseObject::name().

Referenced by SkeletonObject::showIndices(), and SkeletonObject::showMotionPath().

SeparatorNode * BaseObjectData::baseNode (  ) 

get the base node of this object (Use this node to add custom Nodes to the Object which should not be transformed with the manipulator of the Object)

Definition at line 263 of file BaseObjectData.cc.

References separatorNode_.

Referenced by init(), SkeletonObject::showIndices(), SkeletonObject::showMotionPath(), and ViewControlPlugin::slotUpdateContextMenu().

void BaseObjectData::cleanup ( void   )  [virtual]
void BaseObjectData::enablePicking ( bool  _enable  )  [virtual]

Enable or disable picking for this Node The basic function defined here does nothing. It has to be reimplemented in the derived class

Reimplemented in BSplineCurveObject, BSplineSurfaceObject, CameraObject, CoordsysObject, LightObject, MeshObject< MeshT >, PlaneObject, SkeletonObject, and SphereObject.

Definition at line 349 of file BaseObjectData.cc.

template<typename NodeT >
bool BaseObjectData::getAdditionalNode ( NodeT *&  _node,
QString  _pluginName,
QString  _nodeName,
int  _id = 0 
) [inline]

get an addition node from the object

If you store additional Scenegraph node with the objects you can get these nodes with this function.

Parameters:
_node Returns the node
_pluginName Name of the current plugin
_nodeName Name of the Node
_id extra index, if there are multiple nodes with this name ( defaults to 0)
Returns:
true if found

Definition at line 84 of file BaseObjectDataT.cc.

References additionalNodes_.

Referenced by SkeletonObject::showIndices(), SkeletonObject::showMotionPath(), SkeletonObject::updateIndices(), and SkeletonObject::updateMotionPath().

bool BaseObjectData::hasAdditionalNode ( QString  _pluginName,
QString  _nodeName,
int  _id = 0 
)

check if an object has the additional node

If you store additional Scenegraph nodes with the objects you can check if they exist with this function.

Parameters:
_pluginName Name of the current plugin
_nodeName Name of the Node
_id extra index, if there are multiple nodes with this name( defaults to 0)
Returns:
true if found

Definition at line 368 of file BaseObjectData.cc.

References additionalNodes_.

Referenced by addAdditionalNode().

bool BaseObjectData::hasNode ( BaseNode _node  )  [virtual]

Check if the given node is owned by this object.

You can overload this function and return true, if your object generated the given node. Don't forget to call this baseclass function on overload!

Reimplemented in LightObject.

Definition at line 267 of file BaseObjectData.cc.

References BaseObject::child(), ACG::SceneGraph::BaseNode::childrenBegin(), ACG::SceneGraph::BaseNode::childrenEnd(), ACG::SceneGraph::BaseNode::find(), ACG::SceneGraph::BaseNode::push_back(), and separatorNode_.

Referenced by LightObject::hasNode().

void BaseObjectData::init (  )  [protected, virtual]
QtTranslationManipulatorNode * BaseObjectData::manipulatorNode (  ) 
bool BaseObjectData::pickingEnabled (  )  [virtual]

Check if picking is enabled for this Node This function will return true unless the derived class overwrites this function.

Reimplemented in BSplineCurveObject, BSplineSurfaceObject, CameraObject, CoordsysObject, LightObject, MeshObject< MeshT >, PlaneObject, SkeletonObject, and SphereObject.

Definition at line 352 of file BaseObjectData.cc.

BaseNode * BaseObjectData::primaryNode (  )  [virtual]

get the primary node of this object (Use this node to change drawModes)

Reimplemented in MeshObject< MeshT >.

Definition at line 289 of file BaseObjectData.cc.

References separatorNode_.

Referenced by ViewControlPlugin::setObjectDrawMode(), and setObjectDrawMode().

template<typename NodeT >
bool BaseObjectData::removeAdditionalNode ( NodeT *&  _node,
QString  _pluginName,
QString  _nodeName,
int  _id = 0 
) [inline]

remove an additional node from the object

If additional nodes are stored for this object, such a node can be removed using this function. If this node has children, they will be removed from the scenegraph as well (and their memory is freed).

Parameters:
_node Needed for type specification
_pluginName Name of the current plugin
_nodeName Name of the Node
_id extra index, if there are multiple nodes with this name ( defaults to 0)
Returns:
true if found and removed

Definition at line 99 of file BaseObjectDataT.cc.

References additionalNodes_, ACG::SceneGraph::BaseNode::childrenBegin(), and ACG::SceneGraph::BaseNode::childrenEnd().

Referenced by SkeletonObject::showIndices(), SkeletonObject::showMotionPath(), SkeletonObject::updateIndices(), and SkeletonObject::updateMotionPath().

void BaseObjectData::setFromFileName ( QString  _filename  ) 

Set the object name from a filename. The function will set the name of the object to the filename. At the same time the path is set to the one given in the parameter

Parameters:
_filename path to the file.

Definition at line 188 of file BaseObjectData.cc.

References path_, and setName().

Referenced by MeshObject< MeshT >::loadMesh(), FileSPHPlugin::loadObject(), FilePlaPlugin::loadObject(), and FileLightPlugin::loadObject().

void BaseObjectData::setObjectDrawMode ( const ACG::SceneGraph::DrawModes::DrawMode  _mode,
bool  _force = false 
)

Set the draw mode for the object.

Parameters:
_mode The draw mode that should be active for this object
_force If true, the mode is set ignoring if its supported by the node and its subnodes

Definition at line 332 of file BaseObjectData.cc.

References primaryNode(), and ACG::SceneGraph::traverse().

ACG::SceneGraph::ShaderNode * BaseObjectData::shaderNode (  )  [virtual]

Return pointer to the shader node If you want to support shaders, you have to add a shader node into your scenegraph structure above your object to be rendered. If you do not have a shader, just ignore this function and it will return a 0 pointer.

Reimplemented in BSplineSurfaceObject, and MeshObject< MeshT >.

Definition at line 297 of file BaseObjectData.cc.

Referenced by ViewControlPlugin::disableShader(), ViewControlPlugin::setShader(), ViewControlPlugin::setUniform(), and ViewControlPlugin::slotUpdateContextMenu().

void BaseObjectData::update ( UpdateType  _type = UPDATE_ALL  )  [virtual]

This function is called to update the object.

If the object changes, the core will call this function. Normally this will update the corresponding scenegraph nodes or trigger other data handling which has to be done when the object changes.

Reimplemented from BaseObject.

Reimplemented in BSplineCurveObject, BSplineSurfaceObject, LightObject, and MeshObject< MeshT >.

Definition at line 359 of file BaseObjectData.cc.


Member Data Documentation

std::vector< std::pair <BaseNode*,QString> > BaseObjectData::additionalNodes_ [private]

This pointer may be used to store additional Nodes belonging to this Object The String should be used by the plugin to identify its Nodes

Definition at line 368 of file BaseObjectData.hh.

Referenced by addAdditionalNode(), cleanup(), getAdditionalNode(), hasAdditionalNode(), and removeAdditionalNode().


The documentation for this class was generated from the following files:
Generated on Thu Jun 30 10:10:55 2011 for DeveloperDocumentation by  doxygen 1.6.3