Developer Documentation
MeshObject< MeshT > Class Template Reference

#include <Type-OpenMesh/ObjectTypes/MeshObject/MeshObjectT.hh>

Inheritance diagram for MeshObject< MeshT >:
BaseObjectData BaseObject

Public Member Functions

 MeshObject (const MeshObject &_object)
 copy constructor More...
 
 MeshObject (DataType _typeId)
 Constructor. More...
 
virtual ~MeshObject ()
 destructor More...
 
virtual void cleanup ()
 Reset current object, including all related nodes. More...
 
Name and Path handling
void setName (QString _name)
 Set the name of the Object. More...
 
Load/Save
bool loadMesh (QString _filename)
 Load a mesh from the given file. More...
 
Object Information
QString getObjectinfo ()
 Get all Info for the Object as a string. More...
 
Picking
bool picked (uint _node_idx)
 detect if the node has been picked More...
 
void enablePicking (bool _enable)
 Enable or disable picking for this Node.
 
bool pickingEnabled ()
 Check if picking is enabled for this Node.
 
- Public Member Functions inherited from BaseObjectData
 BaseObjectData (const BaseObjectData &_object)
 copy constructor More...
 
 BaseObjectData ()
 constructor
 
virtual ~BaseObjectData ()
 destructor
 
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...
 
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...
 
QtTranslationManipulatorNodemanipulatorNode ()
 
MaterialNodematerialNode ()
 get a pointer to the materialnode
 
const MaterialNodematerialNode () const
 get a const 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...
 
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...
 
- Public Member Functions inherited from BaseObject
 BaseObject (const BaseObject &_object)
 
 BaseObject (BaseObject *_parent=0)
 
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

virtual void init (MeshT *_mesh=0)
 Initialise current object, including all related nodes. More...
 
Update handling

This is mostly private. Updates have to be triggered via emit updatedObject()

virtual void update (UpdateType _type=UPDATE_ALL)
 Update the whole Object (Selection,Topology,...) More...
 
void updateSelection ()
 Call this function to update the modeling regions. More...
 
void updateModelingRegions ()
 Call this function to update the modeling regions. More...
 
void updateFeatures ()
 Update Feature Visualization Node. More...
 
void updateGeometry ()
 Update Geometry of all data structures. More...
 
void updateColor ()
 Update Colors of all data structures. More...
 
void updateTopology ()
 Update Topology of all data structures. More...
 
void updateTexture ()
 Update Texture of all data structures. More...
 
Update handling
Update handling

Friends

class TypePolyMeshPlugin
 
class TypeTriangleMeshPlugin
 

Content

MeshT * mesh_
 pointer to the mesh
 
MeshT * mesh ()
 return a pointer to the mesh More...
 
const MeshT * mesh () const
 return a const pointer to the mesh More...
 

Visualization

ACG::SceneGraph::SelectionNodeT< MeshT > * statusNode_
 Status Node for a mesh, visualizing the selection state of a mesh.
 
ACG::SceneGraph::StatusNodeT< MeshT, AreaNodeMod< MeshT > > * areaNode_
 Area selection Vis.
 
ACG::SceneGraph::StatusNodeT< MeshT, HandleNodeMod< MeshT > > * handleNode_
 Handle selection Vis.
 
ACG::SceneGraph::StatusNodeT< MeshT, FeatureNodeMod< MeshT > > * featureNode_
 Feature selection Vis.
 
ACG::SceneGraph::MeshNodeT< MeshT > * meshNode_
 Scenegraph Mesh Node.
 
ACG::SceneGraph::EnvMapNodetextureNode_
 Scenegraph TextureNode.
 
ACG::SceneGraph::ShaderNodeshaderNode_
 Scenegraph ShaderNode.
 
ACG::SceneGraph::StatusViewNodeT< MeshT > * statusView_
 Scenegraph StatusNodeView.
 
ACG::SceneGraph::EnvMapNodetextureNode ()
 Get the TextureNode of the current mesh. More...
 
ACG::SceneGraph::ShaderNodeshaderNode ()
 Return pointer to the shader node. More...
 
void hideSelection (bool _hide)
 Hide or show the selection Node of the object. More...
 
bool selectionVisible ()
 return if the selections are currently visible
 
void hideFeatures (bool _hide)
 Hide or show the feature Node of the object.
 
bool featuresVisible ()
 return if the feature Node of the object is currently visible
 
