Developer Documentation
|
#include <OpenFlipper/common/BaseObject.hh>
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 | |
void | dumpTree () |
Debugging function, writing the subtree to output. | |
virtual BaseObject * | copy () |
Returns a full copy of the object. | |
Tree : Parent nodes | |
int | row () const |
get the row of this item from the parent | |
BaseObject * | parent () |
Get the parent item ( 0 if rootitem ) | |
const BaseObject * | parent () const |
get the row of this item from the parent | |
void | setParent (BaseObject *_parent) |
Set the parent pointer. | |
Tree : Children | |
BaseObject * | childExists (int _objectId) |
Check if the element exists in the subtree of this element. | |
BaseObject * | childExists (QString _name) |
Check if the element exists in the subtree of this element. | |
void | appendChild (BaseObject *child) |
add a child to this node | |
BaseObject * | child (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 () 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 () |
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. | |
PerObjectData * | objectData (QString _dataName) |
Returns the object data pointer. | |
void | deleteData () |
Delete all data attached to this object ( calls delete on each object ) | |
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) |
Object visualization | |
bool | visible_ |
virtual bool | visible () |
return if object is visible | |
virtual void | visible (bool _visible) |
Sets visiblity. | |
void | visibilityChanged (int _objectId) |
Tree Structure | |
BaseObject * | parentItem_ |
Parent item or 0 if rootnode. | |
QList< BaseObject * > | childItems_ |
Children of this node. | |
BaseObject * | last () |
BaseObject * | next () |
int | level () |
Name and Path handling | |
QString | path_ |
path to the file from which the object is loaded ( defaults to "." ) | |
QString | filename_ |
path to the file from which the object is loaded ( defaults to "." ) | |
QString | name_ |
Object/FileName ( defaults to NONAME ) | |
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. | |
virtual void | setName (QString _name) |
path to the file from which the object is loaded ( defaults to "." ) | |
QString | filename () const |
return the filename of the object | |
void | setFileName (const QString &_filename) |
set the filename for this object | |
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 |
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 94 of file BaseObject.hh.
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 88 of file BaseObject.cc.
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 147 of file BaseObject.cc.
|
virtual |
Clean all data structures of the object
Reimplemented in BaseObjectData, MeshObject< MeshT >, MeshObject< PolyMesh >, MeshObject< TriMesh >, PolyLineObject, BSplineSurfaceObject, SplatCloudObject, CameraObject, BSplineCurveObject, VolumeMeshObject< MeshT >, CoordsysObject, LightObject, PlaneObject, SphereObject, QtWidgetObject, and SkeletonObject.
Definition at line 218 of file BaseObject.cc.
|
inline |
Get comment for the specified key.
If no comment with the specified exists, an empty one is created.
Definition at line 583 of file BaseObject.hh.
|
inline |
Get comment for the specified key.
If no comment with the specified exists, an empty one is created.
Definition at line 579 of file BaseObject.hh.
bool BaseObject::dataType | ( | DataType | _type | ) | const |
Check the if the object is of the given type
_type | checks, if the object is of the given type |
Definition at line 232 of file BaseObject.cc.
DataType BaseObject::dataType | ( | ) | const |
return the dataType of the object
Definition at line 240 of file BaseObject.cc.
bool BaseObject::flag | ( | QString | _flag | ) |
Get a custom flag of this item
Definition at line 310 of file BaseObject.cc.
QStringList BaseObject::flags | ( | ) |
Get all flags of this item
Definition at line 341 of file BaseObject.cc.
|
inline |
Returns a reference to all comments.
Definition at line 588 of file BaseObject.hh.
|
inline |
Returns a flat, human readable representation of all comments.
Definition at line 593 of file BaseObject.hh.
|
inline |
Get comment for the specified key.
If no comment with the specified exists, an empty one is created.
Definition at line 556 of file BaseObject.hh.
|
inline |
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 565 of file BaseObject.hh.
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 671 of file BaseObject.cc.
QStringList BaseObject::getGroupNames | ( | ) |
Get a vector of all group names this object belongs to ( this function omits the root object )
Definition at line 692 of file BaseObject.cc.
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 835 of file BaseObject.cc.
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.
Definition at line 612 of file BaseObject.cc.
|
inline |
Returns true if a comment for the specified key exists, false otherwise.
Definition at line 570 of file BaseObject.hh.
|
inline |
Indicates whether any comment has been supplied for this object.
Definition at line 575 of file BaseObject.hh.
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 201 of file BaseObject.cc.
bool BaseObject::isInGroup | ( | int | _id | ) | const |
Check if this item belongs to a group with this id
_id | id of the group |
Definition at line 636 of file BaseObject.cc.
bool BaseObject::isInGroup | ( | QString | _name | ) | const |
Check if this item belongs to a group with this name
_name | Name of the group |
Definition at line 653 of file BaseObject.cc.
BaseObject * BaseObject::last | ( | ) |
Get the last item of the tree (Preorder traversal of the tree)
Definition at line 375 of file BaseObject.cc.
int BaseObject::level | ( | ) |
level of the current object ( root node has level 0)
Definition at line 452 of file BaseObject.cc.
BaseObject * BaseObject::next | ( | ) |
Get the next item of the tree (Preorder traversal of the tree)
Definition at line 415 of file BaseObject.cc.
|
signal |
This signal is emitted when properties of the object have been changed like its name or the parent changed
|
signal |
Stores all item flags as strings. Source and target flags are represented as "source" and "target" strings.
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 205 of file BaseObject.cc.
void BaseObject::persistentId | ( | int | _id | ) |
set the persistent id of the object
Definition at line 209 of file BaseObject.cc.
void BaseObject::setDataType | ( | DataType | _type | ) |
set the object type
_type | the type of the object (if it has a type defined, it will output a warning) |
Definition at line 244 of file BaseObject.cc.
void BaseObject::setFlag | ( | QString | _flag, |
bool | _set | ||
) |
Set a custom flag on this item
Definition at line 315 of file BaseObject.cc.
void BaseObject::setFromFileName | ( | const QString & | _filename | ) |
Set the object path and filename from the given parameter.
_filename | path to the file. |
Definition at line 727 of file BaseObject.cc.
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.
_dataName | Define a name for your data |
_data | a pointer to your object data |
Definition at line 792 of file BaseObject.cc.
bool BaseObject::source | ( | ) |
Is this item selected as a source item? Some algorithms use source meshes to define their input.
Definition at line 302 of file BaseObject.cc.
void BaseObject::source | ( | bool | _source | ) |
Set this item as a source
Definition at line 306 of file BaseObject.cc.
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 284 of file BaseObject.cc.
void BaseObject::target | ( | bool | _target | ) |
Set this item as a target
Definition at line 288 of file BaseObject.cc.
|
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.
Reimplemented in BaseObjectData, QtWidgetObject, SkeletonObject, CameraObject, MeshObject< MeshT >, MeshObject< PolyMesh >, MeshObject< TriMesh >, SphereObject, VolumeMeshObject< MeshT >, CoordsysObject, PolyLineObject, LightObject, BSplineCurveObject, BSplineSurfaceObject, PlaneObject, and SplatCloudObject.
Definition at line 756 of file BaseObject.cc.
|
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
|
private |
Get comment for the specified key.
If no comment with the specified exists, an empty one is created.
Definition at line 630 of file BaseObject.hh.
|
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 541 of file BaseObject.hh.
|
private |
Stores all item flags as strings. Source and target flags are represented as "source" and "target" strings.
Definition at line 255 of file BaseObject.hh.
|
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 146 of file BaseObject.hh.
|
static |
predefined handle which is returned when objects are not found or not initialized.
Static member for no object initialization
Definition at line 118 of file BaseObject.hh.
|
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 179 of file BaseObject.hh.
|
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 153 of file BaseObject.hh.
|
protected |
Show/hide/ Object
Visibility is handled by DataControlPlugin so emit updated_objects if you changed this value defaults to visible
Definition at line 286 of file BaseObject.hh.