Public Member Functions | Friends

BaseObject Class Reference

#include <OpenFlipper/common/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 (UpdateType _type=UPDATE_ALL)
 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 ()
Object Payload

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

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 ()
void objectSelectionChanged (int _objectId)

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)
void objectPropertiesChanged (int _objectId)

Object Payload functions for internal use only!



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

Object visualization



bool visible_
virtual bool visible ()
 return if object is visible
virtual void visible (bool _visible)
 Sets visiblity.
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 83 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 automatically attached to the objectRoot.

Definition at line 76 of file BaseObject.cc.

References PluginFunctions::addObjectToMap(), appendChild(), childItems_, flags_, id_, PluginFunctions::increaseObjectCount(), name_, PluginFunctions::objectRoot(), objectType_, parentItem_, persistentId_, setParent(), and visible_.

BaseObject::BaseObject ( BaseObject _parent = 0  ) 

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

References PluginFunctions::addObjectToMap(), appendChild(), id_, PluginFunctions::increaseObjectCount(), PluginFunctions::objectRoot(), and setParent().


Member Function Documentation

void BaseObject::cleanup ( void   )  [virtual]

Clean all data structures of the object

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

Definition at line 190 of file BaseObject.cc.

References flags_, name_, persistentId_, and visible_.

DataType BaseObject::dataType (  ) 
bool BaseObject::dataType ( DataType  _type  ) 

Check the if the object is of the given type

Parameters:
_type checks, if the object is of the given type

Definition at line 203 of file BaseObject.cc.

References DATA_ALL, and objectType_.