void hideArea (StatusBits _bit, bool _hide)
 Hide or show the area Nodes of the object. More...
 
bool areaVisible (StatusBits _bit)
 Return if the selected areas are currently visible. More...
 
ACG::SceneGraph::MeshNodeT< MeshT > * meshNode ()
 Get the Scenegraph Mesh Node. More...
 
void boundingBox (ACG::Vec3d &_bbMin, typename ACG::Vec3d &_bbMax)
 Get the BoundingBox of this object. More...
 
BaseNodeprimaryNode ()
 Status Node for a mesh, visualizing the selection state of a mesh.
 
void setSelectionColor (const ACG::Vec4f &_color)
 set color for selection
 
ACG::Vec4f selectionColor () const
 get color for selection. returns -1 vector, if handle node does not exists
 
void setAreaColor (const ACG::Vec4f &_color)
 set color for areas
 
ACG::Vec4f areaColor () const
 get color for areas. returns -1 vector, if handle node does not exists
 
void setFeatureColor (const ACG::Vec4f &_color)
 set color for features
 
ACG::Vec4f featureColor () const
 get color for features. returns -1 vector, if handle node does not exists
 
void setHandleColor (const ACG::Vec4f &_color)
 set color for handles
 
ACG::Vec4f handleColor () const
 get color for handles. returns -1 vector, if handle node does not exists
 
ACG::SceneGraph::SelectionNodeT< MeshT > * statusNode ()
 
ACG::SceneGraph::StatusNodeT< MeshT, AreaNodeMod< MeshT > > * areaNode ()
 Returns the area selection node if available, nullptr otherwise.
 
ACG::SceneGraph::StatusNodeT< MeshT, HandleNodeMod< MeshT > > * handleNode ()
 Returns the handle selection node if available, nullptr otherwise.
 
ACG::SceneGraph::StatusNodeT< MeshT, FeatureNodeMod< MeshT > > * featureNode ()
 Returns the feature selection node if available, nullptr otherwise.
 

BSP Extension ( Implements a BSP for the mesh used for fast searches )

typedef OpenMeshTriangleBSPT< MeshT > OMTriangleBSP
 If requested a bsp is created for this object.
 
OMTriangleBSPtriangle_bsp_
 If requested a bsp is created for this object.
 
OMTriangleBSPrequestTriangleBsp ()
 
void invalidateTriangleBsp ()
 
OMTriangleBSPresetTriangleBsp ()
 
bool hasBsp () const
 check if a BSP has been computed and is valid 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

template<class MeshT>
class MeshObject< MeshT >

This class provides the functionality for all kind of meshes for the framework

Definition at line 97 of file MeshObjectT.hh.

Constructor & Destructor Documentation

◆ MeshObject() [1/2]

template<class MeshT >
MeshObject< MeshT >::MeshObject ( const MeshObject< MeshT > &  _object)

copy constructor

Create a copy of this object

Definition at line 73 of file MeshObjectT_impl.hh.

◆ MeshObject() [2/2]

template<class MeshT >
MeshObject< MeshT >::MeshObject ( DataType  _typeId)

Constructor.

This is the standard constructor for MeshObjects. As triangle and Poly Meshes are handled by this class, the typeId is passed to the MeshObject to specify it.

Parameters
_typeIdThis is the type Id the Object will use. Should be typeId("TriangleMesh") or typeId("PolyMesh")

Constructor for Mesh Objects. This object class gets a Separator Node giving the root node to which it should be connected. The mesh is generated internally and all nodes for visualization will be added below the scenegraph node.
You dont need to create an object of this type manually. Use PluginFunctions::addTriMesh or PluginFunctions::addPolyMesh instead. The objectDataType has to match the one of MeshT ( see Types.hh::DataType )

Definition at line 102 of file MeshObjectT_impl.hh.

◆ ~MeshObject()

template<class MeshT >
MeshObject< MeshT >::~MeshObject ( )
virtual

destructor

Destructor for Mesh Objects. The destructor deletes the mesh and all Scenegraph nodes associated with the mesh or the object.

Definition at line 123 of file MeshObjectT_impl.hh.

Member Function Documentation

◆ areaVisible()

template<class MeshT >
bool MeshObject< MeshT >::areaVisible ( StatusBits  _bit)

Return if the selected areas are currently visible.

Note
If the bits contain multiple area bits, than only if all are visible, this function will return true
Parameters
_bitStatus bit to check
Returns
All visible?

