Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
BaseObjectData Class Reference

#include <OpenFlipper/common/BaseObjectData.hh>

Inheritance diagram for BaseObjectData:
BaseObject BSplineCurveObject BSplineSurfaceObject CameraObject CoordsysObject LightObject MeshObject< MeshT > MeshObject< PolyMesh > MeshObject< TriMesh > PlaneObject PolyLineObject QtWidgetObject SkeletonObject SphereObject SplatCloudObject VolumeMeshObject< MeshT >

Public Member Functions

 BaseObjectData (const BaseObjectData &_object)
 copy constructor More...
 
 BaseObjectData ()
 constructor
 
virtual ~BaseObjectData ()
 destructor
 
virtual void setName (QString _name)
 path to the file from which the object is loaded ( defaults to "." )
 
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 ()
 
virtual ACG::Vec3d refinePick (ACG::SceneGraph::PickTarget _pickTarget, const ACG::Vec3d _hitPoint, const ACG::Vec3d _start, const ACG::Vec3d _dir, const unsigned int _targetIdx)
 Refine picking. More...
 
- Public Member Functions inherited from BaseObject
 BaseObject (const BaseObject &_object)
 
 BaseObject (BaseObject *_parent=0)
 
virtual QString getObjectinfo ()
 Get all Info for the Object as a string.
 
virtual void printObjectInfo ()
 Print all information about the object.
 
void dumpTree ()
 Debugging function, writing the subtree to output.
 
virtual BaseObjectcopy ()
 Returns a full copy of the object.
 
int row () const
 get the row of this item from the parent
 
BaseObjectparent ()
 Get the parent item ( 0 if rootitem )
 
const BaseObjectparent () const
 get the row of this item from the parent
 
void setParent (BaseObject *_parent)
 Set the parent pointer.
 
BaseObjectchildExists (int _objectId)
 Check if the element exists in the subtree of this element.
 
BaseObjectchildExists (QString _name)
 Check if the element exists in the subtree of this element.
 
void appendChild (BaseObject *child)
 add a child to this node
 
BaseObjectchild (int row)
 return a child
 
int childCount () const
 get the number of children
 
void removeChild (BaseObject *_item)
 Remove a child from this object.
 
QList< BaseObject * > getLeafs ()
 get all leafes of the tree below this object ( These will be all visible objects )
 
void deleteSubtree ()
 delete the whole subtree below this item ( The item itself is not touched )
 
int group () const
 
bool isGroup () const
 Check if object is a group.
 
bool isInGroup (int _id) const
 
bool isInGroup (QString _name) const
 
std::vector< int > getGroupIds ()
 
QStringList getGroupNames ()
 
void setObjectData (QString _dataName, PerObjectData *_data)
 
void clearObjectData (QString _dataName)
 Clear the object data pointer ( this will not delete the object!! )
 
bool hasObjectData (QString _dataName)
 Checks if object data with given name is available.
 
PerObjectDataobjectData (QString _dataName)
 Returns the object data pointer.
 
void deleteData ()
 Delete all data attached to this object ( calls delete on each object )
 
int id () const
 
int persistentId () const
 
void persistentId (int _id)
 
bool dataType (DataType _type) const
 
DataType dataType () const
 
void setDataType (DataType _type)
 
bool target ()
 
void target (bool _target)
 
bool source ()
 
void source (bool _source)
 
bool flag (QString _flag)
 
void setFlag (QString _flag, bool _set)
 
QStringList flags ()
 
BaseObjectlast ()
 
BaseObjectnext ()
 
int level ()
 
void setFromFileName (const QString &_filename)
 
QString path () const
 return the path to the object ( defaults to "." if unset )
 
void setPath (const QString &_path)
 set the path to the object.
 
QString name () const
 return the name of the object. The name defaults to NONAME if unset.
 
QString filename () const
 return the filename of the object
 
void setFileName (const QString &_filename)
 set the filename for this object
 
QMap< QString, PerObjectData * > & getPerObjectDataMap ()
 get reference to map of all perObject Datas More...
 
QString & getCommentByKey (const QString &key)
 Get comment for the specified key. More...
 
const QString getCommentByKey (const QString &key) const
 Get comment for the specified key. More...
 
bool hasCommentForKey (const QString &key) const
 
bool hasComments () const
 
void clearComment (const QString &key)
 Get comment for the specified key. More...
 
void clearAllComments ()
 Get comment for the specified key. More...
 
const QMap< QString, QString > & getAllComments () const
 
const QString getAllCommentsFlat () const
 

Protected Member Functions

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

Private Member Functions

void initializeScenegraphNodes ()
 

Friends

class Core
 

Object visualization

bool manipPlaced_
 rootNode of global Scenegraph structure
 
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. More...
 
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, const bool &_force=false)
 Set the draw mode for the object. More...
 

Additional nodes

Functions to attach additional Nodes to objects

Manage additional scenegraph nodes that belong to an object.

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 More...
 
bool hasAdditionalNode (QString _pluginName, QString _nodeName, int _id=0)
 check if an object has the additional node More...
 
