MeVisLab Scripting Reference
MLWEMWrapper Class Reference

Inherits MLRefCountedBaseWrapper.

Public Types

enum  NotificationType {
  WEM_NOTIFICATION_NONE = ml::WEM_NOTIFICATION_NONE , WEM_NOTIFICATION_SELECTION = ml::WEM_NOTIFICATION_SELECTION , WEM_NOTIFICATION_FINISHED = ml::WEM_NOTIFICATION_FINISHED , WEM_NOTIFICATION_REPAINT = ml::WEM_NOTIFICATION_REPAINT ,
  WEM_NOTIFICATION_INTERACTION_INIT = ml::WEM_NOTIFICATION_INTERACTION_INIT
}
 

Public Slots

MLWEMNearestPointWrappercreateNearestPointOnSurfaceObject ()
 
MLWEMPatchWrapperaddTrianglePatchFromNumPyArray (PyObject *nodePositions, PyObject *triangleIndices)
 
MLWEMPatchWrapperaddQuadPatchFromNumPyArray (PyObject *nodePositions, PyObject *quadIndices)
 
MLWEMPatchWrapperaddPatchCopy (MLWEMPatchWrapper *patch)
 
void notifyObservers (int type=(WEM_NOTIFICATION_FINISHED|WEM_NOTIFICATION_SELECTION|WEM_NOTIFICATION_REPAINT)) const
 
QList< MLWEMPatchWrapper * > getWEMPatches () const
 
MLWEMPatchWrappergetWEMPatchAt (int index) const
 
MLWEMPatchWrappergetWEMPatchById (int id) const
 
unsigned int getWEMPatchIndex (MLWEMPatchWrapper *wemPatch) const
 
unsigned int getWEMPatchIndex (int id) const
 
bool hasWEMPatch (MLWEMPatchWrapper *wemPatch) const
 
void removeWEMPatchAt (int index)
 
void removeWEMPatchById (int index)
 
void removeAll ()
 
void mergeAllPatchesIntoSinglePatch ()
 
bool isValid () const
 
int getNumWEMPatches () const
 
int getId () const
 
QString getName () const
 
void setName (QString name)
 
bool loadWEMSurface (QString filename, bool generateEdges=true)
 
void saveWEMSurface (QString filename)
 
void registerForNotification (unsigned int flags, MLABModule *module, QString methodName)
 
void deregisterForNotification (unsigned int flags, MLABModule *module, QString methodName)
 

Static Public Member Functions

static ml::RefCountedBase * createObject (const QVariantList &arguments)
 

Detailed Description

A class that wraps WEM objects for use in scripting.

If you need fast ray intersection with the WEM, have a look at the MLWEMBoundingVolumeHierarchyWrapper.

Member Enumeration Documentation

◆ NotificationType

Enumeration of notification types.

Enumerator
WEM_NOTIFICATION_NONE 

no notification at all (for initializing).

WEM_NOTIFICATION_SELECTION 

a part has been selected.

WEM_NOTIFICATION_FINISHED 

an interaction on a part has been finished.

WEM_NOTIFICATION_REPAINT 

a part needs a repainting.

WEM_NOTIFICATION_INTERACTION_INIT 

an interaction module needs initialization.

Member Function Documentation

◆ addPatchCopy

MLWEMPatchWrapper* MLWEMWrapper::addPatchCopy ( MLWEMPatchWrapper patch)
slot

Add a copy of the given patch to this WEM.

◆ addQuadPatchFromNumPyArray

MLWEMPatchWrapper* MLWEMWrapper::addQuadPatchFromNumPyArray ( PyObject *  nodePositions,
PyObject *  quadIndices 
)
slot

Adds a new quad patch.

Call notifyObservers() to let others know about this. The nodePositions should be a numpy array of 3D vectors. The quad indices should be a 2D numpy array with 4 indices per quad. The indices refer to the node positions. The node normals and bounding box are automatically calculated.

◆ addTrianglePatchFromNumPyArray

MLWEMPatchWrapper* MLWEMWrapper::addTrianglePatchFromNumPyArray ( PyObject *  nodePositions,
PyObject *  triangleIndices 
)
slot

Adds a new triangle patch.

Call notifyObservers() to let others know about this. The nodePositions should be a numpy array of 3D vectors. The triangle indices should be a 2D numpy array with 3 indices per triangle. The indices refer to the node positions. The node normals and bounding box are automatically calculated.

◆ createNearestPointOnSurfaceObject

MLWEMNearestPointWrapper* MLWEMWrapper::createNearestPointOnSurfaceObject ( )
slot