Definition at line 621 of file MeshObjectT_impl.hh.

◆ boundingBox()

template<class MeshT >
void MeshObject< MeshT >::boundingBox ( ACG::Vec3d _bbMin,
typename ACG::Vec3d _bbMax 
)

Get the BoundingBox of this object.

Get the Bounding box size of this object

Definition at line 644 of file MeshObjectT_impl.hh.

◆ cleanup()

template<class MeshT >
void MeshObject< MeshT >::cleanup ( void  )
virtual

Reset current object, including all related nodes.

Cleanup Function for Mesh Objects. Deletes the contents of the whole object and calls MeshObject::init afterwards.

Reimplemented from BaseObjectData.

Definition at line 158 of file MeshObjectT_impl.hh.

◆ getObjectinfo()

template<class MeshT >
QString MeshObject< MeshT >::getObjectinfo ( )
virtual

Get all Info for the Object as a string.

Returns a string containing all information about the current object. This also includes the information provided by BaseObjectData::getObjectinfo

Returns
String containing the object information

Reimplemented from BaseObject.

Definition at line 703 of file MeshObjectT_impl.hh.

◆ hasBsp()

template<class MeshT >
bool MeshObject< MeshT >::hasBsp ( ) const

check if a BSP has been computed and is valid

This function checks if a bsp has been computed for this mesh object and if it is still valid (meaning, nothing has been changed on the object after the BSP has been computed

Returns
BSP valid?

Definition at line 817 of file MeshObjectT_impl.hh.

◆ hideArea()

template<class MeshT >
void MeshObject< MeshT >::hideArea ( StatusBits  _bit,
bool  _hide 
)

Hide or show the area Nodes of the object.

Shows or hides the areas on the object

Definition at line 598 of file MeshObjectT_impl.hh.

◆ hideSelection()

template<class MeshT >
void MeshObject< MeshT >::hideSelection ( bool  _hide)

Hide or show the selection Node of the object.

Shows or hides the selections on the object

Definition at line 571 of file MeshObjectT_impl.hh.

◆ init()

template<class MeshT>
void MeshObject< MeshT >::init ( MeshT *  _mesh = 0)
protectedvirtual

Initialise current object, including all related nodes.

This function initalizes the mesh object. It creates the scenegraph nodes, the mesh and requests all required properties for the mesh.

Definition at line 190 of file MeshObjectT_impl.hh.

◆ invalidateTriangleBsp()

template<class MeshT >
void MeshObject< MeshT >::invalidateTriangleBsp ( )

If something in the mesh changes, call this function to clear the octree. You have to do a new request as the old one will be deleted.

Todo:

: Update the tree when the update function of this object is called.

: dont recreate but update the old one.

Returns
The new pointer to the bsp or Null if unsupported

Definition at line 806 of file MeshObjectT_impl.hh.

◆ loadMesh()

template<class MeshT >
bool MeshObject< MeshT >::loadMesh ( QString  _filename)

Load a mesh from the given file.

Load the mesh data from a file. The loader uses the OpenMesh object loaders and therefore supports all mesh types supported by OpenMesh.

Parameters
_filenameFull path of the file to load.

Definition at line 664 of file MeshObjectT_impl.hh.

◆ mesh() [1/2]

template<class MeshT >
MeshT * MeshObject< MeshT >::mesh ( )

return a pointer to the mesh

Get a pointer to the object's mesh.

Returns
Pointer to the mesh

Definition at line 350 of file MeshObjectT_impl.hh.

◆ mesh() [2/2]

template<class MeshT >
const MeshT * MeshObject< MeshT >::mesh ( ) const

return a const pointer to the mesh

Get a const pointer to the object's mesh.

Returns
Const pointer to the mesh

Definition at line 358 of file MeshObjectT_impl.hh.

◆ meshNode()

template<class MeshT >
ACG::SceneGraph::MeshNodeT< MeshT > * MeshObject< MeshT >::meshNode ( )

Get the Scenegraph Mesh Node.

Returns a pointer to the mesh node

Returns
Pointer to the mesh node

Definition at line 637 of file MeshObjectT_impl.hh.

◆ picked()

template<class MeshT >
bool MeshObject< MeshT >::picked ( uint  _node_idx)
virtual

detect if the node has been picked

Given an node index from PluginFunctions::scenegraphPick this function can be used to check if the meshNode of the object has been picked.

Parameters
_node_idxIndex of the picked mesh node
Returns
bool if the meshNode of this object is the picking target.

Reimplemented from BaseObjectData.

Definition at line 734 of file MeshObjectT_impl.hh.

◆ requestTriangleBsp()

template<class MeshT >
MeshObject< MeshT >::OMTriangleBSP * MeshObject< MeshT >::requestTriangleBsp ( )

Get a bsp for this object. Only supported for Triangle Meshes at the moment.

Returns
Pointer to bsp or Null if unsupported for this type.

Definition at line 763 of file MeshObjectT_impl.hh.

◆ resetTriangleBsp()

template<class MeshT >
MeshObject< MeshT >::OMTriangleBSP * MeshObject< MeshT >::resetTriangleBsp ( )

Update the bsp for this object. Only supported for Triangle Meshes at the moment.

Returns
Pointer to bsp or Null if unsupported for this type.

Definition at line 794 of file MeshObjectT_impl.hh.

◆ setName()

template<class MeshT >
void MeshObject< MeshT >::setName ( QString  _name)
virtual

Set the name of the Object.

Set the name of an object. All Scenegraph nodes are renamed too. It also calls BaseObjectData::setName.

Reimplemented from BaseObjectData.

Definition at line 310 of file MeshObjectT_impl.hh.

◆ shaderNode()

template<class MeshT >
ACG::SceneGraph::ShaderNode * MeshObject< MeshT >::shaderNode ( )
virtual

Return pointer to the shader node.

Returns a pointer to the shader node

Returns
Pointer to the shader node

Reimplemented from BaseObjectData.

Definition at line 564 of file MeshObjectT_impl.hh.

◆ statusNode()

template<class MeshT>
ACG::SceneGraph::SelectionNodeT<MeshT>* MeshObject< MeshT >::statusNode ( )
inline

Returns the status node (visualizing the selection) if available, nullptr otherwise.

Definition at line 266 of file MeshObjectT.hh.

◆ textureNode()

template<class MeshT >
ACG::SceneGraph::EnvMapNode * MeshObject< MeshT >::textureNode ( )

Get the TextureNode of the current mesh.

Returns a pointer to the texture node

Returns
Pointer to the texture node

Definition at line 556 of file MeshObjectT_impl.hh.

◆ update()

template<class MeshT >
void MeshObject< MeshT >::update ( UpdateType  _type = UPDATE_ALL)
protectedvirtual

Update the whole Object (Selection,Topology,...)

Updates the visualization of the object. Calls MeshObject::updateGeometry, MeshObject::updateTopology, MeshObject::updateSelection and MeshObject::updateModelingRegions.

Reimplemented from BaseObjectData.

Definition at line 367 of file MeshObjectT_impl.hh.

◆ updateColor()

template<class MeshT >
void MeshObject< MeshT >::updateColor ( )
protected

Update Colors of all data structures.

Updates the color information in the mesh scenegraph node

Definition at line 434 of file MeshObjectT_impl.hh.

◆ updateFeatures()

template<class MeshT >
void MeshObject< MeshT >::updateFeatures ( )
protected

Update Feature Visualization Node.

Updates the modeling regions scenegraph nodes

Definition at line 463 of file MeshObjectT_impl.hh.

◆ updateGeometry()

template<class MeshT >
void MeshObject< MeshT >::updateGeometry ( )
protected

Update Geometry of all data structures.

Updates the geometry information in the mesh scenegraph node

Definition at line 414 of file MeshObjectT_impl.hh.

◆ updateModelingRegions()

template<class MeshT >
void MeshObject< MeshT >::updateModelingRegions ( )
protected

Call this function to update the modeling regions.

Updates the modeling regions scenegraph nodes

Definition at line 454 of file MeshObjectT_impl.hh.

◆ updateSelection()

template<class MeshT >
void MeshObject< MeshT >::updateSelection ( )
protected

Call this function to update the modeling regions.

Updates the selection scenegraph nodes

Definition at line 405 of file MeshObjectT_impl.hh.

◆ updateTexture()

template<class MeshT >
void MeshObject< MeshT >::updateTexture ( )
protected

Update Texture of all data structures.

Updates the modeling regions scenegraph nodes

Definition at line 470 of file MeshObjectT_impl.hh.

◆ updateTopology()

template<class MeshT >
void MeshObject< MeshT >::updateTopology ( )
protected

Update Topology of all data structures.

Updates the topology information in the mesh scenegraph node

Definition at line 441 of file MeshObjectT_impl.hh.


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