Referenced by TopologyPlugin::add_face(), CoreWidget::addContextMenus(), InfoMeshObjectPlugin::aspectRatio(), PluginFunctions::BaseObjectIterator::BaseObjectIterator(), InfoMeshObjectPlugin::boundaryCount(), InfoMeshObjectPlugin::boundingBoxMax(), InfoMeshObjectPlugin::boundingBoxMin(), InfoMeshObjectPlugin::boundingBoxSize(), TopologyPlugin::clearAddFaceVertices(), MeshObjectSelectionPlugin::clearEdgeSelection(), MeshObjectSelectionPlugin::clearFaceSelection(), MeshObjectSelectionPlugin::clearHalfedgeSelection(), MeshObjectSelectionPlugin::clearHandleVertices(), MeshObjectSelectionPlugin::clearModelingVertices(), MeshObjectSelectionPlugin::clearVertexSelection(), InfoMeshObjectPlugin::cog(), MeshObjectSelectionPlugin::colorizeEdgeSelection(), MeshObjectSelectionPlugin::colorizeFaceSelection(), MeshObjectSelectionPlugin::colorizeHalfedgeSelection(), MeshObjectSelectionPlugin::colorizeVertexSelection(), InfoMeshObjectPlugin::componentCount(), DecimaterPlugin::decimate(), MeshObjectSelectionPlugin::deleteEdgeSelection(), MeshObjectSelectionPlugin::deleteFaceSelection(), MeshObjectSelectionPlugin::deleteVertexSelection(), InfoMeshObjectPlugin::edgeCount(), InfoMeshObjectPlugin::edgeLength(), InfoMeshObjectPlugin::faceArea(), InfoMeshObjectPlugin::faceCount(), InfoMeshObjectPlugin::genus(), InfoMeshObjectPlugin::getEdgeLengths(), MeshObjectSelectionPlugin::getEdgeSelection(), MeshObjectSelectionPlugin::getFaceSelection(), getGroupIds(), getGroupNames(), MeshObjectSelectionPlugin::getHalfedgeSelection(), MeshObjectSelectionPlugin::getHandleVertices(), MeshObjectSelectionPlugin::getModelingVertices(), MeshObjectSelectionPlugin::getVertexSelection(), MeshObjectSelectionPlugin::growFaceSelection(), MeshObjectSelectionPlugin::growVertexSelection(), MeshObjectSelectionPlugin::invertEdgeSelection(), MeshObjectSelectionPlugin::invertFaceSelection(), MeshObjectSelectionPlugin::invertHalfedgeSelection(), MeshObjectSelectionPlugin::invertVertexSelection(), isInGroup(), MeshObjectSelectionPlugin::lassoSelection(), MeshObjectSelectionPlugin::loadFlipperModelingSelection(), INIPlugin::loadIniFile(), Core::loadObject(), ViewControlPlugin::modelingAreasVisible(), MovePlugin::moveObject(), TreeModel::objectAdded(), TreeModelObjectSelection::objectAdded(), PluginFunctions::ObjectIterator::ObjectIterator(), SelectVolumeAction::operator()(), PluginFunctions::ObjectIterator::operator++(), PluginFunctions::BaseObjectIterator::operator++(), SkeletonEditingPlugin::placeManip(), MovePlugin::placeManip(), MeshObjectSelectionPlugin::saveFlipperModelingSelection(), INIPlugin::saveIniFile(), DataControlPlugin::saveIniFileOptions(), Core::saveObject(), MeshObjectSelectionPlugin::selectAllEdges(), MeshObjectSelectionPlugin::selectAllFaces(), MeshObjectSelectionPlugin::selectAllHalfedges(), MeshObjectSelectionPlugin::selectAllVertices(), MeshObjectSelectionPlugin::selectBoundaryEdges(), MeshObjectSelectionPlugin::selectBoundaryFaces(), MeshObjectSelectionPlugin::selectBoundaryHalfedges(), MeshObjectSelectionPlugin::selectBoundaryVertices(), MeshObjectSelectionPlugin::selectClosestBoundaryVertices(), MeshObjectSelectionPlugin::selectEdges(), MeshObjectSelectionPlugin::selectFaces(), MeshObjectSelectionPlugin::selectHalfedges(), MeshObjectSelectionPlugin::selectHandleVertices(), ViewControlPlugin::selectionVisible(), MeshObjectSelectionPlugin::selectModelingVertices(), MeshObjectSelectionPlugin::selectVertices(), MeshObjectSelectionPlugin::setAllHandleVertices(), MeshObjectSelectionPlugin::setAllModelingVertices(), ViewControlPlugin::showModelingAreas(), LoadWidget::showSave(), ViewControlPlugin::showSelection(), MeshObjectSelectionPlugin::shrinkFaceSelection(), MeshObjectSelectionPlugin::shrinkVertexSelection(), MeshObjectSelectionPlugin::slotClosestBoundarySelection(), MeshObjectSelectionPlugin::slotComponentsSelection(), DataControlPlugin::slotCustomContextMenuRequested(), MeshObjectSelectionPlugin::slotFloodFillSelection(), Core::slotGenerateBackup(), Core::slotMouseEventIdentify(), MovePlugin::slotMoveManipToCOG(), SkeletalAnimationPlugin::slotObjectUpdated(), MovePlugin::slotRotate(), MovePlugin::slotScale(), MovePlugin::slotSetPosition(), MeshObjectSelectionPlugin::slotToggleSelection(), ViewControlPlugin::slotUpdateContextMenu(), TextureControlPlugin::slotUpdateContextMenu(), MeanCurvaturePlugin::slotUpdateTexture(), LaplaceLengthPlugin::slotUpdateTexture(), SmootherPlugin::smooth(), MovePlugin::transform(), MovePlugin::transformEdgeSelection(), MovePlugin::transformFaceSelection(), MovePlugin::transformVertexSelection(), MovePlugin::translate(), MovePlugin::translateSelection(), MeshObjectSelectionPlugin::unselectEdges(), MeshObjectSelectionPlugin::unselectFaces(), MeshObjectSelectionPlugin::unselectHalfedges(), MeshObjectSelectionPlugin::unselectHandleVertices(), MeshObjectSelectionPlugin::unselectModelingVertices(), MeshObjectSelectionPlugin::unselectVertices(), MeshRepairPlugin::updateFaceNormals(), MeshRepairPlugin::updateNormals(), CoreWidget::updatePopupMenuObject(), MeshRepairPlugin::updateVertexNormals(), InfoMeshObjectPlugin::vertexCount(), and InfoMeshObjectPlugin::vertexValence().