Returns a object which allows to get the nearest point on the WEM efficiently (or None, if the patches of this WEM are not triangle patches).

Note
The user is responsible for discarding this object if the WEM has changed, crashes are possible if the object is still used otherwise.

◆ createObject()

static ml::RefCountedBase* MLWEMWrapper::createObject ( const QVariantList &  arguments)
static

Create new WEM object; this is used by MLAB.createMLBaseObject to create a WEM.

If the arguments are empty, a new WEM will be created. If the arguments are a single WEM wrapper, a new copy of the WEM will be returned.

◆ deregisterForNotification

void MLWEMWrapper::deregisterForNotification ( unsigned int  flags,
MLABModule module,
QString  methodName 
)
slot

Remove notification callback: deregister the method determined by methodName of the given module for the WEM notifications defined by flags.

◆ getId

int MLWEMWrapper::getId ( ) const
slot

Get the id of the WEM.

◆ getName

QString MLWEMWrapper::getName ( ) const
slot

Get name of the WEM.

◆ getNumWEMPatches

int MLWEMWrapper::getNumWEMPatches ( ) const
slot

Returns the number of WEMs in the list.

◆ getWEMPatchAt

MLWEMPatchWrapper* MLWEMWrapper::getWEMPatchAt ( int  index) const
slot

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

◆ getWEMPatchById

MLWEMPatchWrapper* MLWEMWrapper::getWEMPatchById ( int  id) const
slot

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

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

◆ getWEMPatches

QList< MLWEMPatchWrapper* > MLWEMWrapper::getWEMPatches ( ) const
slot

Returns a list with all WEMPatches.

◆ getWEMPatchIndex [1/2]

unsigned int MLWEMWrapper::getWEMPatchIndex ( int  id) const
slot

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

◆ getWEMPatchIndex [2/2]

unsigned int MLWEMWrapper::getWEMPatchIndex ( MLWEMPatchWrapper wemPatch) const
slot

Returns the index of the given WEMPatch in its list.

◆ hasWEMPatch

bool MLWEMWrapper::hasWEMPatch ( MLWEMPatchWrapper wemPatch) const
slot

Returns whether there is the given WEMPatch in the list.

◆ isValid

bool MLWEMWrapper::isValid ( ) const
slot

Returns whether the WEM is valid.

The WEM is valid if at least one member WEMPatch is non-NULL and contains a non-zero amount of faces and nodes.

◆ loadWEMSurface

bool MLWEMWrapper::loadWEMSurface ( QString  filename,
bool  generateEdges = true 
)
slot

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

◆ mergeAllPatchesIntoSinglePatch

void MLWEMWrapper::mergeAllPatchesIntoSinglePatch ( )
slot

Flattens all WEMPatches to one triangle WEMPatch.

◆ notifyObservers

void MLWEMWrapper::notifyObservers ( int  type = (WEM_NOTIFICATION_FINISHED|WEM_NOTIFICATION_SELECTION|WEM_NOTIFICATION_REPAINT)) const
slot

Notify the observers of a WEM that it has changed.

The type is an OR combination of the NotificationType. Call this after modifying patches.

◆ registerForNotification

void MLWEMWrapper::registerForNotification ( unsigned int  flags,
MLABModule module,
QString  methodName 
)
slot

Add notification callback: register the method determined by methodName of the given module for the WEM notifications defined by flags.

In Python scripting, the registered method name is called with a list of arguments that is filled with the following infos in that order:

  • patchId
  • repaintNodes
  • repaintEdges
  • repaintFaces
  • repaintBoundingBoxes
  • selectionFaceHit
  • selectionWasClicked
  • selectionHitPoint

◆ removeAll

void MLWEMWrapper::removeAll ( )
slot

Removes all patches. Call notifyObservers() to notify observers!

◆ removeWEMPatchAt

void MLWEMWrapper::removeWEMPatchAt ( int  index)
slot

Removes the WEMPatch at given index.

Beware that a previously returned wrapper for the patch will be invalid. Call notifyObservers() to notify observers!

◆ removeWEMPatchById

void MLWEMWrapper::removeWEMPatchById ( int  index)
slot

Removes the WEMPatch with the given id.

Beware that a previously returned wrapper for the patch will be invalid. Call notifyObservers() to notify observers!

◆ saveWEMSurface

void MLWEMWrapper::saveWEMSurface ( QString  filename)
slot

Saves the geometry to the given file name.

◆ setName

void MLWEMWrapper::setName ( QString  name)
slot

Set name of the WEM to the given string.