QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsmeshadvancedediting.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmeshadvancedediting.h - QgsMeshAdvancedEditing
3
4 ---------------------
5 begin : 9.7.2021
6 copyright : (C) 2021 by Vincent Cloarec
7 email : vcloarec at gmail dot com
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGSMESHADVANCEDEDITING_H
17#define QGSMESHADVANCEDEDITING_H
18
19
20#include "qgis_core.h"
21#include "qgstopologicalmesh.h"
22#include "qgstriangularmesh.h"
23
24class QgsMeshEditor;
27
39{
40 public:
41
44
46 void setInputVertices( const QList<int> verticesIndexes );
47
49 void setInputFaces( const QList<int> faceIndexes );
50
52 QString message() const;
53
55 void clear();
56
61 virtual bool isFinished() const;
62
64 virtual QString text() const;
65
66 protected:
67 QList<int> mInputVertices;
68 QList<int> mInputFaces;
69 QString mMessage;
70 bool mIsFinished = false;
71
78
79 friend class QgsMeshEditor;
80};
81
98{
99 public:
100
102
103 QString text() const override;
104
105 private:
106 QgsTopologicalMesh::Changes apply( QgsMeshEditor *meshEditor ) override;
107
108 struct FaceRefinement
109 {
110 QList<int> newVerticesLocalIndex; // new vertices in the same order of the vertex index (ccw)
111 QList<bool> refinedFaceNeighbor;
112 QList<bool> borderFaceNeighbor;
113 int newCenterVertexIndex;
114 QList<int> newFacesChangesIndex;
115 };
116
117 struct BorderFace
118 {
119 QList<bool> refinedFacesNeighbor;
120 QList<bool> borderFacesNeighbor;
121 QList<bool> unchangeFacesNeighbor;
122 QList<int> newVerticesLocalIndex;
123 QList<int> edgeFace; //global index of the dirst face exposed on edge
124 };
125
127 void createNewVerticesAndRefinedFaces( QgsMeshEditor *meshEditor,
128 QSet<int> &facesToRefine,
129 QHash<int, FaceRefinement> &facesRefinement );
130
131 bool createNewBorderFaces( QgsMeshEditor *meshEditor,
132 const QSet<int> &facesToRefine,
133 QHash<int, FaceRefinement> &facesRefinement,
134 QHash<int, BorderFace> &borderFaces );
135
136 friend class TestQgsMeshEditor;
137};
138
139
163{
164 public:
165
167
168 QString text() const override;
169
175 void setExpressions( const QString &expressionX, const QString &expressionY, const QString &expressionZ );
176
187 bool calculate( QgsMeshLayer *layer, QgsProject *project = nullptr );
188
194 QgsMeshVertex transformedVertex( QgsMeshLayer *layer, int vertexIndex ) const;
195
206 void setZFromTerrain( bool enable );
207
208 private:
209 QString mExpressionX;
210 QString mExpressionY;
211 QString mExpressionZ;
212 QHash<int, int> mChangingVertexMap;
213 bool mZFromTerrain = false;
214
215 QgsTopologicalMesh::Changes apply( QgsMeshEditor *meshEditor ) override;
216
217 friend class TestQgsMeshEditor;
218};
219
220#endif // QGSMESHADVANCEDEDITING_H
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QString message() const
Returns a message that can be provided by the advanced editing when applying is done.
virtual QgsTopologicalMesh::Changes apply(QgsMeshEditor *meshEditor)=0
Apply a change to mesh Editor.
void setInputVertices(const QList< int > verticesIndexes)
Sets the input vertices indexes that will be used for the editing.
virtual ~QgsMeshAdvancedEditing()
void clear()
Removes all data provided to the editing or created by the editing.
virtual bool isFinished() const
Returns whether the advanced edit is finished, if not, this edit has to be applied again with QgsMesh...
virtual QString text() const
Returns a short text string describing what this advanced edit does. Default implementation return a ...
void setInputFaces(const QList< int > faceIndexes)
Sets the input faces indexes that will be used for the editing.
QString text() const override
Returns a short text string describing what this advanced edit does. Default implementation return a ...
Handles edit operations on a mesh layer.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
void setExpressions(const QString &expressionX, const QString &expressionY, const QString &expressionZ)
Sets the expressions for the coordinates transformation.
QgsMeshVertex transformedVertex(QgsMeshLayer *layer, int vertexIndex) const
Returns the transformed vertex from its index vertexIndex for the mesh layer.
bool calculate(QgsMeshLayer *layer, QgsProject *project=nullptr)
Calculates the transformed vertices of the mesh layer, returns false if this leads to topological or ...
void setZFromTerrain(bool enable)
Sets if Z values for vertices should be obtained from project terrain, instead of expression.
QString text() const override
Returns a short text string describing what this advanced edit does. Default implementation return a ...
Base class for providing feedback from a processing algorithm.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
Contains topological differences between two states of a topological mesh, only accessible from the Q...
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_ABSTRACT
Definition qgis_sip.h:221
QgsPoint QgsMeshVertex
xyz coords of vertex