Developer Documentation
BaseObject Class Reference

#include <OpenFlipper/common/BaseObject.hh>

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

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. More...
 
virtual void printObjectInfo ()
 Print all information about the object. More...
 
Content
void dumpTree ()
 Debugging function, writing the subtree to output. More...
 
virtual BaseObjectcopy ()
 Returns a full copy of the object. More...
 
Tree : Parent nodes
int row () const
 get the row of this item from the parent More...
 
BaseObjectparent ()
 Get the parent item ( 0 if rootitem ) More...
 
const BaseObjectparent () const
 get the row of this item from the parent More...
 
void setParent (BaseObject *_parent)
 Set the parent pointer. More...
 
Tree : Children
BaseObjectchildExists (int _objectId)
 Check if the element exists in the subtree of this element. More...
 
BaseObjectchildExists (QString _name)
 Check if the element exists in the subtree of this element. More...
 
void appendChild (BaseObject *child)
 add a child to this node More...
 
BaseObjectchild (int row)
 return a child More...
 
int childCount () const
 get the number of children More...
 
void removeChild (BaseObject *_item)
 Remove a child from this object. More...
 
QList< BaseObject * > getLeafs ()
 get all leafes of the tree below this object ( These will be all visible objects ) More...
 
void deleteSubtree ()
 delete the whole subtree below this item ( The item itself is not touched ) More...
 
Grouping
int group () const
 
bool isGroup () const
 Check if object is a group. More...
 
bool isInGroup (int _id) const
 
bool isInGroup (const QString &_name) const
 
std::vector< int > getGroupIds ()
 
QStringList getGroupNames ()
 
Object Payload

void setObjectData (QString _dataName, PerObjectData *_data)
 
void clearObjectData (QString _dataName)
 Clear the object data pointer ( this will not delete the object!! ) More...
 
bool hasObjectData (QString _dataName)
 Checks if object data with given name is available. More...
 
PerObjectDataobjectData (QString _dataName)
 Returns the object data pointer. More...
 
void deleteData ()
 Delete all data attached to this object ( calls delete on each object ) More...
 

Static Public Attributes

static int NOOBJECT = -1
 

Protected Member Functions

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

Friends

class BaseObjectData
 
class Core
 

Object Identification

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

Data Type Handling

DataType objectType_
 
bool dataType (DataType _type) const
 
DataType dataType () const
 
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 ()
 
void objectSelectionChanged (int _objectId)
 

Tree Structure

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

Name and Path handling

QString path_
 path to the file from which the object is loaded ( defaults to "." ) More...
 
QString filename_
 path to the file from which the object is loaded ( defaults to "." ) More...
 
QString name_
 Object/FileName ( defaults to NONAME ) More...
 
void setFromFileName (const QString &_filename)
 
QString path () const
 return the path to the object ( defaults to "." if unset ) More...
 
void setPath (const QString &_path)
 set the path to the object. More...
 
QString name () const
 return the name of the object. The name defaults to NONAME if unset. More...
 
virtual void setName (QString _name)
 path to the file from which the object is loaded ( defaults to "." ) More...
 
QString filename () const
 return the filename of the object More...
 
void setFileName (const QString &_filename)
 set the filename for this object More...
 
void objectPropertiesChanged (int _objectId)
 

Object Payload functions for internal use only!

QMap< QString, PerObjectData * > dataMap_
 get reference to map of all perObject Datas More...
 
QMap< QString, PerObjectData * > & getPerObjectDataMap ()
 get reference to map of all perObject Datas More...
 

Object Comment

QMap< QString, QString > commentsByKey_
 Get comment for the specified key. 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
 

Object visualization

bool visible_
 
virtual bool visible ()
 return if object is visible More...
 
virtual void visible (bool _visible)
 Sets visiblity. More...
 
void visibilityChanged (int _objectId)
 

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 82 of file BaseObject.hh.

Constructor & Destructor Documentation

◆ BaseObject() [1/2]

BaseObject::BaseObject ( const BaseObject _object)

Creates a copy of this Object. Currently it will not have any per Object data attached. Its automatically attached to the objectRoot.

Definition at line 77 of file BaseObject.cc.

◆ BaseObject() [2/2]

BaseObject::BaseObject ( BaseObject _parent = 0)
explicit

