MeVisLab Toolbox Reference
ml::WEM Class Reference

A WEM comprises a number of WEMPatches. More...

#include <WEM.h>

Inheritance diagram for ml::WEM:
ml::RefCountedBase ml::EventSource ml::Base

Classes

struct  WEMNotificationCBData
 This struct combines a function pointer, a user data pointer and a flag for the notification observer mechanism. More...
 

Public Member Functions

 WEM ()
 Standard constructor. More...
 
 WEM (const WEM &wem)
 Copy constructor. More...
 
void clone (const WEM &wem)
 Clones the internal WEMs of the given WEM to this one. More...
 
WEMdeepCopy () const override
 Returns a deep copy of this WEM. More...
 
bool isValid () const
 Returns whether this WEM is valid. More...
 
void addNotificationObserver (wemNotificationCB *callback, void *userData)
 Adds a notification observer to this WEM. More...
 
void removeNotificationObserver (wemNotificationCB *callback, void *userData)
 Removes a notification observer from this WEM. More...
 
void notifyObservers (std::vector< WEMEventContainer > ecList)
 Notifies all observers with the events stored in the event container list. More...
 
void notifyObservers (const ml::WEMNotificationType &notificationType)
 Notifies all observers with the given event. More...
 
unsigned int getCurrentWEMPatchId ()
 Returns the current last id (incremented each call) for WEMPatches. More...
 
void setCurrentWEMPatchId (unsigned int id)
 Sets the current last id for WEMPatches. Do not mess with it. More...
 
void addWEMPatch (WEMPatch *wemPatch, bool mergeAllPatches=false)
 Adds the given WEMPatch as a pointer to the list. More...
 
WEMTrianglePatchaddWEMPatchCopy (WEMTrianglePatch *wemPatch, bool assignNewId=false)
 Adds a copy of the given WEMPatch (WEMTrianglePatch) to the list. Assigns optionally a new id to the patch. More...
 
WEMQuadPatchaddWEMPatchCopy (WEMQuadPatch *wemPatch, bool assignNewId=false)
 Adds a copy of the given WEMPatch (WEMQuadPatch) to the list. Assigns optionally a new id to the patch. More...
 
WEMPolygonPatchaddWEMPatchCopy (WEMPolygonPatch *wemPatch, bool assignNewId=false)
 Adds a copy of the given WEMPatch (WEMPolygonPatch) to the list. Assigns optionally a new id to the patch. More...
 
bool removeWEMPatch (WEMPatch *wemPatch)
 Removes a given WEMPatch from the list. More...
 
bool removeWEMPatch (unsigned int id)
 Removes a WEMPatch by its id . More...
 
bool removeAll ()
 Removes all WEMPatches from the list. More...
 
void removeAllNoDelete ()
 Clear internal vector (DOES NOT DELETE WEMPatches!!!) More...
 
WEMPatchgetWEMPatchAt (unsigned int index)
 Returns a pointer to the WEMPatch at the given position in the internal list. More...
 
const WEMPatchgetWEMPatchAt (unsigned int index) const
 Returns a pointer to the WEMPatch at the given position in the internal list. More...
 
WEMPatchgetWEMPatchById (unsigned int id)
 Returns a pointer to the WEMPatch with the given unique id. More...
 
const WEMPatchgetWEMPatchById (unsigned int id) const
 Returns a pointer to the WEMPatch with the given unique id. More...
 
unsigned int getWEMPatchIndex (WEMPatch *wemPatch) const
 Returns the index of the given WEMPatch in its list. More...
 
unsigned int getWEMPatchIndex (unsigned int id) const
 Returns the index of the WEMPatch with the given id in its list. More...
 
bool hasWEMPatch (WEMPatch *wemPatch) const
 Returns whether there is the given WEMPatch in the list. More...
 
unsigned int getNumWEMPatches () const
 Returns the number of WEMs in the list. More...
 
void enableRepaintObserver ()
 Enables the repaint observer mechanism. More...
 
void disableRepaintObserver ()
 Disables the repaint observer mechanism. More...
 
void enableFinishedObserver ()
 Enables the finished observer mechanism. More...
 
void disableFinishedObserver ()
 Disables the finished observer mechanism. More...
 
void enableInteractionObserver ()
 Enables the interaction observer mechanism. More...
 
void disableInteractionObserver ()
 Disables the interaction observer mechanism. More...
 
