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 );
142 int addVertices(
const QVector<QgsMeshVertex> &vertices,
double tolerance );
SIP_SKIP
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;
282 QVector<QgsMeshFace> prepareFaces(
const QVector<QgsMeshFace> &faces,
QgsMeshEditingError &error );
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;
618 #endif // QGSMESHEDITOR_H