Creates a new object. If the parent is 0 and the objectroot does not exist, it will have no parent. If the objectroot exists and parent is 0, it will be appended to the objectroot. If a parent is given, it is appended to this object.

Definition at line 134 of file BaseObject.cc.

◆ ~BaseObject()

BaseObject::~BaseObject ( )
virtual

Definition at line 170 of file BaseObject.cc.

Member Function Documentation

◆ appendChild()

void BaseObject::appendChild ( BaseObject child)

add a child to this node

Definition at line 496 of file BaseObject.cc.

◆ child()

BaseObject * BaseObject::child ( int  row)

return a child

Definition at line 504 of file BaseObject.cc.

◆ childCount()

int BaseObject::childCount ( ) const

get the number of children

Definition at line 509 of file BaseObject.cc.

◆ childExists() [1/2]

BaseObject * BaseObject::childExists ( int  _objectId)

Check if the element exists in the subtree of this element.

Definition at line 514 of file BaseObject.cc.

◆ childExists() [2/2]

BaseObject * BaseObject::childExists ( QString  _name)

Check if the element exists in the subtree of this element.

Definition at line 530 of file BaseObject.cc.

◆ cleanup()

◆ clearAllComments()

void BaseObject::clearAllComments ( )

Get comment for the specified key.

If no comment with the specified exists, an empty one is created.

Definition at line 841 of file BaseObject.cc.

◆ clearComment()

void BaseObject::clearComment ( const QString &  key)

Get comment for the specified key.

If no comment with the specified exists, an empty one is created.

Definition at line 837 of file BaseObject.cc.

◆ clearObjectData()

void BaseObject::clearObjectData ( QString  _dataName)

Clear the object data pointer ( this will not delete the object!! )

Definition at line 784 of file BaseObject.cc.

◆ copy()

◆ dataType() [1/2]

DataType BaseObject::dataType ( ) const

return the dataType of the object

Definition at line 227 of file BaseObject.cc.

◆ dataType() [2/2]

bool BaseObject::dataType ( DataType  _type) const

Check the if the object is of the given type

Parameters
_typechecks, if the object is of the given type

Definition at line 219 of file BaseObject.cc.

◆ deleteData()

void BaseObject::deleteData ( )

Delete all data attached to this object ( calls delete on each object )

Definition at line 809 of file BaseObject.cc.

◆ deleteSubtree()

void BaseObject::deleteSubtree ( )

delete the whole subtree below this item ( The item itself is not touched )

Definition at line 580 of file BaseObject.cc.

◆ dumpTree()

void BaseObject::dumpTree ( )

Debugging function, writing the subtree to output.

Definition at line 746 of file BaseObject.cc.

◆ filename()

QString BaseObject::filename ( ) const

return the filename of the object

Definition at line 704 of file BaseObject.cc.

◆ flag()

bool BaseObject::flag ( QString  _flag)

Get a custom flag of this item

Definition at line 297 of file BaseObject.cc.

◆ flags()

QStringList BaseObject::flags ( )

Get all flags of this item

Definition at line 328 of file BaseObject.cc.

◆ getAllComments()

const QMap< QString, QString > & BaseObject::getAllComments ( ) const

Returns a reference to all comments.

Definition at line 846 of file BaseObject.cc.

◆ getAllCommentsFlat()

const QString BaseObject::getAllCommentsFlat ( ) const

Returns a flat, human readable representation of all comments.

Definition at line 850 of file BaseObject.cc.

◆ getCommentByKey() [1/2]

QString & BaseObject::getCommentByKey ( const QString &  key)

Get comment for the specified key.

If no comment with the specified exists, an empty one is created.

Definition at line 818 of file BaseObject.cc.

◆ getCommentByKey() [2/2]

const QString BaseObject::getCommentByKey ( const QString &  key) const

Get comment for the specified key.

If no comment with the specified exists, an empty comment is returned (but not inserted into the map).

Definition at line 823 of file BaseObject.cc.

◆ getGroupIds()

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 658 of file BaseObject.cc.

◆ getGroupNames()

QStringList BaseObject::getGroupNames ( )

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

Definition at line 679 of file BaseObject.cc.

◆ getLeafs()

