31class WEMPatchPersistence;
380 void _storePrimitiveValueListValue(
unsigned int i,
unsigned int index,
double value);
383 bool _irregularSurfaceDetected{};
Wraps a FileMap so we can handle errors and exceptions more easily.
This class represents an axis aligned bounding box for a WEMPatch.
Defines the mesh component: edge.
Defines the mesh component: face.
Dynamic vector, based on a memory pool. Keeps track on entry numbers of stored primitives.
Defines the mesh component: node.
Base class for triangle and quad patches.
bool removePrimitiveValueList(const std::string &name)
Removes the PVL with the given name. Returns whether the operation was successful.
friend class WEMPatchPersistence
void delEdge(WEMEdge *edge)
Deletes an edge and erases it from the internal edges vector.
WEMIndexVector< WEMNode > * getNodes()
Returns the pointer to the internal nodes structure.
void removeAllEdges()
Removes all edges.
void deleteOrphanNodes()
Deletes orphan nodes (number of edges == number of faces == 0).
unsigned int loadFrom(FileMapWrapper &mapper, const WEMPersistenceParameters &persistenceParameters, const WEMReadParameters ¶meters, WEMProgressUpdater &progressUpdater)
Loads this patch from given memory map.
int getCreatorId() const
Returns the creator ID of the WEMPatch.
const WEMBoundingBox * getBoundingBox() const
Returns the bounding box.
WEMNode * getNodeAt(unsigned int index)
Returns the node at the given index.
WEMIndexVector< WEMEdge > * getEdges()
Returns the pointer to the internal edges structure.
const WEMPrimitiveValueList * getPrimitiveValueList(const std::string &name) const
void translate(const Vector3 &offset)
Translates all nodes by the given offset.
virtual void _delFaceUpdatePrimitiveValueLists(WEMFace *face)
Updates primitive value lists on delFace.
WEMBoundingBox * getBoundingBox()
Returns the bounding box.
virtual WEMFace * addFace()=0
virtual void buildEdgeConnectivity()
virtual WEMFace * getFaceAt(unsigned int index)=0
Returns the face at the given index.
double getArea() const
Returns the area of this patch in square mm.
int _creatorId
ID of the creator of this WEMPatch.
void setEdgeTraversalState(bool state)
Sets the specified traversal state to all edges.
void setId(unsigned int newId)
Sets the unique ID of this WEMPatch. Beware: do not set this ID unless you really know what you do!
WEMPatch(const WEMPatch &wemPatch)
Copy constructor.
void setNodeTraversalState(bool state)
Sets the specified traversal state to all nodes.
virtual WEMPatch * copy()=0
Create a (deep) copy of the patch.
WEMIndexVector< WEMEdge > _edges
The vector that holds all the edges of the wem.
void computeNormals()
Computes all normals.
WEMPatch(unsigned int bs=8192)
Standard constructor.
double getVolume() const
Returns the volume of this patch in cubic mm.
unsigned int getBlocksize() const
Returns the block size for the patch.
unsigned int getNumNodes() const
Returns the number of nodes in the patch.
WEMPrimitiveValueList * getPrimitiveValueList(const std::string &name)
WEMEdge * getEdgeAt(unsigned int index)
Returns the edge at the given index.
WEM * _wem
A pointer to the WEM this WEMPart is in.
bool isSingleColored(WEMFace *face)
Returns whether the given face is single colored.
std::vector< std::string > getRegisteredPrimitiveValueLists() const
const WEM * getWEM() const
Returns the internal pointer to the embracing WEM.
virtual const WEMFace * getFaceAt(unsigned int index) const =0
Returns the face at the given index.
unsigned int getNumSingleColoredFaces()
Return the number of single-colored faces.
bool isTrianglePatch() const
Helper method to check if the patch is a triangle patch.
bool isSingleColored(WEMNode *node)
Returns whether an adjacent face to the given node is single colored.
void averageNodeValues(WEMNode *target, WEMNode *source1, WEMNode *source2)
Averages the given source node values and stores values in the given target node.
void buildLocalEdgeConnectivity(WEMFace *face)
virtual unsigned int getNumFaces() const
Returns the number of faces in the patch.
bool isQuadPatch() const
Helper method to check if the patch is a quad patch.
virtual ~WEMPatch()
Standard destructor.
void setFaceTraversalState(bool state)
Sets the specified traversal state to all faces.
void addPatch(WEMPatch *wemPatch)
Adds the primitives of the given patch to this patch.
unsigned int _uniqueId
Unique ID of this WEM.
unsigned int _blocksize
Initial blocksize for the WEMVector, WEMObjectVector variables used.
void centerByBoundingBox()
Centers the patch by its bounding box.
void addNodeValues(WEMNode *target, WEMNode *source, double modifier)
WEM * getWEM()
Returns the internal pointer to the embracing WEM.
const std::vector< WEMPrimitiveValueList * > & getPrimitiveValueLists() const
Returns an array of the primitive value lists.
void extendNodeValueLists(unsigned int number, double value)
Extends all node value lists with the given value.
bool hasSingleColoredPVL()
Returns whether the patch has a PVL set for single colored faces.
virtual void sortFacesByZPosition()=0
Sorts the faces by the z-position of their centroids.
void addEdgeValues(WEMEdge *target, WEMEdge *source, double modifier)
void setWEM(WEM *wem)
Sets the internal pointer to the embracing WEM.
void mirror()
Mirrors the faces in this patch.
WEMAttributes _attributes
The attributes of this WEMPatch.
bool hasAllFacesSingleColored()
Returns whether all faces are single colored.
void triangulate(WEMTrianglePatch *wemPatch, TriangulationModes triangulationMode)
Triangulates the patch and adds triangles to the given triangle patch.
WEMPatch(WEM *wem, unsigned int bs=8192)
void addFaceValues(WEMFace *target, WEMFace *source, double modifier)
const WEMIndexVector< WEMEdge > * getEdges() const
Returns the pointer to the internal edges structure.
void extendEdgeValueLists(unsigned int number, double value)
Extends all edge value lists with given value.
WEMPatch * makeCompatible(WEMRequirements *requirements, TriangulationModes triangulationMode)
Makes WEMPatch compatible with the given requirements.
std::string _type
Type of this WEMPatch.
void applyMatrix(const Matrix4 &transformationMatrix)
void extendFaceValueLists(unsigned int number, double value)
Extends all face value lists with the given value.
void setCreatorId(int id)
Sets the creator ID of the WEMPatch.
WEMNode * addNodeNoUpdatePrimitiveValueLists()
Creates and returns a new node without changing the nodes PVL.
void flipNormals()
Flip all normals.
WEMPatch(WEMPatch &&other) noexcept
Move c'tor.
bool irregularSurfaceDetected() const
Returns whether an irregular face reference was detected during last buildEdgeConnectivity.
void saveTo(OutStreamWrapper &ostreamWrapper, const WEMPersistenceParameters &writeParameters, WEMProgressUpdater &progressUpdater)
Saves this patch to given output stream.
std::string getType() const
Returns the type of the WEMPatch.
bool hasEdges() const
Returns whether this patch has any edges.
bool isSingleColored(WEMEdge *edge)
Returns whether an adjacent face to the given edge is single colored.
WEMPrimitiveValueList * createOrGetPrimitiveValueList(const std::string &name)
WEMPatch & operator=(WEMPatch &&other) noexcept
Move assignment operator.
virtual void _addFaceUpdatePrimitiveValueLists()
Updates primitive value lists on addFace.
WEMBoundingBox _boundingBox
The bounding box of this WEMPatch.
const WEMNode * getNodeAt(unsigned int index) const
Returns the node at the given index.
unsigned int getNumEdges() const
Returns the number of edges in the patch.
void setLabel(std::string label)
Sets the 'label' attribute of this WEMPatch.
const WEMEdge * getEdgeAt(unsigned int index) const
Returns the edge at the given index.
void dispose()
Disposes of internal data structures.
void setDescription(std::string desc)
Sets the 'description' attribute of this WEMPatch.
void delNode(WEMNode *node)
const WEMIndexVector< WEMNode > * getNodes() const
Returns the pointer to internal nodes structure.
bool pointsOutwards() const
Checks and returns whether this patch has most normals pointing outwards.
std::string getDescription() const
Returns the 'description' attribute of this WEMPatch.
WEMIndexVector< WEMNode > _nodes
The vector that holds all the nodes of the wem.
std::vector< WEMPrimitiveValueList * > _primitiveValueLists
The registered primitive value lists vector.
virtual PatchTypes getPatchType() const =0
Returns the mesh type of this patch.
void setType(std::string type)
Sets the type of the WEMPatch.
void computeBoundingBox()
Computes the bounding box.
void _getReorderedIndicesForFaces(std::vector< unsigned int > &reorderedIndices)
unsigned int getId() const
Returns the unique ID of this WEMPatch.
std::string getLabel() const
Returns the 'label' attribute of this WEMPatch.
double getMaxValue() const
Returns the maximum value.
double getMinValue() const
Returns the minimum value.
This class represents WEMPatch requirements to be used by WEMProcessor.
This represents a WEMPatch consisting of triangles only.
PrimitiveValueListTypes
Enumeration of primitive value list types.
Tmat4< MLdouble > Matrix4
The standard 4x4 matrix of type double.
TriangulationModes
Enumeration of the triangulation modes. Note that these are 'mirrored' in the SoWEM part.
Tvec3< MLdouble > Vector3
A vector with three components of type double.
PatchTypes
Enumeration of mesh types.
@ WEM_PATCH_TRIANGLES
Patch type: all faces are triangles.
@ WEM_PATCH_QUADS
Patch type: all faces are quads.
Structure used to sort faces in z-direction.
Structure to gather persistence parameters.
WEMPrimitiveCount(WEMPatch *patch)
unsigned int getNumPrimitives(PrimitiveValueListTypes pvlType) const
Helper struct for updating the progress bar while loading/saving.
Helper struct for bundling parameters to keep method interfaces small.