43 repaintBoundingBoxes =
false;
45 selectionWasClicked =
false;
47 selectionHitPoint.assign(0,0,0);
77 #define ML_WEM_REFCOUNTED 1
201 inline unsigned int getNumWEMPatches()
const {
return static_cast<unsigned int>(_wemPatchList.size()); }
239 inline int getId()
const {
return _uniqueId; }
241 inline std::string
getName()
const {
return _name; }
243 inline void setName(std::string name) { _name = name; }
286 void _setIdAndName();
289 static int _getUniqueId();
292 void _closeFileHandles(
void* hMap,
HANDLE hFile,
HANDLE dFile);
294 void _closeFileHandles(
void* hMap,
int dFile,
MLuint64 filesize);
304 std::vector<WEMPatch*>_wemPatchList;
312 unsigned int _currentLastWEMPatchId;
315 std::vector<WEMNotificationCBData>_notificationObservers;
318 bool _enableRepaintObserver;
320 bool _enableFinishedObserver;
322 bool _enableInteractionObserver;
324 bool _enableSelectionObserver;
328 static int _currentLastId;
331 static std::vector<WEM*> _registeredWEMs;
334 static void registerWEM(
WEM* wem);
336 static void deregisterWEM(
WEM* wem);
Field to encapsulate an increasing float value from range [0,1].
This class represents an axis aligned bounding box for a WEMPatch.
Base class for triangle and quad patches.
This represents a WEMPatch consisting of polygons only.
This represents a WEMPatch consisting of quads only.
This class represents WEMPatch requirements to be used by WEMProcessor.
This represents a WEMPatch consisting of triangles only.
A WEM comprises a number of WEMPatches.
unsigned int getNumWEMPatches() const
Returns the number of WEMs in the list.
void enableRepaintObserver()
Enables the repaint observer mechanism.
bool removeAll()
Removes all WEMPatches from the list.
void enableFinishedObserver()
Enables the finished observer mechanism.
unsigned int getWEMPatchIndex(WEMPatch *wemPatch) const
Returns the index of the given WEMPatch in its list.
void setName(std::string name)
Sets name of the WEM to the given string.
bool isRepaintNotificationEnabled() const
Returns whether the repaint notification is enabled.
void flatten(WEMTrianglePatch *triPatch, WEMRequirements *requirements, TriangulationModes triangulationMode)
Flatten: joins and converts all patches to triangle patches with same normal orientation.
WEM * deepCopy() const override
Returns a deep copy of this WEM.
bool isValid() const
Returns whether this WEM is valid.
const WEMPatch * getWEMPatchAt(unsigned int index) const
Returns a pointer to the WEMPatch at the given position in the internal list.
bool isSelectionNotificationEnabled() const
Returns whether the selection notification is enabled.
bool removeWEMPatch(WEMPatch *wemPatch)
Removes a given WEMPatch from the list.
void enableSelectionObserver()
Enables the selection observer mechanism.
WEMPolygonPatch * addWEMPatchCopy(WEMPolygonPatch *wemPatch, bool assignNewId=false)
Adds a copy of the given WEMPatch (WEMPolygonPatch) to the list. Assigns optionally a new id to the p...
void enableInteractionObserver()
Enables the interaction observer mechanism.
~WEM() override
The WEM destructor is protected since the WEM ownership is managed by the WEMPtr intrusive smart poin...
WEMQuadPatch * addWEMPatchCopy(WEMQuadPatch *wemPatch, bool assignNewId=false)
Adds a copy of the given WEMPatch (WEMQuadPatch) to the list. Assigns optionally a new id to the patc...
WEM()
Standard constructor.
WEMBoundingBox * getBoundingBox()
Returns the bounding box of all patches.
void addNotificationObserver(wemNotificationCB *callback, void *userData)
Adds a notification observer to this WEM.
bool loadWEMSurface(const std::string &filename, bool generateEdges=true, ProgressField *progressFld=nullptr)
Loads the geometry from a file given by its file name.
static void removeNotificationObserverFromAllWEMs(wemNotificationCB *callback, void *userData)
Removes a certain notification observer from all WEM.
bool removeWEMPatch(unsigned int id)
Removes a WEMPatch by its id .
int getId() const
Returns the id of the WEM.
void addWEMPatch(WEMPatch *wemPatch, bool mergeAllPatches=false)
Adds the given WEMPatch as a pointer to the list.
void disableRepaintObserver()
Disables the repaint observer mechanism.
WEMTrianglePatch * addWEMPatchCopy(WEMTrianglePatch *wemPatch, bool assignNewId=false)
Adds a copy of the given WEMPatch (WEMTrianglePatch) to the list. Assigns optionally a new id to the ...
void notifyObservers(std::vector< WEMEventContainer > ecList)
Notifies all observers with the events stored in the event container list.
WEMPatch * getWEMPatchAt(unsigned int index)
Returns a pointer to the WEMPatch at the given position in the internal list.
void removeNotificationObserver(wemNotificationCB *callback, void *userData)
Removes a notification observer from this WEM.
bool isFinishedNotificationEnabled() const
Returns whether the finished notification is enabled.
void disableSelectionObserver()
Disables the selection observer mechanism.
bool hasWEMPatch(WEMPatch *wemPatch) const
Returns whether there is the given WEMPatch in the list.
std::vector< std::string > getRegisteredPrimitiveValueLists() const
Returns unique list of registered primitive value lists for all patches as a vector.
void computeBoundingBox()
(Re)Computes the bounding boxes of all patches.
void mergeAllPatchesIntoSinglePatch()
Merges all internal WEMPatches into a single WEMPatch.
void notifyObservers(const ml::WEMNotificationType ¬ificationType)
Notifies all observers with the given event.
WEMPatch * getWEMPatchById(unsigned int id)
Returns a pointer to the WEMPatch with the given unique id.
bool hasPrimitiveValueListForAllPatches(std::string description) const
Returns whether all patches have a PVL with the given description.
unsigned int getWEMPatchIndex(unsigned int id) const
Returns the index of the WEMPatch with the given id in its list.
bool isInteractionInitNotificationEnabled() const
Returns whether the interaction init notification is enabled.
void removeAllNoDelete()
Clear internal vector (DOES NOT DELETE WEMPatches!!!)
std::string getName() const
Returns name of the WEM.
void saveWEMSurface(std::ostream &outstream, const WEMPersistenceParameters &persistenceParameters, ProgressField *progressFld=nullptr)
Saves the geometry to a given stream.
void setCurrentWEMPatchId(unsigned int id)
Sets the current last id for WEMPatches. Do not mess with it.
void disableInteractionObserver()
Disables the interaction observer mechanism.
unsigned int getCurrentWEMPatchId()
Returns the current last id (incremented each call) for WEMPatches.
WEM(const WEM &wem)
Copy constructor.
const WEMPatch * getWEMPatchById(unsigned int id) const
Returns a pointer to the WEMPatch with the given unique id.
void saveWEMSurface(const std::string &filename, const WEMPersistenceParameters &persistenceParameters, ProgressField *progressFld=nullptr)
Saves the geometry to the given file name.
void disableFinishedObserver()
Disables the finished observer mechanism.
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.
void clone(const WEM &wem)
Clones the internal WEMs of the given WEM to this one.
#define ML_REFCOUNTED_PTR(CLASSNAME)
Macro that defines convenience Ptr/ConstPtr typedefs to be used instead of intrusive_ptr templates.
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non-existing export symbol.
UINT64 MLuint64
Introduce platform-independent 64-bit unsigned integer type.
const int WEM_PATCH_ID_ALL
Patch Id meaning: all patches.
TriangulationModes
Enumeration of the triangulation modes. Note that these are 'mirrored' in the SoWEM part.
void wemNotificationCB(void *data, std::vector< WEMEventContainer > ecList)
Defines the function signature for the callback methods that is to be touched by a WEM notification.
WEMNotificationType
Defines the available WEM notifications.
@ WEM_NOTIFICATION_NONE
Notification flag: no notification at all (for initializing).
This struct holds all necessary data for the different notifications.
int notificationType
The type of the event (None, Repaint, Selection, Finished or InteractionInit). Default: None.
bool repaintFaces
Flag: repaint the faces.
bool repaintEdges
Flag: repaint the edges.
bool selectionWasClicked
Flag: was the WEM part selected by clicking?
Vector3 selectionHitPoint
The hit point.
int patchId
The id of the WEM part for which the event is to be evaluated. Default: -1 for all parts.
bool repaintBoundingBoxes
Flag: repaint the bounding boxes.
bool repaintNodes
Flag: repaint the nodes.
int selectionFaceHit
The entryNum of the hit face.
Structure to gather persistence parameters.
This struct combines a function pointer, a user data pointer and a flag for the notification observer...
wemNotificationCB * notificationCB
The callback function that is triggered by the notification.
void * notificationCBData
The callback data that is a pointer to the observer object.
std::vector< WEMEventContainer > ecList
Each eventContainer contains all information on the type and content of the notification.