QList< BaseObject * > BaseObject::getLeafs ( )

get all leafes of the tree below this object ( These will be all visible objects )

Definition at line 565 of file BaseObject.cc.

◆ getObjectinfo()

◆ getPerObjectDataMap()

QMap< QString, PerObjectData * > & BaseObject::getPerObjectDataMap ( )

get reference to map of all perObject Datas

Don't use this function! It's only for the backup Plugin to store and restore perObjectDatas!

Definition at line 880 of file BaseObject.cc.

◆ group()

int BaseObject::group ( ) const

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 599 of file BaseObject.cc.

◆ hasCommentForKey()

bool BaseObject::hasCommentForKey ( const QString &  key) const

Returns true if a comment for the specified key exists, false otherwise.

Definition at line 828 of file BaseObject.cc.

◆ hasComments()

bool BaseObject::hasComments ( ) const

Indicates whether any comment has been supplied for this object.

Definition at line 833 of file BaseObject.cc.

◆ hasObjectData()

bool BaseObject::hasObjectData ( QString  _dataName)

Checks if object data with given name is available.

Definition at line 792 of file BaseObject.cc.

◆ id()

int BaseObject::id ( ) const

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 188 of file BaseObject.cc.

◆ isGroup()

bool BaseObject::isGroup ( ) const

Check if object is a group.

Definition at line 617 of file BaseObject.cc.

◆ isInGroup() [1/2]

bool BaseObject::isInGroup ( const QString &  _name) const

Check if this item belongs to a group with this name

Parameters
_nameName of the group

Definition at line 640 of file BaseObject.cc.

◆ isInGroup() [2/2]

bool BaseObject::isInGroup ( int  _id) const

Check if this item belongs to a group with this id

Parameters
_idid of the group

Definition at line 623 of file BaseObject.cc.

◆ last()

BaseObject * BaseObject::last ( )

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

Definition at line 362 of file BaseObject.cc.

◆ level()

int BaseObject::level ( )

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

Definition at line 439 of file BaseObject.cc.

◆ name()

QString BaseObject::name ( ) const

return the name of the object. The name defaults to NONAME if unset.

Definition at line 728 of file BaseObject.cc.

◆ next()

BaseObject * BaseObject::next ( )

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

Definition at line 402 of file BaseObject.cc.

◆ objectData()

PerObjectData * BaseObject::objectData ( QString  _dataName)

Returns the object data pointer.

Definition at line 800 of file BaseObject.cc.

◆ objectPropertiesChanged

void BaseObject::objectPropertiesChanged ( int  _objectId)
signal

This signal is emitted when properties of the object have been changed like its name or the parent changed

◆ objectSelectionChanged

void BaseObject::objectSelectionChanged ( int  _objectId)
signal

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

◆ parent() [1/2]

BaseObject * BaseObject::parent ( )

Get the parent item ( 0 if rootitem )

Definition at line 464 of file BaseObject.cc.

◆ parent() [2/2]

const BaseObject * BaseObject::parent ( ) const

get the row of this item from the parent

Definition at line 469 of file BaseObject.cc.

◆ path()

QString BaseObject::path ( ) const

return the path to the object ( defaults to "." if unset )

Definition at line 732 of file BaseObject.cc.

◆ persistentId() [1/2]

int BaseObject::persistentId ( ) const

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 192 of file BaseObject.cc.

◆ persistentId() [2/2]

void BaseObject::persistentId ( int  _id)

set the persistent id of the object

Definition at line 196 of file BaseObject.cc.

◆ printObjectInfo()

void BaseObject::printObjectInfo ( )
virtual

Print all information about the object.

Definition at line 262 of file BaseObject.cc.

◆ removeChild()

void BaseObject::removeChild ( BaseObject _item)

Remove a child from this object.

Definition at line 546 of file BaseObject.cc.

◆ row()

int BaseObject::row ( ) const

get the row of this item from the parent

Definition at line 456 of file BaseObject.cc.

◆ setDataType()

void BaseObject::setDataType ( DataType  _type)

set the object type

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

Definition at line 231 of file BaseObject.cc.

◆ setFileName()

void BaseObject::setFileName ( const QString &  _filename)

set the filename for this object

Definition at line 709 of file BaseObject.cc.

◆ setFlag()

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