void enableSelectionObserver ()
 Enables the selection observer mechanism. More...
 
void disableSelectionObserver ()
 Disables the selection observer mechanism. More...
 
bool isRepaintNotificationEnabled () const
 Returns whether the repaint notification is enabled. More...
 
bool isFinishedNotificationEnabled () const
 Returns whether the finished notification is enabled. More...
 
bool isInteractionInitNotificationEnabled () const
 Returns whether the interaction init notification is enabled. More...
 
bool isSelectionNotificationEnabled () const
 Returns whether the selection notification is enabled. More...
 
int getId () const
 Returns the id of the WEM. More...
 
std::string getName () const
 Returns name of the WEM. More...
 
void setName (std::string name)
 Sets name of the WEM to the given string. More...
 
void saveWEMSurface (const std::string &filename, const WEMPersistenceParameters &persistenceParameters, ProgressField *progressFld=nullptr)
 Saves the geometry to the given file name. More...
 
void saveWEMSurface (std::ostream &outstream, const WEMPersistenceParameters &persistenceParameters, ProgressField *progressFld=nullptr)
 Saves the geometry to a given stream. More...
 
bool loadWEMSurface (const std::string &filename, bool generateEdges=true, ProgressField *progressFld=nullptr)
 Loads the geometry from a file given by its file name. More...
 
bool loadWEMSurface (const std::string &filename, MLuint64 filesize, bool generateEdges=true, ProgressField *progressFld=nullptr)
 Loads the geometry from a file given by its file name. More...
 
bool hasPrimitiveValueListForAllPatches (std::string description) const
 Returns whether all patches have a PVL with the given description. More...
 
std::vector< std::string > getRegisteredPrimitiveValueLists () const
 Returns unique list of registered primitive value lists for all patches as a vector. More...
 
void flatten (WEMTrianglePatch *triPatch, WEMRequirements *requirements, TriangulationModes triangulationMode)
 Flatten: joins and converts all patches to triangle patches with same normal orientation. More...
 
void mergeAllPatchesIntoSinglePatch ()
 Merges all internal WEMPatches into a single WEMPatch. More...
 
void computeBoundingBox ()
 (Re)Computes the bounding boxes of all patches. More...
 
WEMBoundingBoxgetBoundingBox ()
 Returns the bounding box of all patches. More...
 
- Public Member Functions inherited from ml::RefCountedBase
 RefCountedBase ()
 Constructor. More...
 
 RefCountedBase (const RefCountedBase &)
 Explicit copy constructor. More...
 
virtual void incRefCount () const
 Increases the reference count. More...
 
virtual void decRefCount () const
 Decreases the reference count (object will be deleted if the reference count is decremented to 0). More...
 
bool isRefCountedBase () const override
 Returns whether the instance is derived from RefCountedBase. More...
 
- Public Member Functions inherited from ml::EventSource
 EventSource ()
 
 EventSource (const EventSource &evSource)
 
 ~EventSource () override
 
void addEventListener (BaseEventCallback *cb, void *userData)
 Adds event listener callback to this Base object. More...
 
void removeEventListener (BaseEventCallback *cb, void *userData)
 Removes event listener callback from this Base object. More...
 
bool hasEventListeners () const
 Checks whether any event listeners have been added to this Base object; this can be used to skip the sendEvent call and the potentially expensive building of the event object altogether. More...
 
- Public Member Functions inherited from ml::Base
 Base ()
 Constructor. More...
 
virtual ~Base ()
 Destructor. More...
 
bool isOfAllowedType (const std::vector< const RuntimeType * > &types) const
 Checks whether this object's type is equal to or derived from one of the types given in the argument. More...
 
virtual std::string detailString () const
 Returns a string describing this object. More...
 
virtual bool implementsPersistence (PersistenceInterface) const
 Override this method to declare which persistence interfaces are implemented by your derived class. More...
 
virtual std::string persistentState () const
 Returns a string describing the object's internal state. More...
 
virtual void setPersistentState (const std::string &state)
 Restores the object's internal state from a string that had been previously generated using persistentState(). More...
 
virtual void addStateToTree (TreeNode *) const
 Attaches the object state as children of the given parent node. More...
 
virtual void readStateFromTree (TreeNode *)
 Reads the object state from the children of the given parent node. More...
 
