16#ifndef QGSMESHEDITOR_H
17#define QGSMESHEDITOR_H
20#include <QUndoCommand>
32template CORE_EXPORT QVector<QVector<int>>
SIP_SKIP;
54 int elementIndex = -1;
111 bool faceCanBeAdded( const
QgsMeshFace &face ) const;
121 bool faceCanBeAddedWithNewVertices( const QList<
int> &verticesIndex, const QList<
QgsMeshVertex> &newVertices ) const;
SIP_SKIP
127 bool isFaceGeometricallyCompatible( const
QgsMeshFace &face ) const;
149 bool edgeCanBeFlipped(
int vertexIndex1,
int vertexIndex2 ) const;
152 void flipEdge(
int vertexIndex1,
int vertexIndex2 );
157 bool canBeMerged(
int vertexIndex1,
int vertexIndex2 ) const;
160 void merge(
int vertexIndex1,
int vertexIndex2 );
165 bool faceCanBeSplit(
int faceIndex ) const;
171 int splitFaces( const QList<
int> &faceIndexes );
191 int addPointsAsVertices( const QVector<
QgsPoint> &point,
double tolerance );
198 QgsMeshEditingError removeVerticesWithoutFillHoles( const QList<
int> &verticesToRemoveIndexes );
207 QList<
int> removeVerticesFillHoles( const QList<
int> &verticesToRemoveIndexes );
212 void changeZValues( const QList<
int> &verticesIndexes, const QList<
double> &newValues );
225 bool canBeTransformed( const QList<
int> &facesToCheck, const std::function<const
QgsMeshVertex(
int )> &transformFunction ) const;
SIP_SKIP
232 void changeXYValues( const QList<
int> &verticesIndexes, const QList<
QgsPointXY> &newValues );
239 void changeCoordinates( const QList<
int> &verticesIndexes, const QList<
QgsPoint> &newCoordinates );
253 bool isModified() const;
262 bool reindex(
bool renumbering );
267 QList<
int> freeVerticesIndexes() const;
270 bool isVertexOnBoundary(
int vertexIndex ) const;
273 bool isVertexFree(
int vertexIndex ) const;
297 bool edgeIsClose(
QgsPointXY point,
double tolerance,
int &faceIndex,
int &edgePosition );
300 int validFacesCount() const;
303 int validVerticesCount() const;
306 int maximumVerticesPerFace() const;
316 int mMaximumVerticesPerFace = 0;
318 int mValidVerticesCount = 0;
319 int mValidFacesCount = 0;
323 bool isFaceGeometricallyCompatible( const QList<
int> &vertexIndex, const QList<
QgsMeshVertex> &vertices ) const;
326 QUndoStack *mUndoStack =
nullptr;
333 void applyEdit( Edit &edit );
334 void reverseEdit( Edit &edit );
336 void applyAddVertex( Edit &edit,
const QgsMeshVertex &vertex,
double tolerance );
337 bool applyRemoveVertexFillHole( Edit &edit,
int vertexIndex );
338 void applyRemoveVerticesWithoutFillHole( QgsMeshEditor::Edit &edit,
const QList<int> &verticesIndexes );
340 void applyRemoveFaces( Edit &edit,
const QList<int> &faceToRemoveIndex );
341 void applyChangeZValue( Edit &edit,
const QList<int> &verticesIndexes,
const QList<double> &newValues );
342 void applyChangeXYValue( Edit &edit,
const QList<int> &verticesIndexes,
const QList<QgsPointXY> &newValues );
343 void applyFlipEdge( Edit &edit,
int vertexIndex1,
int vertexIndex2 );
344 void applyMerge( Edit &edit,
int vertexIndex1,
int vertexIndex2 );
345 void applySplit( QgsMeshEditor::Edit &edit,
int faceIndex );
352 friend class TestQgsMeshEditor;
359 friend class QgsMeshLayerUndoCommandSetZValue;
383 void undo()
override;
384 void redo()
override;
407 void redo()
override;
410 QVector<QgsMeshVertex> mVertices;
411 double mTolerance = 0;
429 void redo()
override;
432 QList<int> mVerticesToRemoveIndexes;
455 void redo()
override;
458 QList<int> mVerticesToRemoveIndexes;
459 QList<int> *mRemainingVerticesPointer =
nullptr;
476 void redo()
override;
495 void redo()
override;
497 QList<int> mfacesToRemoveIndexes;
516 void redo()
override;
519 QList<int> mVerticesIndexes;
520 QList<double> mNewValues;
539 void redo()
override;
542 QList<int> mVerticesIndexes;
543 QList<QgsPointXY> mNewValues;
562 void redo()
override;
565 QList<int> mVerticesIndexes;
566 QList<QgsPoint> mNewCoordinates;
584 void redo()
override;
587 int mVertexIndex1 = -1;
588 int mVertexIndex2 = -1;
607 void redo()
override;
610 int mVertexIndex1 = -1;
611 int mVertexIndex2 = -1;
629 void redo()
override;
632 QList<int> mFaceIndexes;
648 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.