Set a custom flag on this item

Definition at line 302 of file BaseObject.cc.

◆ setFromFileName()

void BaseObject::setFromFileName ( const QString &  _filename)

Set the object path and filename from the given parameter.

Parameters
_filenamepath to the file.

Definition at line 714 of file BaseObject.cc.

◆ setName()

void BaseObject::setName ( QString  _name)
virtual

◆ setObjectData()

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
_dataNameDefine a name for your data
_dataa pointer to your object data

Definition at line 778 of file BaseObject.cc.

◆ setParent()

void BaseObject::setParent ( BaseObject _parent)

Set the parent pointer.

Definition at line 475 of file BaseObject.cc.

◆ setPath()

void BaseObject::setPath ( const QString &  _path)

set the path to the object.

Definition at line 736 of file BaseObject.cc.

◆ source() [1/2]

bool BaseObject::source ( )

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

Definition at line 289 of file BaseObject.cc.

◆ source() [2/2]

void BaseObject::source ( bool  _source)

Set this item as a source

Definition at line 293 of file BaseObject.cc.

◆ target() [1/2]

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 271 of file BaseObject.cc.

◆ target() [2/2]

void BaseObject::target ( bool  _target)

Set this item as a target

Definition at line 275 of file BaseObject.cc.

◆ update()

void BaseObject::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 when it is required)

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

Definition at line 743 of file BaseObject.cc.

◆ visibilityChanged

void BaseObject::visibilityChanged ( int  _objectId)
signal

This slot is emitted when the visibility of the object gets changed.

The signal is normally handled by the core to tell the plugins that an object changed its visibility

◆ visible() [1/2]

bool BaseObject::visible ( )
virtual

return if object is visible

Reimplemented in LightObject, QtWidgetObject, and BaseObjectData.

Definition at line 337 of file BaseObject.cc.

◆ visible() [2/2]

void BaseObject::visible ( bool  _visible)
virtual

Sets visiblity.

Reimplemented in LightObject, QtWidgetObject, and BaseObjectData.

Definition at line 341 of file BaseObject.cc.

Friends And Related Function Documentation

◆ BaseObjectData

friend class BaseObjectData
friend

Definition at line 86 of file BaseObject.hh.

◆ Core

friend class Core
friend

Definition at line 87 of file BaseObject.hh.

Member Data Documentation

◆ childItems_

QList<BaseObject*> BaseObject::childItems_
private

Children of this node.

Definition at line 335 of file BaseObject.hh.

◆ commentsByKey_

QMap<QString, QString> BaseObject::commentsByKey_
private

Get comment for the specified key.

If no comment with the specified exists, an empty one is created.

Definition at line 570 of file BaseObject.hh.

◆ dataMap_

QMap<QString, PerObjectData* > BaseObject::dataMap_
private

get reference to map of all perObject Datas

Don't use this function! It's only for the backup Plugin to store and restore perObjectDatas!

Definition at line 529 of file BaseObject.hh.

◆ filename_

QString BaseObject::filename_
private

path to the file from which the object is loaded ( defaults to "." )

Definition at line 467 of file BaseObject.hh.

◆ flags_

QStringList BaseObject::flags_
private

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

Definition at line 243 of file BaseObject.hh.

◆ id_

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 134 of file BaseObject.hh.

◆ name_

QString BaseObject::name_
private

Object/FileName ( defaults to NONAME )

Definition at line 478 of file BaseObject.hh.

◆ NOOBJECT

int BaseObject::NOOBJECT = -1
static

predefined handle which is returned when objects are not found or not initialized.

Static member for no object initialization

Definition at line 106 of file BaseObject.hh.

◆ objectType_

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 167 of file BaseObject.hh.

◆ parentItem_

BaseObject* BaseObject::parentItem_
private

Parent item or 0 if rootnode.

Definition at line 332 of file BaseObject.hh.

◆ path_

QString BaseObject::path_
private

path to the file from which the object is loaded ( defaults to "." )

Definition at line 466 of file BaseObject.hh.

◆ persistentId_

int BaseObject::persistentId_
private

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 141 of file BaseObject.hh.

◆ visible_

bool BaseObject::visible_
protected

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

Definition at line 274 of file BaseObject.hh.


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