template<typename NodeT >
bool getAdditionalNode (NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
 get an addition node from the object More...
 
template<typename NodeT >
bool removeAdditionalNode (NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
 remove an additional node from the object More...
 

Additional Inherited Members

- Signals inherited from BaseObject
void objectSelectionChanged (int _objectId)
 
void visibilityChanged (int _objectId)
 
void objectPropertiesChanged (int _objectId)
 
- Static Public Attributes inherited from BaseObject
static int NOOBJECT = -1
 
- Protected Attributes inherited from BaseObject
bool visible_
 

Detailed Description

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

Definition at line 105 of file BaseObjectData.hh.

Constructor & Destructor Documentation

BaseObjectData::BaseObjectData ( const BaseObjectData _object)

copy constructor

Create new basic scenegraph nodes for this object

We have to create our own visualization nodes as we are a new object

Definition at line 74 of file BaseObjectData.cc.

Member Function Documentation

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

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
_nodeNode to add
_pluginNameName of the current plugin
_nodeNameName of the New Node
_idextra index, if there will be multiple nodes with this name( defaults to 0)
Returns
true if successfull

Definition at line 74 of file BaseObjectDataT.cc.

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 231 of file BaseObjectData.cc.

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 MeshObject< MeshT >, MeshObject< PolyMesh >, MeshObject< TriMesh >, VolumeMeshObject< MeshT >, SplatCloudObject, LightObject, BSplineSurfaceObject, PolyLineObject, BSplineCurveObject, PlaneObject, QtWidgetObject, CameraObject, SkeletonObject, SphereObject, and CoordsysObject.

Definition at line 317 of file BaseObjectData.cc.

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

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
_nodeReturns the node
_pluginNameName of the current plugin
_nodeNameName of the Node
_idextra index, if there are multiple nodes with this name ( defaults to 0)
Returns
true if found

Definition at line 91 of file BaseObjectDataT.cc.

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
_pluginNameName of the current plugin
_nodeNameName of the Node
_idextra index, if there are multiple nodes with this name( defaults to 0)
Returns
true if found

Definition at line 340 of file BaseObjectData.cc.

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, and QtWidgetObject.

Definition at line 235 of file BaseObjectData.cc.

void BaseObjectData::initializeScenegraphNodes ( )
private

This function creates the basic scenegraph nodes

Definition at line 127 of file BaseObjectData.cc.

QtTranslationManipulatorNode * BaseObjectData::manipulatorNode ( )

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

Definition at line 261 of file BaseObjectData.cc.

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 MeshObject< MeshT >, MeshObject< PolyMesh >, MeshObject< TriMesh >, VolumeMeshObject< MeshT >, SplatCloudObject, LightObject, BSplineSurfaceObject, PolyLineObject, BSplineCurveObject, PlaneObject, QtWidgetObject, CameraObject, SkeletonObject, SphereObject, and CoordsysObject.

Definition at line 320 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 >, MeshObject< PolyMesh >, MeshObject< TriMesh >, and VolumeMeshObject< MeshT >.

Definition at line 257 of file BaseObjectData.cc.

ACG::Vec3d BaseObjectData::refinePick ( ACG::SceneGraph::PickTarget  _pickTarget,
const ACG::Vec3d  _hitPoint,
const ACG::Vec3d  _start,
const ACG::Vec3d  _dir,
const unsigned int  _targetIdx 
)
virtual

Refine picking.

Reimplement this function, if the object type can refine picking. E.g. the standard picking will rely on the z-buffer resolution, while a mesh can intersect a ray with the triangle and refine the depth via the exact intersection point.

Parameters
_pickTargetCurrent picking target (Faces, all,...)
_originalhitpoint
_eyePoscurrent picking ray start position
_dirRay direction when picking
_targetIdxEntity id hit (e.g. face index for meshes

Reimplemented in PolyLineObject, TriMeshObject, and PolyMeshObject.

Definition at line 324 of file BaseObjectData.cc.

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

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
_nodeNeeded for type specification
_pluginNameName of the current plugin
_nodeNameName of the Node
_idextra index, if there are multiple nodes with this name ( defaults to 0)
Returns
true if found and removed

Definition at line 106 of file BaseObjectDataT.cc.

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

Set the draw mode for the object.

Parameters
_modeThe draw mode that should be active for this object
_forceIf true, the mode is set ignoring if its supported by the node and its subnodes

Definition at line 300 of file BaseObjectData.cc.

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 MeshObject< MeshT >, MeshObject< PolyMesh >, MeshObject< TriMesh >, VolumeMeshObject< MeshT >, SplatCloudObject, and BSplineSurfaceObject.

Definition at line 265 of file BaseObjectData.cc.

void BaseObjectData::update ( UpdateType  _type = UPDATE_ALL)
protectedvirtual

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.

Note
Do not call this function yourself to avoid unnecessary overhead(the core will call it via the type plugins when it is required)

Reimplemented from BaseObject.

Reimplemented in QtWidgetObject, SkeletonObject, CameraObject, MeshObject< MeshT >, MeshObject< PolyMesh >, MeshObject< TriMesh >, SphereObject, CoordsysObject, VolumeMeshObject< MeshT >, PolyLineObject, LightObject, BSplineCurveObject, BSplineSurfaceObject, PlaneObject, and SplatCloudObject.

Definition at line 331 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 375 of file BaseObjectData.hh.


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