16 #ifndef QGSMESHEDITOR_H
17 #define QGSMESHEDITOR_H
20 #include <QUndoCommand>
32 template CORE_EXPORT QVector<QVector<int>>
SIP_SKIP;
54 int elementIndex = -1;
98 bool isFaceGeometricallyCompatible( const
QgsMeshFace &face );
110 bool edgeCanBeFlipped(
int vertexIndex1,
int vertexIndex2 ) const;
113 void flipEdge(
int vertexIndex1,
int vertexIndex2 );
118 bool canBeMerged(
int vertexIndex1,
int vertexIndex2 ) const;
121 void merge(
int vertexIndex1,
int vertexIndex2 );
126 bool faceCanBeSplit(
int faceIndex ) const;
132 int splitFaces( const QList<
int> &faceIndexes );
152 int addPointsAsVertices( const QVector<
QgsPoint> &point,
double tolerance );
159 QgsMeshEditingError removeVerticesWithoutFillHoles( const QList<
int> &verticesToRemoveIndexes );
168 QList<
int> removeVerticesFillHoles( const QList<
int> &verticesToRemoveIndexes );
173 void changeZValues( const QList<
int> &verticesIndexes, const QList<
double> &newValues );
186 bool canBeTransformed( const QList<
int> &facesToCheck, const std::function<const
QgsMeshVertex(
int )> &transformFunction ) const;
SIP_SKIP
193 void changeXYValues( const QList<
int> &verticesIndexes, const QList<
QgsPointXY> &newValues );
200 void changeCoordinates( const QList<
int> &verticesIndexes, const QList<
QgsPoint> &newCoordinates );
214 bool isModified() const;
223 bool reindex(
bool renumbering );
228 QList<
int> freeVerticesIndexes() const;
231 bool isVertexOnBoundary(
int vertexIndex ) const;
234 bool isVertexFree(
int vertexIndex ) const;
258 bool edgeIsClose(
QgsPointXY point,
double tolerance,
int &faceIndex,
int &edgePosition );
261 int validFacesCount() const;
264 int validVerticesCount() const;
267 int maximumVerticesPerFace() const;
277 int mMaximumVerticesPerFace = 0;
279 int mValidVerticesCount = 0;
280 int mValidFacesCount = 0;
285 QUndoStack *mUndoStack =
nullptr;
292 void applyEdit( Edit &edit );
293 void reverseEdit( Edit &edit );
295 void applyAddVertex( Edit &edit,
const QgsMeshVertex &vertex,
double tolerance );
296 bool applyRemoveVertexFillHole( Edit &edit,
int vertexIndex );
297 void applyRemoveVerticesWithoutFillHole( QgsMeshEditor::Edit &edit,
const QList<int> &verticesIndexes );
299 void applyRemoveFaces( Edit &edit,
const QList<int> &faceToRemoveIndex );
300 void applyChangeZValue( Edit &edit,
const QList<int> &verticesIndexes,
const QList<double> &newValues );
301 void applyChangeXYValue( Edit &edit,
const QList<int> &verticesIndexes,
const QList<QgsPointXY> &newValues );
302 void applyFlipEdge( Edit &edit,
int vertexIndex1,
int vertexIndex2 );
303 void applyMerge( Edit &edit,
int vertexIndex1,
int vertexIndex2 );
304 void applySplit( QgsMeshEditor::Edit &edit,
int faceIndex );
311 friend class TestQgsMeshEditor;
318 friend class QgsMeshLayerUndoCommandSetZValue;
342 void undo()
override;
343 void redo()
override;
366 void redo()
override;
369 QVector<QgsMeshVertex> mVertices;
370 double mTolerance = 0;
388 void redo()
override;
391 QList<int> mVerticesToRemoveIndexes;
414 void redo()
override;
417 QList<int> mVerticesToRemoveIndexes;
418 QList<int> *mRemainingVerticesPointer =
nullptr;
435 void redo()
override;
454 void redo()
override;
456 QList<int> mfacesToRemoveIndexes;
475 void redo()
override;
478 QList<int> mVerticesIndexes;
479 QList<double> mNewValues;
498 void redo()
override;
501 QList<int> mVerticesIndexes;
502 QList<QgsPointXY> mNewValues;
521 void redo()
override;
524 QList<int> mVerticesIndexes;
525 QList<QgsPoint> mNewCoordinates;
543 void redo()
override;
546 int mVertexIndex1 = -1;
547 int mVertexIndex2 = -1;
566 void redo()
override;
569 int mVertexIndex1 = -1;
570 int mVertexIndex2 = -1;
588 void redo()
override;
591 QList<int> mFaceIndexes;
607 void redo()
override;
MeshEditingErrorType
Type of error that can occur during mesh frame editing.
Abstract class that can be derived to implement advanced editing on mesh.
Abstract class that represents a dataset group.
Class that represents an error during mesh editing.
Qgis::MeshEditingErrorType errorType
bool operator==(const QgsMeshEditingError &other) const
bool operator!=(const QgsMeshEditingError &other) const
Class that makes edit operation on a mesh.
Class for undo/redo command for adding faces in mesh.
QgsMeshLayerUndoCommandAddFaces(QgsMeshEditor *meshEditor, QgsTopologicalMesh::TopologicalFaces &faces)
Constructor with the associated meshEditor and faces that will be added.
Class for undo/redo command for adding vertices in mesh.
QgsMeshLayerUndoCommandAddVertices(QgsMeshEditor *meshEditor, const QVector< QgsMeshVertex > &vertices, double tolerance)
Constructor with the associated meshEditor and vertices that will be added.
Class for undo/redo command for applying advanced editing.
QgsMeshLayerUndoCommandAdvancedEditing(QgsMeshEditor *meshEditor, QgsMeshAdvancedEditing *advancdEdit)
Constructor with the associated meshEditor.
Class for undo/redo command for changing coordinate (X,Y,Z) values of vertices.
QgsMeshLayerUndoCommandChangeCoordinates(QgsMeshEditor *meshEditor, const QList< int > &verticesIndexes, const QList< QgsPoint > &newCoordinates)
Constructor with the associated meshEditor and indexes verticesIndexes of the vertices that will have...
Class for undo/redo command for changing (X,Y) value of vertices.
QgsMeshLayerUndoCommandChangeXYValue(QgsMeshEditor *meshEditor, const QList< int > &verticesIndexes, const QList< QgsPointXY > &newValues)
Constructor with the associated meshEditor and indexes verticesIndexes of the vertices that will have...
Class for undo/redo command for changing Z value of vertices.
QgsMeshLayerUndoCommandChangeZValue(QgsMeshEditor *meshEditor, const QList< int > &verticesIndexes, const QList< double > &newValues)
Constructor with the associated meshEditor and indexes verticesIndexes of the vertices that will have...
Class for undo/redo command for flipping edge.
QgsMeshLayerUndoCommandFlipEdge(QgsMeshEditor *meshEditor, int vertexIndex1, int vertexIndex2)
Constructor with the associated meshEditor and the vertex indexes of the edge (vertexIndex1,...
Class for undo/redo command for merging face.
QgsMeshLayerUndoCommandMerge(QgsMeshEditor *meshEditor, int vertexIndex1, int vertexIndex2)
Constructor with the associated meshEditor and the vertex indexes of the edge (vertexIndex1,...
Base class for undo/redo command for mesh editing.
QList< QgsMeshEditor::Edit > mEdits
QgsMeshLayerUndoCommandMeshEdit(QgsMeshEditor *meshEditor)
Constructor for the base class.
QPointer< QgsMeshEditor > mMeshEditor
Class for undo/redo command for removing faces in mesh.
QgsMeshLayerUndoCommandRemoveFaces(QgsMeshEditor *meshEditor, const QList< int > &facesToRemoveIndexes)
Constructor with the associated meshEditor and indexes facesToRemoveIndexes of the faces that will be...
Class for undo/redo command for removing vertices in mesh filling holes created by removed faces.
QgsMeshLayerUndoCommandRemoveVerticesFillHoles(QgsMeshEditor *meshEditor, const QList< int > &verticesToRemoveIndexes, QList< int > *remainingVerticesPointer=nullptr)
Constructor with the associated meshEditor and vertices that will be removed.
Class for undo/redo command for removing vertices in mesh without filling holes created by removed fa...
QgsMeshLayerUndoCommandRemoveVerticesWithoutFillHoles(QgsMeshEditor *meshEditor, const QList< int > &verticesToRemoveIndexes)
Constructor with the associated meshEditor and vertices that will be removed.
Class for undo/redo command for splitting faces.
QgsMeshLayerUndoCommandSplitFaces(QgsMeshEditor *meshEditor, const QList< int > &faceIndexes)
Constructor with the associated meshEditor and indexes faceIndexes of the faces to split.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Convenient class that turn around a vertex and provide information about faces and vertices.
A class to represent a 2D point.
Point geometry type, with support for z-dimension and m-values.
A rectangle specified with double values.
Class that contains topological differences between two states of a topological mesh,...
Class that contains independent faces an topological information about this faces.
Class that wraps a QgsMesh to ensure the consistency of the mesh during editing and help to access to...
The Changes class is used to make changes of the triangular and to keep traces of this changes If a C...
Triangular/Derived Mesh is mesh with vertices in map coordinates.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QVector< int > QgsMeshFace
List of vertex indexes.
Mesh - vertices, edges and faces.