virtual void writeTo (AbstractPersistenceOutputStream *) const
 Writes the objects state to the data stream object. More...
 
virtual void readFrom (AbstractPersistenceInputStream *, int)
 Reads the objects state from the data stream object. More...
 

Static Public Member Functions

static void removeNotificationObserverFromAllWEMs (wemNotificationCB *callback, void *userData)
 Removes a certain notification observer from all WEM. More...
 
- Static Public Member Functions inherited from ml::RefCountedBase
static void updateReferenceCountingIfSupported (Base *oldValue, Base *newValue, bool &isRefCountedBase)
 Helper method that handles incrementing/decrementing of the reference count if base instances support it. More...
 

Protected Member Functions

 ~WEM () override
 The WEM destructor is protected since the WEM ownership is managed by the WEMPtr intrusive smart pointer. More...
 
- Protected Member Functions inherited from ml::RefCountedBase
 ~RefCountedBase () override
 Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h. More...
 
- Protected Member Functions inherited from ml::EventSource
void sendEvent (BaseEvent *event, void *skipListener=nullptr)
 Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h. More...
 

Additional Inherited Members

- Public Types inherited from ml::Base
enum  PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream }
 This enum describes the different persistence interfaces available. More...
 
- Protected Attributes inherited from ml::RefCountedBase
std::atomic_int_least32_t _refCount
 Reference count. More...
 

Detailed Description

A WEM comprises a number of WEMPatches.

The WEM is derived from Base and can be used as a data structure in a MeVisLab network. The WEM ownership is managed via smart pointers, make sure to use a WEMPtr to manage newly created WEM objects.

Definition at line 88 of file WEM.h.

Constructor & Destructor Documentation

◆ WEM() [1/2]

ml::WEM::WEM ( )

Standard constructor.

◆ WEM() [2/2]

ml::WEM::WEM ( const WEM wem)

Copy constructor.

◆ ~WEM()

ml::WEM::~WEM ( )
overrideprotected

The WEM destructor is protected since the WEM ownership is managed by the WEMPtr intrusive smart pointer.

If you encounter code that tries to delete a WEM object, you will very likely need to change the usage of a WEM* to a WEMPtr and replace the delete call with a NULL assignment.

Member Function Documentation

◆ addNotificationObserver()

void ml::WEM::addNotificationObserver ( wemNotificationCB callback,
void *  userData 
)

Adds a notification observer to this WEM.

◆ addWEMPatch()

void ml::WEM::addWEMPatch ( WEMPatch wemPatch,
bool  mergeAllPatches = false 
)

Adds the given WEMPatch as a pointer to the list.

Be very very careful of deleting this WEMPatch from the list afterwards. If mergeAllPatches is true, all incoming patches are merge to a single patch, otherwise, all incoming patches are just added in parallel.

◆ addWEMPatchCopy() [1/3]

WEMPolygonPatch* ml::WEM::addWEMPatchCopy ( WEMPolygonPatch wemPatch,
bool  assignNewId = false 
)

Adds a copy of the given WEMPatch (WEMPolygonPatch) to the list. Assigns optionally a new id to the patch.

◆ addWEMPatchCopy() [2/3]

WEMQuadPatch* ml::WEM::addWEMPatchCopy ( WEMQuadPatch wemPatch,
bool  assignNewId = false 
)

Adds a copy of the given WEMPatch (WEMQuadPatch) to the list. Assigns optionally a new id to the patch.

◆ addWEMPatchCopy() [3/3]

WEMTrianglePatch* ml::WEM::addWEMPatchCopy ( WEMTrianglePatch wemPatch,
bool  assignNewId = false 
)

Adds a copy of the given WEMPatch (WEMTrianglePatch) to the list. Assigns optionally a new id to the patch.

◆ clone()

void ml::WEM::clone ( const WEM wem)

Clones the internal WEMs of the given WEM to this one.

◆ computeBoundingBox()

void ml::WEM::computeBoundingBox ( )

(Re)Computes the bounding boxes of all patches.

Call this before getBoundingBox to ensure that the returned bounding box reflects the current state.

◆ deepCopy()

WEM* ml::WEM::deepCopy ( ) const
overridevirtual

Returns a deep copy of this WEM.

Reimplemented from ml::Base.

◆ disableFinishedObserver()

void ml::WEM::disableFinishedObserver ( )
inline

Disables the finished observer mechanism.

Definition at line 213 of file WEM.h.

