BaseObject Class Reference

#include <BaseObject.hh>

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

List of all members.

Public Member Functions

 BaseObject (const BaseObject &_object)
 BaseObject (BaseObject *_parent=0)
Data



virtual void cleanup ()
Object Information



virtual QString getObjectinfo ()
 Get all Info for the Object as a string.
virtual void printObjectInfo ()
 Print all information about the object.
Content



virtual void update ()
 This function is called to update the object.
void dumpTree ()
 Debugging function, writing the subtree to output.
virtual BaseObjectcopy ()
 Returns a full copy of the object.
Tree : Parent nodes



int row () const
 get the row of this item from the parent
BaseObjectparent ()
 Get the parent item ( 0 if rootitem ).
void setParent (BaseObject *_parent)
 Set the parent pointer.
Tree : Children



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 )
Grouping



int group ()
bool isGroup ()
 Check if object is a group.
bool isInGroup (int _id)
bool isInGroup (QString _name)
std::vector< int > getGroupIds ()
QStringList getGroupNames ()

Friends

class BaseObjectData

Object Identification



int id_
 Unique ID for this Object.
int persistentId_
 Persistent ID for this Object.
int id ()
int persistentId ()
void persistentId (int _id)

Data Type Handling



DataType objectType_
bool dataType (DataType _type)
DataType dataType ()
void setDataType (DataType _type)

Flag handling (source, target, ...)



QStringList flags_
bool target ()
void target (bool _target)
bool source ()
void source (bool _source)
bool flag (QString _flag)
void setFlag (QString _flag, bool _set)
QStringList flags ()

Object visualization



bool visible_
virtual bool visible ()
 return if object is visible
virtual void visible (bool _visible)
 Sets visiblity.

Tree Structure



BaseObjectparentItem_
 Parent item or 0 if rootnode.
QList< BaseObject * > childItems_
 Children of this node.
BaseObjectlast ()
BaseObjectnext ()
int level ()

Name and Path handling



QString name_
 Object/FileName ( defaults to NONAME ).
QString name ()
 return the name of the object. The name defaults to NONAME if unset.
virtual void setName (QString _name)
 set the name of the object. ( If you overwrite it, call BaseObject::setName(_name ) it in your funtion first)

Object Payload



QMap< QString, PerObjectData * > dataMap_
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 ).

Detailed Description

This is the basic Data class providing the functions common to all objects. If the Datacontrol Plugin is available, a Tree structure will be generated allowing groups of objects.

Definition at line 80 of file BaseObject.hh.


Constructor & Destructor Documentation

BaseObject::BaseObject ( const BaseObject _object  ) 

Creates a copy of this Object. Currently it will not have any per Object data attached. Its also not attached to the object tree. This has to be done by using setParent.

Todo:
Maybe copy per Object Data

Definition at line 68 of file BaseObject.cc.

References childItems_, flags_, id_, name_, objectType_, parentItem_, persistentId_, and visible_.


Member Function Documentation

void BaseObject::cleanup (  )  [virtual]

Clean all data structures of the object

Reimplemented in BaseObjectData, MeshObject< MeshT, objectDataType >, and PlaneObject.

Definition at line 124 of file BaseObject.cc.

References DATA_UNKNOWN, flags_, name_, objectType_, persistentId_, and visible_.

DataType BaseObject::dataType (  ) 
bool BaseObject::dataType ( DataType  _type  ) 
bool BaseObject::flag ( QString  _flag  ) 

Get a custom flag of this item

Definition at line 206 of file BaseObject.cc.

References flags_.

Referenced by source(), and target().

QStringList BaseObject::flags (  ) 

Get all flags of this item

Definition at line 225 of file BaseObject.cc.

References flags_.

Referenced by PluginFunctions::BaseObjectIterator::BaseObjectIterator(), and PluginFunctions::BaseObjectIterator::operator++().

std::vector< int > BaseObject::getGroupIds (  ) 

Get a vector of all Group ids this object belongs to ( this function omits the root object )

Definition at line 541 of file BaseObject.cc.

References DATA_GROUP, dataType(), id(), and parent().

QStringList BaseObject::getGroupNames (  ) 

Get a vector of all group names this object belongs to ( this function omits the root object )

Definition at line 562 of file BaseObject.cc.

References DATA_GROUP, dataType(), name(), and parent().

int BaseObject::group (  ) 

Return the primary group of this object or -1 if ungrouped. As this is a tree structure this returns the first group of this object. Groups of groups are only suppurted via the other functions.

Returns:
Primary group of this object or -1

Definition at line 482 of file BaseObject.cc.

References DATA_GROUP, dataType(), and parent().

int BaseObject::id (  ) 

return the unique id of the object. These ids will be generated every time an object is created. It will stay valid during the runtime of the application.

Definition at line 107 of file BaseObject.cc.

References id_.

Referenced by dumpTree(), getGroupIds(), isInGroup(), Core::openIniFile(), Core::slotCopyObject(), Core::slotDeleteAllObjects(), MouseAndKeyPlugin::slotKeyEvent(), CoreWidget::updatePopupMenu(), and CoreWidget::updatePopupMenuObject().