bool BaseObject::flag ( QString  _flag  ) 

Get a custom flag of this item

Definition at line 282 of file BaseObject.cc.

References flags_.

Referenced by source(), SelectionObjectMarker::stencilRefForObject(), and target().

QStringList BaseObject::flags (  ) 

Get all flags of this item

Definition at line 313 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 655 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 676 of file BaseObject.cc.

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

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

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

References id_.

Referenced by TopologyPlugin::add_face(), TypeTriangleMeshPlugin::addEmpty(), TypeSpherePlugin::addEmpty(), TypePolyMeshPlugin::addEmpty(), TypePlanePlugin::addEmpty(), TypeCoordsysPlugin::addEmpty(), TopologyPlugin::clearAddFaceVertices(), MeshObjectSelectionPlugin::clearEdgeSelection(), MeshObjectSelectionPlugin::clearFaceSelection(), MeshObjectSelectionPlugin::clearHalfedgeSelection(), MeshObjectSelectionPlugin::clearHandleVertices(), MeshObjectSelectionPlugin::clearModelingVertices(), MeshObjectSelectionPlugin::clearVertexSelection(), TopologyPlugin::collapse_edge(), MeshObjectSelectionPlugin::colorizeEdgeSelection(), MeshObjectSelectionPlugin::colorizeHalfedgeSelection(), DecimaterPlugin::decimate(), TopologyPlugin::delete_face(), MeshObjectSelectionPlugin::deleteEdgeSelection(), MeshObjectSelectionPlugin::deleteFaceSelection(), MeshObjectSelectionPlugin::deleteVertexSelection(), dumpTree(), TopologyPlugin::flip_edge(), TypeTriangleMeshPlugin::get_unique_name(), TypeSpherePlugin::get_unique_name(), TypeSkeletonPlugin::get_unique_name(), TypePolyMeshPlugin::get_unique_name(), TypePlanePlugin::get_unique_name(), TypeLightPlugin::get_unique_name(), TypeCoordsysPlugin::get_unique_name(), TypeCameraPlugin::get_unique_name(), MovePlugin::getDialogWidget(), getGroupIds(), DataControlPlugin::getObject(), DataControlPlugin::groupObjects(), MeshObjectSelectionPlugin::growFaceSelection(), MeshObjectSelectionPlugin::growVertexSelection(), MovePlugin::hideManipulator(), MeshObjectSelectionPlugin::invertEdgeSelection(), MeshObjectSelectionPlugin::invertFaceSelection(), MeshObjectSelectionPlugin::invertHalfedgeSelection(), MeshObjectSelectionPlugin::invertVertexSelection(), isInGroup(), MeshObjectSelectionPlugin::lassoSelection(), DataControlPlugin::loadIniFileOptionsLast(), FileVTKPlugin::loadObject(), FileSTLPlugin::loadObject(), FileOFFPlugin::loadObject(), FileOBJPlugin::loadObject(), FileBVHPlugin::loadObject(), FileOMPlugin::loadPolyMeshObject(), FileOMPlugin::loadTriMeshObject(), SkeletonEditingPlugin::manipulatorMoved(), TreeModel::objectAdded(), TreeModelObjectSelection::objectAdded(), TreeModel::objectChanged(), TreeModelObjectSelection::objectChanged(), Core::openIniFile(), SelectVolumeAction::operator()(), SkeletonEditingPlugin::placeManip(), MovePlugin::placeManip(), TypeLightPlugin::rotateLightDirection(), MeshObjectSelectionPlugin::selectAllEdges(), MeshObjectSelectionPlugin::selectAllFaces(), MeshObjectSelectionPlugin::selectAllHalfedges(), MeshObjectSelectionPlugin::selectAllVertices(), MeshObjectSelectionPlugin::selectBoundaryEdges(), MeshObjectSelectionPlugin::selectBoundaryFaces(), MeshObjectSelectionPlugin::selectBoundaryHalfedges(), MeshObjectSelectionPlugin::selectBoundaryVertices(), MeshObjectSelectionPlugin::selectClosestBoundaryVertices(), MeshObjectSelectionPlugin::selectEdges(), MeshObjectSelectionPlugin::selectFaces(), MeshObjectSelectionPlugin::selectHalfedges(), MeshObjectSelectionPlugin::selectHandleVertices(), MeshObjectSelectionPlugin::selectModelingVertices(), MeshObjectSelectionPlugin::selectVertices(), MeshObjectSelectionPlugin::setAllHandleVertices(), MeshObjectSelectionPlugin::setAllModelingVertices(), OBJImporter::setObject(), SkeletonEditingPlugin::showManipulators(), MovePlugin::showManipulators(), MovePlugin::showProps(), MeshObjectSelectionPlugin::shrinkFaceSelection(), MeshObjectSelectionPlugin::shrinkVertexSelection(), SkeletalAnimationPlugin::slotAnimationIndexChanged(), MeshObjectSelectionPlugin::slotClosestBoundarySelection(), MeshObjectSelectionPlugin::slotComponentsSelection(), Core::slotCopyObject(), DataControlPlugin::slotCustomContextMenuRequested(), Core::slotDeleteAllObjects(), MeshObjectSelectionPlugin::slotFloodFillSelection(), SkeletalAnimationPlugin::slotFrameChanged(), DataControlPlugin::slotGroup(), DataControlPlugin::slotMoveBaseObject(), MovePlugin::slotRotate(), MovePlugin::slotScale(), MovePlugin::slotSetPosition(), MeshObjectSelectionPlugin::slotSphereSelection(), ObjectSelectionPlugin::slotToggleSelection(), MeshObjectSelectionPlugin::slotToggleSelection(), BSplineSurfaceSelectionPlugin::slotToggleSelection(), BSplineCurveSelectionPlugin::slotToggleSelection(), MovePlugin::slotTranslation(), DataControlPlugin::slotUngroup(), SmootherPlugin::smooth(), TopologyPlugin::split_edge(), TopologyPlugin::split_face(), SubdividerPlugin::subdivide(), MeshObjectSelectionPlugin::unselectEdges(), MeshObjectSelectionPlugin::unselectFaces(), MeshObjectSelectionPlugin::unselectHalfedges(), MeshObjectSelectionPlugin::unselectHandleVertices(), MeshObjectSelectionPlugin::unselectModelingVertices(), MeshObjectSelectionPlugin::unselectVertices(), TypeLightPlugin::updateLights(), CoreWidget::updatePopupMenuObject(), and SkeletalAnimationPlugin::UpdateSkins().

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 637 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 620 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 347 of file BaseObject.cc.