◆ disableInteractionObserver()

void ml::WEM::disableInteractionObserver ( )
inline

Disables the interaction observer mechanism.

Definition at line 218 of file WEM.h.

◆ disableRepaintObserver()

void ml::WEM::disableRepaintObserver ( )
inline

Disables the repaint observer mechanism.

Definition at line 208 of file WEM.h.

◆ disableSelectionObserver()

void ml::WEM::disableSelectionObserver ( )
inline

Disables the selection observer mechanism.

Definition at line 223 of file WEM.h.

◆ enableFinishedObserver()

void ml::WEM::enableFinishedObserver ( )
inline

Enables the finished observer mechanism.

Definition at line 211 of file WEM.h.

◆ enableInteractionObserver()

void ml::WEM::enableInteractionObserver ( )
inline

Enables the interaction observer mechanism.

Definition at line 216 of file WEM.h.

◆ enableRepaintObserver()

void ml::WEM::enableRepaintObserver ( )
inline

Enables the repaint observer mechanism.

Definition at line 206 of file WEM.h.

◆ enableSelectionObserver()

void ml::WEM::enableSelectionObserver ( )
inline

Enables the selection observer mechanism.

Definition at line 221 of file WEM.h.

◆ flatten()

void ml::WEM::flatten ( WEMTrianglePatch triPatch,
WEMRequirements requirements,
TriangulationModes  triangulationMode 
)

Flatten: joins and converts all patches to triangle patches with same normal orientation.

◆ getBoundingBox()

WEMBoundingBox* ml::WEM::getBoundingBox ( )

Returns the bounding box of all patches.

Call computeBoundingBox before obtaining the bounding box to ensure that the bounding box is up-to-date.

◆ getCurrentWEMPatchId()

unsigned int ml::WEM::getCurrentWEMPatchId ( )

Returns the current last id (incremented each call) for WEMPatches.

If there are no WEMPatches in the list, this id is set back to 0. Can not be const, because if changes the object's state.

◆ getId()

int ml::WEM::getId ( void  ) const
inline

Returns the id of the WEM.

Definition at line 239 of file WEM.h.

◆ getName()

std::string ml::WEM::getName ( ) const
inline

Returns name of the WEM.

Definition at line 241 of file WEM.h.

◆ getNumWEMPatches()

unsigned int ml::WEM::getNumWEMPatches ( ) const
inline

Returns the number of WEMs in the list.

Definition at line 201 of file WEM.h.

◆ getRegisteredPrimitiveValueLists()

std::vector<std::string> ml::WEM::getRegisteredPrimitiveValueLists ( ) const

Returns unique list of registered primitive value lists for all patches as a vector.

◆ getWEMPatchAt() [1/2]

WEMPatch* ml::WEM::getWEMPatchAt ( unsigned int  index)

Returns a pointer to the WEMPatch at the given position in the internal list.

◆ getWEMPatchAt() [2/2]

const WEMPatch* ml::WEM::getWEMPatchAt ( unsigned int  index) const
inline

Returns a pointer to the WEMPatch at the given position in the internal list.

Definition at line 184 of file WEM.h.

References getWEMPatchAt().

Referenced by getWEMPatchAt().

◆ getWEMPatchById() [1/2]

WEMPatch* ml::WEM::getWEMPatchById ( unsigned int  id)

Returns a pointer to the WEMPatch with the given unique id.

Returns NULL if no such WEMPatch is stored in the list.

◆ getWEMPatchById() [2/2]

const WEMPatch* ml::WEM::getWEMPatchById ( unsigned int  id) const
inline

Returns a pointer to the WEMPatch with the given unique id.

Returns NULL if no such WEMPatch is stored in the list.

Definition at line 190 of file WEM.h.

References getWEMPatchById().

Referenced by getWEMPatchById().

◆ getWEMPatchIndex() [1/2]

unsigned int ml::WEM::getWEMPatchIndex ( unsigned int  id) const

Returns the index of the WEMPatch with the given id in its list.

◆ getWEMPatchIndex() [2/2]

unsigned int ml::WEM::getWEMPatchIndex ( WEMPatch wemPatch) const

Returns the index of the given WEMPatch in its list.

◆ hasPrimitiveValueListForAllPatches()

bool ml::WEM::hasPrimitiveValueListForAllPatches ( std::string  description) const

Returns whether all patches have a PVL with the given description.