bool BaseObject::isInGroup ( QString  _name  ) 

Check if this item belongs to a group with this name

Parameters:
_name Name of the group

Definition at line 523 of file BaseObject.cc.

References DATA_GROUP, dataType(), name(), and parent().

bool BaseObject::isInGroup ( int  _id  ) 

Check if this item belongs to a group with this id

Parameters:
_id id of the group

Definition at line 506 of file BaseObject.cc.

References id(), and parent().

BaseObject * BaseObject::last (  ) 

Get the last item of the tree (Preorder traversal of the tree)

Definition at line 248 of file BaseObject.cc.

int BaseObject::level (  ) 

level of the current object ( root node has level 0)

Definition at line 324 of file BaseObject.cc.

References parent().

Referenced by dumpTree().

BaseObject * BaseObject::next (  ) 
void BaseObject::persistentId ( int  _id  ) 

set the persistent id of the object

Definition at line 115 of file BaseObject.cc.

References persistentId_.

int BaseObject::persistentId (  ) 

return the persistent id of an object ( This id can be managed by a database ). It should be persistent across program starts. It will be -1 if the object has not been registered by a database. This id will only be set if a database plugin manages it.

Definition at line 111 of file BaseObject.cc.

References persistentId_.

void BaseObject::setDataType ( DataType  _type  ) 

set the object type

Parameters:
_type the type of the object (if it has a type defined, it will output a warning)

Definition at line 150 of file BaseObject.cc.

References DATA_UNKNOWN, and objectType_.

Referenced by PlaneObject::cleanup(), MeshObject< MeshT, objectDataType >::cleanup(), GroupObject::GroupObject(), MeshObject< MeshT, objectDataType >::MeshObject(), and PlaneObject::PlaneObject().

void BaseObject::setFlag ( QString  _flag,
bool  _set 
)

Set a custom flag on this item

Definition at line 211 of file BaseObject.cc.

References flags_.

Referenced by source(), and target().

void BaseObject::setObjectData ( QString  _dataName,
PerObjectData _data 
)

Set a pointer to your object data Your data class has to be derived from PerObjectData and should implement a destructor. use dynamic_casts to cast between your object and the Baseclass.

Parameters:
_dataName Define a name for your data
_data a pointer to your object data

Definition at line 633 of file BaseObject.cc.

void BaseObject::source ( bool  _source  ) 

Set this item as a source

Definition at line 202 of file BaseObject.cc.

References setFlag().

bool BaseObject::source (  ) 

Is this item selected as a source item? Some algorithms use source meshes to define their input.

Definition at line 198 of file BaseObject.cc.

References flag().

Referenced by getObjectinfo(), PluginFunctions::ObjectIterator::ObjectIterator(), Core::openIniFile(), and PluginFunctions::ObjectIterator::operator++().

void BaseObject::target ( bool  _target  ) 

Set this item as a target

Definition at line 194 of file BaseObject.cc.

References setFlag().

bool BaseObject::target (  ) 

Is this item selected as a target item? Most algorithms operate on target meshes. These meshes are also considered as active. Blending for inactive meshes is handled by DataControlPlugin so emit objectSelectionChanged if you changed this value.

Definition at line 190 of file BaseObject.cc.

References flag().

Referenced by getObjectinfo(), PluginFunctions::ObjectIterator::ObjectIterator(), Core::openIniFile(), and PluginFunctions::ObjectIterator::operator++().

void BaseObject::update (  )  [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 in BaseObjectData, and MeshObject< MeshT, objectDataType >.

Definition at line 597 of file BaseObject.cc.


Member Data Documentation

QStringList BaseObject::flags_ [private]

Stores all item flags as strings. Source and target flags are represented as "source" and "target" strings.

Definition at line 226 of file BaseObject.hh.

Referenced by BaseObject(), cleanup(), flag(), flags(), and setFlag().

int BaseObject::id_ [private]

Unique ID for this Object.

If you need to identify an Object in your plugin then use this id to find it. It does not change during the Objects lifetime. In PluginFunctions.hh are some Functions which help with finding objects using this id.

Definition at line 120 of file BaseObject.hh.

Referenced by BaseObject(), childExists(), and id().

DataType BaseObject::objectType_ [private]

This Field describes the Data Types available in the object.
You should check this Field, if your plugin can handle the data in the object.

Definition at line 153 of file BaseObject.hh.

Referenced by BaseObject(), cleanup(), dataType(), and setDataType().

Persistent ID for this Object.

If you need to identify an Object acroos program starts in your plugin then use this id to find it. It will not change across program restarts. This id will only be set if a database plugin manages it.

Definition at line 127 of file BaseObject.hh.

Referenced by BaseObject(), cleanup(), and persistentId().

bool BaseObject::visible_ [private]

Show/hide/ Object
Visibility is handled by DataControlPlugin so emit updated_objects if you changed this value defaults to visible

Definition at line 248 of file BaseObject.hh.

Referenced by BaseObject(), cleanup(), BaseObjectData::hide(), BaseObjectData::show(), BaseObjectData::visible(), and visible().


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

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .