MeVisLab Toolbox Reference
WEMPolygonPatch.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #pragma once
14 
15 #include "WEMPatch.h"
16 #include "WEMPolygon.h"
17 #include "WEMIndexedFace.h"
18 
19 ML_START_NAMESPACE
20 
22 
25 {
26 public:
27 
29  WEMPolygonPatch(unsigned int bs = 8192);
32  WEMPolygonPatch(WEM* wem, unsigned int bs = 8192);
34  WEMPolygonPatch(const WEMPolygonPatch &wemPatch);
35  WEMPolygonPatch(WEMPolygonPatch&& wemPatch) noexcept;
36  WEMPolygonPatch& operator=(WEMPolygonPatch &&wemPatch) noexcept;
38  ~WEMPolygonPatch() override;
40  WEMPatch* copy() override;
42  virtual void dispose();
43 
45  inline PatchTypes getPatchType() const override { return WEM_PATCH_POLYGONS; }
46 
48 
50  inline unsigned int getNumFaces() const override { return _polygons.num(); }
52  inline WEMIndexVector<WEMPolygon>* getFaces() { return &_polygons; }
54  inline const WEMIndexVector<WEMPolygon>* getFaces() const { return const_cast<WEMPolygonPatch*>(this)->getFaces(); }
55 
57 
59  inline WEMFace* getFaceAt(unsigned int index) override { return _polygons.at(index); }
61  inline const WEMFace* getFaceAt(unsigned int index) const override { return const_cast<WEMPolygonPatch*>(this)->getFaceAt(index); }
63  inline WEMPolygon* getPolygonAt(unsigned int index) { return _polygons.at(index); }
65  inline const WEMPolygon* getPolygonAt(unsigned int index) const { return const_cast<WEMPolygonPatch*>(this)->getPolygonAt(index); }
67  WEMFace* addFace() override;
74  void delPolygon(WEMPolygon* polygon);
75 
77 
79  void convertIndexedFace(WEMIndexedFace* indexedFace);
80 
82  void sortFacesByZPosition() override;
83 
84 private:
87 };
88 
90 
91 ML_END_NAMESPACE
#define MLWEM_EXPORT
Definition: MLWEMSystem.h:18
Defines the mesh component: face.
Definition: WEMFace.h:30
Dynamic vector, based on a memory pool. Keeps track on entry numbers of stored primitives.
Defines the mesh component: an face holding a list of up to 100 indices.
Base class for triangle and quad patches.
Definition: WEMPatch.h:48
This represents a WEMPatch consisting of polygons only.
void convertIndexedFace(WEMIndexedFace *indexedFace)
Adds the given indexed face to this patch.
const WEMIndexVector< WEMPolygon > * getFaces() const
Returns the pointer to the internal faces structure.
WEMPolygonPatch(WEM *wem, unsigned int bs=8192)
Constructor which takes a pointer to the WEM this WEMPatch is in.
virtual void dispose()
Disposes of internal data structures.
WEMPolygonPatch(unsigned int bs=8192)
Standard constructor.
WEMPolygon * getPolygonAt(unsigned int index)
Returns the WEMPolygon at the given index.
WEMFace * getFaceAt(unsigned int index) override
Returns the face at the given index.
WEMPolygonPatch(WEMPolygonPatch &&wemPatch) noexcept
const WEMPolygon * getPolygonAt(unsigned int index) const
Returns the WEMPolygon at the given index.
PatchTypes getPatchType() const override
Returns the mesh type of this patch.
WEMPolygon * addPolygon()
Instantiates a new WEMPolygon and adds it to the internal faces vector.
WEMIndexVector< WEMPolygon > * getFaces()
Returns the pointer to internal faces structure.
void sortFacesByZPosition() override
Sorts the faces by the z-position of their centroids.
~WEMPolygonPatch() override
Standard destructor.
WEMPolygonPatch(const WEMPolygonPatch &wemPatch)
Copy constructor.
WEMPolygonPatch & operator=(WEMPolygonPatch &&wemPatch) noexcept
const WEMFace * getFaceAt(unsigned int index) const override
Returns the face at the given index.
unsigned int getNumFaces() const override
Returns the number of faces in the patch.
WEMPatch * copy() override
Create a (deep) copy of the patch.
void delPolygon(WEMPolygon *polygon)
Deletes a polygon and erases it from the internal faces vector.
WEMFace * addFace() override
Instantiates a new WEMPolygon and adds it to the internal faces vector. Returns a pointer to this new...
WEMPolygon * addPolygonNoUpdatePrimitiveValueLists()
Creates and returns a new polygon without adding an entry to the face PLVs.
Defines the mesh component: polygon.
Definition: WEMPolygon.h:22
A WEM comprises a number of WEMPatches.
Definition: WEM.h:88
PatchTypes
Enumeration of mesh types.
@ WEM_PATCH_POLYGONS
Patch type: the faces can be n-polygons with up to WEM_MAX_NUM_NODES.