◆ hasWEMPatch()

bool ml::WEM::hasWEMPatch ( WEMPatch wemPatch) const

Returns whether there is the given WEMPatch in the list.

◆ isFinishedNotificationEnabled()

bool ml::WEM::isFinishedNotificationEnabled ( ) const
inline

Returns whether the finished notification is enabled.

Definition at line 230 of file WEM.h.

◆ isInteractionInitNotificationEnabled()

bool ml::WEM::isInteractionInitNotificationEnabled ( ) const
inline

Returns whether the interaction init notification is enabled.

Definition at line 232 of file WEM.h.

◆ isRepaintNotificationEnabled()

bool ml::WEM::isRepaintNotificationEnabled ( ) const
inline

Returns whether the repaint notification is enabled.

Definition at line 228 of file WEM.h.

◆ isSelectionNotificationEnabled()

bool ml::WEM::isSelectionNotificationEnabled ( ) const
inline

Returns whether the selection notification is enabled.

Definition at line 234 of file WEM.h.

◆ isValid()

bool ml::WEM::isValid ( ) const

Returns whether this WEM is valid.

The WEM is valid if at least one WEMPatch has numFaces > 0 and numNodes > 0.

◆ loadWEMSurface() [1/2]

bool ml::WEM::loadWEMSurface ( const std::string &  filename,
bool  generateEdges = true,
ProgressField progressFld = nullptr 
)

Loads the geometry from a file given by its file name.

Returns whether the operation was successful.

◆ loadWEMSurface() [2/2]

bool ml::WEM::loadWEMSurface ( const std::string &  filename,
MLuint64  filesize,
bool  generateEdges = true,
ProgressField progressFld = nullptr 
)

Loads the geometry from a file given by its file name.

Returns whether the operation was successful.

◆ mergeAllPatchesIntoSinglePatch()

void ml::WEM::mergeAllPatchesIntoSinglePatch ( )

Merges all internal WEMPatches into a single WEMPatch.

This method does not use spatial information at all, so no nodes at the same position will be merged.

◆ notifyObservers() [1/2]

void ml::WEM::notifyObservers ( const ml::WEMNotificationType notificationType)

Notifies all observers with the given event.

◆ notifyObservers() [2/2]

void ml::WEM::notifyObservers ( std::vector< WEMEventContainer ecList)

Notifies all observers with the events stored in the event container list.

◆ removeAll()

bool ml::WEM::removeAll ( )

Removes all WEMPatches from the list.

Returns whether there was something to remove.

◆ removeAllNoDelete()

void ml::WEM::removeAllNoDelete ( )

Clear internal vector (DOES NOT DELETE WEMPatches!!!)

◆ removeNotificationObserver()

void ml::WEM::removeNotificationObserver ( wemNotificationCB callback,
void *  userData 
)

Removes a notification observer from this WEM.

◆ removeNotificationObserverFromAllWEMs()

static void ml::WEM::removeNotificationObserverFromAllWEMs ( wemNotificationCB callback,
void *  userData 
)
static

Removes a certain notification observer from all WEM.

◆ removeWEMPatch() [1/2]

bool ml::WEM::removeWEMPatch ( unsigned int  id)

Removes a WEMPatch by its id .

Returns whether there was something to remove.

◆ removeWEMPatch() [2/2]

bool ml::WEM::removeWEMPatch ( WEMPatch wemPatch)

Removes a given WEMPatch from the list.

Returns whether there was something to remove.

◆ saveWEMSurface() [1/2]

void ml::WEM::saveWEMSurface ( const std::string &  filename,
const WEMPersistenceParameters persistenceParameters,
ProgressField progressFld = nullptr 
)

Saves the geometry to the given file name.

◆ saveWEMSurface() [2/2]

void ml::WEM::saveWEMSurface ( std::ostream &  outstream,
const WEMPersistenceParameters persistenceParameters,
ProgressField progressFld = nullptr 
)

Saves the geometry to a given stream.

◆ setCurrentWEMPatchId()

void ml::WEM::setCurrentWEMPatchId ( unsigned int  id)
inline

Sets the current last id for WEMPatches. Do not mess with it.

Definition at line 151 of file WEM.h.

◆ setName()

void ml::WEM::setName ( std::string  name)
inline

Sets name of the WEM to the given string.

Definition at line 243 of file WEM.h.


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