int BaseObject::level (  ) 

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

Definition at line 423 of file BaseObject.cc.

References parent().

Referenced by dumpTree().

BaseObject * BaseObject::next (  ) 
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

Referenced by setName(), and setParent().

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

References persistentId_.

void BaseObject::persistentId ( int  _id  ) 

set the persistent id of the object

Definition at line 181 of file BaseObject.cc.

References persistentId_.

void BaseObject::setDataType ( DataType  _type  ) 
void BaseObject::setFlag ( QString  _flag,
bool  _set 
)

Set a custom flag on this item

Definition at line 287 of file BaseObject.cc.

References flags_, and isGroup().

Referenced by VSI::ObjectPickDialog::selectedId(), ObjectPickDialog::selectedId(), 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 750 of file BaseObject.cc.

bool BaseObject::source (  ) 
void BaseObject::source ( bool  _source  ) 

Set this item as a source

Definition at line 276 of file BaseObject.cc.

References setFlag(), and source().

void BaseObject::target ( bool  _target  ) 

Set this item as a target

Definition at line 259 of file BaseObject.cc.

References PluginFunctions::decreaseTargetCount(), PluginFunctions::increaseTargetCount(), setFlag(), and target().

bool BaseObject::target (  ) 
void BaseObject::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 in BSplineCurveObject, BSplineSurfaceObject, LightObject, MeshObject< MeshT >, and BaseObjectData.

Definition at line 714 of file BaseObject.cc.

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

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


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

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

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

Referenced by BaseObject(), 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 137 of file BaseObject.hh.

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

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

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


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