16#ifndef QGSMESHEDITOR_H
17#define QGSMESHEDITOR_H
20#include <QUndoCommand>
32template CORE_EXPORT QVector<QVector<int>>
SIP_SKIP;
54 int elementIndex = -1;
113 bool isFaceGeometricallyCompatible( const
QgsMeshFace &face );
125 bool edgeCanBeFlipped(
int vertexIndex1,
int vertexIndex2 ) const;
128 void flipEdge(
int vertexIndex1,
int vertexIndex2 );
133 bool canBeMerged(
int vertexIndex1,
int vertexIndex2 ) const;
136 void merge(
int vertexIndex1,
int vertexIndex2 );
141 bool faceCanBeSplit(
int faceIndex ) const;
147 int splitFaces( const QList<
int> &faceIndexes );
167 int addPointsAsVertices( const QVector<
QgsPoint> &point,
double tolerance );
174 QgsMeshEditingError removeVerticesWithoutFillHoles( const QList<
int> &verticesToRemoveIndexes );
183 QList<
int> removeVerticesFillHoles( const QList<
int> &verticesToRemoveIndexes );
188 void changeZValues( const QList<
int> &verticesIndexes, const QList<
double> &newValues );
201 bool canBeTransformed( const QList<
int> &facesToCheck, const std::function<const
QgsMeshVertex(
int )> &transformFunction ) const;
SIP_SKIP
208 void changeXYValues( const QList<
int> &verticesIndexes, const QList<
QgsPointXY> &newValues );
215 void changeCoordinates( const QList<
int> &verticesIndexes, const QList<
QgsPoint> &newCoordinates );
229 bool isModified() const;
238 bool reindex(
bool renumbering );
243 QList<
int> freeVerticesIndexes() const;
246 bool isVertexOnBoundary(
int vertexIndex ) const;
249 bool isVertexFree(
int vertexIndex ) const;
273 bool edgeIsClose(
QgsPointXY point,
double tolerance,
int &faceIndex,
int &edgePosition );
276 int validFacesCount() const;
279 int validVerticesCount() const;
282 int maximumVerticesPerFace() const;
292 int mMaximumVerticesPerFace = 0;
294 int mValidVerticesCount = 0;
295 int mValidFacesCount = 0;
300 QUndoStack *mUndoStack =
nullptr;
307 void applyEdit( Edit &edit );
308 void reverseEdit( Edit &edit );
310 void applyAddVertex( Edit &edit,
const QgsMeshVertex &vertex,
double tolerance );
311 bool applyRemoveVertexFillHole( Edit &edit,
int vertexIndex );
312 void applyRemoveVerticesWithoutFillHole( QgsMeshEditor::Edit &edit,
const QList<int> &verticesIndexes );
314 void applyRemoveFaces( Edit &edit,
const QList<int> &faceToRemoveIndex );
315 void applyChangeZValue( Edit &edit,
const QList<int> &verticesIndexes,
const QList<double> &newValues );
316 void applyChangeXYValue( Edit &edit,
const QList<int> &verticesIndexes,
const QList<QgsPointXY> &newValues );
317 void applyFlipEdge( Edit &edit,
int vertexIndex1,
int vertexIndex2 );
318 void applyMerge( Edit &edit,
int vertexIndex1,
int vertexIndex2 );
319 void applySplit( QgsMeshEditor::Edit &edit,
int faceIndex );
326 friend class TestQgsMeshEditor;
333 friend class QgsMeshLayerUndoCommandSetZValue;
357 void undo()
override;
358 void redo()
override;
381 void redo()
override;
384 QVector<QgsMeshVertex> mVertices;
385 double mTolerance = 0;
403 void redo()
override;
406 QList<int> mVerticesToRemoveIndexes;
429 void redo()
override;
432 QList<int> mVerticesToRemoveIndexes;
433 QList<int> *mRemainingVerticesPointer =
nullptr;
450 void redo()
override;
469 void redo()
override;
471 QList<int> mfacesToRemoveIndexes;
490 void redo()
override;
493 QList<int> mVerticesIndexes;
494 QList<double> mNewValues;
513 void redo()
override;
516 QList<int> mVerticesIndexes;
517 QList<QgsPointXY> mNewValues;
536 void redo()
override;
539 QList<int> mVerticesIndexes;
540 QList<QgsPoint> mNewCoordinates;
558 void redo()
override;
561 int mVertexIndex1 = -1;
562 int mVertexIndex2 = -1;
581 void redo()
override;
584 int mVertexIndex1 = -1;
585 int mVertexIndex2 = -1;
603 void redo()
override;
606 QList<int> mFaceIndexes;
622 void redo()
override;
MeshEditingErrorType
Flags which control behavior of raster renderers.
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.